Firstly, here's what hybrid suspend does:
  • initially, the computer is suspended to RAM, which is quick to suspend / resume but it also uses some power
  • if the computer doesn't wake up after a configurable amount of time, suspend to disk is used so the computer stops using any power (it's the same as if it was powered off) - this is also known as hibernation

Basically, using the hybrid suspend method from this article, the system initially enters suspend which is quick to resume and after the time you set, the system hibernates so it no longer uses any battery power. This is useful if for example you close the lid when you move from one room to another (between meetings, classrooms, etc.) and you need the system to resume quickly, but you also want to preserve battery power if you don't use it.

There is another "true" hybrid suspend method (available in Linux kernel 3.6 - Ubuntu 12.10 uses Linux kernel 3.5, so it's not in Ubuntu by default yet) in which the system suspends to both the RAM and hard disk in the same time, which is useful to get both a quick resume / suspend and be able to resume the computer in case of power loss or if the system runs out of battery, but the "true" hybrid suspend uses battery power so I prefer the hybrid suspend method in this post.



Set up hybrid suspend in Ubuntu


suspend ubuntu

Before proceeding, please note that I've tested this in Ubuntu 12.10 and it's known to work in Ubuntu 12.04 as well, but I don't know if it works in older Ubuntu versions.


Firstly, check if your system supports hybrid suspend by running the following command in a terminal:
sudo pm-is-supported --suspend-hybrid && echo "hybrid suspend is supported" || echo "your system doesn't support hybrid suspend"


To enable hybrid suspend in Ubuntu, create a file called "/etc/pm/config.d/00-use-suspend-hybrid" - you can do it using the following command:
sudoedit /etc/pm/config.d/00-use-suspend-hybrid

The above command uses the default (usually "nano") command line editor, but you can use a graphical text editor like Gedit if you want (e.g.: "gksu gedit /etc/pm/config.d/00-use-suspend-hybrid").

And paste the following in the newly opened file (use "Ctrl + Shift + V" to paste in a terminal):
# Always use suspend_hybrid instead of suspend
if [ "$METHOD" = "suspend" ]; then
METHOD=suspend_hybrid
fi
PM_HIBERNATE_DELAY=900 # time in seconds until hibernate (suspend to disk) occurs; 900 means 15 minutes

Then, adjust the "PM_HIBERNATE_DELAY" value to whatever you want (this is the time in seconds until hibernate - suspend to disk - occurs), save the file (to save the file in Nano command line text editor and then exit, use: Ctrl + O, Enter, Ctrl + X) and your system should now use hybrid suspend instead of the regular suspend method.

Update: There's also a second method - "true" hybrid suspend, which writes the image to both disk and RAM from the beginning, having the benefits that resuming will always be fast and that the machine will not wake up for a short time to hibernate for real. To use it, instead of he code above, paste the following in the /etc/pm/config.d/00-use-suspend-hybrid file:

# WORKAROUND: always set the default hibernate mode first (normal mode)
# (not required if you have the patch mentioned by Rohan below (http://askubuntu.com/a/344879/169))
HIBERNATE_MODE=platform

# Always use hibernate instead of suspend, but with "suspend to both"
if [ "$METHOD" = "suspend" ]; then
METHOD=hibernate
HIBERNATE_MODE=suspend
fi

# Make sure to use the kernel's method, in case uswsusp is installed etc.
SLEEP_MODULE=kernel

Then save the file (to save the file in Nano command line text editor and then exit, use: Ctrl + O, Enter, Ctrl + X) and that's it, your computer should now use "true" hybrid suspend.

0 comments:

Post a Comment

 
Top