[2024-feb-29] Sad news: Eric Layton aka Nocturnal Slacker aka vtel57 passed away on Feb 26th, shortly after hospitalization. He was one of our Wiki's most prominent admins. He will be missed.

Welcome to the Slackware Documentation Project

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
howtos:hibernation [2012/09/19 23:30 (UTC)] – Added the hibernate lock trick zithrohowtos:hibernation [2012/09/25 02:46 (UTC)] (current) – moved to the howtos:slackware_admin section mfillpot
Line 1: Line 1:
-====== Hibernation ====== 
  
-Hibernation (also known as suspend-to-disk) is a method used to power down a computer while preserving the state of the operating system. Once powered up, the operating system will be in the exact state as it was at the time of hibernation.  
- 
-In Slackware, hibernation works out-of-the-box. However, in order to resume successfully from a hibernated state, you need to configure the bootloader so it knows where to locate the resume data. 
- 
-===== Hibernating ===== 
- 
-==== Desktop Environments ==== 
- 
-KDE, XFCE and other [[slackware:desktop_environment|desktop environments]] offer hibernation from logout screen/menu. 
- 
-==== lightweight windows managers ==== 
- 
-You can hibernate your system from console. Either as root via pm-utils or D-Bus with additional programs as regular user. 
- 
-=== pm-utils === 
- 
-Hibernation is done via ''pm-hibernate'' command. 
- 
-=== D-Bus === 
- 
-Slackware offers two services to control power management in it's recent releases. UPower and HAL. Since HAL is deprecated in Slackware 14.0, use HAL in older Slackware releases (from 12.0 to 13.37), otherwise use UPower.  
- 
-Use one of these command to hibernate your system. 
- 
-== UPower ==  
- 
-<code bash> 
- $ dbus-send --system --print-reply --dest="org.freedesktop.UPower" \ 
- /org/freedesktop/UPower org.freedesktop.UPower.Hibernate 
-</code> 
- 
-== HAL == 
- 
-<code bash> 
-$ dbus-send --system --print-reply --dest="org.freedesktop.Hal" \ 
- /org/freedesktop/Hal/devices/computer org.freedesktop.Hal.Device.SystemPowerManagement.Hibernate 
-</code> 
- 
-===== Bootloader configuration ===== 
- 
-==== Non-LVM setup ==== 
- 
-=== LILO configuration === 
- 
-To tell your kernel where to resume from, you need to write the info to ''lilo.conf'': 
-<code> 
-append=" resume=/dev/sdaX" 
-</code> 
-Replace ''/dev/sdaX'' with your actual swap partition. 
- 
-==== LVM setup ==== 
- 
-LILO doesn't support booting from LVM, therefore you have to create initial ramdisk (initrd). You need one even though your kernel has build-in support for LVM. 
- 
-You don't have to specially adjust ''lilo.conf'' because you can set everything resume-related in initrd. 
-<code> 
-mkinitrd -c -k <kernel-version> -f <fs_type> -m <modules_required_to_boot> -r <root_partition> -h /dev/volumegroup/swap -L 
-</code> 
-  * -h set your hibernation/swap logical volume 
-  * -L activate LVM 
- 
-Next step is to make sure your ''lilo.conf'' contains following snippet 
-<code> 
-image = /boot/vmlinuz 
-  root = /dev/sdaX 
-  initrd = /boot/initrd.gz 
-  label = Slackware 
-  read-only # Partitions should be mounted read-only 
-</code> 
- 
-Afterwards, run ''lilo'' to save changes. 
-<code> 
-$ lilo 
-</code> 
- 
-===== Lock your computer upon resuming ===== 
- 
-You may have noticed that when your computer resumes, there is no protection to ensure no one can use your computer. As ''pm-hibernate'' must be run as root, any user that powers up your computer will be granted a root terminal! I'll show you some tricks to ensure a proper lock of the system. 
-<note warning>Security warning: whether you are using the trick from the command-line or from an X session, don't forget to logout from all other ttys! None of them will get locked, so people issuing <key>CTRL+ALT+F1</key> (ar any Fx key) upon resuming will be able to access them, rendering the lock trick totally useless!</note> 
- 
-==== With pm-utils ==== 
- 
-=== From the command line === 
-If you dont have an X session open, the only way to lock your computer is to logout from your session before hibernation. You can use the following command: 
-<code>pm-hibernate & logout (OR pm-hibernate & exit)</code> 
-It's important to logout from every tty prior to hibernation! ''logout'' will only log you out from the terminal from where you launched the command. Please read the warning in the following section. 
-<note>This trick may not work on fast systems, as ''logout'' may not have enough time to complete. You may think that using '';'' instead of ''&'' could do the trick (as it will log out the user //after// resuming), but it allows the user doing a <key>CTRL+C</key> upon resuming, killing the ''logout'' command.</note> 
- 
-=== From an X session === 
-If you want to lock the computer prior hibernation, you can issue the following command (as root of course):\\  
-<code># xlock & sleep 5 ; pm-hibernate</code> 
-You can also create the following script:\\  
-<code bash>#!/bin/bash 
-echo 'Hibernating in 5 seconds' 
-xlock & 
-sleep 5 
-pm-hibernate</code> 
-''xlock'' is a command that locks your X session. Upon rebooting, you will be asked for the //root// password. The ''sleep'' command may be omitted, but I think it's safer to leave it, so you are sure that ''xlock'' has enough time to run properly. You don't have to use ''exit'' (or ''logout'') at the end of the command or the script, as it has no use concerning security. You may want to use it though to automatically close the xterm on resuming. 
-<note warning>Security warning: this "trick" will only lock the X system! If you are logged on as root in any of the other ttys, ''xlock'' can be killed, leaving full access to the X session.\\ For people using init3 (no automatic X startup), remember to also logout from the tty from where you launched the X system with ''startx'': hit <key>CTRL+Z</key> (to suspend the task), then ''bg'' (to resume the task in the background), then <key>CTRL+D</key> (or ''logout'') to logout.</note> 
- 
-===== Further reading ===== 
- 
-  * Hibernate to encrypted swap - [[http://slackware.osuosl.org/slackware-13.37/README_CRYPT.TXT|README_CRYPT.TXT]] 
- 
-===== Sources ===== 
-  * Original source: [[http://www.slackwiki.com/Hibernate]] 
-    * Original author unknown - original submissions [[http://www.slackwiki.com/index.php?title=Hibernate&oldid=366|1]],[[http://www.slackwiki.com/index.php?title=Hibernate&oldid=368|2]] 
-    * Otherwise [[http://www.slackwiki.com/index.php?title=Hibernate&action=history|rewritten]] by [[wiki:user:yenn|Martin Matějek]] (also on Slackwiki) 
- 
-{{tag>howtos hardware hibernation power_saving}} 
 howtos:hibernation ()