Software & AppsOperating SystemLinux

How To Enable Hibernate Entry in Menu on Ubuntu 22.04

Ubuntu 18

In this article, we will provide a step-by-step guide on how to enable the Hibernate entry in the menu on Ubuntu 22.04. This feature can be useful for users who want to save their work and power down their computer, without closing all their open applications.

Quick Answer

To enable the Hibernate entry in the menu on Ubuntu 22.04, you need to edit the policy file located at /etc/polkit-1/localauthority/50-local.d/com.ubuntu.enable-hibernate.pkla and add specific lines to it. Additionally, you will need to install the Hibernate button extension from the GNOME Extensions website.

Prerequisites

Before we begin, you need to check if hibernate works on your system. Open a terminal by pressing Ctrl + Alt + T and execute the following command:

systemctl hibernate

If your system hibernates and wakes up correctly, you can proceed to the next step. If not, you’ll need to define your swap partition or file. You can refer to the Ubuntu handbook for instructions on how to do this.

Editing the Policy File

The first step to enable the Hibernate entry is to edit the policy file. This file is located at /etc/polkit-1/localauthority/50-local.d/com.ubuntu.enable-hibernate.pkla.

To edit this file, you can use a text editor with root privileges. For example, you can use gedit, a graphical text editor. Open a terminal and execute the following command:

sudo gedit /etc/polkit-1/localauthority/50-local.d/com.ubuntu.enable-hibernate.pkla

The sudo command is used to run the following command with root privileges. gedit is the text editor, and the path after it is the file you want to edit.

Once the file is open, add the following lines to 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

The Identity field specifies the users this policy applies to. In this case, it’s all users (unix-user:*). The Action field specifies the actions this policy applies to. The ResultActive field specifies the result of the action when the subject is active. In this case, it’s set to yes, which means the action is allowed.

After adding these lines, save the file and exit the text editor.

Installing the Hibernate Button Extension

The final step is to install the Hibernate button extension. This extension adds a Hibernate button to the system menu. You can install it from the GNOME Extensions website.

To install the extension, visit the Hibernate Status Button Extension page and click on the “ON” switch next to the extension name.

After installing the extension, you should see the Hibernate entry in the system menu.

Conclusion

With these steps, you should be able to enable the Hibernate entry in the menu on Ubuntu 22.04. If you encounter any issues, make sure to check your swap configuration and follow the instructions provided in this article. Remember, enabling hibernate can be a great way to save your work and power down your computer without losing your progress.

How do I check if hibernate works on my Ubuntu 22.04 system?

To check if hibernate works on your system, open a terminal and execute the command systemctl hibernate. If your system hibernates and wakes up correctly, hibernate is working. If not, you’ll need to define your swap partition or file. Refer to the Ubuntu handbook for instructions on how to do this.

How do I edit the policy file to enable the Hibernate entry?

To edit the policy file, open a terminal and execute the command sudo gedit /etc/polkit-1/localauthority/50-local.d/com.ubuntu.enable-hibernate.pkla. This will open the file in the gedit text editor with root privileges. Add the provided lines to the file, save it, and exit the text editor.

How do I install the Hibernate button extension?

To install the Hibernate button extension, visit the Hibernate Status Button Extension page and click on the "ON" switch next to the extension name. This will install the extension, and you should see the Hibernate entry in the system menu afterwards.

Leave a Comment

Your email address will not be published. Required fields are marked *