* how to get hibernation to work

Posted on February 26th, 2009 by Alex. Filed under Linux.


Unfortunately I upgraded my nvidia driver to 180.22 and now I am facing problems such as blank screen after resume. If you still have the .deb packages of 177.8x (nvidia-kernel-source, nvidia-glx, nvidia-glx-dev) please let me know. I could not find them anywhere in the net. [Update 07/03/2009] Suspend seems to work with the latest drivers from the experimental branch of debian (180.29). However it is difficult to say, if the removal of “quiet” (one of the kernel options) helped in resolving the issue, or not.[/Update]
As long as this issue is not solved, as a workaround I decided to hibernate the laptop instead of suspending it. However even this did not work. I changed the hard disk configuration some time back and the swap partition which usually contains the image, shifted (now /dev/sda5). The error message when I executed hibernate as root from the console was:

hibernate-disk: Running /usr/sbin/s2disk …
s2disk: Could not use the resume device (try swapon -a). Reason: No such device

But swapon -a did not have the promising effect, since the swap was already activated and available. Also mkswap did not lead to any solution. To fix the problem, perform the following steps:

  1. First I had to tell the hibernate script where to find the new partition. Go to /etc/hibernate/suspend2.conf and check the entry

    ## useful for initrd usage:
    SuspendDevice swap:/dev/sda5

  2. After that modify/create a file in /etc/initramfs-tools/conf.d/ named resume and check its content. It should look like this:

    RESUME=/dev/sda5

  3. Run dpkg-reconfigure uswsusp and answer all questions. A configurations file is generated located in /etc/uswsusp.conf. Its content could be like mine:

    # /etc/uswsusp.conf(8) — Configuration file for s2disk/s2both
    resume device = /dev/sda5
    compress = y
    early writeout = y
    image size = 427039211
    RSA key file = /etc/uswsusp.key
    shutdown method = platform

After these steps, hibernate (executed as root in the terminal) should save the image on the swap drive. However, hibernation consists of two parts: hibernation itself and obviously also resuming. If you are not successful in resuming and you only get error messages like

Unable to find swap-space signature

and

Invalidating stale software suspend images

during boot, the kernel continues with a normal boot and not with a resume. To fix that problem check, if the correct resume parameter is set in /boot/grub/menu.lst:

title Debian GNU/Linux, kernel 2.6.28.7-1
root (hd0,2)
kernel /vmlinuz-2.6.28.7-1 root=/dev/sda2 resume=swap:/dev/sda5 ro quiet
initrd /initrd.img-2.6.28.7-1

The swap: above can be omitted.

If you compile your own kernel, make sure that despite the fact that an initrd might not be necessary, since you might compile all needed modules into the kernel, the resume binary is not included in the kernel binaries. It is written to the initrd making it mandatory to define the initrd parameter. A initrd can be created with update-initramfs -u -k 2.6.28.7-1 with 2.6.28.7-1 being the kernel version (uname -a) and -u updating an existing ramdisk. If you need to create a new one, replace -u by -c.



One Response to “how to get hibernation to work”

  1. jose Says:

    Thanks a lot. I upgraded my machine a couple of days ago with the strange outcome of having a working suspend but broken hibernation. I think I had overlooked the boot parameter, or perhaps the initramfs step. In any case, now it works.

    Regards

    [REPLY]

Trackback URI | Comments RSS

Leave a Reply


RSS Feeds:

Search:


Pages:

Categories:

Archives: