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.

2
  • 1
    I can't test this right now, but regarding the lid there is a good answer here Sep 7, 2018 at 8: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. Sep 12, 2018 at 9:46

1 Answer 1

2
+50

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?

1

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .