Nixpkgs: lightlocker: broken on second lock activation with systemd 243

Created on 25 Sep 2019  路  24Comments  路  Source: NixOS/nixpkgs

Describe the bug
There is an issue upstream https://github.com/the-cavalry/light-locker/issues/146.
This makes desktop use for users of lightdm and lightlocker unusable.
Currently Pantheon DE will mostly be affected as it's the default screenlocker.

To Reproduce
Steps to reproduce the behavior:

  1. light-locker-command -l (do this twice)
bug wait-for-upstream nixos pantheon user experience

Most helpful comment

@dmvianna I've updated systemd on staging-19.09 to include those fixes https://github.com/NixOS/nixpkgs/pull/71616 and in staging https://github.com/NixOS/nixpkgs/pull/71615. So yes, eventually it will be in 19.09.

Closing this as fixed.

All 24 comments

It's reported you could do dm-tool switch-to-greeter as a workaround https://github.com/the-cavalry/light-locker/issues/146#issuecomment-529986608 or just kill light-locker and switch vt7

Using busctl monitor on a tty might be helpful to figure out what goes wrong between logind and lightdm.

sudo busctl monitor

I just upgraded light-locker to the latest commit: https://github.com/the-cavalry/light-locker/commit/7587b53954a4d1c41a76d178d5e11ebb59eba922 but now there is a delay after suspend where my session is unlocked before light-locker actually locks the screen. Maybe this is because they dropped upower events: https://github.com/the-cavalry/light-locker/commit/7587b53954a4d1c41a76d178d5e11ebb59eba922#diff-c82195dae9a98fbd24be9f5bdd693739L1383

However I now immediately get redirected to the lightdm login screen after that delay, where my screen is not locked.

Huh, so removing listening on upower's sleep/resume events actually makes it get unlocked and proper vt switch? I'll see if that has any effects on my system.

I've used the following in an overlay to give light-locker debug info

lightlocker = self.enableDebugging (super.lightlocker.overrideAttrs(old: rec {
  src = self.fetchFromGitHub {
    owner = "the-cavalry";
    repo = "light-locker";
    rev = "7587b53954a4d1c41a76d178d5e11ebb59eba922";
    sha256 = "1j1d7bf1s2rv2sgwyvjs5y1mgyyvavk3ixrbldnzghgg0iv4xhcb";
  };

  postFixup = ''
    substituteInPlace $out/etc/xdg/autostart/light-locker.desktop \
      --replace "Exec=light-locker" "Exec=systemd-cat light-locker --debug"
  '';
}));

On my system with the latest commits, running light-locker-command -l on the second invocation has no effects. Whereas before it would show a message trying to redirect me, which only could be worked-around by using loginctl unlock-session $foo in another tty and switching back to vt7.

I see this in light-locker logs

.light-locker-w[1818]: [listener_dbus_handle_session_message] ../src/gs-listener-dbus.c:974 (08:57:25):         Received Lock request
.light-locker-w[1818]: [listener_active_changed_cb] ../src/gs-monitor.c:261 (08:57:25):         Unable to set manager active: 1
.light-locker-w[1818]: [gs_listener_set_active] ../src/gs-listener-dbus.c:344 Active-changed signal not handled
.light-locker-w[1818]: [gs_monitor_lock_screen] ../src/gs-monitor.c:71 (08:57:25):         Unable to lock the screen

It appears the only info I could get from busctl was with busctl monitor --user and that's on org.freedesktop.ScreenSaver showing the Lock method calls.

Before suspend it fails now to lock the screen:

[listener_dbus_handle_system_message] ../src/gs-listener-dbus.c:1307 (13:59:37):         obj_path=/org/fre
edesktop/login1 interface=org.freedesktop.login1.Manager method=PrepareForSleep destination=(null)
[listener_dbus_handle_system_message] ../src/gs-listener-dbus.c:1364 (13:59:37):         systemd initiatin
g sleep

** (light-locker:20675): CRITICAL **: 13:59:37.020: gs_grab_grab_root: assertion 'GS_IS_GRAB (grab)' faile
d
[listener_active_changed_cb] ../src/gs-monitor.c:261 (13:59:37):         Unable to set manager active: 1
[gs_listener_set_active] ../src/gs-listener-dbus.c:344 (13:59:37):       Active-changed signal not handled
[gs_monitor_lock_screen] ../src/gs-monitor.c:71 (13:59:37):      Unable to lock the screen
[listener_dbus_handle_system_message] ../src/gs-listener-dbus.c:1307 (13:59:37):         obj_path=/org/fre
edesktop/login1 interface=org.freedesktop.DBus.Properties method=PropertiesChanged destination=(null)
[listener_dbus_handle_system_message] ../src/gs-listener-dbus.c:1307 (13:59:37):         obj_path=/org/fre
edesktop/login1 interface=org.freedesktop.DBus.Properties method=PropertiesChanged destination=(null)

