Archiv für: Juni 2012

03.06.12

Use hybrid suspend method by default with pm-utils/Linux (suspend to RAM and disk)

There is this nice method of suspending a computer to RAM (which is quick to suspend and resume, but still uses some battery) and after a given amount of time to disk, if it has not been waken up since then (e.g. after 15 minutes).

Ubuntu (and any other distribution using pm-utils) supports this via the pm-utils package and its pm-suspend-hybrid script.

Unfortunately this is not used by default (even hibernation is not available from the menu by default), but only normal suspend.

The following configuration snippet will make pm-utils use the "suspend_hybrid" method instead of "suspend" when being invoked:

You have to create a file like /etc/pm/config.d/00-use-suspend-hybrid and add the following code (e.g. via sudo -e /etc/pm/config.d/00-use-suspend-hybrid):

Code:

# Always use suspend_hybrid instead of suspend
if [ "$METHOD" = "suspend" ]; then
    METHOD=suspend_hybrid
fi

I came up with this solution after having asked for a method to do so at Ask Ubuntu.

This way hybrid suspend will be used automatically if you select e.g. "Suspend" from the menu or close your laptop's lid (both actions call pm-suspend which then gets remapped).

You can configure the amount of time before hibernation (Suspend To Disk) is being invoked with the PM_HIBERNATE_DELAY variable (in seconds), which you can just configure in the same file, too:

Code:

# Always use suspend_hybrid instead of suspend
if [ "$METHOD" = "suspend" ]; then
    METHOD=suspend_hybrid
fi
PM_HIBERNATE_DELAY=300  # invoke hibernation to disk after 5 minutes (300 seconds)

You might want to make sure that the hybrid method is supported on your system via the following code. If it says "0" it should work:

Code:

sudo pm-is-supported --suspend-hybrid && echo $?

Happy suspending.

Update (2013-10-09): I have updated my own answer at AskUbuntu with another (really hybrid, often preferred method), which you can use with Linux 3.6+.

Seitenleiste