Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Tue 02 Sep 2014, 23:15
All times are UTC - 4
 Forum index » House Training » HOWTO ( Solutions )
How to make Puppy hibernate
Moderators: Flash, Ian, JohnMurga
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 1 [13 Posts]  
Author Message
piratesmack


Joined: 16 Sep 2009
Posts: 100

PostPosted: Sun 29 Aug 2010, 21:30    Post subject:  How to make Puppy hibernate  

This was tested with a frugal install of Puppy 5.1

Note: Before doing anything, you'll need a swap partition to hibernate. A swap file won't work.


Here's how I did it:

The kernel needs to be recompiled with support for hibernation:
    * Download the source tarball and DOTconfig from here: http://bkhome.org/sources/kernel-2.6.33.2/
    * Compile the kernel:
    Quote:

    ----------------------------------------------

    To compile kernel
    -----------------

    # make clean
    # make mrproper
    <<<copy in the .config file
    # make menuconfig <<<enable hibernation under power management options
    # make bzImage
    (no need to rebuild modules)

    * Replace your kernel with the new one:
    Code:

    mv /mnt/home/vmlinuz /mnt/home/vmlinuz.old
    cp arch/x86/boot/bzImage /mnt/home/vmlinuz



The initrd needs to be modified to resume after hibernating:

    * Extract the initrd:
    Code:

    mkdir -p /tmp/initrd-tree && cd /tmp/initrd-tree
    zcat /mnt/home/initrd.gz | cpio -id --no-absolute-filenames

    * Edit the init script:
    Code:

    geany init

    * In between the 'Loading modules to access disk drives' and 'Searching for puppy files' sections, insert the following:
    Code:

    ##############END MODULE LOADING TO ACCESS DRIVES####################

    # piratesmack: Resume after hibernation
    #
    # Note: boot parameter 'resume' must be set
    # e.g. resume=sda3, where sda3 is the swap partition you hibernated to
    #
    RESUME="$(tr ' ' '\n' < /proc/cmdline | grep '^resume=' | cut -d= -f2 | sed -e 's:^/dev/::')"
    if [ -n "$RESUME" -a -e "/sys/power/resume" ]; then
      PTRN="$RESUME$"
      # get major and minor number of resume partition
      MAJMIN="$(grep "$PTRN" /proc/partitions | tr -s ' ' | cut -d' ' -f2,3 | tr ' ' :)"
      echo -n $MAJMIN > /sys/power/resume
    fi
    ########################################

    #######################FINDING PUPPY FILES###########################

    * Now save and exit geany
    * Rebuild the initrd:
    Code:

    mv /mnt/home/initrd.gz /mnt/home/initrd.gz.old
    find . | cpio -o -H newc | gzip -c9 > /mnt/home/initrd.gz




You'll also need to edit your boot loader's config file and add "resume=sdXX" as a boot parameter:

    * here is an example grub menu.lst, replace sda1 with your swap partiiton
    Code:

    title Puppy 5.1
    root (hd0,1)
    kernel /vmlinuz pmedia=atahd resume=sda1
    initrd /initrd.gz



Reboot

That's it.

Now you can hibernate with the following command:
echo -n disk > /sys/power/state

I apologize, this probably isn't very newbie-friendly.
You can download a prebuilt kernel and initrd from the following link.

http://www.mediafire.com/?o28pgbbh6jomsz6

Last edited by piratesmack on Mon 30 Aug 2010, 13:40; edited 3 times in total
Back to top
View user's profile Send private message 
piratesmack


Joined: 16 Sep 2009
Posts: 100

PostPosted: Mon 30 Aug 2010, 10:11    Post subject:  

To hibernate when laptop lid closed:

Download and install acpid from here:
http://distro.ibiblio.org/pub/linux/distributions/quirky/pet_packages-quirky/acpid-1.0.8-20100603.pet

Edit /etc/acpi/actions/suspend.sh:
Code:

