Difference between revisions of "Suspend to RAM"

From ArchWiki
Jump to: navigation, search
(kernel (swsusp): drop pm-utils example, I think it's not necessary)
(introduction)
Line 1: Line 1:
 
[[Category:Power management]]
 
[[Category:Power management]]
 
{{Article summary start}}
 
{{Article summary start}}
{{Article summary text|Describes the operation of the pm-utils suspend framework and supported backend methods}}
+
{{Article summary text|Provides general overview of methods for suspending Arch Linux system.}}
 
{{Article summary heading|Related}}
 
{{Article summary heading|Related}}
 
{{Article summary wiki|Pm-utils}}
 
{{Article summary wiki|Pm-utils}}
 
{{Article summary wiki|Uswsusp}}
 
{{Article summary wiki|Uswsusp}}
 
{{Article summary wiki|TuxOnIce}}
 
{{Article summary wiki|TuxOnIce}}
 +
{{Article summary wiki|Suspending to RAM with hibernate-script}}
 
{{Article summary end}}
 
{{Article summary end}}
 
From [[Wikipedia:Sleep mode]]:
 
From [[Wikipedia:Sleep mode]]:
 
:''Sleep mode can go by many different names, including '''Stand By''', '''Sleep''', and '''Suspend'''. When placed in this sleep mode, aside from the RAM which is required to restore the machine's state, the computer attempts to cut power to all unneeded parts of the machine. Because of the large power savings, most laptops automatically enter this mode when the computer is running on batteries and the lid is closed.''
 
:''Sleep mode can go by many different names, including '''Stand By''', '''Sleep''', and '''Suspend'''. When placed in this sleep mode, aside from the RAM which is required to restore the machine's state, the computer attempts to cut power to all unneeded parts of the machine. Because of the large power savings, most laptops automatically enter this mode when the computer is running on batteries and the lid is closed.''
  
There is a variety of mechanisms to enable your operating system to suspend to memory or to disk. To understand the difference between these systems, you need to know that there exists a suspend/resume implementation in the kernel (swsusp) and typically a set of additional tweaks to handle specific drivers/modules/hardware (e.g. video card re-initialization).
+
This article describes generally mechanisms to suspend Arch Linux system to memory. There are multiple low level interfaces (backends) providing basic functionality, and some high level interfaces providing  tweaks to handle problematic hardware drivers/kernel modules (e.g. video card re-initialization).
 
+
* [[systemd]] provides commands for suspend to RAM, hibernate and a hybrid suspend using the kernel's native suspend/resume functionality. There are also mechanisms to add hooks to customize pre- and post-suspend actions.
+
 
+
* [[pm-utils]] is a set of shell scripts that encapsulate the kernel's suspend/resume functionality. It comes with a set of pre- and post-suspend tweaks and various hooks to customize the process.
+
 
+
* [[uswsusp]] also aims to provide programs that encapsulate the kernel's suspend/resume functionality with the additional necessary tweaks. It also aims to provide a suspend-to-both functionality - this allows resuming from memory if battery is not depleted and resuming from disk if battery is completely depleted.
+
 
+
* [[TuxOnIce]] differs from pm-utils and uswsusp in that it attempts to directly patch the kernel's suspend/resume functionality to add more functionality than the default implementation. Therefore it requires a custom kernel.
+
 
+
* [[Suspending to RAM with hibernate-script]]
+
 
+
Note that the end goal of these packages is to provide binaries/scripts that can be invoked to perform suspend/resume. Actually hooking them up to power buttons or menu clicks or laptop lid events is left to other mechanisms. To automatically suspend/resume on certain power events, such as laptop lid close or battery depletion percentage, you may want to look into running [[Acpid]].
+
  
 
== Low level interfaces ==
 
== Low level interfaces ==
Line 45: Line 34:
  
 
== High level interfaces ==
 
== High level interfaces ==
 +
 +
Note that the end goal of these packages is to provide binaries/scripts that can be invoked to perform suspend/resume. Actually hooking them up to power buttons or menu clicks or laptop lid events is left to other mechanisms. To automatically suspend/resume on certain power events, such as laptop lid close or battery depletion percentage, you may want to look into running [[Acpid]].
  
 
=== systemd ===
 
=== systemd ===
  
Systemd provides native commands for suspend, hibernate and a hybrid suspend, see [[Power Management#Power management with systemd]] for details.
+
[[systemd]] provides native commands for suspend, hibernate and a hybrid suspend, see [[Power Management#Power management with systemd]] for details.
  
 
See [[Power Management#Sleep hooks]] for additional information on configuring suspend/resume hooks. Also see {{ic|man systemctl}}, {{ic|man systemd-sleep}}, and {{ic|man systemd.special}}.
 
See [[Power Management#Sleep hooks]] for additional information on configuring suspend/resume hooks. Also see {{ic|man systemctl}}, {{ic|man systemd-sleep}}, and {{ic|man systemd.special}}.
  
 
=== pm-utils ===
 
=== pm-utils ===
 +
 +
pm-utils is a set of shell scripts that encapsulate the backend's suspend/resume functionality. It comes with a set of pre- and post-suspend tweaks and various hooks to customize the process.
  
 
See main article [[pm-utils]].
 
See main article [[pm-utils]].

Revision as of 13:38, 27 July 2013

Template:Article summary start Template:Article summary text Template:Article summary heading Template:Article summary wiki Template:Article summary wiki Template:Article summary wiki Template:Article summary wiki Template:Article summary end From Wikipedia:Sleep mode:

Sleep mode can go by many different names, including Stand By, Sleep, and Suspend. When placed in this sleep mode, aside from the RAM which is required to restore the machine's state, the computer attempts to cut power to all unneeded parts of the machine. Because of the large power savings, most laptops automatically enter this mode when the computer is running on batteries and the lid is closed.

This article describes generally mechanisms to suspend Arch Linux system to memory. There are multiple low level interfaces (backends) providing basic functionality, and some high level interfaces providing tweaks to handle problematic hardware drivers/kernel modules (e.g. video card re-initialization).

Low level interfaces

Though these interfaces can be used directly, it is advisable to use some of high level interfaces to suspend/resume. Using low level interfaces directly is significantly faster using any high level interface, since running all the pre- and post-suspend hooks takes time, but hooks can properly set hardware clock, restore wireless etc.

kernel (swsusp)

The most straightforward approach is to directly inform the in-kernel software suspend code (swsusp) to enter a suspended state; the exact method and state depends on the level of hardware support. On modern kernels, writing appropriate strings to /sys/power/state is the primary mechanism to trigger this suspend. See http://acpi.sourceforge.net/documentation/sleep.html for details.

uswsusp

The uswsusp ('Userspace Software Suspend') provides s2ram, a wrapper around the kernel's suspend-to-RAM mechanism, which performs some graphics adapter manipulations from userspace before suspending and after resuming.

See main article Uswsusp.

tuxonice

TuxOnIce is a fork of the kernel implementation of suspend/resume that provides kernel patches to improve the default implementation. It requires a custom kernel to achieve this purpose.

See main article TuxOnIce.

High level interfaces

Note that the end goal of these packages is to provide binaries/scripts that can be invoked to perform suspend/resume. Actually hooking them up to power buttons or menu clicks or laptop lid events is left to other mechanisms. To automatically suspend/resume on certain power events, such as laptop lid close or battery depletion percentage, you may want to look into running Acpid.

systemd

systemd provides native commands for suspend, hibernate and a hybrid suspend, see Power Management#Power management with systemd for details.

See Power Management#Sleep hooks for additional information on configuring suspend/resume hooks. Also see man systemctl, man systemd-sleep, and man systemd.special.

pm-utils

pm-utils is a set of shell scripts that encapsulate the backend's suspend/resume functionality. It comes with a set of pre- and post-suspend tweaks and various hooks to customize the process.

See main article pm-utils.

Troubleshooting

ACPI_OS_NAME

You might want to tweak your DSDT table to make it work. See DSDT article

Other Resources

  • Uswsusp Home Page
  • Advanced Configuration and Power Interface
  • /usr/share/doc/suspend/README Uswsusp Documentation
  • /usr/share/doc/suspend/README.s2ram-whitelist s2ram-whitelist README
  • /usr/src/linux-2.6.38-ARCH/Documentation/power/interface.txt Kernel Power Management Interface
  • /usr/src/linux-2.6.38-ARCH/Documentation/power/states.txt System Power Management States