Web lists-archives.com

Re: Plasma5 user sessions




Am 15.01.2018 um 20:07 schrieb Kai Uwe Broulik:
Hi,
Thanks for your replay
We found out, that running a process with a systemd inhibitor as root e.g

# systemd-inhibit --what=shutdown --mode=block sleep 365d
Try mode "delay", this will temporarily delay the action until you release 
your inhibition. Typically used for certain cleanup tasks, like disconnecting 
the network, before sending the computer to sleep but according to 
documentation this works also for "shutdown" command. Check out the Logind 
inhibition documentation [1].
Sadly the mode "delay" is no option: since there is a globally set timeout for any delay, which is per default set to 5 sec and can be changed in /etc/systemd/logind.conf by setting InhibitDelayMaxSec. Setting this to a very high value would probably mean a high risk of breaking other uses cases (set to sleep?).

Another Problem is, that in order to prevent the system from being shutdown the inhibitor has to be set by root (or at least by a different user than the dbus command is sent). In my opinion this is a implementation flaw in systemd and contradicts some uses cases listed at the beginning of https://www.freedesktop.org/wiki/Software/systemd/inhibit

At this point it would be extremely complicated to use inhibitors to achieve our goal. The only way would be a system daemon which sets a block inhibitor for shutdown and watches all user sessions and releases the inhibitor only if there is no user session running. This would however render the shutdown button in plasma useless.

As for the warning when shutting down with multiple users, I  that might be an 
SDDM limitation/bug/missing feature.
Probably this is how KDM worked with utmp or ConsoleKit before. Correct me if I am wrong, but in the old days the user session would always reuse the x-server from the display manager. So naturally when the user session ends the display manager would naturally regain control.

But now the kdisplaymanager code send messages to logind via dbus, which then just killes the session. Any code after the comment in "startkde":
> #Anything after here is logout/shutdown
is definitely
not executed on shutdown.

Cheers,
Kai Uwe

[1] https://www.freedesktop.org/wiki/Software/systemd/inhibit/