如何禁用关闭笔记本电脑盖子时的自动暂停?

如何禁用关闭笔记本电脑盖子时的自动暂停?

我用的是archlinux。在最近的系统升级之前它永远不会自动挂起(也许我更新了内核?)。

laptop-mode我认为它与or有关acpid,所以我阻止它们:

/etc/rc.d/laptop-mode stop
/etc/rc.d/acpid stop

我还编辑/etc/laptop-mode/laptop-mode.conf

ENABLE_LAPTOP_MODE_TOOLS=0

然后我编辑/etc/acpi/actions/lm_lid.sh,注释掉最后一行:

# /usr/sbin/laptop_mode auto

但以上所有方法都不起作用。发现以下行/var/log/kernel.log(省略无关行):

Oct 23 15:29:20 localhost kernel: [18617.549098] PM: Syncing filesystems ... done.
Oct 23 15:29:20 localhost kernel: [18618.001898] PM: Preparing system for mem sleep
Oct 23 15:29:30 localhost kernel: [18618.039565] Freezing user space processes ... (elapsed 0.01 seconds) done.
Oct 23 15:29:30 localhost kernel: [18618.052596] Freezing remaining freezable tasks ... (elapsed 0.01 seconds) done.
Oct 23 15:29:30 localhost kernel: [18618.065999] PM: Entering mem sleep
Oct 23 15:29:30 localhost kernel: [18618.066167] Suspending console(s) (use no_console_suspend to debug)
Oct 23 15:29:30 localhost kernel: [18618.097917] sd 0:0:0:0: [sda] Synchronizing SCSI cache
Oct 23 15:29:30 localhost kernel: [18618.098103] sd 0:0:0:0: [sda] Stopping disk
Oct 23 15:29:30 localhost kernel: [18618.270537] snd_hda_intel 0000:00:14.2: power state changed by ACPI to D3hot
Oct 23 15:29:30 localhost kernel: [18619.274374] PM: suspend of devices complete after 1196.192 msecs
Oct 23 15:29:30 localhost kernel: [18619.274691] PM: late suspend of devices complete after 0.313 msecs
Oct 23 15:29:30 localhost kernel: [18619.440877] ohci_hcd 0000:00:14.5: wake-up capability enabled by ACPI
Oct 23 15:29:30 localhost kernel: [18619.642144] ACPI: Waking up from system sleep state S3
Oct 23 15:29:30 localhost kernel: [18620.049424] PM: noirq resume of devices complete after 333.503 msecs
Oct 23 15:29:30 localhost kernel: [18620.049852] PM: early resume of devices complete after 0.334 msecs
Oct 23 15:29:30 localhost kernel: [18622.418605] PM: resume of devices complete after 2371.906 msecs
Oct 23 15:29:30 localhost kernel: [18622.419018] PM: Finishing wakeup.
Oct 23 15:29:30 localhost kernel: [18622.419019] Restarting tasks ... done.
Oct 23 15:29:30 localhost kernel: [18622.464752] video LNXVIDEO:01: Restoring backlight state

我认为这不是由 引起的pm-susend,因为/var/log/pm-suspend.log不记录任何内容。

我不希望我的笔记本电脑在合上盖子时进入睡眠状态。怎么做?

内核版本:3.6.2-1-ARCH

答案1

编辑/etc/systemd/logind.conf并确保您有

HandleLidSwitch=ignore

这将使它忽略正在关闭的盖子。 (您可能还需要撤消所做的其他更改。)

然后,您需要重新加载logind.conf以使更改生效(感谢 Ehtesh Choudhury 在评论中指出这一点):

systemctl restart systemd-logind

完整详细信息位于archlinux 维基

Logind.conf 的手册页也有相关资料,

HandlePowerKey=, HandleSuspendKey=, HandleHibernateKey=, HandleLidSwitch=

    控制登录是否应处理系统电源和睡眠键以及盖子开关以触发系统断电或挂起等操作。可以是“忽略”、“断电”、“重新启动”、“停止”、“kexec”、“挂起”、“休眠”、“混合睡眠”和“锁定”之一。如果“忽略”,logind 将永远不会处理这些键。如果“锁定”,则所有正在运行的会话将被屏幕锁定;否则,将在相应事件中采取指定的操作。只有带有“power-switch”udev 标签的输入设备才会被监视以获取键/盖开关事件。 HandlePowerKey= 默认为“关机”。 HandleSuspendKey=HandleLidSwitch= 默认为“暂停”。 HandleHibernateKey=默认为“休眠”。

答案2

您可以使用它来暂时禁用盖子开关事件:

systemd-inhibit --what=handle-lid-switch sleep 1d

相关内容