49

I have a fresh install of 16.04.1 on a Lenovo T450s that always worked fine with respect to suspend/hibernate on Ubuntu (previous version I used was 14.04.5). Swap is comfortably bigger than RAM on this install.

As I am used to now, after the install I tried to go on with the usual hack for hibernation activation. However, things seem to be different this time as sudo pm-hibernate does not seem to do anything.

As far as I understand, now that ubuntu has switched to systemd, the correct command would be systemctl hibernate which returns

 Failed to hibernate system via logind: Sleep verb not supported

I tried the solutions mentioned here, but they are mostly aimed at re-enabling pm-hibernate and making it an entry in the logout menu. I also saw that one possible solution is to install the Tuxonice kernel, but did not try as I am not very keen on tampering with the kernel in general and using a PPA kernel in particular.

So, is there a way to reactivate hibernation on the last, systemd-based versions of Ubuntu? Preferably using systemd, and avoiding potentially system-breaking hacks. Or do I just have to wait and hope until the next update?

4
  • 1
    Yes, I tried. The thing is it is not that hibernation fails, say the system hangs while shutting down or fails to thaw. It is just that nothing happens when I fire systemctl hibernate (with or without sudo), except this message Failed to hibernate system via logind: Sleep verb not supported.
    – Marc
    Jan 6, 2017 at 23:24
  • Swap is up and working well, no problem there. I tried the grub thing anyways just to be sure. No luck.
    – Marc
    Jan 8, 2017 at 8:55
  • FWIW, sudo pm-hibernate still works on 16.04... usually. From your answer below, It seems that hibernating doesn't really work with Secure Boot, but if it did, pm-hibernate would definitely work as expected. Of course, you could also use the systemctl command as well. Sep 17, 2017 at 5:13
  • Shame the message did not read: Failed to hibernate system via logind: Please use BIOS to disable secure boot
    – Bad Loser
    Nov 5, 2019 at 21:22

2 Answers 2

55

I was finally able to solve my own problem following some topics on Fedora (they made the switch to systemd a while ago so there's more material there).

It turns out that I had secure boot enabled (I recall being asked about that during 16.04 install, and that I kept it on without giving it much thought) and that caused the output of cat /sys/power/disk to be:

 [disabled]

Indeed not a very good sign. So I rebooted and went searching in my BIOS settings, disabled secure boot there. Now cat /sys/power/disk gets me:

 [platform] shutdown reboot suspend 

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

Moreover, the option to hibernate now shows up in the graphical interface without the need for any hack (at least on my computer).

9
  • 1
    Thanks man. You saved my day. I really thank you. Thank you thank you.
    – Khamidulla
    Feb 27, 2017 at 1:39
  • 4
    This should be added in the Ubuntu documentation here: help.ubuntu.com/stable/ubuntu-help/power-hibernate.html May 12, 2017 at 15:18
  • Thanks. It worked for me as well with Ubuntu 16.04 on asus zenbook apart that menu option for hibernating in graphical interface still is missing.
    – Wojteks
    Jun 6, 2017 at 6:37
  • Just FYI, if your disk setting is not the reason or the answer doesn't fix your error, try enabling your swap space and make sure it is reasonably sized over your total installed physical RAM. That did it for me! Aug 15, 2017 at 5:20
  • 1
    this answer to similar question explains in details why hibernate does not work with secure boot: it is intentionally disabled as there's currently no way to verify resume image saved in swap (so enabling it would give a false impression of security)
    – morgwai
    Apr 23, 2020 at 9:01
22

This can also happen when your swap is too small to hold your RAM contents (e.g. when you added more RAM to your computer after setting up the OS).

Check e.g. in htop, then Mem number should be <= the Swp number.

See https://github.com/systemd/systemd/issues/6729

3
  • 1
    Thanks for your suggestion, but this was not the problem in my case. It was discussed in the comments. I will update the main text to make it even clearer. By the way, I do not understand why this is always the first thing people suggest regarding fixing hibernation, while the standard ubuntu install will usually come out with the right amount of swap, unless you voluntarily tampered with it.
    – Marc
    Sep 17, 2017 at 4:24
  • 1
    @Marc Like I said in the answer: Even if the Ubuntu install picks the right amount of swap at the time of the installation, it is very common for people to just buy another RAM stick and plug it into the computer after the installation (e.g. upgrade from 8 GB to 16 GB RAM a year after you bought and installed the machine).
    – nh2
    Sep 17, 2017 at 14:08
  • 1
    that was my case! I increased the size of the swap file(my ubuntu uses a swapfile instead of a swap partition) using this procedure: bogdancornianu.com/change-swap-size-in-ubuntu Apr 1, 2020 at 23:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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