为什么light-locker解锁后屏幕一直是黑屏?

为什么light-locker解锁后屏幕一直是黑屏?

一台安装了 Xubuntu 16.04 完整补丁的机器,如果新创建了一个用户,则在使用 light-locker 锁定屏幕后,不会让我解锁(无论是手动还是通过超时激活锁定)。屏幕保持黑屏(但已通电)输入正确的密码

从 tty1 杀死 light-locker 将显示桌面(从而防止进一步锁定)。

尝试的步骤:

  • 在灯锁设置和电源设置中启用/禁用锁定(无变化)
  • 使用 xscreensaver 代替 light-locker (有效)
  • 测试问题是否与暂停或关闭盖子有关(不是)
    • 然而,暂停后黑屏显示This session is locked: You will be redirected to the unlock dialog automatically in a few seconds消息 - 没有任何重定向发生
  • 清除并重新安装 lightdm、light-locker 和 xubuntu-default-settings
  • 使用loginctl unlock-session无效
  • systemctl status lightdm仅显示有关 kwallet pam 模块丢失的(无害、预期的)消息
  • 检查了 dpkg 日志中“有效”和“无效”之间的升级(无可疑)并启动了之前的内核(问题仍然存在)
  • 比较会话启动的 light-locker 与手动启动的 light-locker 之间的行为(无区别)
  • 将用户添加到组nopasswdlogin组(锁定后立即出现黑屏,而不仅仅是输入密码后)

还有哪些其他步骤可以帮助解决此问题?

调试日志:

$ export LC_ALL=C; light-locker --debug & ( sleep 5; echo "## Locking now"; light-locker-command --lock; sleep 10; echo "### 10 seconds have passed - entering password now"; sleep 10; echo "### 10 more seconds have passwd - Killing"; killall light-locker; sleep 5; echo "### Killed now" )  
[1] 23463
[gs_debug_init] gs-debug.c:106 (00:08:32):   Debugging enabled
[main] light-locker.c:142 (00:08:32):    initializing light-locker 1.7.0
[main] light-locker.c:144 (00:08:32):    lock after screensaver 10
[main] light-locker.c:145 (00:08:32):    late locking 0
[main] light-locker.c:146 (00:08:32):    lock on suspend 1
[main] light-locker.c:147 (00:08:32):    lock on lid 0
[main] light-locker.c:148 (00:08:32):    idle hint 1
[query_session_id] gs-listener-dbus.c:2088 (00:08:32):   org.freedesktop.login1.NoSessionForPID raised:
 PID 23463 does not belong to any known session


