Ubuntu – how to make linux prefer sudo pm-hibernate over systemctl hibernate as default

hibernatepower-managementsystemd

On installing uswsusp, sudo pm-hibernate works perfectly, but systemctl hibernate does not. How can I make the default hibernate button run the pm-hibernate command?

Best Answer

I faced the same problem on Ubuntu 18.10. You need to edit the hibernation service :

sudo systemctl edit systemd-hibernate.service

then paste this:

[Service]
ExecStart=
ExecStartPre=-/bin/run-parts -v -a pre /usr/lib/systemd/system-sleep
ExecStart=/usr/sbin/s2disk
ExecStartPost=-/bin/run-parts -v --reverse -a post /usr/lib/systemd/system-sleep

Save, then:

sudo systemctl daemon-reload

Run sudo systemctl hibernate it should work now.

Related Question