Plasma5 user sessions

Max Harmathy max.harmathy at web.de
Thu Jan 18 09:06:27 UTC 2018


Am 15.01.2018 um 14:32 schrieb Max Harmathy:
> Greetings from Munich's LiMux developers team.
>
> short story:
>
> * during user session initialisation notifications get displayed as windows
> * if one user requests a shutdown (reboot, poweroff) all sessions get killed
>
> long story:
>
> We are currently in development of our next (final?) release. Our
> current release is based on Ubuntu 14.04 trust, whereas our next release
> will be based on Ubuntu 18.04 bionic.
>
> Thus we switch from
> * upstart to systemd
> * ConsoleKit to logind
> * KDM to SDDM
> * Plasma 4.x to Plasma 5.x
>
> We have to execute some tasks for every user who logs into a computer.
> This includes configuring start menu applications, configuring printers,
> mounting network shares and synchronise the users home directory with a
> filer (downsync). We also provide slots where administrators can run
> scripts in the user context.
>
> Up until now we hooked into the user session by putting some files into
> /etc/X11/Xsession.d which is as far as we understand executed by the
> display-manager when a x11 user session gets initialised.
>
> During these configuration steps there are some notifications we want to
> be displayed after the desktop is ready. Therefore we collect such
> messages. The a script in /etc/xdg/autostart displays them after the
> plasma session started as normal desktop notifications. Therefore the
> script sends them through the DBus session bus via
> org.freedesktop.Notifications. However on our development release those
> messages get displayed as windows instead of the usual bubbles. It seems
> that the notification handling is not ready when the autostarts are running.
>
> When the user ends the session we also run code to synchronise the home
> directory (upsync), umnount network shares etc. This works as expected
> if the user does a simple logout. However if the user requests a
> shutdown (reboot, poweroff) then the session and other user sessions are
> killed and the computer shuts down. The KSMServer
> (plasma-workspace/ksmserver/server.cpp, void KSMServer::cleanUp()) uses
> a KDisplayManager (plasma-workspace/libkworkspace/kdisplaymanager.cpp)
> which sends a "Reboot" or "PowerOff" through the system bus to logind.
> This results in an immediate shutdown and neither our code nor parts of
> the startkde script is executed.
>
> Comments in kdisplaymanager.cpp state that there should be a policykit
> dialog preventing a shutdown if other sessions are running, which is not
> displayed in our case. But also without other sessions running, the
> logout should finish in a clean way(wait for startkde to terminate).
>
> We found out, that running a process with a systemd inhibitor as root e.g
>> # systemd-inhibit --what=shutdown --mode=block sleep 365d
> prevents the system from killing the session and a clean logout is
> conducted. However in this case also the shutdown request is silently
> ignored.
>
> There are some questions we where not able to find answers by ourselves:
>
> Is there a definition when xdg-autostart applications are started?
>
> Is there a way to make sure that the session is ready to display
> notifications?
>
> It seems that sending dbus messages to logind in kdisplaymanager.cpp is
> too early. Could this be a general issue? Should this not be the last
> part of startkde?
>
> Could this be a misconfiguration of policykit?
>
> Could it be that the behaviour of logind changed recently?
>
> It looks like there are currently some weak spots with plasma5 sessions.
> We hope that we can work together to make the users session handling
> more robust.
>

I familiarised myself with session handling with logind [1]. I also
looked at what GNOME is doing [2].

I have come to the conclusion, that we will most likely patch
plasma-workspace not to send DBus requests to logind. Instead we will
record the request of the user (with a flag file) and handle it during
logout after startkde terminated and our configuration tasks have finished.

Nevertheless I think that the session handling in the KDisaplayManager
code has a severe issue in conjunction with logind. Therefore I opened a
ticket on Bugzilla[3].

Max

[1] https://dvdhrm.wordpress.com/2013/08/24/session-management-on-linux/
[2] https://git.gnome.org/browse/gnome-session/
[3] https://bugs.kde.org/show_bug.cgi?id=389144


More information about the Enterprise mailing list