[init_session_id] gs-listener-dbus.c:2180 (00:08:32):    Got session-id: (null)
[query_sd_session_id] gs-listener-dbus.c:2164 (00:08:32):    Couldn't determine our own sd session id: No such process
[init_session_id] gs-listener-dbus.c:2185 (00:08:32):    Got sd-session-id: (null)
[init_seat_path] gs-listener-dbus.c:2262 (00:08:32):     Got seat: /org/freedesktop/DisplayManager/Seat0
[gs_listener_delay_suspend] gs-listener-dbus.c:449 (00:08:32):   Delay suspend
[gs_listener_x11_acquire] gs-listener-x11.c:172 (00:08:32):  ScreenSaver Registered
[listener_dbus_handle_system_message] gs-listener-dbus.c:1330 (00:08:32):    obj_path=/org/freedesktop/DBus interface=org.freedesktop.DBus method=NameAcquired destination=:1.316
## Locking now
[gs_grab_grab_root] gs-grab-x11.c:647 (00:08:37):    Grabbing the root window
[gs_grab_get_keyboard] gs-grab-x11.c:153 (00:08:37):     Grabbing keyboard widget=E3
[gs_grab_get_mouse] gs-grab-x11.c:213 (00:08:37):    Grabbing mouse widget=E3
[gs_manager_create_windows_for_screen] gs-manager.c:548 (00:08:37):  Creating 1 windows for screen 0
[gs_manager_create_window_for_monitor] gs-manager.c:324 (00:08:37):  Creating window for monitor 0 [0,0] (1600x900)
[update_geometry] gs-window-x11.c:197 (00:08:37):    got geometry for monitor 0: x=0 y=0 w=1600 h=900
[update_geometry] gs-window-x11.c:210 (00:08:37):    using geometry for monitor 0: x=0 y=0 w=1600 h=900
[update_geometry] gs-window-x11.c:197 (00:08:37):    got geometry for monitor 0: x=0 y=0 w=1600 h=900
[update_geometry] gs-window-x11.c:210 (00:08:37):    using geometry for monitor 0: x=0 y=0 w=1600 h=900
[gs_window_move_resize_window] gs-window-x11.c:243 (00:08:37):   Move and/or resize window on monitor 0: x=0 y=0 w=1600 h=900
[update_geometry] gs-window-x11.c:197 (00:08:37):    got geometry for monitor 0: x=0 y=0 w=1600 h=900
[update_geometry] gs-window-x11.c:210 (00:08:37):    using geometry for monitor 0: x=0 y=0 w=1600 h=900
[gs_window_move_resize_window] gs-window-x11.c:243 (00:08:37):   Move and/or resize window on monitor 0: x=0 y=0 w=1600 h=900
[update_geometry] gs-window-x11.c:197 (00:08:37):    got geometry for monitor 0: x=0 y=0 w=1600 h=900
[update_geometry] gs-window-x11.c:210 (00:08:37):    using geometry for monitor 0: x=0 y=0 w=1600 h=900
[gs_window_move_resize_window] gs-window-x11.c:243 (00:08:37):   Move and/or resize window on monitor 0: x=0 y=0 w=1600 h=900
[gs_manager_timed_switch] gs-manager.c:445 (00:08:37):   Start switch to greeter timer
[gs_window_xevent] gs-window-x11.c:369 (00:08:37):   not raising our windows
[window_map_event_cb] gs-manager.c:233 (00:08:37):   Handling window map_event event
[gs_listener_resume_suspend] gs-listener-dbus.c:513 (00:08:37):  Resume suspend: fd=14
[manager_maybe_grab_window] gs-manager.c:204 (00:08:37):     Moving grab to 0x5595f8d5a290
[gs_grab_move_keyboard] gs-grab-x11.c:450 (00:08:37):    Moving keyboard grab from E3 to 3A0000C
[gs_grab_move_keyboard] gs-grab-x11.c:457 (00:08:37):    *** doing X server grab
[gs_grab_release_keyboard] gs-grab-x11.c:279 (00:08:37):     Ungrabbing keyboard
[gs_grab_get_keyboard] gs-grab-x11.c:153 (00:08:37):     Grabbing keyboard widget=3A0000C
[gs_grab_move_keyboard] gs-grab-x11.c:479 (00:08:37):    *** releasing X server grab
[gs_grab_move_mouse] gs-grab-x11.c:395 (00:08:37):   Moving pointer grab from E3 to 3A0000C
[gs_grab_move_mouse] gs-grab-x11.c:402 (00:08:37):   *** doing X server grab
[gs_grab_release_mouse] gs-grab-x11.c:320 (00:08:37):    Ungrabbing pointer
[gs_grab_get_mouse] gs-grab-x11.c:213 (00:08:37):    Grabbing mouse widget=3A0000C
[gs_grab_move_mouse] gs-grab-x11.c:425 (00:08:37):   *** releasing X server grab
[listener_dbus_handle_system_message] gs-listener-dbus.c:1330 (00:08:37):    obj_path=/org/freedesktop/login1 interface=org.freedesktop.DBus.Properties method=PropertiesChanged destination=(null)
[update_geometry] gs-window-x11.c:197 (00:08:37):    got geometry for monitor 0: x=0 y=0 w=1600 h=900
[update_geometry] gs-window-x11.c:210 (00:08:37):    using geometry for monitor 0: x=0 y=0 w=1600 h=900
[gs_window_move_resize_window] gs-window-x11.c:243 (00:08:37):   Move and/or resize window on monitor 0: x=0 y=0 w=1600 h=900
[update_geometry] gs-window-x11.c:197 (00:08:37):    got geometry for monitor 0: x=0 y=0 w=1600 h=900
[update_geometry] gs-window-x11.c:210 (00:08:37):    using geometry for monitor 0: x=0 y=0 w=1600 h=900
[gs_window_move_resize_window] gs-window-x11.c:243 (00:08:37):   Move and/or resize window on monitor 0: x=0 y=0 w=1600 h=900
[gs_listener_send_lock_session] gs-listener-dbus.c:180 (00:08:38):   Send lock session
[listener_dbus_handle_system_message] gs-listener-dbus.c:1330 (00:08:38):    obj_path=(null) interface=(null) method=(null) destination=:1.316
[listener_dbus_handle_system_message] gs-listener-dbus.c:1330 (00:08:39):    obj_path=/org/freedesktop/login1/session/c5 interface=org.freedesktop.DBus.Properties method=PropertiesChanged destination=(null)
[listener_dbus_handle_system_message] gs-listener-dbus.c:1330 (00:08:39):    obj_path=/org/freedesktop/login1/session/c12 interface=org.freedesktop.DBus.Properties method=PropertiesChanged destination=(null)
[listener_dbus_handle_system_message] gs-listener-dbus.c:1330 (00:08:39):    obj_path=/org/freedesktop/login1/seat/seat0 interface=org.freedesktop.DBus.Properties method=PropertiesChanged destination=(null)
process 23463: arguments to dbus_message_new_method_call() were incorrect, assertion "path != NULL" failed in file ../../dbus/dbus-message.c line 1340.
This is normally a bug in some application using the D-Bus library.
[query_session_active] gs-listener-dbus.c:1124 (00:08:39):   Couldn't allocate the dbus message
[listener_dbus_handle_system_message] gs-listener-dbus.c:1361 (00:08:39):    systemd notified ActiveSession 0
[listener_session_switched_cb] gs-monitor.c:298 (00:08:39):  Session switched: 0
[gs_manager_stop_switch] gs-manager.c:456 (00:08:39):    Stop switch to greeter timer
[listener_dbus_handle_system_message] gs-listener-dbus.c:1330 (00:08:39):    obj_path=/org/freedesktop/login1/seat/seat0 interface=org.freedesktop.DBus.Properties method=PropertiesChanged destination=(null)
[listener_dbus_handle_system_message] gs-listener-dbus.c:1330 (00:08:39):    obj_path=/org/freedesktop/login1/session/c12 interface=org.freedesktop.DBus.Properties method=PropertiesChanged destination=(null)
[listener_dbus_handle_system_message] gs-listener-dbus.c:1330 (00:08:39):    obj_path=/org/freedesktop/login1/user/_108 interface=org.freedesktop.DBus.Properties method=PropertiesChanged destination=(null)
[listener_dbus_handle_system_message] gs-listener-dbus.c:1330 (00:08:39):    obj_path=/org/freedesktop/login1/seat/seat0 interface=org.freedesktop.DBus.Properties method=PropertiesChanged destination=(null)
process 23463: arguments to dbus_message_new_method_call() were incorrect, assertion "path != NULL" failed in file ../../dbus/dbus-message.c line 1340.
This is normally a bug in some application using the D-Bus library.
[query_session_active] gs-listener-dbus.c:1124 (00:08:39):   Couldn't allocate the dbus message
[listener_dbus_handle_system_message] gs-listener-dbus.c:1361 (00:08:39):    systemd notified ActiveSession 0
[listener_session_switched_cb] gs-monitor.c:298 (00:08:39):  Session switched: 0
[listener_dbus_handle_system_message] gs-listener-dbus.c:1330 (00:08:39):    obj_path=/org/freedesktop/login1/session/c5 interface=org.freedesktop.login1.Session method=Lock destination=(null)
### 10 seconds have passed - entering password now
[listener_dbus_handle_system_message] gs-listener-dbus.c:1330 (00:08:51):    obj_path=/org/freedesktop/login1/session/c5 interface=org.freedesktop.login1.Session method=Unlock destination=(null)
[listener_dbus_handle_system_message] gs-listener-dbus.c:1330 (00:08:51):    obj_path=/org/freedesktop/login1/session/c13 interface=org.freedesktop.DBus.Properties method=PropertiesChanged destination=(null)
[listener_dbus_handle_system_message] gs-listener-dbus.c:1330 (00:08:51):    obj_path=/org/freedesktop/login1/session/c5 interface=org.freedesktop.DBus.Properties method=PropertiesChanged destination=(null)
[listener_dbus_handle_system_message] gs-listener-dbus.c:1330 (00:08:51):    obj_path=/org/freedesktop/login1/seat/seat0 interface=org.freedesktop.DBus.Properties method=PropertiesChanged destination=(null)
process 23463: arguments to dbus_message_new_method_call() were incorrect, assertion "path != NULL" failed in file ../../dbus/dbus-message.c line 1340.
This is normally a bug in some application using the D-Bus library.
[query_session_active] gs-listener-dbus.c:1124 (00:08:51):   Couldn't allocate the dbus message
[listener_dbus_handle_system_message] gs-listener-dbus.c:1361 (00:08:51):    systemd notified ActiveSession 0
[listener_session_switched_cb] gs-monitor.c:298 (00:08:51):  Session switched: 0
[xroot_filter] gs-listener-x11.c:124 (00:08:52):     ScreenSaver stopped
### 10 more seconds have passwd - Killing
### Killed now

将其与已知良好的系统进行比较,得出:

$ comm -3 <(grep -iv grab good | sed 's/[0-9:]\+/[NN]/g;s/[ \t]\+/ /g' | sort) <(grep -iv grab bad | sed 's/[0-9:]\+/[NN]/g;s/[ \t]\+/ /g' | sort) | head -n2
[init_session_id] gs-listener-dbus.c[NN] ([NN])[NN] Got session-id[NN] (null)
[init_session_id] gs-listener-dbus.c[NN] ([NN])[NN] Got session-id[NN] /org/freedesktop/login[NN]/session/c[NN]

事实上,会话设置确实有些让人尴尬的地方:

$ loginctl session-status
Could not get properties: No such process

答案1

TL;DR:如果 systemd 无法读取 /proc,light-locker 将保持屏幕黑屏

  • light-locker取决于dbus提供IPC
  • dbus取决于systemd-logind提供的session信息。
  • systemd-logind取决于/proc提供的process信息。

这意味着它们不能很好地协同工作:

$ file /sbin/init
/sbin/init: symbolic link to /lib/systemd/systemd
$ mount | grep proc
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime,hidepid=2,gid=1337)

并且也不能指望任何一方会:

hidepid 实际上与 systemd 不兼容。抱歉。[..] 无论如何,关闭,因为这不是由 systemd 引起的。--伦纳特·普特林

