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):
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:
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:
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+.
# Always use suspend_hybrid instead of suspend
if [ "$METHOD" = "suspend" ]; then
where, xx is the number of seconds that you want (for example "PM_HIBERNATE_DELAY=86400" for 24 hours)
I have fixed your comment and added the example to the blog post itself.
Also, you do not want to set this timeout only when using suspend-hybrid instead of suspend, but also when invoking suspend-hybrid directly. Therefore, it should not be in the "if" block.
I am using it in my debian laptop.
But I have one question. As far as I now, hybrid suspend have the benefit that if you dont go out of power it resume like from suspend very fast...and If yo go out of power it acts like hibernate and you dont loose the data (http://mjg59.livejournal.com/100643.html). Isn't it?
So my question is:
Should I put the "PM_HIBERNATE_DELAY=xx" variable or it is not necesary and I wil not loose my data if I let the power off?.
Because the normal proccess for me is to close the lid, and forget the laptop one day or more and when i came back the battery is was out and the laptop is turned off.
You may want to look at the s2both tool from the uswsusp package, which does what you want (from reading the man page): suspend to disk, but do not power off (but do suspend to RAM "forever").
Just install the "uswsusp" package and the default configuration of SLEEP_MODULE="auto" should pick it up (i.e. use it) automatically.
Is there a way to suspend2both and then have the machine just turn off (without further HDD activity) after some time? That would seem to be the best of both worlds.
Test whether hybrid-suspend is supported. Hybrid-suspend is the process where first the state of the system is saved to disk -- just like with hibernate -- but instead of
poweroff, the system goes in suspend state, which means it can wakeup quicker than for normal hibernation. The advantage over suspend is that you can resume even if you run out
of power. s2both is a hybrid-suspend implementation."
~$ sudo pm-is-supported --suspend-hybrid ; echo $?
~$ pm-is-supported --suspend-hybrid ; echo $?
Considering this "--suspend-hybrid" should be supported on your system.
1) The suspend option in the user menu doesn't work... 2) closing my lid puts it into "suspend" i think but it won't come back alive after that. If I invoke suspend from sudo pm-suspend it's happen and returns
P.S Daniel - Catcha errors are displayed in new page. Prior to my installing https://addons.mozilla.org/en-us/firefox/addon/lazarus-form-recovery/ having to retype/c&p my comment would have made me rather annoyed. Please consider using AJAX for this functionality going forward.