I would like to use the hybrid suspend method instead of suspend when closing the lid or selecting "Suspend" from the menu.
I can imagine to change the pm-suspend script to do so automatically, but there might be a more maintainable / easier way.
I would like to use the hybrid suspend method instead of suspend when closing the lid or selecting "Suspend" from the menu.
I can imagine to change the pm-suspend script to do so automatically, but there might be a more maintainable / easier way.
This is the older method: first suspend and then wake up to hibernate after a delay (15 minutes by default). Use this with a Linux kernel before 3.6, or if you like that it does not use any power after 15 minutes any more.
Add the file /etc/pm/config.d/00-use-suspend-hybrid
:
# Always use suspend_hybrid instead of suspend
if [ "$METHOD" = "suspend" ]; then
METHOD=suspend_hybrid
fi
# The delay after which hibernation gets triggered (default: 900 seconds, 15 minutes):
PM_HIBERNATE_DELAY=900
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:
sudo pm-is-supported --suspend-hybrid && echo $?
If you have a Linux 3.6 kernel, you can use the following, which will suspend to both disk and RAM from the beginning.
Add the file /etc/pm/config.d/00-use-suspend-hybrid
:
# 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
This will always write the image to disk and then suspend to RAM, having the benefits that resuming will always be fast (as long as the battery does not run out) and that the machine will not wake up for a short time (after PM_HIBERNATE_DELAY) to hibernate for real.
The drawback is that the process takes longer (because it always hibernates to disk), and that your battery might run out in the long run (e.g. after 12 hours).