自动挂起 - “由于不活动,计算机将很快挂起” - 我该如何禁用此功能?

自动挂起 - “由于不活动,计算机将很快挂起” - 我该如何禁用此功能?

我在虚拟机上运行 Ubuntu 17.10。

在客户机中,我打开了 GNOME 终端,使用 启动了 Aptitude sudo aptitude,然后切换到主机执行一些任务。
当我返回 Ubuntu 客户机时,它在锁定屏幕上显示了此通知:

力量
1 条新通知

弹出窗口

解锁后:

自动挂起
计算机将由于不活动而很快挂起。

弹出窗口

解锁后 Aptitude 刚说无法下载软件包,因为系统处于离线状态。

我怎样才能禁用此行为?

答案1

解决方案是禁用自动挂起:

  1. 打开GNOME 控制中心, 去力量tab (或者简单来说gnome-control-center power
  2. 暂停和电源按钮自动暂停, 到离开什么时候插入

<code>gnome-control-center 电源</code>

这将改变设置

$ dconf dump / | grep -i "suspend\|sleep"
sleep-inactive-ac-timeout=900
sleep-inactive-ac-type='suspend' # <
sleep-inactive-battery-timeout=900

$ gsettings list-recursively | grep -i "suspend\|sleep"
org.gnome.desktop.screensaver ubuntu-lock-on-suspend true
org.gnome.settings-daemon.plugins.power button-power 'suspend'
org.gnome.settings-daemon.plugins.power sleep-inactive-ac-timeout 900
org.gnome.settings-daemon.plugins.power power-button-action 'suspend'
org.gnome.settings-daemon.plugins.power lid-close-suspend-with-external-monitor false
org.gnome.settings-daemon.plugins.power sleep-inactive-ac-type 'suspend' # <
org.gnome.settings-daemon.plugins.power button-suspend 'suspend'
org.gnome.settings-daemon.plugins.power button-sleep 'hibernate'
org.gnome.settings-daemon.plugins.power sleep-inactive-battery-timeout 900
org.gnome.settings-daemon.plugins.power lid-close-ac-action 'suspend'
org.gnome.settings-daemon.plugins.power sleep-inactive-battery-type 'suspend'
org.gnome.settings-daemon.plugins.power lid-close-battery-action 'suspend'

$ dconf dump / | grep -i "suspend\|sleep"
sleep-inactive-ac-timeout=900
sleep-inactive-ac-type='nothing' # <
sleep-inactive-battery-timeout=900

$ gsettings list-recursively | grep -i "suspend\|sleep"
org.gnome.desktop.screensaver ubuntu-lock-on-suspend true
org.gnome.settings-daemon.plugins.power button-power 'suspend'
org.gnome.settings-daemon.plugins.power sleep-inactive-ac-timeout 900
org.gnome.settings-daemon.plugins.power power-button-action 'suspend'
org.gnome.settings-daemon.plugins.power lid-close-suspend-with-external-monitor false
org.gnome.settings-daemon.plugins.power sleep-inactive-ac-type 'nothing' # <
org.gnome.settings-daemon.plugins.power button-suspend 'suspend'
org.gnome.settings-daemon.plugins.power button-sleep 'hibernate'
org.gnome.settings-daemon.plugins.power sleep-inactive-battery-timeout 900
org.gnome.settings-daemon.plugins.power lid-close-ac-action 'suspend'
org.gnome.settings-daemon.plugins.power sleep-inactive-battery-type 'suspend'
org.gnome.settings-daemon.plugins.power lid-close-battery-action 'suspend'

答案2

概括:

设置->电源:暂停:“关闭”

或者打开终端并执行命令:

gsettings set org.gnome.settings-daemon.plugins.power sleep-inactive-ac-type 'nothing'

详细的:

使用设置对话框“电源”,将自动暂停设置为“关闭”。有时设置对话框中没有该设置;它只是缺失了。(例如,仅显示屏幕超时。)

那么请使用终端。

使用以下命令检查当前设置:

gsettings get org.gnome.settings-daemon.plugins.power sleep-inactive-ac-type

它应该答复:

'suspend'

请检查密钥是否可写:

gsettings writable org.gnome.settings-daemon.plugins.power sleep-inactive-ac-type

它应该答复:

true

检查范围:

gsettings range org.gnome.settings-daemon.plugins.power sleep-inactive-ac-type

它应该答复:

enum
'blank'
'suspend'
'shutdown'
'hibernate'
'interactive'
'nothing'
'logout'

并将值(“无”单引号、双引号或无引号)设置为您选择的值:

gsettings set org.gnome.settings-daemon.plugins.power sleep-inactive-ac-type 'nothing'

之后检查设置是否已改变:

gsettings get org.gnome.settings-daemon.plugins.power sleep-inactive-ac-type

它应该显示你的更改:

'nothing'

提示:请避免使用 sudo 或 root shell,这将禁止访问本地设置。

答案3

需要补充的是,鉴于 GUI 控制中心似乎有无数个版本(我的版本看起来与上面的版本完全不同),我发现进行此更改的最简单方法是:

gsettings set org.gnome.settings-daemon.plugins.power sleep-inactive-ac-type "nothing"

相关内容