Quick Links

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.