Difference between revisions of "Suspend and Hibernate"

From gr0x0rd
Jump to navigation Jump to search
 
(4 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
== Configuring Hardware - Suspend and Hibernate ==
 
== Configuring Hardware - Suspend and Hibernate ==
  
If you have a laptop, chances are you'll want your system to go to sleep based on various actions, such as closing the lid. The ability to suspend and hibernate should already have been installed along with the ''sys-power/pm-utils'' package. When running xfce, managing power actions and events can be simplified by leveraging ''xfce4-power-manager''.
+
If you have a laptop, chances are you'll want your system to go to sleep based on various actions, such as closing the lid when running on battery power. There are a number of packages that can perform suspend and hibernate functionality, but the most compatible one is the ''sys-power/pm-utils'' package.  
  '''$''' sudo emerge -av xfce4-power-manager
+
'''$''' sudo emerge -av sys-power/pm-utils
Once the emerge has completed, you can access your power settings via Settings -> Xfce 4 Power Manager from your menu. You can easily set the icon to display on ac or battery power, and set actions for things such as closing the lid, when the ac adapter is unplugged, or after running on batteries for a certain time period.
+
You can test to see if your system is capable of suspending or hibernating by calling
 +
'''$''' sudo pm-suspend
 +
and
 +
  '''$''' sudo pm-hibernate
 +
respectively.
 +
 
 +
Not all systems can suspend or hibernate easily; these features are very dependent on your kernel configuration. Some drivers, such as USB, network and sound, may need to be unloaded before going into either of these states, and loaded again when the system resumes. To enable this, you'll first need to compile the necessary components as modules in the [[Configure_the_Kernel | kernel]]. Once you've done this, you can test the effect manually before automating it by issuing the command
 +
'''$''' sudo modprobe -r ''modulename''
 +
before suspending or hibernating and calling
 +
'''$''' sudo modprobe ''modulename''
 +
once the system has resumed. If you've found the necessary configuration allowing your system to suspend or hibernate and resume successfully, you can automate this by creating and editing ''/etc/pm/config.d/modules''. This example unloads the USB, USB 2.0 and USB 3.0 modules.
 +
'''$''' sudo nano -w /etc/pm/config.d/modules
 +
=== /etc/pm/config.d/modules ===
 +
SUSPEND_MODULES="xhci_hcd ehci_hcd uhci_hcd"
 +
You should now be able to suspend without having to unload the modules above manually. If things seemed to work, you can check your logs
 +
'''$''' sudo tail -100 /var/log/messages
 +
to ensure the modules were loaded after resuming.

Latest revision as of 13:23, 23 December 2010

Configuring Hardware - Suspend and Hibernate

If you have a laptop, chances are you'll want your system to go to sleep based on various actions, such as closing the lid when running on battery power. There are a number of packages that can perform suspend and hibernate functionality, but the most compatible one is the sys-power/pm-utils package.

$ sudo emerge -av sys-power/pm-utils

You can test to see if your system is capable of suspending or hibernating by calling

$ sudo pm-suspend

and

$ sudo pm-hibernate

respectively.

Not all systems can suspend or hibernate easily; these features are very dependent on your kernel configuration. Some drivers, such as USB, network and sound, may need to be unloaded before going into either of these states, and loaded again when the system resumes. To enable this, you'll first need to compile the necessary components as modules in the kernel. Once you've done this, you can test the effect manually before automating it by issuing the command

$ sudo modprobe -r modulename

before suspending or hibernating and calling

$ sudo modprobe modulename

once the system has resumed. If you've found the necessary configuration allowing your system to suspend or hibernate and resume successfully, you can automate this by creating and editing /etc/pm/config.d/modules. This example unloads the USB, USB 2.0 and USB 3.0 modules.

$ sudo nano -w /etc/pm/config.d/modules

/etc/pm/config.d/modules

SUSPEND_MODULES="xhci_hcd ehci_hcd uhci_hcd"

You should now be able to suspend without having to unload the modules above manually. If things seemed to work, you can check your logs

$ sudo tail -100 /var/log/messages

to ensure the modules were loaded after resuming.