How to Enable Hibernation in Ubuntu 14.04

Last updated: May 27, 2016

ubuntu hibernate

This simple and brief tutorial is going to show you how to enable the hibernate feature in Ubuntu 14.04 Trusty Tahr.

Hibernate is disabled by default in Ubuntu, when the computer hibernates, all of your applications and documents are stored and the computer completely switches off so it does not use any power, but the applications and documents will still be open when you switch on the computer again.

hibernate ubuntu 14.04

Test if hibernate works in your case:

Before getting started, press Ctrl+ALt+T on your keyboard to open the terminal. When it opens, run:

sudo pm-hibernate

After you computer turns off, switch it back on. Did your open applications re-open? If hibernate doesn’t work, check if your swap partition is at least as large as your available RAM.

Enable Hibernate in System Tray Menu:

The indicator-session was updated to use logind instead of upower. Hibernate is disabled by default in both upower and logind.

To re-enable hibernate, run the commands below one by one to edit the config file:

sudo -i

cd /var/lib/polkit-1/localauthority/50-local.d/

gedit com.ubuntu.enable-hibernate.pkla

Tips: if the config file does not work for you, try another one by changing /var/lib to /etc in the code.

Copy and paste below lines into the file and save it.

[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

enable hibernate ubuntu 14.04

Restart your computer and done.

Hibernate your laptop when lid is closed:

1.Edit “/etc/systemd/logind.conf” via command:

sudo gedit /etc/systemd/logind.conf

2. Change the line #HandleLidSwitch=suspend to HandleLidSwitch=hibernate and save the file.

3. Run command below or just restart your computer to apply changes:

sudo restart systemd-logind

That’s it. Enjoy!

Twitter

I'm a freelance blogger who started using Ubuntu in 2007 and wishes to share my experiences and some useful tips with Ubuntu beginners and lovers. Please comment to remind me outdated tutorial! And, notify me if you find any typo/grammar/language mistakes. English is not my native language. Contact me via [email protected] Buy me a coffee: https://ko-fi.com/ubuntuhandbook1

34 responses to How to Enable Hibernation in Ubuntu 14.04

  1. Hello

    Thanks for the solution, but it is possible that Option: Energy/when lid is closed/hibernate ??
    Because it only exist 2 options ::: Energy/when lid is closed/suspend or Energy/when lid is closed/ignore (or something like that)

    Do you know how can it available that options?

    PS:Sorry my English isnt good

  2. Or you simply modify existing file /var/lib/polkit-1/localauthority/10-vendor.d/com.ubuntu.desktop.pkla ;)

  3. How can I enable login screen when I resume form hibernation on Ubuntu 14.04 + gnome 3.10 shell.

    Thanks,
    George

  4. Thaanks a lot! It worked perfectly!
    No difficult, easy to understand and to execute.
    No more shutdown!

  5. Thierry’s answer is „da best“.
    The configuration you are talking about already sits in file
    /var/lib/polkit-1/localauthority/10-vendor.d/com.ubuntu.desktop.pkla
    Just open this file and enable hibernation

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

    [Disable hibernate by default in logind]
    Identity=unix-user:*
    Action=org.freedesktop.login1.hibernate
    ResultActive=yes
    ...

  6. On machines with multiple users, you´ll have to add another code to the configuration file:

    [Re-enable hibernate for multiple users by default in logind]
    Identity=unix-user:*
    Action=org.freedesktop.login1.hibernate-multiple-sessions
    ResultActive=yes

  7. Hi!
    In my laptop I can hibernate the system with

    echo disk > /sys/power/state

    but not with pm-hibernate. In this situation, is it still possible to have the hibarnate option on the dropdown menu?
    Cheers!

  8. Hi,

    Thanks for the recipe.

    I would like to leave some traces of the modifications. Do you know how can I add comments in the pkla file?

  9. soham chakraborty September 17, 2014 at 8:11 am

    thanx :-) but this should have been enabled by default in ubuntu

  10. thx a lot.
    now hibernate works fine.
    my computer is connected with the router with a cable. but after waking up from hibernate, my network card (or a module) doesn’t work any more. i can’t get a connection and have to restart, and than all works normal.
    any ideas?

  11. Hi, I followed your fix above and enabled the hibernate in my sys tray. it seems to have messed up my wifi after that. whenever I suspend and then restart my laptop after that, the wifi doesnot work. any suggestions on how to undo the above change or correct the wifi problem. thanks in advance.

  12. This may be a stupid question but…. On my Windows laptop this happens when I close the lid:
    – It first goes to standby mode, so when I open the lid it is ready in a second
    – After a few hours of lid being closed, it started hibernating

    So… with my Ubuntu laptop I tried the above, and it goes to hibernation immediately when I close the lid. Is there a way to make it like I have it on Windows. So it first (after closing the lid) remains on standby for a predefined period, then goes to hibernation if the lid is not opened?

    Thanks

  13. Hello. I have a big problem after runing: sudo pm-hibernate
    Notebook then shut down and before that I saw some error. Now I can only access boot menu. I use Ubuntu 14.04.
    Can you give me some advice?

  14. I ran your final command “sudo restart systemd-logind” to apply changes after editing the /etc/systemd/logind.conf, and I got back a “restart: Unknown job: systemd-logind”.

    I can always restart my computer to apply as you indicate, but any idea what the issue is here?

  15. Hi,

    Hibernate woks good, thanks, but when test second part, about lid, that is ;#HandleLidSwitch=suspend to HandleLidSwitch=hibernate and run sudo restart systemd-logind, I received this message:
    restart: Unknown job: systemd-logind
    And after restart with the restart button this not work, that is, when put down the lid the computer don’t hibernate!
    Help please.

  16. Hi,
    thanx 4 your good advice.
    After applying all changes hibernation worked well in system tray.
    But there’s no option in the GUI energymanager..that’s not too bad, but..
    Closing lid triggers only the present options there.. do nothing or suspend.
    What I’m doing wrong?

  17. Worked on Xubuntu 14.10 January 21, 2015 at 4:15 pm

    “Enable Hibernate in System Tray Menu” worked. “Restart your computer and done.” – a restart wasn’t needed, the hibernate icon appeared instantly.

  18. Been trying to fix this for my mom’s laptop… I went through your entire tutorial and also changed the lidswitch option, but the darn thing won’t hibernate. HIbernating from terminal works great, so the swap and everything is there. I tried changing several of the lines in /etc/systemd/logind.conf to hibernate (power button and lidswitch), but it’s just like the machine ignores the changes, even after double-checking and restarting it twice. The power button still triggers the “old” turn off that was in the line before, and lidswitch still suspends instead of hibernating. What do?

  19. Jhon Castañeda June 1, 2015 at 2:33 am

    worked properly in /var/lib tks very much.

    Regards…

  20. Hi, I wanted to enable Hibernate-to-Disk. I tried following these instructions. Now my Asus K55A Laptop (Ubuntu 14.04.2 LTS Gnome) won’t Resume after Suspend-to-RAM or after Hibernate-to-Disk. Any time I close the laptop lid I am presented with a power button which is lit (on?) a few lights on the laptop front are on, but a blank screen. My only option then is a hard-reboot, and then re-login and restart all the programs I had running. Installing TuxOnIce didn’t help either. Please advise me on how to get back to at least Suspend-to-RAM on Laptop-Lid-Close, and a successful resume from that.

  21. Hi. What if hibernation doesn’t work at all? I mean from terminal “sudo pm-hibernate” nothing happens. Swap partition seem to be ok (2GB with 2GB RAM)

  22. Excellent Explanation… very help full post… i did and it worked…
    thanks… have a nice day…

  23. m using ubuntu 14.04 my swap memory is 12 gb and i have 6 gb ram.
    i ran command

    “sudo pm-hibernate”

    but my system didnt hibernate. help

  24. THANKS! This is nicest solution ever. Here>>> https://help.ubuntu.com/16.04/ubuntu-help/power-hibernate.html <<< is solution which doesn't work. Thanks.

  25. I made the changes, enabled hibernation ok. But when I close the lid, it still suspends even though I have made the last change as well. Any suggestions?

  26. arshad chowdhury May 26, 2016 at 10:33 am

    how to enable hibernate in ubuntu 16.04?

  27. This doesn’t work with 16.04, though this is what’s recommended. Polkit sends the following to my efforts: ** (gedit:4907): WARNING **: Set document metadata failed: Setting attribute metadata::gedit-position not supported
    root@wordsmyth-Aspire-E1-531:/var/lib/polkit-1/localauthority/50-local.d#