SEARCH

How-To Geek

How to Re-Enable Hibernate in Ubuntu 12.04

image

If you’ve just updated to Ubuntu 12.04, you may notice an option missing in its system menu. The Hibernate option is now hidden by default, but you can get it back if you prefer to hibernate your system.

Hibernate is disabled by default because it can cause problems on some system configurations. You should perform a hibernate with a special command to test that it works properly before re-enabling it.

Hibernate vs. Suspend

The Suspend option is still available in Ubuntu’s system menu. Like hibernate, suspend saves your open programs and data, so you can quickly resume to your previous sate. However, suspend requires power — while in suspend mode, your computer will continue to draw a small amount of power. If the system loses power — for example, if you unplug a desktop computer from the power socket or a laptop’s battery empties, you’ll lose your work.

image

In contras, hibernate saves your system’s state to your hard disk and shuts the system off, consuming no power. When you resume from hibernate, your open programs and data will be restored. Hibernate saves power, but it takes longer – the computer has to restore data to the RAM, while suspend preserves the data in the RAM.

Why It’s Disabled

Hibernate doesn’t work properly on many hardware configurations with Ubuntu and other Linux distributions. If hibernate doesn’t work properly on your system, you may resume from hibernate to find that your work has been lost. Some hardware drivers may also not work properly with hibernate — for example, Wi-Fi hardware or other devices may not work after resuming from hibernate.

To prevent new users from encountering these bugs and losing their work, hibernate is disabled by default.

Testing Hibernate

Before re-enabling hibernate, you should test it to verify it works properly on your system. First, save your work in all open programs — you’ll lose it if hibernate doesn’t work properly.

To test hibernate, launch a terminal. Type terminal into the Dash and or use the Ctrl-Alt-T keyboard shortcut.

image

In the terminal, run the following command:

sudo pm-hibernate

image

Your system will shut down. After running the command, turn your system back on — if your open programs reappear, hibernate works properly.

Troubleshooting Hibernate

While hardware incompatibilities are a major problem with hibernate, there’s one other common problem. Hibernate saves the contents of your RAM to your swap partition. Therefore, your swap partition must be at least as large as your RAM. If you have a 2GB swap partition and 4GB of RAM, hibernate won’t work properly.

A quick way to compare your RAM and swap sizes is with the System Monitor application.

image

You can view the memory and swap sizes on the Resources tab. “Memory” here refers to your RAM.

image

If really want to use hibernate and your swap partition is smaller than your RAM, try running GParted from a live CD. You can run GParted from a Ubuntu live CD or a dedicated GParted live CD. From the live CD, you can resize your Ubuntu partitions — you can’t do this while they’re in-use.

Re-Enabling Hibernate

You can run the sudo pm-hibernate command whenever you want to hibernate, but this is inconvenient. To re-enable the hibernate option in the menus, you’ll have to create a PolicyKit file.

You can use any text editor for this, but we’ll use gedit in this example. Run the following command to launch gedit as the root user and specify the file you want to create:

gksu gedit /etc/polkit-1/localauthority/50-local.d/com.ubuntu.enable-hibernate.pkla

image

Paste the following text into the file:

[Enable Hibernate]
Identity=unix-user:*
Action=org.freedesktop.upower.hibernate
ResultActive=yes

image

Save the text file, then log out and log back in. You’ll be able to hibernate from the system menu.

Chris Hoffman is a technology writer and all-around computer geek. He's as at home using the Linux terminal as he is digging into the Windows registry. Connect with him on Google+.

  • Published 05/14/12

Comments (12)

  1. MJ

    Good to know, thanks for the information!

  2. cam2644

    More useful stuff. Thanks

  3. Citrus Rain

    Hmmm… I need to check my swap size. I assume it’s that partition I didn’t create, and is unlabeled.
    I tried to hibernate sometime last month before the LTS, and it took 10 minutes to shut off & not actually save anything.

    Thank you for explaining that.

  4. practitioner

    Great Article, thanks.

    I tried sudo pm-hibernate on my Dell Vostro 1014, it took sometime before powering off, then I turned it on, it restored and everything worked fine BUT it took a lot of time. On Windows 7 it takes very less comparatively. I’ve 4 GB RAM and my SWAP partition is also 4 GB. I checked on System Monitor Memory says 2.4 of 3.8 and Swap says 1.2 of 4.0 GB.

    How do I improve this so that it takes less time than it’s taking now.

  5. Gnomeuser

    If you’re using gnome shell, you just restart the shell “Alt + f2, r”. There is no need to logout.

  6. higuita

    practitioner: if your swap file is in the end of the HD, it might be a lot slower than if it was in the start of the HD.
    HDs dont have the same speed in all places, the end is usually the slower part and you can get a 80% speed redution. if the swap is in the slower part, writing and reading to and from it will take longer.

    If you can, create the swap a little bigger than the RAM, so that the RAM might fit in swap, even if the swap have already some data. your total now is 3.6GB of 4GB… with 2 more GB of swap, you have more room to hibernate

  7. ML

    Perfect! Thanks!

  8. Jonathan

    So Ubuntu still isn’t ready for regular users then?

    Thanks for the tutorial, but for people who are used to using hibernate without thinking about it (as I am in Windows 7) this is obviously not a solution. Whoever’s fault it is, doesn’t change the fact that Ubuntu doesn’t work in some respects.

  9. Chris Hoffman

    @Jonathan

    Well, it’s disabled because it will often break, depending on the hardware. Better users miss the option than struggle with losing their work. Neither is ideal, of course.

  10. Ricardo Martins

    thanks for this tip. I was needing it

  11. farid

    Very useful tutorial, tnx

  12. sukeshi

    Hello evry1,
    I did all the steps properly, getting the hibernate option but it is not working. Please give some inputs.

Get Free Articles in Your Inbox!

Join 134,000 newsletter readers

Email:

Go check your email!