Plasma >= 5.21 Systemd >= 246
kwriteconfig5 --file startkderc --group General --key systemdBoot true
Verifying things work
systemctl --user status
You should see a bunch of plasma-* services
- Create an alias for "systemd --user" you will use it a lot
drkonqi fails to work nicely with the systemd managed services. Coredumps and crash restarting work but not drkonqi.
Distros should not enable this by default until this is fixed, unless they have their own internal crash solution.
If you use a custom prefix, we have to be careful.
systemd is started /very/ early in the login process. Inside pam, before we've got to spawning the Exec line from the desktop session.
If that script adds in additional prefixes we obviously don't search them.
startplasma-dev.sh contains a workaround. Be sure to re-run your ./install-sessions.sh script in plasma-workspace Even with this fixed it means autostart .desktop files in non /usr locations are not searched.
Long term solutions are on https://phabricator.kde.org/T14135
kwin_wayland is not systemd managed
It is started, but from the boot script. So to an end user it's still "fine", but it's not ideal.
Challenge is the current code of startplasma some of those "pre-systemd" steps require a working display manager. It just needs a bit more cleanup and refactor.
If you find a new bug, please include "systemd" somewhere in the summary, and report to the relevant place. I have a search set up on that title.
The units provided now are very barebones aimed at just working with the current system. Next we can add in some namespaces to provide some security on features that don't need it, OOM hints, as well as potentially hard CPU/memory limits and weights.
If you have ideas and suggestions please let me know.
Internals / Adding services
Startup can be summarised as being:
plasma-core.target plasma-workspace@.target graphical-session.target
plasma-workspace@ is the target explicitly activated.
X11 and wayland
plasma-workspace@ is a template file that ends with x11 or wayland. That will then require the correct kwin_ startup order can be different between the two.
Wants & Order
Note that in systemd dependencies (wants/wantedby) counter-intuitively do not determine order.
plasma-workspace wants graphical-session, meaning it will make it something started by it, but it also explicitly comes before graphical-session.
The order of events is: plasma-core does anything that adjusts environment variables plasma-workspace@ starts all runtime services graphical-session is at a point where everything including runtime services are up
Adding a new service
If something is /required/ by a working session place it in the WantedBy of plasma-core or plasma-workspace.
If something is optional add an [Install] section into that specific service file and make it into graphical-session.target.wants upstream documentation on this is the best.
The following settings are recommended:
When using the plasma systemd boot, this will scope services to only be valid whilst the session is active.
When not using the plasma systemd boot we hit issues with X11 connection being taken away. This exits with 1, we don't want to restart in this case
The default timeout between quit signal and killing is ridiculously long. No user service should take more than a few ms. We want this short to prevent the user getting stuck waiting forever on shutdown if an issue does arise.