After suspend I get the following (screen then also gets locked after a few seconds)

[listener_dbus_handle_system_message] ../src/gs-listener-dbus.c:1307 (13:59:50):         obj_path=/org/freedesktop/login1 interface=org.freedesktop.login1.Manager method=PrepareForSleep destination=(null)
[listener_dbus_handle_system_message] ../src/gs-listener-dbus.c:1364 (13:59:50):         systemd initiating resume
[listener_dbus_handle_system_message] ../src/gs-listener-dbus.c:1307 (13:59:50):         obj_path=/org/freedesktop/login1 interface=org.freedesktop.DBus.Properties method=PropertiesChanged destination=(null)
[listener_dbus_handle_system_message] ../src/gs-listener-dbus.c:1307 (13:59:50):         obj_path=/org/freedesktop/UPower/devices/battery_BAT0 interface=org.freedesktop.DBus.Properties method=PropertiesChanged destination=(null)
[listener_dbus_handle_system_message] ../src/gs-listener-dbus.c:1307 (13:59:50):         obj_path=/org/freedesktop/UPower/devices/DisplayDevice interface=org.freedesktop.DBus.Properties method=PropertiesChanged destination=(null)
[listener_dbus_handle_system_message] ../src/gs-listener-dbus.c:1307 (13:59:50):         obj_path=/org/freedesktop/UPower/devices/battery_BAT1 interface=org.freedesktop.DBus.Properties method=PropertiesChanged destination=(null)
[listener_dbus_handle_system_message] ../src/gs-listener-dbus.c:1307 (13:59:50):         obj_path=/org/freedesktop/UPower/devices/line_power_AC interface=org.freedesktop.DBus.Properties method=PropertiesChanged destination=(null)
[gs_listener_send_switch_greeter] ../src/gs-listener-dbus.c:135 (13:59:51):      Send switch greeter
[listener_dbus_handle_system_message] ../src/gs-listener-dbus.c:1307 (13:59:51):         obj_path=(null) interface=(null) method=(null) destination=:1.1124
[listener_dbus_handle_system_message] ../src/gs-listener-dbus.c:1307 (13:59:51):         obj_path=/org/freedesktop/login1/user/_78 interface=org.freedesktop.DBus.Properties method=PropertiesChanged destination=(null)
[listener_dbus_handle_system_message] ../src/gs-listener-dbus.c:1307 (13:59:51):         obj_path=/org/freedesktop/login1/session/_325 interface=org.freedesktop.DBus.Properties method=PropertiesChanged destination=(null)
[listener_dbus_handle_system_message] ../src/gs-listener-dbus.c:1307 (13:59:52):         obj_path=/org/freedesktop/login1 interface=org.freedesktop.DBus.Properties method=PropertiesChanged destination=(null)
[listener_dbus_handle_system_message] ../src/gs-listener-dbus.c:1307 (13:59:52):         obj_path=/org/freedesktop/login1/user/_78 interface=org.freedesktop.DBus.Properties method=PropertiesChanged destination=(null)
[listener_dbus_handle_system_message] ../src/gs-listener-dbus.c:1307 (13:59:52):         obj_path=/org/freedesktop/login1/seat/seat0 interface=org.freedesktop.DBus.Properties method=PropertiesChanged destination=(null)
[listener_dbus_handle_system_message] ../src/gs-listener-dbus.c:1338 (13:59:52):         systemd notified ActiveSession 0
[listener_session_switched_cb] ../src/gs-monitor.c:243 (13:59:52):       Session switched: 0
[listener_dbus_handle_system_message] ../src/gs-listener-dbus.c:1307 (13:59:52):         obj_path=/org/freedesktop/login1/session/_325 interface=org.freedesktop.login1.Session method=Lock destination=(null)
[listener_dbus_handle_system_message] ../src/gs-listener-dbus.c:1323 (13:59:52):         systemd requested session lock

