How to activate hibernation in 16.04.1 ? (systemd)

Solution 1:

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).

Solution 2:

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