Arch-Linux

關閉筆記型電腦蓋時如何禁用自動掛起?

  • May 12, 2021

我正在使用archlinux。在最近的系統升級之前它永遠不會自動掛起(也許我更新了核心?)。

我認為它與laptop-modeor有關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

編輯/etc/systemd/logind.conf並確保你有

HandleLidSwitch=ignore

這將使它忽略關閉的蓋子。(您可能還需要撤消所做的其他更改。)

然後,您需要重新載入logind.conf以使您的更改生效(感謝 Ehtesh Choudhury 在評論中指出這一點):

systemctl restart systemd-logind

完整的細節在archlinux Wiki上。

logind.conf 的手冊頁也有相關資訊,

HandlePowerKey=, HandleSuspendKey=, HandleHibernateKey=, HandleLidSwitch=

控制 logind 是否應處理系統電源和睡眠鍵以及蓋子開關以觸發系統斷電或掛起等操作。可以是“ignore”、“poweroff”、“rebo​​ot”、“halt”、“kexec”、“suspend”、“hibernate”、“hybrid-sleep”和“lock”之一。如果“忽略”,logind 將永遠不會處理這些密鑰。如果“鎖定”,所有正在執行的會話將被螢幕鎖定;否則,將在相應事件中執行指定的操作。只有帶有“power-switch” udev 標籤的輸入設備才會被監視按鍵/蓋子開關事件。 HandlePowerKey= 預設為“斷電”。 HandleSuspendKey=HandleLidSwitch= 預設為“暫停”。 HandleHibernateKey=預設為“休眠”。

引用自:https://unix.stackexchange.com/questions/52643