Draft: systemd bootup: wait for services on logout
startplasma should wait for session services to shut down to avoid issues like in bug https://bugs.kde.org/show_bug.cgi?id=461475.
This is a draft because it turns out that waiting for graphical-session.target
(or other targets) to shut down is not enough: Stopping graphical-session.target
will propagate the stop action to all units with PartOf=graphical-session.target
,
but does not impose any (additional) ordering restrictions between the units.
Only units which have an ordering restriction of After=graphical-session.target
will be shut down before the stop job for graphical-session.target
completes,
other units may stop later. There appears to be no easy way to wait for these
units to stop.
I have multiple ideas about how we could approach this:
- Ensure that all plasma services started as part of the session have useful
After=*.target
ordering specifications. This is basically how gnome-session solves it. - Have startplasma enumerate all units which are
PartOf=graphical-session.target
and explicitly wait for them to stop. - Have startplasma monitor systemd and don't exit while there are outstanding stop jobs for any unit.
Did I miss something? Any strong opinions on how to implement it? I'm willing to do all of the coding work but I could use some guidance since I'm kind of a rookie.