Hibernation enabled in Ubuntu

Howto: Make Ubuntu 12.04 Hibernate Successfully

Ubuntu has always had problems getting their system to shutdown successfully into a state of hibernation. There’s never been a single solution that fits all machines or all machines. This article is a combination of resources explaining how to enable hibernation by default, or use TuxOnIce to patch the kernel.

Ubuntu 12.04 LTS Precise PangolinUbuntu has always had problems getting their system to shutdown successfully into a state of hibernation. There’s never been a single solution that fits all machines. With my machines they’ve always been left in a state of a non-responsive black screen, sometimes a blinking white cursor in the top left, but usually pure blackness.

This problem has probably been the case for me since the days of Jaunty Jackalope (9.04), and a fresh install of Precise Pangolin didn’t bring around any form of fix either. On Precise Pangolin (Ubuntu 12.04), the option to hibernate is greyed out on all the power settings, yet ‘suspend’ is available. I prefer hibernation over suspending a session by default, but that’s really splitting hairs.

Checking the forums it seems there isn’t a clear strategy for the Ubuntu guys on how to handle the hibernate/suspend modesin future Ubuntu releases either; some opting for a hardware configuration white-list for these power modes, others pedalling for a black-list.

From piecing together several articles, tips and tutorials, I’ve hopefully found a good work around thats applicable for all hardware combo’s of Ubuntu’s latest release, Precise Pangolin 12.04, yet hopefully should work for other versions too.

Have you been hibernation blacklisted?

First off it seems that the Ubuntu guys have denied everyone the ‘luxury’ of hibernating their system because of its known stability issue with various hardware combinations. Its disabled down at the policykit level.

Whether this is within the mentality of Ubuntu’s ethos, or if it was the best way to bypass the problem, is irrelevant for the purpose of this article, but it might help us fix the problem quite quickly. To see whether hibernation will work once re-enabled, try to execute the following in a terminal window.

sudo pm-hibernate

The system should attempt to hibernate your system. If it shuts down successfully, wait a few seconds and then power the system back on. If your session restores correctly that’s great news, that means hibernation natively works with your system. If it freezes on a black screen (like mine did), or your session doesn’t restore correctly, please jump down to the TuxOnIce section below.

To enable the hibernation options in Ubuntu’s power management setting, execute the following:

sudo nano /etc/polkit-1/localauthority/50-local.d/com.ubuntu.enable-hibernate.pkla

Add this content and save the document:

[Re-enable hibernate by default]

You should then be able to reboot the system and have your hibernation options restored to you! Result.

If this method doesn’t work, or you’re unable to boot back into your desktop, use shell to remove the new policy kit file you just added by running the following command:

sudo rm /etc/polkit-1/localauthority/50-local.d/com.ubuntu.enable-hibernate.pkla

Once that’s deleted, try the TuxOnIce method below.

Patch the kernel with TuxOnIce

TuxOnIce is most easily described as the Linux equivalent of Windows’ hibernate functionality, but better. It saves the contents of memory to disk and powers down. When the computer is started up again, it reloads the contents and the user can continue from where they left off.

TuxOnIce patches the kernel so that the hibernation and suspension modes are handled completely differently for your system. The TuxOnIce site talks into more detail about how this works and which packages were forked from what, but thats far beyond what we need to know. All we need to know is its easy to install, and if it doesn’t work, easy to remove.

To see if we’re able to run TuxOnIce safely we need to make sure we have enough swap space available. Swap space is an area of the hard drive that is set aside specifically for virtual memory. Type the following into terminal:


This’ll give a quick breakdown of the memory you’ve got installed, and importantly, how you’ve got it configured.

Memory usage on Ubuntu

Here you can see the physical memory, (row beginning with ‘Mem:’), as well as the swap virtual memory. As long as the total column of Swap is greater than the total for Mem you won’t have any problem. If it isn’t, you’ll need to re-address the size of your swap partition. Drop me a message below if you want to know how this is done.

Installing TuxOnIce

So onto installing TuxOnIce. This article mentions how to install TuxOnIce, which can simply be done using apt-get. Add the TuxOnIce package archive to the apt-get repository on your system by executing the following in terminal:

sudo add-apt-repository ppa:tuxonice/ppa

This’ll mean you can pull TuxOnIce from the remote archives. Before you can do so though, you need to update the information on your system. Execute the following:

sudo apt-get update

This’ll update the known packages that you’re system can install. To actually install the kernel patch, run the following apt-get command:

sudo apt-get install tuxonice-userui linux-generic-tuxonice linux-headers-generic-tuxonice

On my machine this actually took a couple of minutes, and I did see some errors regarding TuxOnIce GUI packages, but it seemed to finish without a critical installation error. Now to test whether this worked or not, you should be able to run the same test as mentioned at the very top, executing:

sudo pm-hibernate

Several articles talk of TuxOnIce showing a progress bar of the machine being put into hibernation, however on mine the screen went to its normal black state. Thankfully after about 10 seconds the power light switched off – a great sign!

Turning the machine back on, it loaded straight into my old session, with windows and applications opened as before. It worked! Hibernation on Ubuntu 12.04 thanks to TuxOnIce!

Enabling Ubuntu hibernation

Now that hibernation works, you should be able to modify the policy kit to enable hibernation in Ubuntu’s power options. Execute this command:

sudo nano /etc/polkit-1/localauthority/50-local.d/com.ubuntu.enable-hibernate.pkla

And add this content:

[Re-enable hibernate by default]

After a save and a reboot you should now be able to select hibernation from the power management window.

