在 Debian 12 上禁用挂起等

在 Debian 12 上禁用挂起等

刚刚安装了 Debian 12.0.0。

从 11.2 升级不起作用,因此从 Bookworm DVD 进行了全新安装。

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

即使这样也不能防止屏幕变黑

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

确实表明他们都戴着面具。这在这台机器上的 Debian 11.2 上完美运行,并且在我的其他 Debian 11.2 服务器上仍然运行良好。

创建 /etc/systemd/sleep.conf.d/nosuspend.conf AS:

[Sleep]
AllowSuspend=no
AllowHibernation=no
AllowSuspendThenHibernate=no
AllowHybridSleep=no

即使重新启动后也没有任何影响。

它在 Dell XPS 8930 上运行,配备 i7-9700 CPU @ 3.00 GHz、32 GB RAM、1 TB SSD 和两个 4 TB HDD。

有什么建议吗?

答案1

事实证明,命令行显然不是最好的方法。这四个步骤有效:

  1. 单击最右上角的电源按钮。
  2. 单击出现的下拉框中的设置齿轮。
  3. 在弹出的设置窗口的左侧菜单中单击“电源”。
  4. 在“省电选项”下,选择“从不”而不是“5 分钟”。

答案2

我通过编辑/etc/gdm3/greeter.dconf-defaults、取消注释该行、更改suspend为来修复此问题blank

sleep-inactiva-ac-type="blank"

并重新启动 gdm3:

sudo systemctl restart gdm3

这是/etc/gdm3/greeter.dconf-defaults

# Automatic suspend
# =================
[org/gnome/settings-daemon/plugins/power]
# - Time inactive in seconds before suspending with AC power
#   1200=20 minutes, 0=never
# sleep-inactive-ac-timeout=1200
# - What to do after sleep-inactive-ac-timeout
#   'blank', 'suspend', 'shutdown', 'hibernate', 'interactive' or 'nothing'
sleep-inactive-ac-type='blank'
# - As above but when on battery
# sleep-inactive-battery-timeout=1200
# sleep-inactive-battery-type='suspend'

答案3

编辑greeter.dconf-defaults为我完成了这项工作:


# These are the options for the greeter session that can be set 
# through GSettings. Any GSettings setting that is used by the 
# greeter session can be set here.

# Note that you must configure the path used by dconf to store the 
# configuration, not the GSettings path.


# Theming options
# ===============
#  - Change the GTK+ theme
[org/gnome/desktop/interface]
# gtk-theme='Adwaita'
#  - Use another background
[org/gnome/desktop/background]
# picture-uri='file:///usr/share/themes/Adwaita/backgrounds/stripes.jpg'
# picture-options='zoom'
#  - Or no background at all
[org/gnome/desktop/background]
# picture-options='none'
# primary-color='#000000'

# Login manager options
# =====================
[org/gnome/login-screen]
logo='/usr/share/images/vendor-logos/logo-text-version-64.png'

# - Disable user list
# disable-user-list=true
# - Disable restart buttons
# disable-restart-buttons=true
# - Show a login welcome message
# banner-message-enable=true
# banner-message-text='Welcome'

# Automatic suspend
# =================
[org/gnome/settings-daemon/plugins/power]
# - Time inactive in seconds before suspending with AC power
#   1200=20 minutes, 0=never
sleep-inactive-ac-timeout=0
# - What to do after sleep-inactive-ac-timeout
#   'blank', 'suspend', 'shutdown', 'hibernate', 'interactive' or 'nothing'
sleep-inactive-ac-type='nothing'
# - As above but when on battery
# sleep-inactive-battery-timeout=1200
# sleep-inactive-battery-type='suspend'

安装一个像样的编辑器是至关重要的。我在这里使用旧版本的 vim :在此输入链接描述

答案4

对我来说,将一行更改/etc/gdm3/greeter.dconf-defaults

sleep-inactive-ac-timeout=0 

并执行

sudo systemctl reload gdm; sudo systemctl reload gdm3  

解决了问题。

https://unix.stackexchange.com/a/736305/32825

相关内容