Gentoo/Suspend To Disk Using uswsusp and genkernel
sys-power/suspend aka uswsusp is the mainline suspend/resume solution. It contain both s2ram (suspend to RAM) and s2disk (suspend to disk aka hibernate). The problem is that Genkernel developers ignores the need to use suspend properly see bug 156445.
|Linux Kernel Configuration:|
General setup ---> [*] Initial RAM filesystem and RAM disk (initramfs/initrd) support Power management and ACPI options ---> [*] Suspend to RAM and standby [*] Hibernation (aka 'suspend to disk') [*] ACPI (Advanced Configuration and Power Interface) Support ---> -*- Button
Assuming swap partition is at /dev/sda2:
Basically it will use standard genkernel process with the patched linuxrc script and inject the resume utility and suspend.conf into the initramfs.
- Switch to text mode.
- Wait for computer to turn off.
- Turn on computer.
- After boot you should resume right after the s2disk.
uswsusp can show nice splash activity during suspend/resume.
Recreate the initramfs overlay with the new resume and suspend.conf.
Run genkernel again now as splash enabled, and again.
Suspending from graphical environment or within complex environment requires tweaking. There are two alternatives: sys-power/hibernate-script and sys-power/pm-utils.
I use the hibernate-script as it is simple and extensible framework.
Now you can suspend from anywhere, try:
The following will suspend to disk when sleep button is pressed, and suspend to RAM if power button is pressed or lid is closed, add:
Suspend to RAM
Suspend to RAM is more problematic than suspend to disk as it requires hardware support and cooperation. In most recent laptops it works correctly.
Use the hibernate script, you may need to alter:
If still not being able to wake up, try to play with other tweaks available in file.
Originally written by: Alon Bar-Lev - 2011-11-17
Authors are people who have worked on this document and have made significant changes to its content. If you have edited this article and wish to add yourself to the authors list please read "Who are Authors".