suspend to disk (µswsusp)

| | Comments (0) | TrackBacks (0)

After I set up a new boot system a few weeks ago, I tried to get also suspend to disk working. First I tried the suspend to disk support built directly into the Linux kernel. However it turned soon out that this wouldn’t suit my needs as it support neither resume from encrypted devices nor from raid devices. Thus I tried my luck with userspace suspend.
First I added the ~x86 keyword for suspend to /etc/portage/package.keywords and emerged the package into the boot image:

ROOT=/boot_image USE=”static” emerge -av suspend

Used /usr/sbin/s2disk to write the image to my encrypted raid1 swap partition and rebooted. When I called the resume binary (/usr/lib/suspend/resume) nothing happened, even no warning or error message. So I compiled the resume binary myself and added some debug information to the resume binary and got the following message:

The system snapshot image could not be read.

It turned out that the resume image was corrupted. After some googling I found this thread, which says basically that s2disk doesn’t handle raid properly. As a matter of this when the raid is assembled on reboot the disks are not in a clean state and resync themselves, which leads probably to the corrupted image (at least resume thinks so). In the thread they suggest to set a variable in the sysfs that the raid should be assembled read-only and hence the resync would be delayed:

echo 1 > /sys/module/mdmod/parameters/startro

However it turned out that this doesn’t help anything, the raid starts to resync anyway. After some more investigations I found the solution: You can tell mdadm to assemble the raid under the assumption that the raid is clean avoiding the rebuild of the raid:

mdadm —build —assume-clean /dev/md1 —level=1 —raid-devices=2 /dev/sda1 /dev/sdb1

Finally I got it up and running :) After I added this to my init script I could resume from the resume image on my encrypted raid1 swap partition. Unfortunately after I removed all the debug stuff and used the resume binary from the boot image again, it stopped to work :/ I got the following error message although I didn’t use encryption of the image:

resume: Encryption not supported

As it turned out the 32bit resume binary can’t read the image stored by the 64bit s2disk binary. Thus I used a 64bit binary also on the boot system and got suspend to disk eventually working.

0 TrackBacks

Listed below are links to blogs that reference this entry: suspend to disk (µswsusp).

TrackBack URL for this entry: http://www.rommel.stw.uni-erlangen.de/~ritschi/cgi-bin/mt/mt-tb.cgi/35

Leave a comment

About this Entry

This page contains a single entry by ritschi published on August 8, 2008 9:58 PM.

xfig problems was the previous entry in this blog.

rctcosx - Rommel Widget is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.