Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

In Ubuntu 12.04 and newer, hibernation has been disabled by default in policykit. How can I enable this back?

share|improve this question
5  
Why did they disable it in the first place? Does it have anything to do with losing audio? –  Ali Oct 15 '13 at 16:01
1  
for 13.10 see askubuntu.com/questions/361734/… –  rogerdpack Jan 6 at 14:54
    
To answer Ali's question, it was disabled because many people had problems hibernating due to problems with their swap partitions. However, in Ubuntu 14.10 Utopic Unicorn, there are plans to get hibernation working for good, with a button and everything. –  FuzzyToothpaste Jun 1 at 19:29
add comment

8 Answers 8

For Ubuntu 14.04 with multiple users you´ll have to add this tags (so that is doesn´t depend of multiple-users or upower as manager instead of login1)

[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
  ResultActive=yes

[Re-enable hibernate for multiple users by default in logind]
  Identity=unix-user:*
  Action=org.freedesktop.login1.hibernate-multiple-sessions
  ResultActive=yes
share|improve this answer
add comment

I have translated above answers to bash scripts. This makes installation on multiple machines less tiresome.

Script enable-hibernate:

#!/bin/bash
#http://askubuntu.com/a/94963/164341
cat << '_EOF_' |sudo tee /etc/polkit-1/localauthority/50-local.d/com.ubuntu.enable-hibernate.pkla
[Enable Hibernate]
Identity=unix-user:*
Action=org.freedesktop.upower.hibernate
ResultActive=yes
_EOF_
clear
echo
echo 'Hibernate enabled.'
echo

Script disable-suspend:

#!/bin/bash
#http://askubuntu.com/a/154821/164341
cat << '_EOF_' |sudo tee /etc/polkit-1/localauthority/50-local.d/com.ubuntu.disable-suspend.pkla
[Disable suspend by default]
Identity=unix-user:*
Action=org.freedesktop.upower.suspend
ResultActive=no
_EOF_
clear
echo
echo 'Suspend disabled.'
echo

Note: Do not forget to chmod +x both scripts to make them executable.

share|improve this answer
add comment
up vote 256 down vote accepted

If this answer does not work in Ubuntu 13.10, see here for an alternative answer


You can follow official documentation here. 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

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.

share|improve this answer
2  
Frustrated here - trying sudo pm hibernate on my machine and nothing whatsoever happens. No power down. –  Danny Staple May 9 '12 at 20:13
9  
@Danny Staple: you omitted the hyphen between pm and hibernate. sudo pm-hibernate –  Paddy Landau May 27 '12 at 13:20
13  
+1 for command line pm-hibernate=) –  cuda.geek Sep 5 '12 at 17:49
6  
Really? Is this the user friendlier version of changing such a simple setting? It's getting uglier every day... –  Esteban Aug 15 '13 at 3:12
3  
I don't think that was Esteban's point. It shouldn't require arcane magic to enable hibernate. Think of something in the /etc/default directory where you change one line from enable_hibernate="false" to enable_hibernate="true". Think of having a system->settings dialog that just lets you turn it on with a warning "this may not work, your machine may not wake up properly." –  Scott Marlowe Nov 15 '13 at 5:50
show 13 more comments

A simple command which does the exact same thing as the accepted answer except non-interactively:

cat <<EOF | sudo tee /etc/polkit-1/localauthority/50-local.d/com.ubuntu.enable-hibernate.pkla
[Re-enable hibernate by default]
Identity=unix-user:*
Action=org.freedesktop.upower.hibernate
ResultActive=yes
EOF
share|improve this answer
add comment

If the response with /etc/polkit-1/localauthority/50-local.d/com.ubuntu.enable-hibernate.pkla does not work as in my case, don't forget to delete the file by:

sudo rm /etc/polkit-1/localauthority/50-local.d/com.ubuntu.enable-hibernate.pkla

And try to use TuxOnIce.


First ensure you have enough of swap. It should be the same size or bigger as the amount of your RAM. Use command

free

rule Swap > Mem. If this is not the case, enlarge your swap size. Then install TuxOnIce by

sudo add-apt-repository ppa:tuxonice/ppa
sudo apt-get update
sudo apt-get install tuxonice-userui linux-generic-tuxonice linux-headers-generic-tuxonice

Then you can try to do a hibernate test run by:

sudo pm-hibernate

Do not forget to save your work before you do it.

If all went fine, your computer will switch off. After switching it on, you will get your desktop in the state you left in it before hibernation.

share|improve this answer
    
tuxonice works also for me, while Ubuntu 14.04 native hibernation fails for some reason! –  Leszek May 24 at 14:55
add comment

First, I do recommend that you test if your laptop supports hibernation, because the reason why hibernation is disabled by default is because it sometimes has fatal results on some machines. Test your machine by

Ctrl+Alt+T and then sudo pm-hibernate

Your machine should hibernate. Wake your machine up after hibernation and observe if it misbehaves or if it acts normally. If you experience any abnormality after the hibernation, then I advise you don't continue with the following procedure. However, if it works just fine, continue to activate hibernation by

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

Edit the opened file and add this lines:

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

After this, restart your machine, and upon login, you should see a hibernation option on the top right settings corner.

share|improve this answer
    
Why the rollback? –  user25656 Oct 13 '13 at 5:06
    
it was a mistaken rollback –  Kelvinelove Oct 13 '13 at 5:14
add comment

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.

share|improve this answer
    
You mean: ResultActive=yes –  user204762 Oct 28 '13 at 8:47
    
No, this should be ResultActive=no. The answer specifies that this to disable suspend. –  Michael Mior Jun 11 at 18:00
add comment

One more thing:

When you want to add the hibernation option to XFCE's panel, you have to right-click your name (topright) and select properties.

After that a screen pops up:

enter image description here

Make sure, you check Hibernate like I did.

share|improve this answer
add comment

protected by Community Apr 29 '12 at 10:22

Thank you for your interest in this question. Because it has attracted low-quality answers, posting an answer now requires 10 reputation on this site.

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.