The future is coming ready-or-not

Hybrid suspend with Ubuntu 12.04 (Precise Pangolin)

with 2 comments

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
# 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.


Written by Steve George

July 14, 2012 at 14:19

Posted in Linux, Tech, Ubuntu

2 Responses

Subscribe to comments with RSS.

  1. I know where you are coming from. The one reason I boot to Linux instead of Windows is that the Windows sleep does an abrupt shutdown 4 out of 5 times, and Linux sleeps very nicely. That said, Linux eats up my battery much faster (1.5 hours) than Windows (3.5 hours). So, for computing on the go, neither solution is optimal.

    A spare battery is an option, or do some of your lightweight browsing and editing on a small notepad. (Evernote and Google drive are useful). Notepads (in general) have a longer battery life than laptops.


    August 7, 2012 at 21:21

  2. Mac OS X does a hybrid sleep/hibernate solution which (I think) is perfect. I’d love to know how this is done on Linux. This is how it works: When sleeping the system saves the RAM state to the disk (like suspend), but then just goes to sleep (doesn’t turn off) and keeps the RAM alive. When you wake it up, the RAM state on disk is quickly invalidated (not needed any more) and it is awake at once*. If, during sleep, the battery runs out, upon restart the saved state (suspend) is used (which on my machine also barely takes 5 seconds, at 4G RAM).

    * and I mean “at once”: My 2009 Macbook, when I open the lid, is so fast at resuming that by the time my external monitor has powered up (2 seconds), the Macbook has resumed, reinitialized our Wifi network, and all network apps (Mail, Skype, etc) have finished updating their data (downloading new stuff etc.)


    September 14, 2013 at 08:26

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: