如何禁用我的系统进入睡眠状态?

我正在家中使用较旧的AMD 2400+台式机进行Web服务器设置。 我安装并运行了Ubuntu 11.04,但是一段时间后,我再也无法浏览到服务器了。 当我转到键盘并按下一个键时,一切都神奇地再次起作用。

我查看了BIOS,但没有看到启用任何省电function。 在Ubuntu中有类似的东西吗? 可以禁用吗?

我没有安装任何GUI。 这只是控制台。

在Ubuntu 16.04 LTS上,我成功使用以下命令禁用挂起:

sudo systemctl mask sleep.target suspend.target hibernate.target hybrid-sleep.target 

这要重新启用它:

 sudo systemctl unmask sleep.target suspend.target hibernate.target hybrid-sleep.target 

来自man systemctl

 mask NAME... Mask one or more units, as specified on the command line. This will link these unit files to /dev/null, making it impossible to start them. This is a stronger version of disable, since it prohibits all kinds of activation of the unit, including enablement and manual activation. Use this option with care. This honors the --runtime option to only mask temporarily until the next reboot of the system. The --now option may be used to ensure that the units are also stopped. This command expects valid unit names only, it does not accept unit file paths. unmask NAME... Unmask one or more unit files, as specified on the command line. This will undo the effect of mask. This command expects valid unit names only, it does not accept unit file paths. 

GUI

你看过了吗:

系统 – >首选项 – >电源管理

在“交流电源”选项卡上,将计算机置于不活动状态时进入睡眠状态:

终奌站

你能打开“gconf-editor”吗?

查看: /apps/gnome-power-manager/timeout

尝试将sleep_computer_ac设置为0

如果还有其他事情需要改变,我不肯定。

对此的正确答案位于 :

您是否尝试将内核选项acpi=off apm=off/etc/default/grubGRUB_CMDLINE_LINUX_DEFAULT

然后运行sudo update-grub并重新启动计算机。

这些描述的解决方案都不适合我。 笔记本电脑还在睡觉。 使用acpi = off的Grub Linux命令行选项导致笔记本电脑无法启动。 我终于找到了这个解决方案

 sudo vi /etc/default/acpi-support # and then set SUSPEND_METHODS="none" sudo /etc/init.d/acpid restart 

基于Stephan的原始解决方案: 在关闭盖子的笔记本电脑上运行Ubuntu Server?

请尝试查看这些链接 – cyberciti.biz和Arch论坛

这是cyberciti.biz链接的摘录:

默认情况下,Linux内核将使用screen-save选项来禁用它,您需要键入此命令 (它关闭监视器VESA省电function):

 $ setterm -powersave off -blank 0 

如果它转储回你的错误 ,如下所示:不能(un)设置powersave模式

您需要关闭X窗口系统并重新运行上述命令。 更好的是, 在〜/ .xinitrc文件中添加以下两个命令:

 setterm -blank 0 -powersave off -powerdown 0 xset s off 

我找到了Light Locker,因为我有UXntu 14.04.2和LXDE(Lubuntu)桌面; 如果您有此桌面,则可以更改默认设置并通过该管理器管理监视器。 否则,如果没有,可能必须通过终端安装gconf-editor。 Light Locker可以在主菜单的Preferences中找到。