geany /etc/acpi/actions/suspend.sh


Find this line:
Code:

echo -n mem > /sys/power/state


Replace it with:
Code:

echo -n disk > /sys/power/state


Save and reboot.
Back to top
View user's profile Send private message 
pemasu


Joined: 08 Jul 2009
Posts: 5463
Location: Finland

PostPosted: Wed 01 Sep 2010, 17:16    Post subject:  

# acpitool --help
Usage: acpitool [option] . . .
Shows ACPI information from the /proc/acpi filesystem, like battery status,
temperature, or ac power. Can also suspend your machine (if supported).

cut...
-s, --suspend suspend to memory (sleep state S3), if supported
-S suspend to disk (sleep state S4), if supported

I have compiled kernel with hibernation (I give also resume=/dev/sdX parameter when in menuconfig) and then used acpitool for suspend to ram or suspend to disk ( hibernate ). I have also made function keys bindings: acpitool -s and acpitool-S with Xbindkeys-config. Nice tool.

No need for anything else. Acpitool just works for me.
Back to top
View user's profile Send private message 
rjbrewer


Joined: 22 Jan 2008
Posts: 4422
Location: merriam, kansas

PostPosted: Wed 01 Sep 2010, 19:18    Post subject:  

Fluppy 004 comes with suspend and hibernate.
_________________

Inspiron 700m, Pent.M 1.6Ghz, 1Gb ram.
Msi Wind U100, N270 1.6>2.0Ghz, 1.5Gb ram.
Eeepc 8g 701, 900Mhz, 1Gb ram.
Full installs

Back to top
View user's profile Send private message 
jawaharpeter

Joined: 24 Jun 2011
Posts: 6
Location: Banglore

PostPosted: Fri 05 Aug 2011, 23:18    Post subject: please include Hibernate in 5.2.6 please
Subject description: please include Hibernate in 5.2.6 please
 

please include Hibernate in 5.2.6 please
Back to top
View user's profile Send private message 
pemasu


Joined: 08 Jul 2009
Posts: 5463
Location: Finland

PostPosted: Sat 06 Aug 2011, 06:49    Post subject:  

Kernel used in lucid puppy series does not have hibernate enabled in kernel level.

Anyway hibernating takes quite a lot time, because whole RAM content needs to be copied to the swap partition. Hibernation is 10 time slower than shuttind down computer. And you swap partition will be locked before you restart the same puppy version which performed the hibernation.

And you need big enough swap partition so that the whole RAM will be able to copy to the swap and you need kernel boot parameter which defines you swap resume partition. A little complicated.

What useful usage there remains for hibernation in usual puppy usage ?
Back to top
View user's profile Send private message 
Luluc


Joined: 16 Mar 2011
Posts: 200

PostPosted: Sat 06 Aug 2011, 19:03    Post subject:  

pemasu wrote:
Kernel used in lucid puppy series does not have hibernate enabled in kernel level.

Anyway hibernating takes quite a lot time, because whole RAM content needs to be copied to the swap partition. Hibernation is 10 time slower than shuttind down computer. And you swap partition will be locked before you restart the same puppy version which performed the hibernation.

And you need big enough swap partition so that the whole RAM will be able to copy to the swap and you need kernel boot parameter which defines you swap resume partition. A little complicated.

What useful usage there remains for hibernation in usual puppy usage ?

Suspend to disk is awfully slow indeed. I never tried it with Puppy, just Slackware and Ubuntu, both were very slow.

But suspend to RAM is awesome. Since I use a notebook with a 7-hour battery that lasts at least two or three days in suspend mode, it is very safe not to shut down the computer anymore, it will sleep well and peacefully even if my AC power supply is interrupted for a few hours for any reason. I just suspend to RAM, it goes to sleep in 5 seconds, then it's another 5 seconds to wake up. Good-bye booting, hello sweet long uptime.
Back to top
View user's profile Send private message 
heywoodj

