On 2021-09-14 08:56, Simon McVittie wrote: > On Mon, 13 Sep 2021 at 22:59:32 +0200, Aurelien Jarno wrote: > > - running the operation on a non-existing user, but as loginctl does a > > check that the user exists, it has to be done directly with the dbus > > API, for instance "gdbus call --system --dest org.freedesktop.login1 > > --object-path /org/freedesktop/login1 --method > > org.freedesktop.login1.Manager.SetUserLinger 12345678 true true" > > > > The latest is more a bit more complex to do (especially that > > libglib2.0-bin is not necessarily installed on the system), but has the > > advantage of exercising all configured NSS modules. > > systemd happens to have its own D-Bus implementation sd-bus (a competitor > to libdbus and GLib's GDBus) for which it provides busctl(1), an > equivalent of gdbus(1) and dbus-send(1). So this could be written as: > > busctl call --system org.freedesktop.login1 /org/freedesktop/login1 \ > org.freedesktop.login1.Manager SetUserLinger ubb $uid true true > > which does not have dependencies outside systemd.deb.
Thanks a lot for the help here, as my knowledge with systemd is relatively limited. That seems to work fine when executed just before the libc6 upgrade in the script I use to trigger the upgrade at boot time. I'll try to insert all pieces into libc6.preinst and see if that still works. > The nonexistent uid should probably be in one of the ranges reserved by > Policy ยง9.2.2: perhaps 4294967294 or (uint32_t) -2, which is reserved > as a representation of the anonymous NFS user? Yes, that is probably a good pick. I guess we should actually disable lingering (so ... ubb 4294967294 false false) to minimize the damages if this user exists anyway. Regards Aurelien -- Aurelien Jarno GPG: 4096R/1DDD8C9B aurel...@aurel32.net http://www.aurel32.net