在 tty1 中关闭笔记本电脑盖上的睡眠

Geo*_*ick 7 server ssh suspend power-management 15.10

我在笔记本电脑上使用 Ubuntu Desktop 15.10,它也运行带有 SSH 的 Apache 服务器。使用 GUI 时,我将电源选项设置为即使关闭笔记本电脑盖也根本不休眠,但最近我停止了 X-System,现在使用 TTY1 来节省资源。但是,在 TTY1 中,如果我合上笔记本电脑的盖子,计算机就会进入睡眠状态并阻止 SSH 和 Apache 服务器工作。有什么方法可以轻松防止这种情况?我打赌的现实答案是改用 Ubuntu Server(除非我弄错了并且 Ubuntu Server 也会在盖子关闭时睡觉)但我还不想切换除非有一种简单的方法可以切换到它,就像您可以切换一样从 ubuntu-desktop 到 lubuntu-desktop?欢迎任何建议以防止计算机休眠

小智 18

尝试编辑/etc/systemd/logind.conf文件并修改行:

#HandleLidSwitch=suspend
Run Code Online (Sandbox Code Playgroud)

HandleLidSwitch=ignore
Run Code Online (Sandbox Code Playgroud)

然后重启。

  • 好的。至少在 20.04 上,我可以“sudo systemctl restart systemd-logind.service”,而不是重新启动。 (2认同)