Hibernation now available in Ubuntu

Hope this has helped, if it did please drop me a comment below, I’d really appreciate the feedback.

The information in this article has been gathered from several sources, hopefully I’ve combined it into a more useful article. Here’s some of the articles I remember using to construct it: The official Ubuntu bug #812394 report, the TuxOnIce kernel patch, installing TuxOnIce.

If this article has helped you I’d really appreciate a share on your favourite choice of social media, or simply a comment of thanks below.

26 thoughts on “Howto: Make Ubuntu 12.04 Hibernate Successfully

  1. In my System Ubuntu 12.04LTS , I can Hibernate after reading This post. But Here is another problem after hibernating when I start my laptop it doesn’t go back to previous session, it just starts a new session. what can I do to my system to go back to previous session after hibernation and restart ?

  2. Hi, I have 3GiB of Swap and 2GiB of RAM, and # pm-hibernate works for me. Also I have added the file in /etc/polkit-1/localauthority as per the instruction. But still on the menu the Hibernation option is grayed out, and there is no hibernation option on the power-manager. Is there some other place, where I am supposed to add these menu items?

    Thanks a lot if you can help me out!
    Btw, I am using Xubuntu 13.04 edition.

    1. Hi there
      I think 13.04 has changed their policy files. Can you run
      sudo touch /var/lib/polkit-1/localauthority/50-local.d/hibernate.pkla
      And add Identifiy / Action and ResultActive lines into that as you’ve done before.
      Let me know if this helps,

  3. Hi – after installing this with 12.04.02 I’m finding that on waking I go through the whole reboot sequence (BIOS etc) and then it appears to wake from it’s previous state although with errors relating to FPMA write etc..

    Rebooting and no further errors.

    Anyone had this problem?



    1. Hi Alex, I’ve never experienced that before. It sounds like its stuck on restoring a previous old state and cant create or update to the newer state. Are you able to paste the FPMA errors?

    2. Paul – thanks, however I’ve decided to go for a (very) drastic option of migrating to a Windows – including migrating 9tb of data to ntfs.

      Fingers crossed!

    3. Ooooo that is quite drastic. Hope it wasn’t just the hibernation issue that drove you away. Fingers crossed the data transfer goes successful.

  4. Only a small point but you spelled Tuxonice with an ‘L’ as part of the instructions, i.e. ‘LuxOnIce’.

    Having said that it doesn’t seem to work on mine but it’s an Acer Aspire 7520 and I’ve found it a bit flakey on some things, so… 🙁

  5. Please let me know how to re-address the memory. Thanks,

    total used free shared buffers cached
    Mem: 1984972 1146440 838532 0 45920 384440
    -/+ buffers/cache: 716080 1268892
    Swap: 979964 0 979964

  6. well written, and solved my problem!

    ❯ cat /etc/*-release
    DISTRIB_DESCRIPTION=”KXStudio 12.04.1″
    VERSION=”12.04.1 LTS, Precise Pangolin”
    PRETTY_NAME=”Ubuntu precise (12.04.1 LTS)”

    1. forgot to say, only issue is that with the kernel change kxstudio loses the low latency kernel. i’m going to play around with it a bit and may end up compiling my own kernel.

      anyway thanks for the article!

  7. This has saved me a ton of headaches. No issues so far (of course I just installed). Much better than kernel hibernate and uswsusp. No issues so far with screen corruption on resume, lost SD detection, and bluetooth going missing.

    Machine Dell M1210 with Nvidia and 4 GB

  8. Hi Paul,

    This guide is very nice and helpful. I followed the steps, and it was a piece of cake to do, and vola! Resume worked after hibernate. Previously, hibernate works and turns off the computer for me, but it won’t resume and instead reboots fresh every time. My machine is a Dell Latitude E6400.

    Just a comment here: when tuxonice was installed (as part of the 3 packages you indicated), a new Kernel is also installed and configured, which requires grub to be updated. In my case, I am using the old grub-legacy, and update-grub did not put the new kernel as the default in menu.lst. So I have to manually tweak it after that, but it’s no big deal.

    Thanks again.


  9. Nice article.

    Any idea how to do the progress bar?
    Looks like Ubuntu lacks the kernel module for splash service?

  10. The first method worked perfectly for my Samsung NC110 netbook. When I close the lid – zero battery consumption.

    Now if only there was an option for “suspend for 15 minutes, then hibernate”.

    Thanks for the excellent article!

  11. Hi Paul,

    Thanks to your tutorial I’m now I able to hibernate from the drop down list.

    Great , but not perfect: although I have activated hibernation in the power management window when the lid closes, when I do close the lid, nothing happens.

    Any idea?
    Thanks for your help,


    1. Glad progress is being made but shame its not fully working yet. When you’re trying to initialise hhbenation, are you signed into any of the TTY sessions? If you are that’ll prevent hibenation being achieved. If you change the settings so that it suspends when you close the lid, does that work?

    2. Hello Paul.

      I am not signed in into one of the tty sessions. When I close the lid, my screen goes black. But besides that nothing happens.

      I am able to hibernate correctly by selecting the option hibernate from the log out icon dropdown list (upper righ hand corner of the screen).

      But it would be perfect to have it working when closing the lid.

      Thanks again for your help,


  12. pm-hibernate didn’t work even after installing TuxOnIce. finally my system says that TuxOnIce is not supported. Now what i should do. btw how should i remove TuxOnIce ? Thank you.

Leave a Reply

Your email address will not be published. Required fields are marked *