This quick tutorial is going to show you how to enable hibernate option in the top-right corner power menu in Ubuntu 18.04. So you’ll get a similar menu as the picture shows:
Test if hibernate works
First of first, you have to make sure hibernate works in command line.
1. Open terminal via Ctrl+Alt+T or by searching for ‘terminal’ from app launcher. When it opens, run command:
sudo systemctl hibernate
Please SAVE all of your work before hitting enter, in case something goes wrong and your open applications and documents cannot be recovered.
2. After you computer turns off, switch it back on. Did your open applications re-open?
If hibernate doesn’t work, take a look at this question on askubuntu.
UPDATE: Hibernate does not work out-of-the-box since Ubuntu 20.04, at least in my case, you have to enable it by adding Kernel parameter in boot menu. See this tutorial for Ubuntu 20.04 & higher.
Enable Hibernate in Menus
If hibernate works in command line, continue enable it in the menus via following steps.
1. Open terminal (Ctrl+Alt+T) and run command to create a configuration file:
sudo gedit /etc/polkit-1/localauthority/50-local.d/com.ubuntu.enable-hibernate.pkla
When the file opens, paste following content 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;org.freedesktop.login1.handle-hibernate-key;org.freedesktop.login1;org.freedesktop.login1.hibernate-multiple-sessions;org.freedesktop.login1.hibernate-ignore-inhibit ResultActive=yes
2. Restart your computer and click the link to install the gnome extension: Hibernate Status Button.
For those who never installed a gnome extension, see this how to tutorial for details.
Great job Ji m, you are the only one I found telling to install this gnome extension ;-)
hibernate was enabled in 17.10 using this procedure but stopped working after upgrade to 18.04. fixed by adding resume=UUID={uuid of swap partition: see /etc/fstab} kernel param
How did you exactly do that? Can you please post your code?
I was able to run `sudo systemctl hibernate`, but everything were closed after turning on it. Any idea? My laptop is Levono ideapad 320
You probably have to edit your grub configuration.
Its about this line: GRUB_CMDLINE_LINUX_DEFAULT=”quiet splash resume=/dev/mmcblk0p3″ . For details see this post: https://askubuntu.com/questions/768136/how-can-i-hibernate-on-ubuntu-16-04
it does like hibernate/restart on my laptop
computer turns off but turns on again automatically (my software’s doesn’t close and they are open)
my laptop is lenovo z500
I also had to edit /etc/default/grub adding a resume=UUID parameter like this:
GRUB_CMDLINE_LINUX_DEFAULT=”quiet splash resume=UUID=XXX-XXX-XXX-XXX-XXX
where XXX-XXX-XXX-XXX-XXX is my system swap UUID. Then do an update-grub.
Works like a charm when using the grub modification. Thanks for the hint!
(minor: You forgot the trailing ” though :-).
This seems to do the trick for me. Using an ASUS Zenbook UX430 with 8GB RAM and Intel i7.
Didn’t work for me in 18.04 for some reason. My swap file is located in `/swapfile`, there were a couple other partitions on my laptop (I use dual boot w/ Win10). I’ve tried all of them one by one in the `resume=UUID=…` line but to no avail. The hibernation command just turned off the PC and that was it.
Same here, to my surprise (ubuntu 18.04 dual w/ Win10).
Hibernate seemed to be doing some swapping work, but after restart the /swapfile “swapon –show”ed 0 used.
Did you get it to work?
GRUB_CMDLINE_LINUX_DEFAULT=”quiet splash resume=UUID=XXX-XXX-XXX-XXX-XXX”
followed by “sudo update-grub” worked like a charm.
Hint: “sudo blkid” can be used to get swap UUID
The short solution for me was to press ALT when the shutdown window was open and a pause button appears which puts the machine into hibernate. But
sudo systemctl hibernate
was not working.Pressing ALT and then clicking on the pause button just suspends, not hibernate, the system.
Unfortunately, this did NOT work for me :-(
It showed “hibernate” and “hybrid-sleep” but it did not work. None of my open application is re-open. Worse, my chrome browser did not even close properly, reporting “crashing”
How wen we enable HIbernate button on Gnome login screen?
I can confirm that this solution is also working for Ubuntu 18.10 with these additions
1) First find UUID of swap partition by running “sudo blkid”
2) Modify one line in /etc/default/grub to
GRUB_CMDLINE_LINUX_DEFAULT=”quiet splash resume=UUID=”
3) Run “sudo update-grub”
4) “sudo systemctl hibernate” will now work perfectly and hibernate button can be added by following steps in these tutorial