Difference between revisions of "Swsusp"
m (→Kernel configuration) |
(→Software Suspend - swsusp) |
||
Line 4: | Line 4: | ||
===Software Suspend - swsusp=== | ===Software Suspend - swsusp=== | ||
Software Suspend (<tt>swsusp</tt>) is a suspend-to-disk implementation included in the 2.6 kernel series. See [[Software Suspend 2]] for an alternative implementation, which has some advantages. | Software Suspend (<tt>swsusp</tt>) is a suspend-to-disk implementation included in the 2.6 kernel series. See [[Software Suspend 2]] for an alternative implementation, which has some advantages. | ||
+ | |||
+ | Note that swsusp is not needed for suspend-to-RAM functionality. | ||
|} | |} | ||
Revision as of 15:52, 3 July 2006
Software Suspend - swsuspSoftware Suspend (swsusp) is a suspend-to-disk implementation included in the 2.6 kernel series. See Software Suspend 2 for an alternative implementation, which has some advantages. Note that swsusp is not needed for suspend-to-RAM functionality. |
Kernel configuration
To enable software suspend change your kernel config as follows:
- Power management options → <*>Power management support (CONFIG_PM)
- Power management options → <*>Software Suspend (CONFIG_SOFTWARE_SUSPEND)
- Power management options → [/dev/resume_partition]Default resume partition (CONFIG_PM_STD_PARTITION)
/dev/resume_partition needs to be replaced by the swap partition you want to use for suspending. (Use # fdisk -l /dev/hda
if unsure.)
You can override the default resume partition anytime by giving resume=/dev/resume_partition
as kernel boot parameter.
Also, in case you suspended, but want to boot up normally (without resuming from the saved image - losing all data that was unsaved at suspend time), you can give the noresume
kernel boot parameter.
Suspending
To suspend you can either do a simple # echo disk > /sys/power/state
(recommended) or use the patched SysVInit and call # swsusp
or # shutdown -z now
. As the /proc/acpi/sleep interface becomes deprecated in newer kernels you should NOT use the old # echo -n 4 > /proc/acpi/sleep
anymore.
Ideally, you would do this from a script like /etc/acpi/actions/hibernate.sh. It has proven to be a good idea to shutdown the following processes/drivers within the script before you do the actual suspend:
- any running mysql server
- the linuxant driver may require to be stopped as well (
# dldrstop
does the trick).
Afterwards you might want to enable them again, as well as run a script that does necessary configurations according to the ac power state. Furthermore, the system clock is not readjusted automatically, so you will probably also want the do that from that script (i.e. by restarting your systemclock bootup script).
If the sound output is silent after resume, the following commands might help to get sound to work again without reloading any modules:
amixer set Master mute >/dev/null 2>&1 amixer set PCM mute >/dev/null 2>&1 amixer set Master unmute >/dev/null 2>&1 amixer set PCM unmute >/dev/null 2>&1
S5 vs. S4 state
Finally you should take note that swsusp does not set the ACPI S4 state. Instead it goes to S5. This means that the machine itself doesn't know that it was suspend rather than shutdown. Hence you can i.e. boot a parallel installed other operating system and resume your linux session later, as long as you don't touch the swap partition the image was saved to.