Joined: 15 Mar 2009
Posts: 68

PostPosted: Sun 07 Aug 2011, 22:58    Post subject:  

Edit: Mods, I moved this to Users.
Back to top
View user's profile Send private message 
Luluc


Joined: 16 Mar 2011
Posts: 200

PostPosted: Mon 08 Aug 2011, 16:15    Post subject:  

Somebody asked me in private how to suspend to RAM. I'd rather answer that question in public, so more people benefit.

First off, configure your screen locking mechanism. Right-click the Lock icon on the desktop area and select "Configure screen locking". Among other things, be sure to create a password you know you will remember. My method doesn't just make the computer hibernate, it locks the screen in case the notebook gets lost or stolen while it is sleeping. So you will have to know that password later on.

There are many ways to achieve suspend to RAM, for example a script. In my case, I just made a shell alias:

Code:
alias hibernate 'xlock -mode blank &; sleep 2; echo -n mem >! /sys/power/state'


I think you add that to your /root/.bash_profile or /root/.bashrc. My shell is tcsh, so I have it in /root/.tcshrc.

Once you have the alias, open a new shell/terminal and run:

Code:
# hibernate


I have no other program, function or script that begins wit 'hib' so all I need to type is hib{tab} to auto complete. Hit Enter and wait 2 or 3 seconds, the operating system goes to sleep.

You can also put that line in a script, then configure your window manager to launch that script when you press a keyboard shortcut. May be more convenient than launching a terminal. In my case, I run Tilda all the time, I spend a lot of time using the Tilda/screen terminal, so it's just there always.

While the OS is suspend to RAM, just press any key to wake everything up again.

Please note, suspend to RAM puts the operating system in RAM, which is volatile. If you disconnect the computer from all power sources (wall outlet/notebook battery), you lose the suspended state, you will have to reboot, and who knows, data may get corrupt too. It is just like pulling the plug on the computer while it is running.

I hope this is useful to someone. Sleep tight.
Back to top
View user's profile Send private message 
night_mare007

Joined: 07 Aug 2011
Posts: 30

PostPosted: Tue 16 Aug 2011, 16:17    Post subject:  

I use Lupu ( puppy 5.25 ) but I can't get SUSPEND TO RAM to works.

when I run:
echo -n mem >! /sys/power/state
or
echo -n mem > /sys/power/state ( without the "!" )

Then my screen flicker for just 1 sec, and return to desktop with this error in the terminal:
bash: echo: write error: No such file or directory

ANY IDEA HOW CAN I RUN S3 ( suspend-to-ram ) in LUPU 5.25 ???

P.S - I even tried to download that acpid.pet - but that doesn't work.
[EDIT]
Forgot to mention that I'm sure my Kernel supports suspend-to-ram, but not to HDD, As I recompiled it and made sure that option on available.
Back to top
View user's profile Send private message 
pemasu


Joined: 08 Jul 2009
Posts: 5463
Location: Finland

PostPosted: Wed 17 Aug 2011, 08:35    Post subject:  

Install acpitool from repo. Then in console acpitool -s
Back to top
View user's profile Send private message 
night_mare007

Joined: 07 Aug 2011
Posts: 30

PostPosted: Thu 18 Aug 2011, 15:45    Post subject:    

OK... tried that - NOT WORKING:
i've Installed acpitool_0.5-7 from PPM, and then ran in terminal:
sleep 2; acpitool -s

The screen flicker for 1 sec, then return to the desktop.

I tried to ran this acouple more time - the same....

please guide me how to fix this.... PLEASE !!!!
Back to top
View user's profile Send private message 
Egorio

Joined: 31 Aug 2011
Posts: 3

PostPosted: Fri 02 Sep 2011, 06:56    Post subject:  

maybe that's some sort of bug?
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 1 of 1 [13 Posts]  
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » House Training » HOWTO ( Solutions )
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0877s ][ Queries: 11 (0.0029s) ][ GZIP on ]