如何让 linux 更喜欢 sudo pm-hibernate 而不是 systemctl hibernate 作为默认设置?

Sam*_*Sam 5 hibernate power-management systemd

在安装 uswsusp 时, sudo pm-hibernate 工作正常,但 systemctl hibernate 没有。如何让默认的休眠按钮运行 pm-hibernate 命令?

Eli*_*eny 4

我在 Ubuntu 18.10 上遇到了同样的问题。您需要编辑休眠服务:

sudo systemctl edit systemd-hibernate.service
Run Code Online (Sandbox Code Playgroud)

然后粘贴这个:

[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
Run Code Online (Sandbox Code Playgroud)

保存,然后:

sudo systemctl daemon-reload
Run Code Online (Sandbox Code Playgroud)

运行sudo systemctl hibernate它现在应该可以工作了。