Linux Tutorials

How to Enable Hibernate in Ubuntu Linux

hibernate linux

Are you doing multi-tasking on your Linux machine and suddenly there is a power cut? Is your Laptop battery low or have any problem with your PC’s UPS? Then Hibernate is a good option for you! You can save all your work and resume where you left after switching on the computer.

What is Hibernate?

Hibernate is an option that allows you to save your system state immediately to your hard disk, so that when you switch your computer on then all the programs can be restored from the hard disk and you can start working again with the same system state as you had before switching off, without losing any data.

Hibernate saves all of your RAM data on the hard disk and restores back into RAM after you turn on the computer.

In Ubuntu, Hibernate is not enabled by default, so you will have to do it manually. But don’t worry It will not take much time once you fulfill the requirements.

Before we continue there are some important things to know to enable Hibernate.

Why Hibernate is not enabled?

When Hibernate can save work in an emergency then why it’s not enabled by default. Well, Hibernate does not work properly with many hardware configurations in Ubuntu and other Linux distributions. If hibernate does not work properly then this might cause data loss after switching back on from hibernation. So PCs or Laptops capable of enabling hibernate option can enable it manually.

Is my Hardware Capable of Hibernate?

You can simply know if your system works properly with hibernate or not. Simply save all your work (otherwise you’ll lose work if hibernate does not work properly) and Open up Terminal from dash or CTRL+ALT+T.

how to open terminal in linux ubuntu

Type and run the following command in Terminal.

$ sudo pm-hibernate

As you run the command, your computer will switch off. Switchback on and see if all your programs that were running before switching off are still running. If all programs are running then Hibernate is working properly.

There is one more common problem. As I told you above hibernate saves all your RAM data to the swap partition that you configured when you installed Ubuntu. That’s why the swap partition must be more than or equal to RAM. To check your swap partition open ‘System Monitor’.

system monitor to enable hibernate

In the Resources Tab check your RAM and Swap. If swap is more than RAM, you’re good to go, otherwise, if you still need to enable hibernate then run gparted from a live cd and increase Swap space.

linux hibernate option RAM and swap memory

Enable Hibernate in System Menu

The indicator session was updated to use logind instead of upower. Hibernate is disabled by default in both upower and logind.

Run the following commands to enable hibernate.

$ sudo -i
$ cd /var/lib/polkit-1/localauthority/50-local.d/
$ gedit com.ubuntu.enable-hibernate.pkla

Tips: if the config file does not work for you, try another one by changing /var/lib to /etc in the code.

Copy and paste the below lines to the file and save it.

[Re-enable hibernate by default in upower]
[Re-enable hibernate by default in logind]
linux hibernation feature script

Log out or Restart your system and you’ve done. After you log in, you’ll see hibernate option in your system Menu above in the tray.

hibernate in linux ubuntu

Open /etc/default/grub in nano or text editor of your choice and add the resume=UUID right after GRUB_CMDLINE_LINUX_DEFAULT=.

UUID is the UUID of the swap partition.

Find Swap UUID by the following command –

sudo blkid


Derek March 8, 2020 at 8:11 pm

This does not work in Linux Mint 19.

Suraj Meena June 15, 2020 at 9:49 pm

Neither in ubuntu 20[LTS]

Andrea_S August 7, 2020 at 2:17 am

I think you don’t want to edit localauthority in /var, create a new file like

Arm_Channel September 29, 2020 at 8:19 am

This works perfectly on my Xubuntu set up. Thank you. However, the system resets itself every time after I run System Updates. Is there a way to script it so that it won’t reset after running System Update?

Ben June 30, 2021 at 8:58 am

Yeah, doesn’t work for me either on Ubuntu 20.04.2 .. just goes into hibernate and reboots when I bring it back out.

John T. July 13, 2021 at 7:30 pm

Well, it still doesn’t work in Mint 20.2. As Ben reported, it reboots instead of restoring the previous session. Any fresh ideas?

Shawn September 25, 2021 at 2:43 pm

There may be a message that flashes across your screen too fast to read, which says something like “sparse file not allowed”. This means GRUB can’t identify the filesystem hosting the OS that is going to be restored from hibernation, possibly because GRUB has been configured to save the previously selected OS instead of defaulting to a specific OS on each bootup. (you’d think remembering which OS was booted previously would actually *improve* things, but apparently it causes problems. don’t ask me why.) Check /etc/default/grub and make sure GRUB_DEFAULT=”0″ and GRUB_SAVEDEFAULT=”false”. Change the “0” to whatever number is necessary to correctly target the default Linux OS on your computer. (It’s usually 0, but some people get fancy with multi-boot systems.) Then run “sudo update-grub” to apply the changes.

Elwood August 20, 2021 at 3:26 am

On Mint 20.3 your pm-hibernate command doesn’t work (the laptop switches on).
What worked for me was to install the “hibernate” command as explained here :

Sohail October 16, 2021 at 9:28 am

Updated the article.

Josan2 September 17, 2021 at 1:52 pm

It didn’t work for me at first.

But it worked when I added in the /etc/default/grub

resume=UUID=’the UUID of my swap partition’

at the end of the line



sudo update-grub

and it worked!!

Shawn September 25, 2021 at 2:35 pm

I can confirm that Josan2’s additional step is required, and works correctly. You can also use a swapfile, but you need to run “sudo mkswap [name of swapfile]” and take note of the UUID generated for the swapfile by the mkswap program, and insert that into /etc/default/grub as Josan2 describes above.


Leave a Comment

* By using this form you agree with the storage and handling of your data by this website.