How should I successfully hibernate Ubuntu 16.04?

I've tried almost every solution on the web but non of them was actually helpful. I found my problem almost completely similar to this one

  • 2
    Possible duplicate of How to enable hibernation? – DJCrashdummy Jul 31 '16 at 16:20
  • Does sudo pm-hibernate work? – Pilot6 Aug 1 '16 at 9:01
  • 2
    hasn't the situation changed with systemd? now we are meant to use systemctl hibernate so perhaps not a dupe... or at least updated answer may be required to make the old question valid to dupe – Zanna Aug 1 '16 at 21:03
  • What kernel version are you running? Type uname -r in the terminal (apologies if you already knew this). – WinEunuuchs2Unix Sep 2 '16 at 1:47
  • please edit your question and add the output of free so we can determine if you have enough swap setup to successfully hibernate. – Elder Geek Sep 4 '16 at 18:15

You can use

sudo pm-hibernate 

to check if hibernate works on your system (this will hibernate your computer).

If it does not work , check if your swap size is at least as large as your RAM.

To add the option to the settings menu, you can create a configuration file. Open a terminal window and run this command:

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

It opens nano with an empty file. Copy the lines below and paste them into the nano window.

[Re-enable hibernate by default in upower]

[Re-enable hibernate by default in logind]

Then save the changes and close nano and reboot the system to make Hibernate available appear on "Power options".

Reference: How do I hibernate my computer? in the official documentation for Ubuntu 16.04.

Hope it works. This worked for me after trying all other options.

  • We need a reboot after editing the file to make Hibernate available appear on "Power options". – Jus12 Jan 15 '17 at 7:30
  • 12
    'sudo pm-hibernate' killed my system immediately without warning. You should tell people that's what's going to happen. – Yair Daon Jun 9 '17 at 1:27
  • best answer . This also working on 17.4 and 17.10 as well . – Saurabh Bhandari Sep 23 '17 at 11:40
  • This answer combined with the one telling to add "resume=" to the GRUB_CMDLINE_LINUX_DEFAULT did solve it for me - thx! – Christoph Nov 3 '17 at 15:21
  • I have 17GB in my swap partition and 16GB of RAM, why is it not working? It seems to be hibernating because it takes forever to turn off the computer whereas if I do "shutdown" it turns off almost immediately. But when I turn my computer back on, everything's closed and I have to start over again. That's not hibernating at all. Why can't it be as simple as in Windows? I'd like some help if anyone has ideas about how I can get it to properly hibernate. – user1271772 Apr 3 at 6:38

Hibernation using systemctl and getting it working in tough cases

For me, pm-hibernate always fails. After some tweaks, I was able to hibernate using the interface of systemd (init system in 16.04 and above). I also managed to get it working on 17.04 with a swap file. This case study may be useful for others with problems.

First try:

sudo systemctl hibernate

If that fails, begin troubleshooting: in the hibernate state (HTD or ACPI S4) the machine state is written to disk so that no power is needed to preserve it. The state is written either to a swap partition or to a swap file. Note: if using BTRFS DO NOT attempt to use a swap file as this may cause filesystem corruption

Your swap partition or swap file may need to be the same size as RAM to allow hibernation, but there is a good chance you will be able to hibernate if it is at least 2/5 the size of RAM, according to the Arch wiki page, so try other steps first before increasing swap size.

If your problem is that you get a clean boot instead of the expected resume, at a minimum you most likely need to set a boot parameter to find the disk image

Find your swap partition:

grep swap /etc/fstab

for me this returns (partial output)

# swap was on /dev/mmcblk0p3 during installation

where /dev/mmcblk0p3 is the partition to specify

Add a boot parameter:

sudoedit /etc/default/grub

To the line starting GRUB_CMDLINE_LINUX_DEFAULT add resume=/dev/YourSwapPartition to the section in quotes (replace with the the partition you identified earlier). Using my example:

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash resume=/dev/mmcblk0p3" 

Any time you change this file, you must run sudo update-grub or the changes will have no effect.

Now you need to reboot. Then you can try to hibernate, by issuing the command:

sudo systemctl hibernate

To resume, press the power button and the system will boot.

If you still have problems, start debugging.

I include my case below as an example, but detailed information on debugging S states can be found in this blog and also this one.

