The hibernate functionality is disabled in Ubuntu by default because it might not work on some machines. For those who want to re-enable the feature, here’s how to do it in Ubuntu 17.10.
1. Test if hibernate works on your machine.
Open terminal either via Ctrl+Alt+T keyboard shortcut or by searching ‘terminal’ from application launcher. When it opens, run command:
sudo apt install pm-utils && 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.
2. To re-enable hibernate, run the command to edit the configuration file:
sudo nano /var/lib/polkit-1/localauthority/10-vendor.d/com.ubuntu.desktop.pkla
When the file opens in the terminal window, scroll down to find out the section started as:
“[Disable hibernate by default in upower]” and “[Disable hibernate by default in logind]”
Change the both values of ResultActive to yes.
Save the changes by pressing Ctrl+X and then typing y and finally hitting Enter.
To make Hibernate working for multiple users, you can add following lines into 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
And for some machines you may replace the command in step 2, in case it doesn’t work, with following one:
sudo nano /etc/polkit-1/localauthority/10-vendor.d/com.ubuntu.desktop.pkla
Press power button to hibernate:
After enabled the hibernate functionality, you can launch Settings from application tool. In the ‘Power’ settings, you are able to set ‘Hibernate’ when the power button is pressed.
Hibernate when laptop lid is closed:
You can also make your laptop automatically hibernate when the lid is closed.
To do so, open terminal (Ctrl+Alt+T) and run command to edit the logind.conf file:
xhost +local: && sudo gedit /etc/systemd/logind.conf
When it opens, change the line
#HandleLidSwitch=suspend into HandleLidSwitch=hibernate.
Tip, you can replace the value of HandleLidSwitch to
ignore for other lid closed actions.
To apply all the changes, restart your computer.
The swap partition is larger than available RAM, but s2disk does not recognize it. The swap partition is recognized by swapon -s, though.
Asweome. I was running s2disk and then recognized, that uswsusp was not installed.
After installing it hibernation works pretty smooth. Just have to check how to enable login again, because right now the system restores the session without asking for credentials.
Thanks a lot!
PS: I use Ubuntu 18.04.
It is helpful. Thanks. I’m also using Lubuntu 18.04 by the way.
Thanks works Perfectly
Like a charm. Only missing how to add hibernate option into the shutdown gnome button. Currently only options Cancel, Restart and Power Off are present.
Thank you for the clear and concise instructions. I was having issues with an encrypted partition but after a reinstall this installed perfectly
How to hibernate automatically when battery is over?
Thank you. it worked for me more than 2 months. But from yesterday, it doesn’t work. I looked at the steps above and everything is set up properly. Could you help with this?
I have tried this and several other guides to enable hibernation on my Lenovo ThinkPad L570 running Ubuntu 17.10 (and being certified for Ubuntu). But nothing works so far. (The swapfile is bigger than my RAM.)
Comments are closed.