Sunday, 6 May 2012

How to Re-Enable Hibernate in Ubuntu 12.04


If you have upgraded to Ubuntu 12.04, you may be wondering what happened to the "Hibernate" option in the power menu.

For those of you who are not aware or don’t use this feature at all, the Hibernate button usually lies above the Shut Down option and I use it a lot on my machines to save the current machine state to the hard drive rather than shut down or suspend. The next time you power up, hibernate restores to the previous saved state without going through the full boot process.


So why is hibernate missing in Ubuntu 12.04?”

Apparently Ubuntu's Hibernate feature has not worked consistently on all computers, particularly new hardware models, where,  some instances, the Hibernate feature has even caused data loss. So Canonical put out a statement to the effect:

"For Ubuntu to present a Suspend function that doesn’t work is unprofessional, and presenting a Hibernate function that doesn’t work (and destroys data by never waking up) is even worse."


"After much discussion and debating, the final decision is to disable Hibernate by default on all computers, unless the computer is on a whitelist. The whitelist will include all “Ubuntu Certified” computers that have been tested and proven to work with the Hibernate feature. So if you are not seeing the Hibernate button, most probably your PC is not “Ubuntu Certified”.

Well, no ####, Sherlock. Sadly those of us who know that it works and want to keep using it now have to resort to the Linux command-line ghetto to re-enable it.

The Hibernate option is still available under  "Power -> When power is critically low" system setting, which you can enable without any further action or warning, so you can get your laptop to go into Hibernate mode when your batter power is critically low. But not in regular use.

How to re-enable the Hibernate feature
First, make sure your PC supports the Hibernate feature. Close all open data files, open a terminal and type


sudo pm-hibernate. 


If your machine successfully hibernates and you can wake it, then your PC supports the Hibernate feature. You can proceed to  restore the Hibernate option for normal use.

In the terminal, use root privileges to open the following policy kit file:

sudo gedit /etc/polkit-1/localauthority/50-local.d/com.ubuntu.desktop.pkla

Search for the section

[Disable hibernate by default]
Identity=unix-user:*
Action=org.freedesktop.upower.hibernate
ResultActive=no

and replace it with the following:

[Re-enable hibernate by default]
Identity=unix-user:*
Action=org.freedesktop.upower.hibernate
ResultActive=yes

If the file is empty (some are), you can simply add this section.

Save the file and exit.

Restart the machine and the Hibernate option should return to the power menu. RC