If you are running Ubuntu post 10.04 (or post 11.04 if you use non-LTS releases) you may have noticed that hibernation is no longer an option. You don’t get to choose it from your logout/shutdown options and you don’t get to choose it as an option if your battery is dying.
I’ve read some attempts at explanation, but as near as I can tell it has been disabled because they can’t get it to work consistently on every hardware. Seems they’d rather have actions that can work on all hardware than to risk some users having unexpected crashes.
So before you attempt to enable hibernation, let’s test your hardware to see if hibernation is likely to work for you.
If all goes well this terminal command should hibernate your machine and move all of your active session into a special location on your hard drive. You will then need to power your machine on and it should come back to your hibernated session. If that fails then your machine may not be a good candidate to enable hibernation. If it works, give this a try.
Enabling hibernation for those machine capable of it is a simple matter of creating a configuration file with the relevant data included therein. The file is called com.ubuntu.enable-hibernate.pkla and will live in the /var/lib/polkit-1/localauthority/50-local.d/ folder.
I used Gedit to create and save this file:
gksudo gedit /var/lib/polkit-1/localauthority/50-local.d/com.ubuntu.enable-hibernate.pkla
This will open Gedit with elevated user permissions (so do be careful). Simply add this code directly into the file, save it, and close Gedit. (Mouse over to use the pointy-brackets button in the box for an easier copy and paste.)
[Re-enable hibernate by default in upower] Identity=unix-user:* Action=org.freedesktop.upower.hibernate ResultActive=yes [Re-enable hibernate by default in logind] Identity=unix-user:* Action=org.freedesktop.login1.hibernate ResultActive=yes
That’s it. You should (after a reboot) be able to use hibernation in the various circumstances where it might be appropriate. For me that’s really just in the Power settings, but you may have additional uses for it.