Difference between revisions of "Power management/Suspend and hibernate"

From ArchWiki
Jump to: navigation, search
(systemd: repaired broken link)
(Hibernation)
(One intermediate revision by one other user not shown)
Line 17: Line 17:
 
* Backend: kernel, uswsusp, tuxonice  
 
* Backend: kernel, uswsusp, tuxonice  
  
=Backend=
+
= Backend =
  
==Kernel==
+
== Kernel ==
  
===Suspend===
+
=== Suspend ===
  
works-out-of-box
+
Suspension works out-of-box.
  
===Hibernation===
+
=== Hibernation ===
  
 
It needs a swap partiton.
 
It needs a swap partiton.
Line 46: Line 46:
  
 
{{hc|/etc/mkinitcpio.conf|2=# resume must be placed after ide scsi sata and/or lvm2, but before filesystems
 
{{hc|/etc/mkinitcpio.conf|2=# resume must be placed after ide scsi sata and/or lvm2, but before filesystems
HOOKS="... ide scsi sata lvm2 '''''resume''''' filesystems"}}
+
HOOKS="... block lvm2 '''''resume''''' filesystems"}}
  
 
You must rebuild the initrd image for these changes to take effect:
 
You must rebuild the initrd image for these changes to take effect:
  
{{bc|# mkinitcpio -p linux}}
+
# mkinitcpio -p linux
  
 
{{Note|If you use a custom kernel, then you might have to change the value of the {{ic|-p}} option.}}
 
{{Note|If you use a custom kernel, then you might have to change the value of the {{ic|-p}} option.}}
  
==Uswsusp==
+
== Uswsusp ==
  
 
'''uswsusp''' (userspace software suspend) is a set of user space tools used for hibernation (suspend-to-disk) and suspend (suspend-to-RAM or standby) on Linux systems.
 
'''uswsusp''' (userspace software suspend) is a set of user space tools used for hibernation (suspend-to-disk) and suspend (suspend-to-RAM or standby) on Linux systems.
Line 60: Line 60:
 
Consulte [[Uswsusp]].
 
Consulte [[Uswsusp]].
  
==TuxOnIce==
+
== TuxOnIce ==
  
 
'''TuxOnIce''' , an advanced suspend/hibernate framework which supports suspending to a swap-disk or a regular file with fast LZO-compression.
 
'''TuxOnIce''' , an advanced suspend/hibernate framework which supports suspending to a swap-disk or a regular file with fast LZO-compression.
Line 70: Line 70:
 
== systemd ==
 
== systemd ==
  
{{bc|
+
$ systemctl suspend
$ systemctl suspend
+
$ systemctl hibernate
$ systemctl hibernate
+
$ systemctl hybrid-sleep
$ systemctl hybrid-sleep
+
}}
+
  
See [[Systemd#ACPI_power_management]]
+
See [[Systemd#ACPI_power_management]].
  
==pm-utils==
+
== pm-utils ==
  
{{bc|
+
# pm-suspend
# pm-suspend
+
# pm-hibernate
# pm-hibernate
+
# pm-suspend-hybrid
# pm-suspend-hybrid
+
}}
+
  
See [[pm-utils]]
+
See [[pm-utils]].

Revision as of 14:22, 22 June 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 wiki Template:Article summary wiki Template:Article summary wiki Template:Article summary end

Manually suspending the operating system, either to memory (standby) or to disk (hibernate) sometimes provides the most efficient way to optimize battery life, depending on the usage pattern of the laptop. While there is relatively straightforward support in the linux kernel to support these operations, typically some adjustments have to be made before initiating these operations (typically due to problematic drivers, modules or hardware). The following tools provide wrappers around the kernel interfaces to suspend/resume

  • Wrappers: Systemd, pm-utils
  • Backend: kernel, uswsusp, tuxonice

Backend

Kernel

Suspend

Suspension works out-of-box.

Hibernation

It needs a swap partiton.

About swap partition size

Even if your swap partition is smaller than RAM, you still have a big chance in hibernating successfully. According to kernel documentation: "/sys/power/image_size controls the size of the image created by the suspend-to-disk mechanism [...] which is set to 2/5 of available RAM by default. [...] The suspend-to-disk mechanism will do its best to ensure the image size will not exceed that number." You may either decrease it due to a small swap partition or increase it in purpose of possible hibernation speed up.

Add Kernel Parameters

The parameter resume=SWAP_PARTITION has to be passed to the Kernel parameters (where SWAP_PARTITION is either your swap device, i.e. /dev/sdaX, or your swap UUID). Consult Kernel parameters for more info.

 kernel /boot/vmlinuz-linux ... resume=/dev/sdaX

If you are using swap file instead of regular swap partition, read Swap#Swap file resuming for more info.

 kernel /boot/vmlinuz-linux ... resume=/dev/sdaX resume_offset=12345

You will also need to add the resume hook to mkinitcpio.conf:

/etc/mkinitcpio.conf
# resume must be placed after ide scsi sata and/or lvm2, but before filesystems
HOOKS="... block lvm2 resume filesystems"

You must rebuild the initrd image for these changes to take effect:

# mkinitcpio -p linux
Note: If you use a custom kernel, then you might have to change the value of the -p option.

Uswsusp

uswsusp (userspace software suspend) is a set of user space tools used for hibernation (suspend-to-disk) and suspend (suspend-to-RAM or standby) on Linux systems.

Consulte Uswsusp.

TuxOnIce

TuxOnIce , an advanced suspend/hibernate framework which supports suspending to a swap-disk or a regular file with fast LZO-compression.

Consulte TuxOnIce.

Wrappers

systemd

$ systemctl suspend
$ systemctl hibernate
$ systemctl hybrid-sleep

See Systemd#ACPI_power_management.

pm-utils

# pm-suspend
# pm-hibernate
# pm-suspend-hybrid

See pm-utils.