在 Ubuntu 18.04 中将 pm-hibernate 设置为默认值

lf_*_*ujo 5 hibernate power-management 18.04

在 SO ( 1 , 2 )的问题的帮助下,我设法找到了一种使计算机休眠的方法。唯一有效的方法是使用uswsusp,它可以pm-hibernate工作,但现在即使在创建睡眠模块之后我也只能通过命令行休眠我的机器:

sudo cat /etc/pm/config.d/00sleep_module SLEEP_MODULE=uswsusp

如何设置pm-hibernate默认方法?这样,当我按菜单中的休眠选项或关闭盖子时,pm-hibernate会使用而不是 systemctl 吗?

小智 2

基于这篇文章的想法,我成功地使用 plain 获得了我的 systemctl-hibernate 服务pm-hibernate

我目前使用的是 Ubuntu 18.10。

将 systemd-hibernate.service 文件 ( ) 的内容更改systemctl edit systemd-hibernate.service为:

[Unit]
Description=Hibernate
Documentation=man:systemd-suspend.service(8)
DefaultDependencies=no
    
[Service]
Type=oneshot
ExecStart=/usr/sbin/pm-hibernate
Run Code Online (Sandbox Code Playgroud)

重新加载守护进程

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

并努力去做

systemctl hibernate
Run Code Online (Sandbox Code Playgroud)

如果您使用 gnome 并想要安装 hibernate-button(它实际上适用于此解决方案),请查看此处提供的解决方案。