新情况:经过进一步研究,我发现问题在于系统无法自行挂起,尽管手动挂起(关机->挂起)效果很好。我在电源设置菜单中对交流电和电源都使用了 5 分钟后挂起设置。
我能找到的针对该问题的唯一“解决方案”来自另一个线程: http://thecodecentral.com/2011/01/18/fix-ubuntu-10-10-suspendhibernate-not-working-bug 对我没用。
旧:如果我手动(使用 gconf-editor)将 sleep-inactive-timeout 设置为电源管理器中的 5/10/3/1 以外的其他值,则设置将被忽略(= 根本不会暂停)。我将其设置为 10 并等待了 20 秒。尝试登录/退出并重新启动,结果仍然相同。还重新启动(终止)了 gnome-settings-daemon,结果仍然相同。
我是不是漏掉了什么?如果我理解正确的话,gnome-power-daemon(或旧版本中的名称)现在已完全被 gnome-settings-daemon 取代。还是我漏掉了其他软件包?
这是我的所有设置守护进程 dconf 设置:
org.gnome.settings-daemon.plugins.power active true
org.gnome.settings-daemon.plugins.power button-hibernate 'hibernate'
org.gnome.settings-daemon.plugins.power button-power 'interactive'
org.gnome.settings-daemon.plugins.power button-sleep 'suspend'
org.gnome.settings-daemon.plugins.power button-suspend 'suspend'
org.gnome.settings-daemon.plugins.power critical-battery-action 'hibernate'
org.gnome.settings-daemon.plugins.power idle-brightness 30
org.gnome.settings-daemon.plugins.power idle-dim-ac false
org.gnome.settings-daemon.plugins.power idle-dim-battery true
org.gnome.settings-daemon.plugins.power idle-dim-time 10
org.gnome.settings-daemon.plugins.power lid-close-ac-action 'suspend'
org.gnome.settings-daemon.plugins.power lid-close-battery-action 'suspend'
org.gnome.settings-daemon.plugins.power notify-perhaps-recall true
org.gnome.settings-daemon.plugins.power percentage-action 2
org.gnome.settings-daemon.plugins.power percentage-critical 3
org.gnome.settings-daemon.plugins.power percentage-low 10
org.gnome.settings-daemon.plugins.power priority 1
org.gnome.settings-daemon.plugins.power sleep-display-ac 0
org.gnome.settings-daemon.plugins.power sleep-display-battery 0
org.gnome.settings-daemon.plugins.power sleep-inactive-ac true
org.gnome.settings-daemon.plugins.power sleep-inactive-ac-timeout 10
org.gnome.settings-daemon.plugins.power sleep-inactive-ac-type 'suspend'
org.gnome.settings-daemon.plugins.power sleep-inactive-battery true
org.gnome.settings-daemon.plugins.power sleep-inactive-battery-timeout 10
org.gnome.settings-daemon.plugins.power sleep-inactive-battery-type 'suspend'
org.gnome.settings-daemon.plugins.power time-action 120
org.gnome.settings-daemon.plugins.power time-critical 300
org.gnome.settings-daemon.plugins.power time-low 1200
org.gnome.settings-daemon.plugins.power use-time-for-policy true
答案1
这是一个解决方法。它需要安装 xprintidle:
#!/usr/bin/perl
use strict;
use warnings;
my ($idletime,$suspendtime);
while (1==1){
$idletime= qx/xprintidle/;
$suspendtime = qx/gsettings get org.gnome.settings-daemon.plugins.power sleep-inactive-ac-timeout/;
if ($idletime/1000 >= $suspendtime){
exec("pmi action suspend");
}
print "idle: $idletime\n suspendtime: $suspendtime\n";
sleep 180;
}
将其放在后台的 shell 中或在登录时启动它。