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.
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.