Set some more boot parameters to capture more information. Remove quiet and splash and add initcall_debug and no_console_suspend which will cause init system calls to be printed to the console so you can watch what is going wrong. I set this:

GRUB_CMDLINE_LINUX_DEFAULT="resume=/dev/mmcblk0p3 no_console_suspend initcall_debug"

Which helped me see what was going wrong on resume from hibernation.

In my case, after resume I lost WiFi, and the kernel clearly was upset as most commands (for example reading anything from /sys, reloading modules or any systemctl command) would not work - the process would appear to start and just hang (all this would be returned to normal after reboot of course). Watching the system very slowly shut down and reading all the debug messages, I noticed that there were a lot of problems with "brcm", so I guessed my Broadcom wireless driver module was to blame. Sure enough I adjusted my hibernation procedure to unload the module first:

sudo modprobe -r brcmfmac
sudo systemctl hibernate

on resume I reinsert the module

sudo modprobe brcmfmac

And everything worked perfectly. I also have to blacklist the btsdio module which seems to be incompatible with brcmfmac

Update: Hibernation using a swap file on 17.04.

Once again with help from the Arch wiki page and some additional tinkering, I managed to get hibernation to work on 17.04 with a swap file. This required an additional boot parameter, resume_offset=n where n is the first number under physical_offset in the output of sudo filefrag -v /swapfile:

$ sudo filefrag -v /swapfile
Filesystem type is: ef53
File size of /swapfile is 1425873920 (348114 blocks of 4096 bytes)
 ext:     logical_offset:        physical_offset: length:   expected: flags:
   0:        0..   32767:      34816..     67583:  32768:            
   1:    32768..   63487:      67584..     98303:  30720:            

Therefore, the additional boot parameter in my case is resume_offset=34816. You still need to set a boot parameter for the partition to resume from. This will be the root partition (or whatever partition your swap file is located on) My parameters are now:

GRUB_CMDLINE_LINUX_DEFAULT="no_console_suspend initcall_debug resume=/dev/mmcblk1p2 resume_offset=34816"

Where /dev/mmcblk1p2 is my root partition (yours is more likely to be something like /dev/sda2).

During resume I saw the image loading successfully, but in my case (just an example - YMMVAPD) then some more drivers (i2c_designware) threw some errors and I got a complete system freeze on resume. Hibernation works if I unload those modules in addition to brcmfmac, but the system quickly becomes unusable without those modules. I therefore made a sort of script to unload the buggy modules and immediately reinsert them on resume:

# remove buggy modules
modprobe -r brcmfmac i2c_designware_platform i2c_designware_core &&
# hibernate
echo disk > /sys/power/state
# reinsert
modprobe i2c_designware_core i2c_designware_platform brcmfmac

When I want to hibernate, I run sudo bash script. This works great.


Use systemd, set a boot parameter for resume from swap, identify buggy drivers and unload them before initiating hibernation. If the system can't work for long without those modules or you need to unload several, it may be easier to use a simple script to initiate hibernation.

  • Where is that information from, that 2/5 of the RAM size might be enough, and under which circumstances? I have a user option in Gnome, "Hibernate" and it does seem to hibernate, but on waking up, it doesn't work properly. I have a swap partition of 8GB and 32GB RAM. That's not 2/5, but before creating a 32GB swap file (or partition) it'd be nice to know. – cslotty Dec 13 '16 at 15:11
  • @cslotty I got that information from the Arch wiki IIRC - let me know if you do manage it please – Zanna Dec 13 '16 at 15:52
  • Thanks, @Zanna. I found out that it's actually not hibernate, what I want, but suspend (S3/STR) - sry. – cslotty Dec 13 '16 at 16:36
  • @cslotty no worries at all. In that case, swap is not your problem as it's not related. – Zanna Dec 13 '16 at 16:53
  • 1
    Thanks, I needed a synthesis of this answer as well as the tip on disabling SecureBoot to make it work in the end. – oligofren Dec 18 '17 at 12:55
up vote 17 down vote

I think, how to enable hibernate for 16.04 answer is known to all as described in the Ubuntu Wiki (See below if you need the steps). But The things that need checking isn't thorough I think. At least, that's what I found.

Things to check

From my own tests, I've at least found one extra check that you should perform. I haven't found about it anywhere in the Internet.