** (light-locker:20675): CRITICAL **: 13:59:52.458: gs_grab_grab_root: assertion 'GS_IS_GRAB (grab)' failed
[listener_active_changed_cb] ../src/gs-monitor.c:261 (13:59:52):         Unable to set manager active: 1
[gs_listener_set_active] ../src/gs-listener-dbus.c:344 (13:59:52):       Active-changed signal not handled
[gs_monitor_lock_screen] ../src/gs-monitor.c:71 (13:59:52):      Unable to lock the screen
[listener_dbus_handle_system_message] ../src/gs-listener-dbus.c:1307 (13:59:55):         obj_path=/org/freedesktop/login1/session/_325 interface=org.freedesktop.login1.Session method=Unlock destination=(null)
[listener_dbus_handle_system_message] ../src/gs-listener-dbus.c:1316 (13:59:55):         systemd requested session unlock
[gs_listener_set_active] ../src/gs-listener-dbus.c:336 (13:59:55):       Trying to set active state when already: inactive
[listener_dbus_handle_system_message] ../src/gs-listener-dbus.c:1307 (13:59:56):         obj_path=/org/freedesktop/login1/session/c19 interface=org.freedesktop.DBus.Properties method=PropertiesChanged destination=(null)
[listener_dbus_handle_system_message] ../src/gs-listener-dbus.c:1307 (13:59:56):         obj_path=/org/freedesktop/login1/session/_325 interface=org.freedesktop.DBus.Properties method=PropertiesChanged destination=(null)
[xroot_filter] ../src/gs-listener-x11.c:120 (13:59:56):  ScreenSaver stopped
[listener_dbus_handle_system_message] ../src/gs-listener-dbus.c:1307 (14:00:20):         obj_path=/org/freedesktop/UPower/devices/battery_BAT1 interface=org.freedesktop.DBus.Properties method=PropertiesChanged destination=(null)
[listener_dbus_handle_system_message] ../src/gs-listener-dbus.c:1307 (14:00:37):         obj_path=/org/freedesktop/login1/user/_78 interface=org.freedesktop.DBus.Properties method=PropertiesChanged destination=(null)
[listener_dbus_handle_system_message] ../src/gs-listener-dbus.c:1307 (14:00:50):         obj_path=/org/freedesktop/UPower/devices/battery_BAT1 interface=org.freedesktop.DBus.Properties method=PropertiesChanged destination=(null)
[listener_dbus_handle_system_message] ../src/gs-listener-dbus.c:1307 (14:01:20):         obj_path=/org/freedesktop/UPower/devices/battery_BAT1 interface=org.freedesktop.DBus.Properties method=PropertiesChanged destination=(null)
[listener_dbus_handle_system_message] ../src/gs-listener-dbus.c:1307 (14:01:26):         obj_path=/org/freedesktop/login1/user/_78 interface=org.freedesktop.DBus.Properties method=PropertiesChanged destination=(null)
[listener_dbus_handle_system_message] ../src/gs-listener-dbus.c:1307 (14:01:50):         obj_path=/org/freedesktop/UPower/devices/battery_BAT0 interface=org.freedesktop.DBus.Properties method=PropertiesChanged destination=(null)
[listener_dbus_handle_system_message] ../src/gs-listener-dbus.c:1307 (14:01:50):         obj_path=/org/freedesktop/UPower/devices/DisplayDevice interface=org.freedesktop.DBus.Properties method=PropertiesChanged destination=(null)
[listener_dbus_handle_system_message] ../src/gs-listener-dbus.c:1307 (14:01:50):         obj_path=/org/freedesktop/UPower/devices/battery_BAT1 interface=org.freedesktop.DBus.Properties method=PropertiesChanged destination=(null)
[listener_dbus_handle_system_message] ../src/gs-listener-dbus.c:1307 (14:02:20):         obj_path=/org/freedesktop/UPower/devices/battery_BAT1 interface=org.freedesktop.DBus.Properties method=PropertiesChanged destination=(null)
[listener_dbus_handle_system_message] ../src/gs-listener-dbus.c:1307 (14:02:50):         obj_path=/org/freedesktop/UPower/devices/battery_BAT1 interface=org.freedesktop.DBus.Properties method=PropertiesChanged destination=(null)
[listener_dbus_handle_system_message] ../src/gs-listener-dbus.c:1307 (14:03:20):         obj_path=/org/freedesktop/UPower/devices/battery_BAT1 interface=org.freedesktop.DBus.Properties method=PropertiesChanged destination=(null)
[listener_dbus_handle_system_message] ../src/gs-listener-dbus.c:1307 (14:03:50):         obj_path=/org/freedesktop/UPower/devices/battery_BAT0 interface=org.freedesktop.DBus.Properties method=PropertiesChanged destination=(null)
[listener_dbus_handle_system_message] ../src/gs-listener-dbus.c:1307 (14:03:50):         obj_path=/org/freedesktop/UPower/devices/DisplayDevice interface=org.freedesktop.DBus.Properties method=PropertiesChanged destination=(null)
[listener_dbus_handle_system_message] ../src/gs-listener-dbus.c:1307 (14:03:50):         obj_path=/org/freedesktop/UPower/devices/battery_BAT1 interface=org.freedesktop.DBus.Properties method=PropertiesChanged destination=(null)
[listener_dbus_handle_system_message] ../src/gs-listener-dbus.c:1307 (14:04:20):         obj_path=/org/freedesktop/UPower/devices/battery_BAT1 interface=org.freedesktop.DBus.Properties method=PropertiesChanged destination=(null)
[listener_dbus_handle_system_message] ../src/gs-listener-dbus.c:1307 (14:04:50):         obj_path=/org/freedesktop/UPower/devices/battery_BAT1 interface=org.freedesktop.DBus.Properties method=PropertiesChanged destination=(null)
[listener_dbus_handle_system_message] ../src/gs-listener-dbus.c:1307 (14:05:20):         obj_path=/org/freedesktop/UPower/devices/battery_BAT1 interface=org.freedesktop.DBus.Properties method=PropertiesChanged destination=(null)
[listener_dbus_handle_system_message] ../src/gs-listener-dbus.c:1307 (14:05:50):         obj_path=/org/freedesktop/UPower/devices/battery_BAT0 interface=org.freedesktop.DBus.Properties method=PropertiesChanged destination=(null)
[listener_dbus_handle_system_message] ../src/gs-listener-dbus.c:1307 (14:05:50):         obj_path=/org/freedesktop/UPower/devices/DisplayDevice interface=org.freedesktop.DBus.Properties method=PropertiesChanged destination=(null)
[listener_dbus_handle_system_message] ../src/gs-listener-dbus.c:1307 (14:05:50):         obj_path=/org/freedesktop/UPower/devices/battery_BAT1 interface=org.freedesktop.DBus.Properties method=PropertiesChanged destination=(null)
[listener_dbus_handle_system_message] ../src/gs-listener-dbus.c:1307 (14:06:20):         obj_path=/org/freedesktop/UPower/devices/battery_BAT1 interface=org.freedesktop.DBus.Properties method=PropertiesChanged destination=(null)
[listener_dbus_handle_system_message] ../src/gs-listener-dbus.c:1307 (14:06:50):         obj_path=/org/freedesktop/UPower/devices/battery_BAT1 interface=org.freedesktop.DBus.Properties method=PropertiesChanged destination=(null)
[listener_dbus_handle_system_message] ../src/gs-listener-dbus.c:1307 (14:07:20):         obj_path=/org/freedesktop/UPower/devices/battery_BAT1 interface=org.freedesktop.DBus.Properties method=PropertiesChanged destination=(null)
[listener_dbus_handle_system_message] ../src/gs-listener-dbus.c:1307 (14:07:50):         obj_path=/org/freedesktop/UPower/devices/battery_BAT0 interface=org.freedesktop.DBus.Properties method=PropertiesChanged destination=(null)
[listener_dbus_handle_system_message] ../src/gs-listener-dbus.c:1307 (14:07:50):         obj_path=/org/freedesktop/UPower/devices/DisplayDevice interface=org.freedesktop.DBus.Properties method=PropertiesChanged destination=(null)
[listener_dbus_handle_system_message] ../src/gs-listener-dbus.c:1307 (14:07:50):         obj_path=/org/freedesktop/UPower/devices/battery_BAT1 interface=org.freedesktop.DBus.Properties method=PropertiesChanged destination=(null)

