How to enable hibernation?
If this answer does not work in Ubuntu 13.10, see here for an alternative answer
Hibernation was disabled on 12.04 for machines that are not certified with Ubuntu.
In order to enable hibernation you need to test whether it works correctly by running sudo pm-hibernate
in a terminal. The system will try to hibernate. If you are able to start the system again then you are more or less safe to add an override.
To do so, start editing:
sudo nano /etc/polkit-1/localauthority/50-local.d/com.ubuntu.enable-hibernate.pkla
Fill it with this:
[Re-enable hibernate by default]
Identity=unix-user:*
Action=org.freedesktop.upower.hibernate
ResultActive=yes
Or in 14.04 and later:
[Re-enable hibernate by default for login1]
Identity=unix-user:*
Action=org.freedesktop.login1.hibernate
ResultActive=yes
[Re-enable hibernate for multiple users by default in logind]
Identity=unix-user:*
Action=org.freedesktop.login1.hibernate-multiple-sessions
ResultActive=yes
Save by pressing Ctrl-O then enter and then exit nano by pressing Ctrl-X.
Restart and hibernation is back!
Or run killall unity-panel-service
to just reset the menu.
Some users will then need to run sudo update-grub
to get the hibernate option to be available in the power menu. Some users may also have to at least log out then log in to get it to appear in the (upper right) power menu.
First you need to test your machine supports hibernation. Test it with the command:
sudo pm-hibernate
# or for newer Ubuntus like 17.04
sudo systemctl hibernate
Ubuntu 16.04 and above
For enabling in the interface you'll need to run sudo nano /etc/polkit-1/localauthority/50-local.d/com.ubuntu.enable-hibernate.pkla
and fill with:
[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;org.freedesktop.login1.hibernate-multiple-sessions
ResultActive=yes
Ubuntu 14.04 and 15.04
For enabling in the interface you'll need to run sudo nano /etc/polkit-1/localauthority.conf.d/52-enable-hibernation.conf
for Ubuntu 14.04 and 15.04 and fill with:
[Re-enable hibernate by default]
Identity=unix-user:*
Action=org.freedesktop.upower.hibernate
ResultActive=yes
[Re-enable hibernate by default for login1]
Identity=unix-user:*
Action=org.freedesktop.login1.hibernate;org.freedesktop.login1.hibernate-multiple-sessions
ResultActive=yes
It has several stanzas as you might have multiple users (so that is doesn´t depend of multiple-users or upower as manager instead of login1)
p.s.: official documentation https://help.ubuntu.com/16.04/ubuntu-help/power-hibernate.html
Additionally, for those who want to disable the suspend button (for various reasons), proceed analogously...
Choose any file name, but this is one is verbose/convention:
sudoedit /etc/polkit-1/localauthority/50-local.d/com.ubuntu.disable-suspend.pkla
Fill it with this:
[Disable suspend by default]
Identity=unix-user:*
Action=org.freedesktop.upower.suspend
ResultActive=no
Ctrl+O, Enter, Ctrl+X
No need to restart, it should be gone as soon as you go into the shutdown menu.