Here are some checkings -

  1. Check that you're not using any btrfs partitions. Yes. From my test, I found that if you have btrfs partitions, hibernate will not work. Removing or changing the partition type to ext4 didn't help me. I needed to remove the btrfs-tools package.

    sudo apt-get purge btrfs-tools

    You might want to check other new partition types which are not well tested. Without removing package, blacklisting the driver might also work, but I haven't tested that.

  2. Also you need to check that you have a swap partition large enough to hold the content of RAM. If your RAM is 4 GB, swap should be at least 4 GB large ( You should allocate few more MB to be safe).

Steps to enable hibernate

It involves these steps

  1. Create a file as root in /etc/polkit-1/localauthority/50-local.d/enable-hibernate.pkla

    sudo -i nano /etc/polkit-1/localauthority/50-local.d/enable-hibernate.pkla
  2. Put these contents on that file

    [Re-enable hibernate by default in upower]
    [Re-enable hibernate by default in logind]
  3. Save the file by pressing Ctrl-O. Exit with Ctrl-X

  4. Restart the polkitd daemon

    sudo systemctl restart polkitd.service

It should enable hibernate.

  • 1
    Thanks, Anwar. I filed bug #1619846 and referred you your answer above. Any chance you could propose more exact changes/additions to that page in the official documentation? – Gunnar Hjalmarsson Sep 3 '16 at 4:57
  • @GunnarHjalmarsson I'd propose this caveat. But, I'll need more testers verifying this. Will let you know later – Anwar Sep 3 '16 at 5:54
  • Ok, let's talk more then. – Gunnar Hjalmarsson Sep 3 '16 at 6:00
  • I installed on a btrfs partition and purged btrfs-tools according to your instructions. Still can't hibernate. – Oxwivi Sep 4 '16 at 9:04
  • 1
    On disk there's only vfat for UEFI, and btrfs and swap. I'm actually suspecting it's due to the hardware (AMD laptop). I'm going to test this on another system with btrfs and get back at you. – Oxwivi Sep 4 '16 at 11:03

Secure Boot

(I asked a similar question asking for a focus on systemd-based replies, sharing my solution here for people following this question)