I started light-locker like this:

$ light-locker --lock-on-suspend --lock-on-lid --no-late-locking --debug

This is the assertion that fails when light-locker tries to lock the screen before suspend: https://github.com/the-cavalry/light-locker/blob/695f414cabf32ab3eb75e43fb2b3e0572c41fc99/src/gs-grab-x11.c#L613

which leads to the current error message.

this pointer is apparently NULL already on startup and not correctly initialized.

[main] ../src/light-locker.c:188 (13:59:33):     lock after screensaver 5
[main] ../src/light-locker.c:189 (13:59:33):     late locking 0
[main] ../src/light-locker.c:190 (13:59:33):     lock on suspend 1
[main] ../src/light-locker.c:191 (13:59:33):     lock on lid 1
[main] ../src/light-locker.c:192 (13:59:33):     idle hint 1
[init_session_id] ../src/gs-listener-dbus.c:2027 (13:59:33):     Got session-id: /org/freedesktop/login1/s
ession/_325
[init_session_id] ../src/gs-listener-dbus.c:2037 (13:59:33):     Got sd-session-id: 25
[init_seat_path] ../src/gs-listener-dbus.c:2118 (13:59:33):      Got seat: /org/freedesktop/DisplayManager/Seat0

(light-locker:20675): GLib-GObject-CRITICAL **: 13:59:33.240: g_object_add_weak_pointer: assertion 'G_IS_OBJECT (object)' failed

