3

I am trying to make hibernate work on my Ubuntu 18.04.

I followed all the tutorials around (mostly from the answers here: How can I hibernate on Ubuntu 16.04?)

So far, executing pm-hibernate on the shell works well and systemctl hibernate does not.

I am able to recover correctly from pm-hibernate, with the only problem that the screen is not locked, and I am logged in directly afterwards. I was able to fix that with adding an alias that manually locks, and executes pm-hibernate afterwards (How do I lock the screen after resuming from hibernation?)

However systemctl hibernate does not work and if if come back after executing it on the command line, is the same as I have done a force power off.

In the power settings menu, I have selected 'hibernate', but it seems that this executes the same thing as systemctl hibernate, because after I press the power off button it is the same as if I have powered off.

I have tried adding a resume parameter in the grub configuration

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

where /dev/nvme0n1p2 is my swap partition, but without any help.

So now my idea is to make the power off button execute my hibernate alias that locks and executes pm-hibernate? Also possibly on lid close?

At the moment I have to write hibernate in the terminal to go to hibernation.

  • 1
    I can't test this right now, but regarding the lid there is a good answer here – Robert Riedl Sep 07 '18 at 08:42
  • Yes, it's kinda possible with couple cheap tricks. I once wanted to write a script for that, but never got around to doing so. Maybe I can write it in time for this bounty but probably there won't be enough time. – Sergiy Kolodyazhnyy Sep 12 '18 at 09:46

1 Answers1

2

You can edit this file /etc/acpi/events/powerbtn. action can be assigned to <your hibernate script>. Do let me know if this works out?

  • It does work, but it randomly when I come back from suspend it goes back again. Will try more. I was following the acpid manpage example: http://manpages.ubuntu.com/manpages/bionic/man8/acpid.8.html – Martin Taleski Sep 07 '18 at 12:52