部分解决方案 1

部分的解决方案,因为它伴随着信息披露。

允许非特权程序(例如 systemd,放弃特权后)访问 中的其他用户进程信息/proc

$ sudo mount -o remount,hidepid=0 /proc
 # and fix /etc/fstab accordingly

部分解决方案 2

部分的解决方案,因为 systemd 可能在其他地方中断,而不仅仅是 logind。

将 systemd-logind 添加到适当的组,最方便的方法是添加服务 Drop-In。

$ addgroup showpid
$ adduser myuser showpid
$ sudo mount -o remount,hidepid=2,gid=showpid /proc
 # and fix /etc/fstab accordingly
$ echo -e '[Service]\nSupplementaryGroups=showpid' | sudo tee /etc/systemd/system/systemd-logind.service.d/10-showpid.conf
$ sudo systemctl daemon-reload
$ sudo systemctl restart systemd-logind

任何一个解决方案,Got session-id: (null)消息应该看起来更像Got session-id: /org/freedesktop/login1/c7,并且 light-locker 将能够通过 正确通信dbus


我应该怎么做才能更快地解决这个问题?

  • 如果发生了变化,而您又无法快速找出变化的原因,则只需获取备份和diff -ruiN整个系统即可。
  • 更精确地记录问题首次发生的时间,因此按时间对日志文件/IDS 报告进行排序将快速揭示相关原因。
  • 提交更多错误报告。应用程序在稍后会引起麻烦和/或系统锁定的情况下默默失败是不可接受的。

相关内容