1. Home
  2. Linux

How to restore “Hibernate” mode on Ubuntu

For a while, the Ubuntu Linux operating system has taken away the user’s ability to set their computer in “Hibernate” mode. There are several reasons for this, like the Hibernate function not always working, or that most people don’t ever use the feature and prefer Suspend. Even though Hibernate mode on Ubuntu is less popular (and less reliable) than Suspend, it’s still useful. One of the best aspects to Hibernate is that it powers the machine off rather than setting it to low-power mode: something that is a massive help for the battery life of laptop computers.

If this introduction has sold you on Hibernate, or maybe you’ve always wondered why the feature has been taken away, we’ve got good news! As it turns out, anyone can re-enable Hibernate mode on Ubuntu Linux with a few tweaks.

Hibernate vs Suspend

Many Ubuntu Linux users assume that “Suspend” and “Hibernate” are the same. They aren’t. The primary differences between Suspend and Hibernate are how they handle power management when your PC “goes to sleep.”

When you click the “Suspend” button on your KDE or Gnome desktop environment, your computer doesn’t sleep. Instead, it goes into low-power mode, and everything is saved to the RAM. While your Ubuntu computer is in this state, it’ll still drain your laptop’s battery, or use power, albeit minimally.

Hibernation, on the other hand, doesn’t use power at all. When your Ubuntu Linux PC is set to Hibernate, the entire state of the computer is saved to the hard drive and put in a frozen state, which uses no power.

Both Suspend and Hibernate have their use cases. For example: if you’re always on your laptop and need it at a moments notice, Suspend is a good choice, as it can resume very fast. On the other hand, if you need to conserve battery-life Hibernate may be better, and so on.

Re-enable Hibernate on Ubuntu

In order to use the Hibernate feature inside of Ubuntu Linux, you must install a package. This package is a collection of scripts, including the Hibernate function.

To get your hands on the Pm-utils package, you’ll need to launch a terminal window. Opening a terminal window can be done by pressing Ctrl + Alt + T, or Ctrl + Shift + T in some cases.

Once the terminal window is open, use the Apt package manager and load up the Pm-utils package.

sudo apt install pm-utils

After the Pm-utils package is set up on your Ubuntu computer, the Hibernate function is useable. If you’d like to test it, go to the terminal and run the command below.

Note: the Hibernate command will not work without sudo or root account access. Don’t try to run it without it, because it won’t work and could cause some problems!

sudo pm-hibernate

Assuming the pm-hibernate command runs successfully, Hibernation is working through the terminal, and you’ll be able to use it that way. If you’re happy with setting your Ubuntu PC into Hibernate mode via the terminal, end the tutorial here. Otherwise, move on to the next section where we cover how to re-add the option to the menu.

Re-adding the Hibernate button in Ubuntu

Hibernation is now enabled on your Ubuntu PC. However, the only way to use it is by invoking the Pm-utils hibernation command through the terminal. For average users, this is not very user-friendly. So, if you plan to use this feature regularly, it’s a great idea to add a “Hibernate” button.

Re-adding the Hibernate button is done by modifying the “com.ubuntu.desktop.pkla” file. To edit this file, you’ll need to gain a root shell and then open it up in Nano.

In the terminal, gain a root shell with sudo -s.

sudo -s

Now that your terminal shell has super-user access open up the “com.ubuntu.desktop.pkla” file in the Nano text editor.

nano -w /var/lib/polkit-1/localauthority/10-vendor.d/com.ubuntu.desktop.pkla

In Nano, press the Ctrl + W button. Pressing this keyboard combination will allow you to search the config file. In the search box, type “Disable hibernate” and press the Enter key to jump to the section of the config file that specifies Hibernation settings for Ubuntu.

Under “Disable hibernate by default in upower” and “Disable hibernate” by default in logind,” look for the line below.

ResultActive=no

And change it so that it looks like:

ResultActive=yes

When you’re done making the changes to the configuration file press the Ctrl + O keyboard combination to save. Then, exit the Nano text editor by pressing Ctrl + X.

Hibernate mode on Ubuntu

The new button is added. If you’re using KDE Plasma 5, XFCE4, Mate or a similar Linux distribution, the “Hibernate” option should appear.

Are you using Ubuntu’s Gnome Shell desktop environment? You’ll need to install the “Hibernate Status Button” extension first. Without this extension, you won’t be able to click the “Hibernate” button in Gnome.

Leave a comment