Hybrid suspend with Ubuntu 12.04 (Precise Pangolin)
I’m pretty much tied to my laptop, not only does it have all my applications on it but I think I might be so habituated that I can’t usefully think without having it’s warming reassuring whirr on my lap. Of course like all mobile workers I’m always worried about how much time I have left in the battery, in fact I’m so paranoid that I’ve developed frown lines from constantly scowling at the battery indicator as it slowly dribbles down to the moment when I’ll be disconnected from the world-wide-‘like’-a-sphere! It’s one thing to watch it dribble down when you’re working, but how much worse when you ‘resume’ the laptop to find that half the battery has gone already! Equally, doing a full hibernate is great from a battery perspective but the ‘resume’ takes a long time to get to which isn’t fantastic if you’re just moving from say one meeting room to another. In Ubuntu 12.04 LTS we have the answer with hybrid suspend.
If you’ve ever had a Mac OSX laptop then you’ve seen this capability before. Essentially, when you close the lid the system initially goes to suspend, and then after a few minutes it drops into hibernate so you’re no longer using any power from the battery. One capability the Mac has is to resume from hibernate really quickly, not quite sure how they do that – if you know I’d be interested.
Hibernate takes a while to get back to your previous state because it has to read the system image back from the disk. Equally, with plain suspend you’re using a trickle of battery to keep the system quietly ticking over so it can resume a lot faster. So when you’re using the hybrid system you want to set it to hibernate when you’re not going to be using the laptop for a while. I set it to go to full hibernate after 15 minutes.
Here are the steps to follow:
Test that hibernate actually works:
$ sudo pm-hibernate
Check if the system thinks that suspend-hybrid is supported:
$ sudo pm-is-supported --suspend-hybrid && echo $?
If it returns 0 then suspend-hybrid can be used with this system.
Create the hybrid suspend capability by creating the /etc/pm/config.d/00-use-suspend-hybrid file.
In the file you have:
# Always use suspend_hybrid instead of suspend if [ "$METHOD" = "suspend" ]; then METHOD=suspend_hybrid fi PM_HIBERNATE_DELAY=900 # Hibernate to disk after 15 minutes (900 seconds)
It should now use hybrid suspend and put the system to full hibernation after 15 minutes. There’s some more power saving information in the Ubuntu Wiki, and the original source of the idea was from Daniel Hahlers post.