您尚未登录。

#1 2020-02-15 16:51:04

LynnSpeng
会员
注册时间: 2020-02-13
帖子: 3

[已解决]求助,笔记本合上盖子之后没有挂起

0. 系统信息

                   -`                    lynn@lynn-archlinux 
                  .o+`                   ------------------- 
                 `ooo/                   OS: Arch Linux x86_64 
                `+oooo:                  Host: N95xKP6 
               `+oooooo:                 Kernel: 5.5.3-arch1-1 
               -+oooooo+:                Uptime: 27 mins 
             `/:-:++oooo+:               Packages: 1224 (pacman) 
            `/++++/+++++++:              Shell: zsh 5.7.1 
           `/++++++++++++++:             Resolution: 1920x1080 
          `/+++ooooooooooooo/`           DE: GNOME 3.34.3 
         ./ooosssso++osssssso+`          WM: Mutter 
        .oossssso-````/ossssss+`         WM Theme: Adwaita 
       -osssssso.      :ssssssso.        Theme: Adwaita [GTK2/3] 
      :osssssss/        osssso+++.       Icons: Adwaita [GTK2/3] 
     /ossssssss/        +ssssooo/-       Terminal: gnome-terminal 
   `/ossssso+/:-        -:/+osssso+-     CPU: Intel i5-9400 (6) @ 4.100GHz 
  `+sso+:-`                 `.-/+oso:    GPU: NVIDIA GeForce GTX 1060 Mobile 
 `++:.                           `-/+/   GPU: Intel UHD Graphics 630 
 .`                                 `/   Memory: 2679MiB / 7834MiB 

1. 登录管理器(DM)从gdm切换到了lightdm,并之后卸载了gdm. lightdm运行正常.
2. 已安装gnome-tweak-tool, 但 "Tweak -> General -> Suspend when laptop lid is closed"选项并未开启, 因为想用 systemd 进行电源管理, logind.conf 配置如下:

cat /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=3h
HandlePowerKey=hibernate
#HandleSuspendKey=suspend
#HandleHibernateKey=hibernate
HandleLidSwitch=suspend
#HandleLidSwitchExternalPower=suspend
#HandleLidSwitchDocked=ignore
#PowerKeyIgnoreInhibited=no
SuspendKeyIgnoreInhibited=no
HibernateKeyIgnoreInhibited=no
LidSwitchIgnoreInhibited=yes
#HoldoffTimeoutSec=30s
IdleAction=suspend
IdleActionSec=20min
#RuntimeDirectorySize=10%
#RemoveIPC=yes
#InhibitorsMax=8192
#SessionsMax=8192

3. 在合上笔记本之后, 电脑并未挂起, 而只是屏幕关闭, 键盘灯与风扇均仍在运行, 打开盖子后, 屏幕瞬间亮起. 在此期间, systemd-logind 日志如下:

journalctl --unit=systemd-logind --follow
-- Logs begin at Sun 2019-10-27 18:55:24 CST. --
Feb 15 16:01:40 lynn-archlinux systemd-logind[1051]: Watching system buttons on /dev/input/event3 (Power Button)
Feb 15 16:01:40 lynn-archlinux systemd-logind[1051]: Watching system buttons on /dev/input/event0 (Power Button)
Feb 15 16:01:40 lynn-archlinux systemd-logind[1051]: Watching system buttons on /dev/input/event2 (Lid Switch)
Feb 15 16:01:40 lynn-archlinux systemd-logind[1051]: Watching system buttons on /dev/input/event1 (Sleep Button)
Feb 15 16:01:40 lynn-archlinux systemd-logind[1051]: Watching system buttons on /dev/input/event7 (Intel HID events)
Feb 15 16:01:40 lynn-archlinux systemd-logind[1051]: Watching system buttons on /dev/input/event6 (AT Translated Set 2 keyboard)
Feb 15 16:01:40 lynn-archlinux systemd[1]: Started Login Service.
Feb 15 16:01:43 lynn-archlinux systemd-logind[1051]: New session c1 of user lightdm.
Feb 15 16:01:52 lynn-archlinux systemd-logind[1051]: New session 2 of user lynn.
Feb 15 16:01:52 lynn-archlinux systemd-logind[1051]: Removed session c1.
Feb 15 16:02:37 lynn-archlinux systemd-logind[1051]: Lid closed.
Feb 15 16:06:02 lynn-archlinux systemd-logind[1051]: Lid opened.
^C

4. 执行

dm-tool lock

会锁屏进入登录界面.
5. 执行

systemctl suspend

电脑会正常挂起, 按下电源键, 可正常唤醒进入桌面环境, 但并未经过锁屏界面, 而是直接进入桌面环境.

第一次发帖求助, 如果还需要什么信息, 恳请回复.

我希望最终效果是, 笔记本合上盖子后, 电脑正常挂起, 打开盖子后, 进入登录界面(锁屏界面), 然后输入密码后进入桌面环境, 且保证上次的会话内容不丢失.

提前表示感谢!

最近编辑记录 LynnSpeng (2020-02-16 00:49:04)

离线

#2 2020-02-15 21:52:07

依云
性别女,谢绝一切男性化称呼
所在地: a.k.a. 百合仙子
注册时间: 2011-08-21
帖子: 5,389
个人网站

Re: [已解决]求助,笔记本合上盖子之后没有挂起

看起来是 gnome 的问题。
systemctl suspend 是只挂起不锁屏的。systemd 锁屏用 loginctl lock-session。

离线

#3 2020-02-16 00:47:48

LynnSpeng
会员
注册时间: 2020-02-13
帖子: 3

Re: [已解决]求助,笔记本合上盖子之后没有挂起

依云 说:

看起来是 gnome 的问题。
systemctl suspend 是只挂起不锁屏的。systemd 锁屏用 loginctl lock-session。

谢谢回复, 忙活了一整天了, 最后还是换回了gdm
不过,我在网上找到了对于 lightdm在gnome环境下的锁屏后挂起问题 的解决方案, 详情见这里, 该方案配合acpid设置,可以实现笔记本合盖后锁屏并挂起, 不过还是感觉有些曲线救国.
再次表示感谢.

离线

页脚