Software & AppsOperating SystemLinux

Enabling Hibernation in Kubuntu 20.04

Ubuntu 1

In this article, we will walk you through the steps to enable hibernation in Kubuntu 20.04. Hibernation is a power-saving state designed primarily for laptops. While in hibernation, your computer will save the current state of your system to the hard disk and completely power off, allowing it to save more power compared to sleep mode.

Quick Answer

To enable hibernation in Kubuntu 20.04, you need to install the necessary packages, create a policy kit file, and restart your system. After completing these steps, you will be able to hibernate your system using the "pm-hibernate" command in the terminal.

Prerequisites

Before we start, please ensure that your system has a swap partition or a swap file set up. The hibernation process stores the content of the system’s memory into the swap space, hence it’s a necessary component. If you don’t have one, you will need to create a swap partition or file before hibernation can work properly.

Step 1: Installing Necessary Packages

Firstly, open a terminal and run the following command:

sudo apt install pm-utils uswsusp

This command will install two packages:

  • pm-utils: This is a power management package that provides scripts useful for managing and conserving power.
  • uswsusp: This stands for “userspace software suspend” and it allows your system to be suspended (or hibernated) from userspace.

Step 2: Creating Policy Kit File

Next, we need to create a policy kit file to enable hibernation. Run the following command:

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

This command opens the nano text editor with root permissions to create and edit the file at the specified path.

Copy and paste the following content into the nano editor:

[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

This content re-enables the hibernate option in both upower and logind by setting the ResultActive to yes.

Press Ctrl+O to save the file and Ctrl+X to exit the nano editor.

Step 3: Restart Your System

Finally, restart your system for the changes to take effect. You can do this by clicking on the application launcher, typing “Restart”, and hitting enter.

After the restart, you should be able to hibernate your system using the pm-hibernate command in the terminal.

Conclusion

In this article, we explained how to enable hibernation in Kubuntu 20.04. We installed the necessary packages, created a policy kit file, and restarted the system. Now you should be able to hibernate your system and save power when needed.

Remember, hibernation is a great feature to save power, especially for laptop users, but it does require a swap partition or file. Make sure you have enough swap space available for hibernation to work properly.

If you want to have a hibernation option in the “System Settings” -> “Power Manager” -> “Energy Saving” menu, you may need to install additional packages or modify system files. We hope you found this article helpful, and feel free to leave your comments and questions.

What is the difference between hibernation and sleep mode?

Hibernation is a power-saving state where the current state of your system is saved to the hard disk and the computer completely powers off. Sleep mode, on the other hand, puts your computer into a low-power state where it remains on but uses minimal power.

Why do I need a swap partition or file for hibernation to work?

The hibernation process stores the content of your system’s memory into the swap space. Without a swap partition or file, there is no designated space to save this information, and hibernation will not work properly.

How can I check if I have a swap partition or file set up?

You can check if you have a swap partition by running the command sudo swapon --show. If there is output, it means you have an active swap partition. To check for a swap file, you can run grep swap /etc/fstab. If there is output, it means you have a swap file set up.

Can I enable hibernation on a desktop computer?

Yes, you can enable hibernation on a desktop computer as long as you have a swap partition or file set up. Hibernation is not limited to laptops and can be useful for saving power on any system.

How do I hibernate my system after enabling it?

After enabling hibernation, you can hibernate your system by running the command sudo pm-hibernate in the terminal. This will save the current state of your system and power it off.

Leave a Comment

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