Difference between revisions of "Swsusp"
(Moved from "How to make ACPI work") |
(→S5 vs. S4 state: Point out the dangers of touching filesystems between suspend and resume) |
||
(32 intermediate revisions by 17 users not shown) | |||
Line 1: | Line 1: | ||
+ | {| width="100%" | ||
+ | |style="vertical-align:top;padding-right:20px;width:10px;white-space:nowrap;" | __TOC__ | ||
+ | |style="vertical-align:top" | | ||
+ | ===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. | ||
+ | |} | ||
+ | |||
+ | ==Kernel configuration== | ||
To enable software suspend change your kernel config as follows: | To enable software suspend change your kernel config as follows: | ||
:{{kernelconf|CONFIG_PM|<*>|Power management support|Power management options|||}} | :{{kernelconf|CONFIG_PM|<*>|Power management support|Power management options|||}} | ||
:{{kernelconf|CONFIG_SOFTWARE_SUSPEND|<*>|Software Suspend|Power management options|||}} | :{{kernelconf|CONFIG_SOFTWARE_SUSPEND|<*>|Software Suspend|Power management options|||}} | ||
:{{kernelconf|CONFIG_PM_STD_PARTITION|[/dev/resume_partition]|Default resume partition|Power management options|||}} | :{{kernelconf|CONFIG_PM_STD_PARTITION|[/dev/resume_partition]|Default resume partition|Power management options|||}} | ||
− | |||
<tt>/dev/resume_partition</tt> needs to be replaced by the swap partition you want to use for suspending. (Use {{cmdroot|fdisk -l /dev/hda}} if unsure.) | <tt>/dev/resume_partition</tt> needs to be replaced by the swap partition you want to use for suspending. (Use {{cmdroot|fdisk -l /dev/hda}} if unsure.) | ||
Line 11: | Line 18: | ||
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 {{bootparm|noresume|}} 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 {{bootparm|noresume|}} kernel boot parameter. | ||
− | {{NOTE|For some people suspending did not work if resume_partition was specified in the kernel config. In such case specify the resume partition as a kernel parameter instead.}} | + | {{NOTE|For some people suspending did not work if <tt>resume_partition</tt> was specified in the kernel config. In such case specify the resume partition as a kernel parameter instead.}} |
+ | {{NOTE|When using Debian Etch or Sid, you need to use <tt>initramfs-tools</tt> as yaird is currently (2006-05-18) not supporting swsusp. See [http://wiki.debian.org/InitrdReplacementOptions the Debian Wiki] for more details.}} | ||
+ | |||
+ | ==Suspending== | ||
To suspend you can either do a simple {{cmdroot|echo disk > /sys/power/state}} (recommended) or use the [http://softwaresuspend.berlios.de/old-site/swsusp/sysvinit-2.76-v2-for_swsusp-v5.tar.gz patched SysVInit] and call {{cmdroot|swsusp}} or {{cmdroot|shutdown -z now}}. As the {{path|/proc/acpi/sleep}} interface becomes deprecated in newer kernels you should NOT use the old {{cmdroot|echo -n 4 > /proc/acpi/sleep}} anymore. | To suspend you can either do a simple {{cmdroot|echo disk > /sys/power/state}} (recommended) or use the [http://softwaresuspend.berlios.de/old-site/swsusp/sysvinit-2.76-v2-for_swsusp-v5.tar.gz patched SysVInit] and call {{cmdroot|swsusp}} or {{cmdroot|shutdown -z now}}. As the {{path|/proc/acpi/sleep}} interface becomes deprecated in newer kernels you should NOT use the old {{cmdroot|echo -n 4 > /proc/acpi/sleep}} anymore. | ||
− | Ideally you would do this from a script like {{path|/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 | + | Ideally, you would do this from a script like {{path|/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 | *any running mysql server | ||
− | *the linuxant driver may require | + | *the linuxant driver may require to be stopped as well ({{cmdroot|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. | 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). | 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, | + | 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 Master mute >/dev/null 2>&1 | ||
amixer set PCM mute >/dev/null 2>&1 | amixer set PCM mute >/dev/null 2>&1 | ||
Line 29: | Line 38: | ||
amixer set PCM unmute >/dev/null 2>&1 | amixer set PCM unmute >/dev/null 2>&1 | ||
− | 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. | + | ==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 or any of the filesystems that were mounted at the time of suspend. | ||
+ | |||
+ | ==Model-specific Status== | ||
+ | |||
+ | {| align="center" cellpadding="2" width="100%" style="border:1px; background:grey;" | ||
+ | ! style="background:#efefef;"| Thinkpad Model | ||
+ | ! style="background:#efefef;"| Type | ||
+ | ! style="background:#efefef;"| Operating System | ||
+ | ! style="background:#efefef;"| Kernel Version | ||
+ | ! style="background:#efefef;"| swsusp works | ||
+ | ! style="background:#efefef;"| Note | ||
+ | |- style="background: white;" | ||
+ | |||
+ | |- style="background: white; color:black;" | ||
+ | |{{X60}} | ||
+ | | 1706-BM7 | ||
+ | | [Own Distro] | ||
+ | | 2.6.20 | ||
+ | ! style ="color:green;"| yes | ||
+ | | | ||
+ | |- style="background: white; color:black;" | ||
+ | |||
+ | |- style="background: white; color:black;" | ||
+ | |{{X60s}} | ||
+ | | 1702-55G | ||
+ | | Arch Linux | ||
+ | | 2.6.20 | ||
+ | ! style ="color:green;"| yes | ||
+ | | | ||
+ | |- style="background: white; color:black;" | ||
+ | |||
+ | |- style="background: white; color:black;" | ||
+ | |{{X60s}} | ||
+ | | 1702-5FG | ||
+ | | [[:Category:Debian|Debian Etch]] | ||
+ | | 2.6.18 with [[User:Profilek | Forest Zhao's AHCI patches]] | ||
+ | ! style ="color:green;"| yes | ||
+ | | | ||
+ | |- style="background: white; color:black;" | ||
+ | |||
+ | |- style="background: white; color:black;" | ||
+ | |{{X60s}} | ||
+ | | 1702-5FG | ||
+ | | [[:Category:Debian|Debian Etch]] | ||
+ | | 2.6.19.2 | ||
+ | ! style ="color:green;"| yes | ||
+ | | | ||
+ | |- style="background: white; color:black;" | ||
+ | |||
+ | |- style="background: white; color:black;" | ||
+ | |{{X31}} | ||
+ | | 2672-BCO | ||
+ | | [[:Category:Debian|Debian Etch]] | ||
+ | | 2.6.20.1 | ||
+ | ! style ="color:green;"| yes | ||
+ | | | ||
+ | |- style="background: white; color:black;" | ||
+ | |||
+ | |- style="background: white; color:black;" | ||
+ | |{{X32}} | ||
+ | | 2673 | ||
+ | | [[:Category:Debian|Debian Lenny]] | ||
+ | | 2.6.26 | ||
+ | ! style ="color:green;"| yes | ||
+ | | | ||
+ | |- style="background: white; color:black;" | ||
+ | |||
+ | |{{R52}} | ||
+ | | 18299MG | ||
+ | | [[:Category:Debian|Debian Sarge]] | ||
+ | | 2.6.17.9 | ||
+ | ! style ="color:green;"| yes | ||
+ | | | ||
+ | |- style="background: white; color:black;" | ||
+ | |||
+ | |{{T30}} | ||
+ | | 2366 | ||
+ | | [[:Category:Slackware|Slackware 12 ]] | ||
+ | | 2.6.24.3 | ||
+ | ! style ="color:green;"| yes | ||
+ | | | ||
+ | |- style="background: white; color:black;" | ||
+ | |||
+ | |{{T43}} | ||
+ | | 2668-74G | ||
+ | | [[:Category:Fedora|Fedora Core 6]] | ||
+ | | 2.6.19 | ||
+ | ! style ="color:green;"| yes | ||
+ | | | ||
+ | |||
+ | |- style="background: white; color:black;" | ||
+ | |{{T43}} | ||
+ | | 2668-74G | ||
+ | | [[:Category:Gentoo|Gentoo]] | ||
+ | | 2.6.20.7 | ||
+ | ! style ="color:green;"| yes | ||
+ | | | ||
+ | |||
+ | |- style="background: white; color:black;" | ||
+ | |{{T60}} | ||
+ | | 1953-E7U | ||
+ | | [[:Category:Slackware|Slackware 11]] | ||
+ | | 2.6.20 | ||
+ | ! style="color:green;" | yes | ||
+ | | | ||
+ | |- style="background: white; color:black;" | ||
+ | |||
+ | |- style="background: white; color:black;" | ||
+ | |{{X40}} | ||
+ | | 2386-H6G | ||
+ | | [[:Category:Ubuntu|Ubuntu]] | ||
+ | | 2.6.20 | ||
+ | ! style="color:green;" | yes | ||
+ | | | ||
+ | |- style="background: white; color:black;" |
Latest revision as of 23:36, 24 November 2010
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 or any of the filesystems that were mounted at the time of suspend.
Model-specific Status
Thinkpad Model | Type | Operating System | Kernel Version | swsusp works | Note |
---|---|---|---|---|---|
X60 | 1706-BM7 | [Own Distro] | 2.6.20 | yes | |
X60s | 1702-55G | Arch Linux | 2.6.20 | yes | |
X60s | 1702-5FG | Debian Etch | 2.6.18 with Forest Zhao's AHCI patches | yes | |
X60s | 1702-5FG | Debian Etch | 2.6.19.2 | yes | |
X31 | 2672-BCO | Debian Etch | 2.6.20.1 | yes | |
X32 | 2673 | Debian Lenny | 2.6.26 | yes | |
R52 | 18299MG | Debian Sarge | 2.6.17.9 | yes | |
T30 | 2366 | Slackware 12 | 2.6.24.3 | yes | |
T43 | 2668-74G | Fedora Core 6 | 2.6.19 | yes | |
T43 | 2668-74G | Gentoo | 2.6.20.7 | yes | |
T60 | 1953-E7U | Slackware 11 | 2.6.20 | yes | |
X40 | 2386-H6G | Ubuntu | 2.6.20 | yes |