In Ubuntu 12.04 and newer, hibernation has been disabled by default in policykit. How can I enable this back?
Power Management – How to Enable Hibernation
hibernatepower-management
Related Solutions
Unfortunately, hibernation is not supported for Wubi systems (see this page).
If you want to be able to hibernate your Ubuntu system, you'll have to do a standard installation (alongside, instead of inside, your Windows system) by booting from an Ubuntu CD/DVD or USB flash drive and running the installer.
bcbc has explained this further:
You can't hibernate a Wubi install unless you also have a swap partition. You're using a swap file so increasing the size won't help. There is a way to hibernate with a swap file, but I've never seen anyone get it to work on Wubi.
14.04 and beyond
Mitch points out in his answer for 14.04 and 16.04 that you should check 10-vendor.d/com.ubuntu.desktop.pkla
before modifying anything. Also check that you have Secure Boot disabled and if that brings the menu option back.
Re-enabling the hibernation option in the menu
To re-enable the hibernation option in the menu, your /etc/polkit-1/localauthority/50-local.d/com.ubuntu.enable-hibernate.pkla
should be modified to look like the following in saucy (13.10):
[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
Then reboot or run killall indicator-session-service
in your session and you should have your hibernate functionality/menu option back. Create the file if it doesn't exist already.
Investigation from bug report
Citation from Jeffery To's post on Launchpad Bug Report #1232814:
For Saucy, indicator-session was updated to use logind (org.freedesktop.login1) instead of upower.
If you check /var/lib/polkit-1/localauthority/10-vendor.d/com.ubuntu.desktop.pkla, you'll see that hibernate is disabled by default in both upower and logind.
So the first step to re-enable the Hibernate option is to edit /etc/polkit-1/localauthority/50-local.d/com.ubuntu.enable-hibernate.pkla to something like:
[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
After rebooting, the login screen session menu should have a Hibernate option.
[...]
All thanks and credit go to Jeffery!
Why was hibernation disabled?
There exists a bug report on launchpad that suggests disabling suspend/hibernate instead of tracking which hardware "certifies" for which power modes. It's claimed to be a more scalable approach.
Another thing to mention is that using UEFI Secure Boot and hibernation appears to be possible but may be a risk to circumvent the former. (1, 2) As a reminder, when you use hibernation you store everything in RAM to disk without encryption, this includes passwords for encrypted filesystems and containers.
At some point with 16.04 I had to disable Secure Boot to be able to hibernate my laptops. In my case I used uswsusp and testing with s2disk returned the message below. This may give you a hint that your issue, why you can't hibernate although everything else is in place, is related to Secure Boot:
s2disk: Could not open the snapshot device. Reason: Operation not permitted
However, please understand that this is not a place to complain and please be nice.
Related questions
- How can I tell Ubuntu to do nothing when I close my laptop lid? (or tell Ubuntu to hibernate when closing the laptop lid)
Best Answer
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:
Fill it with this:
Or in 14.04 and later:
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.