With multiple swap partitions resume from hibenation fails
Bug #923326 reported by
b3nmore
This bug affects 5 people
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
initramfs-tools |
Invalid
|
Undecided
|
Unassigned | ||
pm-utils (Ubuntu) |
Invalid
|
Undecided
|
Unassigned |
Bug Description
I've 3 swap partitions: sdX2, sdX5 and sdY2. Hibernate is setup via /etc/defaults/grub and /etc/initramfs-
If I disable swap partition sdX2, using only sdX5 and sdY2, resume works perfectly.
If I use all 3 partitions, but setup hibernate to use sdX2, resume works again.
Xubuntu Oneiric i686, Kernel: 3.0.0-15-generic #26, pm-utils: 1.4.1-8ubuntu1
Not sure about kernel 3.0.x, but I will describe some methods for the tools-0. 98. You most likely
2.6.30+ kernels that I use with initramfs-
have to modify and adapt things to suit your versions. Read carefully
and proceed (at your own risk) only if you know what you are doing.
When multiple swaps are active and you hibernate using the kernel's "kernel" , not tools/conf. d/resume, or via
built-in method (in pm-utils terms, SLEEP_MODULE=
"uswsusp" or "tuxonice"), the kernel will randomly choose one of your
active swap devices to store the snapshot image (AFAIK, there is no way
to force the kernel to use a specific swap device). So resume will only
work if that device happens to be the same one as the one configured
via the "resume=<swapdev>" initramfs parameter (which is specified
either via "RESUME=..." in /etc/initramfs-
grub2 config /etc/default/grub, or manually at the grub boot screen,
with each of these directives overriding the preceding ones).
Unfortunately, under normal conditions the kernel does not notify you
which partition it uses for hibernation. Here are some things to consider.
I will assume only swap partitions are being used --- no swap files.
(A) Quick and dirty manual recovery to resume:
DANGER, WILL ROBINSON!! READ THE WARNINGS BELOW!
If you hibernated while multiple swap partitions were active and still
want to resume, a quick and dirty manual method is to boot into the
initramfs "premount" break-poiint shell (boot parameter break=premount),
and run: blkid -t TYPE=swsusp (or run blkid | grep swsusp), which should
identify the unique partition where the hibernation image is stored.
[Note: Having multiple such partitions is a serious error condition
which should never happen and your only course of action then would be
to do a normal boot and making sure that the suspend signatures on those
partitions are erased (automatically done if those partitions are used as swap).
Also, if the blkid command above does not return anything you have to
do a normal boot; just exit out of the initramfs shell or reboot.]
Next, identify the major and minor numbers m:n for that partition from block/sdaXY/ dev (cat that file).
/sys/class/
Finally, echo the major:minor numbers (in the format m:n) onto
/sys/power/resume. If everything has been done right, it should
perform a proper resume
Note again that these steps are valid only if the kernel's internal
hibernation method was used (when using userland uswsusp, the
command to manually resume is /sbin/resume -r <resume_dev>).
[One can even automate the above manual procedure by adding
an initramfs boot script which runs at the end of premount phase,
after resume via kernel/uswsusp has been tried. Such a script can
detect the presence of a unique "swsusp" swap partition (_after_
the initramfs premount resume/uswsusp boot scripts have
attempted to resume but have returned) and give the user
the option of either attempting a resume from that "swsusp"
partition, or proceeding to a normal boot (echo "if unsure, do
normal boot"). But unless carefully written, such a script can
introduce additional security or other vulnerabilities, see the
warnings below.]
WARNING, USE AT YOUR OWN RI...