![如何在 lightdm 登录屏幕禁用 20 分钟内的挂起功能?](https://linux22.com/image/1181603/%E5%A6%82%E4%BD%95%E5%9C%A8%20lightdm%20%E7%99%BB%E5%BD%95%E5%B1%8F%E5%B9%95%E7%A6%81%E7%94%A8%2020%20%E5%88%86%E9%92%9F%E5%86%85%E7%9A%84%E6%8C%82%E8%B5%B7%E5%8A%9F%E8%83%BD%EF%BC%9F.png)
请您告诉我如何在系统空闲且 lightdm 登录屏幕处于活动状态(没有用户登录)时禁用在 20 或 30 分钟内进入挂起模式。
在我们的机器上,诊断命令给出了以下 dconf 参数:
# sudo -H -u lightdm dbus-launch --exit-with-session gsettings list-recursively org.gnome.settings-daemon.plugins.power
org.gnome.settings-daemon.plugins.power lid-close-ac-action 'suspend'
org.gnome.settings-daemon.plugins.power time-critical 300
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 button-hibernate 'hibernate'
org.gnome.settings-daemon.plugins.power idle-dim true
org.gnome.settings-daemon.plugins.power button-power 'suspend'
org.gnome.settings-daemon.plugins.power lid-close-battery-action 'suspend'
org.gnome.settings-daemon.plugins.power priority 0
org.gnome.settings-daemon.plugins.power idle-brightness 30
org.gnome.settings-daemon.plugins.power active false
org.gnome.settings-daemon.plugins.power critical-battery-action 'hibernate'
org.gnome.settings-daemon.plugins.power button-suspend 'suspend'
org.gnome.settings-daemon.plugins.power button-sleep 'hibernate'
org.gnome.settings-daemon.plugins.power percentage-critical 3
org.gnome.settings-daemon.plugins.power sleep-inactive-ac-timeout 0
org.gnome.settings-daemon.plugins.power sleep-inactive-ac-type 'nothing'
org.gnome.settings-daemon.plugins.power ambient-enabled true
org.gnome.settings-daemon.plugins.power notify-perhaps-recall true
org.gnome.settings-daemon.plugins.power percentage-low 10
org.gnome.settings-daemon.plugins.power percentage-action 2
org.gnome.settings-daemon.plugins.power sleep-inactive-battery-type 'nothing'
org.gnome.settings-daemon.plugins.power time-low 0
org.gnome.settings-daemon.plugins.power sleep-inactive-battery-timeout 0
org.gnome.settings-daemon.plugins.power time-action 0
org.gnome.settings-daemon.plugins.power use-time-for-policy true
你看到的电源管理模块没有处于活动状态(参数active为false)。
/etc/systemd/logind.conf 的内容
# This file is part of systemd.
#
# systemd is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 2.1 of the License, or
# (at your option) any later version.
#
# Entries in this file show the compile time defaults.
# You can change settings by editing this file.
# Defaults can be restored by simply deleting this file.
#
# See logind.conf(5) for details.
[Login]
#NAutoVTs=6
#ReserveVT=6
#KillUserProcesses=no
#KillOnlyUsers=
#KillExcludeUsers=root
#InhibitDelayMaxSec=5
#HandlePowerKey=poweroff
#HandleSuspendKey=suspend
#HandleHibernateKey=hibernate
#HandleLidSwitch=suspend
#HandleLidSwitchExternalPower=suspend
#HandleLidSwitchDocked=ignore
#PowerKeyIgnoreInhibited=no
#SuspendKeyIgnoreInhibited=no
#HibernateKeyIgnoreInhibited=no
#LidSwitchIgnoreInhibited=yes
#HoldoffTimeoutSec=30s
IdleAction=ignore
IdleActionSec=30min
#RuntimeDirectorySize=10%
#RemoveIPC=yes
#InhibitorsMax=8192
#SessionsMax=8192
请告知在哪里可以给出暂停前的 20 或 30 分钟超时时间。
提前谢谢了。
鲁本·伊斯坎达良。
答案1
最后终于找到了解决办法。
问题的原因在于,在安装了 lightdm 和 unity-greeter 作为桌面管理器和欢迎程序的系统中,给出了超时间隔两次作为数值:
(1)lightdm 中暂停之前的时间。 (2)unity-greeter 中暂停之前的时间。
要更改第一组参数(对于 lightdm),我需要通过 dconf 编辑器为用户 lightdm 指定值:
sudo -u lightdm dbus-launch gsettings set org.gnome.settings-daemon.plugins.power sleep-inactive-ac-timeout 0
sudo -u lightdm dbus-launch gsettings set org.gnome.settings-daemon.plugins.power sleep-inactive-battery-timeout 0
我还将暂停时间过后的操作类型更改为“无”
sudo -u lightdm dbus-launch gsettings set org.gnome.settings-daemon.plugins.power sleep-inactive-ac-type 'nothing'
sudo -u lightdm dbus-launch gsettings set org.gnome.settings-daemon.plugins.power sleep-inactive-battery-type 'nothing'
要更改第二组参数(对于 unity-greeter),我需要执行类似的操作:
sudo -u lightdm dbus-launch gsettings set com.canonical.unity.settings-daemon.plugins.power sleep-inactive-ac-timeout 0
sudo -u lightdm dbus-launch gsettings set com.canonical.unity.settings-daemon.plugins.power sleep-inactive-battery-timeout 0
和
sudo -u lightdm dbus-launch gsettings set com.canonical.unity.settings-daemon.plugins.power sleep-inactive-ac-type 'nothing'
sudo -u lightdm dbus-launch gsettings set com.canonical.unity.settings-daemon.plugins.power sleep-inactive-battery-type 'nothing'
测试表明没有观察到进一步的暂停事件。
没有错误,而是对 lightdm 和 unity-greeter 在不同地方存储参数的简单误解。
致以亲切的问候,鲁本·亚历山德罗维奇·伊斯坎达良。