This solution comes from Fedora topics (they made the switch to systemd a while ago so there's more material there).

In my case (fresh 16.04.1 install on a machine that always supported hibernation), calling the obsolete sudo pm-hibernate did not seem to do anything, and the up to date systemd approach, systemctl hibernate, would return:

Failed to hibernate system via logind: Sleep verb not supported

It turns out that secure boot was the culprit: installing 16.04 you are asked what you want to do with it (which is a new thing as far as I can recall) and I kept it ON without giving it much thought.

On my machine with secure boot ON, cat /sys/power/disk answered:


After reboot and disabling secure boot in the BIOS settings (these are machine-specific, but usually pretty straightforward) I tried a cat /sys/power/disk and got:

 [platform] shutdown reboot suspend 

which looks better. And indeed calling systemctl hibernate results in a successful hibernate/thaw sequence.

Moreover, after that I could see hibernation available as an option in various places of the graphical interface, without the need of any polkit hack. So it seems that systemd was actually guessing from /sys/power/disk that the system was not able to hibernate.

  • I did exactly what you have explained here. But after I execute "systemctl hibernate" command the screen got black for 3 seconds then the desktop went back with all my opened programs just like before I executed the command. When I executed the command "cat /sys/power/disk"... it shown me this text: "[platform] shutdown reboot suspend test_resume" which it's similar to the result when you executed the same from your side but the last text: "test_resume". Do you have an idea what I could try to solve my problem ? – foxhard May 6 at 16:58
  • Not too sure, looks like hibernation does not work out of the box on your hardware, which is why it is disabled by default as others pointed out. You might want to start a separate question about your specific issue. – Marc May 14 at 9:04
  • Only half-working for me. Hibernates but instead of waking up from hibernation, goes to normal boot, then gets stuck forever until a hard physical shutdown. – matt Jul 1 at 20:11

First, I do recommend that you test if your machine supports hibernation, because the reason why hibernation is disabled by default is because it sometimes has unpleasant results on some machines. Test your machine by opening the terminal (Ctrl+Alt+T) and then typing sudo pm-hibernate

Your machine should hibernate. Wake your machine up after hibernation and observe if it misbehaves or if it acts normally. If you experience any abnormality after the hibernation, then I advise you don't continue with the following procedure. However, if it works just fine, continue to activate hibernation by doing this:

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

Edit the opened file and add this lines:

[Re-enable hibernation]

After this, restart your machine, and after logging in, you should see a hibernation option added on the power menu, on the top right settings corner.

  • I have thinkpad -E550 and it has no problem with hibernation when my OS is ubuntu 15.1 or windows8.1 . but using ubuntu 16.04 , when i use the command "sudo pm-hibernate" , it does not completely hibernate and just the screen goes black and the machine is still on. – Mahyar May 6 '16 at 18:14
  • In my case, the command does nothing at all. The terminal goes to the newline and awaits next command i.e. previous command has been executed. But it does nothing at all – Aalok Jul 17 '16 at 18:01
  • This doesn't work for me. Ubuntu 16.04. The Hibernate option do not come up and stay disable in Settings -> Power, anything else? – Daniele Segato Aug 7 '16 at 17:02
  • Editing the already existing policy is better: – fgblomqvist Aug 24 '16 at 1:41
  • Incomplete contents in com.ubuntu.enable-hibernate.pkla. See answer posted by NirajW. – Gunnar Hjalmarsson Sep 2 '16 at 6:31

Expanding on my own comment to kelvinelove's answer, the file he suggests editing did not exist on my system (fresh Ubuntu 16.04). Instead, I did this:

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

  2. Look for these sections (they are right by each other):

    [Disable hibernate by default in upower] Identity=unix-user:* Action=org.freedesktop.upower.hibernate ResultActive=no

    [Disable hibernate by default in logind] Identity=unix-user:* Action=org.freedesktop.login1.hibernate;org.freedesktop.login1.handle-hibernate-key; ResultActive=no

  3. Change ResultActive=no to ResultActive=yes for both of them.

  4. Press Ctrl + O to save the file.
  5. Reboot your computer
  6. The Hibernate option is now available in your power menus.

EDIT: Gunnar pointed out that this file gets overwritten if a certain package gets updated, so depending on your intentions it is most likely not the best solution.


  • The file in /etc is not supposed to exists by default. It's a configuration file which you create. Editing a package owned file, as you suggest above, is bad advice, since it will be overwritten at next package update. – Gunnar Hjalmarsson Sep 2 '16 at 6:11
  • @GunnarHjalmarsson If that's the case I would argue that it should be stated that it might not exist. I expect more from a top rated Ask Ubuntu answer than a "copy/paste this command"->"type this" -style answer that lacks any kind of verification of whether you are doing the right thing (other than checking if it worked). What if someone finds that answer in a couple of years, but is afraid of trying it since the file is empty, and the instructions clearly state to add to the file, implying that it exists? Nonetheless, I appreciate the information, will add it to the answer for completion. – fgblomqvist Sep 3 '16 at 1:05
  • 1
    Fair point; I edited NirajW's answer with that clarification. It should be noted that the original source of info at this page talks about creation. – Gunnar Hjalmarsson Sep 3 '16 at 5:16

There are some very good resources here to help you sort out some of the more common hibernate issues under Ubuntu.

In my case, running Ubuntu 16.10 on a Lenovo u300s, in order for hibernate to work correctly I had to do the following:

  • Create an appropriately-sized swap file (I typically set for ~1x in size, but I've heard up to 1.6x and 2x)
  • Edit /etc/default/grub to include the following line:

    GRUB_CMDLINE_LINUX_DEFAULT="splash quiet pci=nomsi RESUME=UUID=92781adb-f2a6-4f15-88fc-e1ce801291dd"

The RESUME refers to your specific swap file UUID. In particular, on my machine setting pci=nomsi was the key.

Best of luck!

For me, it works to install hibernate package, reboot and then run sudo hibernate-disk. I am sure it is possible to add it to menu, but is not worth the time for me.

You have to manually enable it with a little effort. It's been disabled by default.

Then, if it doesn't work, it's might be a 4.4.0 kernel issue, and you might have to upgrade kernel.

  • 1
    The answer referes to 14.04, while the question is about 16.04. – Gunnar Hjalmarsson Sep 2 '16 at 6:08

protected by Community Jan 3 '17 at 12:34

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.