(light-locker:20675): GLib-GObject-WARNING **: 13:59:33.240: invalid uninstantiatable type '(null)' in cast to 'GSGrab'
[gs_listener_delay_suspend] ../src/gs-listener-dbus.c:413 (13:59:33):    Delay suspend
[gs_listener_x11_acquire] ../src/gs-listener-x11.c:168 (13:59:33):       ScreenSaver Registered
[listener_dbus_handle_system_message] ../src/gs-listener-dbus.c:1307 (13:59:33):         obj_path=/org/freedesktop/DBus interface=org.freedesktop.DBus method=NameAcquired destination=:1.1124

Getting the exact output on my system currently with latest commits. Though perhaps they cause this different behavior we observed, the reporter at https://github.com/the-cavalry/light-locker/issues/146 seems to clearly be using 1.8.0 as I can create their output by using that version. And that version doesn't appear to have issues with gs_grab_grab_root, perhaps that's an issue with the GObject syntax rewrites.

I find it particularly interesting that reverting https://github.com/systemd/systemd/commit/3b92c086a8d5338e2164ffa0ae48b3d03d10cfb5 eliminates the issue.

Ah right. It's because of the rewrite. So now the question is, what internal state change breaks suspend between the first and the second time.

In the meantime, is there a workaround that will work with the computer locking itself after 10min of inactivity?

@ElvishJerricco Upgrading to latest master in light-locker actually makes the screen locker just break on second activation. Either that, or switching to a tty and doing loginctl list-sessions and loginctl unlock-session $number and switching back to tt7.

Upgrading to the latest light-locker just doesn't work at all for me... It locked once, but afterwards it won't lock at all. Plus, even when on the first time where it does work, ctrl+alt+f7 brings me right back to an unlocked desktop. The whole point of light-locker was to fix that...

@ElvishJerricco Yeah, my point was is it's completely broken on systemd 243. And on latest master, instead of being trapped with the non-functioning locker it simply doesn't work :rofl:

The thing with loginctl should work fine though in its current state.

An issue has been opened in systemd https://github.com/systemd/systemd/issues/13769

A PR in systemd has been produced

In particular https://github.com/systemd/systemd/pull/13811/commits/8cc64c2a3640121745fdfaccc6eae896ac25a911 is meant to fix this.

@Mic92 If these commits get merged can we backport them to our fork?

Edit: seems to have done the trick. For any observers of the issue you can use the following nixos config to use it right away.

systemd.package = pkgs.systemd.overrideAttrs (old: {
  patches = [
    (pkgs.fetchpatch {
      url = "https://patch-diff.githubusercontent.com/raw/systemd/systemd/pull/13811.patch";
      sha256 = "02r30ly9l1hck5y3n6vy24m3dfq15ssbm262wrfc3d8gazcb9bg8";
    })
  ];
});

@worldofpeace Yes we should backport this. Can you make a PR to: https://github.com/NixOS/systemd/commits/nixos-v243 ?

@worldofpeace Yes we should backport this. Can you make a PR to: https://github.com/NixOS/systemd/commits/nixos-v243 ?

Absolutely :+1: . Though do you recommend waiting until it's accepted upstream?

Edit: opened https://github.com/NixOS/systemd/pull/33

@worldofpeace Yes we should backport this. Can you make a PR to: NixOS/systemd@nixos-v243 (commits) ?

Absolutely +1 . Though do you recommend waiting until it's accepted upstream?

Edit: opened NixOS/systemd#33

The fixes seem simple enough and should be fine, since you already tested them.

Will it make it to nixos-19.09?

@dmvianna I've updated systemd on staging-19.09 to include those fixes https://github.com/NixOS/nixpkgs/pull/71616 and in staging https://github.com/NixOS/nixpkgs/pull/71615. So yes, eventually it will be in 19.09.

Closing this as fixed.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

langston-barrett picture langston-barrett  路  3Comments

chris-martin picture chris-martin  路  3Comments

rzetterberg picture rzetterberg  路  3Comments

ayyess picture ayyess  路  3Comments

sid-kap picture sid-kap  路  3Comments