ubuntu禁用挂起和休眠

挂起休眠和其他睡眠功能由 systemd管理,适用于所有启用了systemd的发行版

编辑配置文件nano /etc/systemd/sleep.conf,将以下行取消注释,值修改为no。

1
2
3
4
AllowSuspend=no
AllowHibernation=no
AllowSuspendThenHibernate=no
AllowHybridSleep=no

sudo systemctl status suspend.target suspend.target hibernate.target hybrid-sleep.target查看状态

状态

要重新启用休眠,将这4行重新添加注释。

参考链接: