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.
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:
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]
[Re-enable hibernate by default in logind]
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!
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
Or you simply modify existing file /var/lib/polkit-1/localauthority/10-vendor.d/com.ubuntu.desktop.pkla ;)
How can I enable login screen when I resume form hibernation on Ubuntu 14.04 + gnome 3.10 shell.
Thaanks a lot! It worked perfectly!
No difficult, easy to understand and to execute.
No more shutdown!
Thierry’s answer is „da best“.
The configuration you are talking about already sits in file
Just open this file and enable hibernation
[Disable hibernate by default in upower]
[Disable hibernate by default in logind]
Together adjusting for multiple sessions as described in Cruz’s reply below, this worked for me.
Thanks! the origional article’s solution did not work for me, however your’s did.
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]
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?
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?
thanx :-) but this should have been enabled by default in ubuntu
Nope, hibernation feature is enabled by default only in current daily build of Ubuntu 14.10 Utopic.
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.
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.
This is an old bug and it has nothing to do with enabling hibernation feature. You can try the fix from Web Upd8:
I had the same problem as you, additionally from the instructions here I found this one:
gsettings set org.gnome.settings-daemon.plugins.power button-power ‘hibernate’
I am not an expert or I even don’t know if they are related, but now I have WiFi every time I resume my laptop.
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?
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?
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?
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!
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?
There’s already a workaround to auto-hibernate when lid is closed at the end of tutorial.
“Enable Hibernate in System Tray Menu” worked. “Restart your computer and done.” – a restart wasn’t needed, the hibernate icon appeared instantly.
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?
worked properly in /var/lib tks very much.
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.
hi I am getting the same issue….have you found the solution?
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)
Excellent Explanation… very help full post… i did and it worked…
thanks… have a nice day…
m using ubuntu 14.04 my swap memory is 12 gb and i have 6 gb ram.
i ran command
but my system didnt hibernate. help
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.
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?
how to enable hibernate in ubuntu 16.04?
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
Comments are closed.