SUMMARY Plasmashell should not give its $INVOCATION_ID and $JOURNAL_STREAM environment variable to child processes. These are supposed to be set by systemd when starting an application so that this application can detect that it runs under systemd as a service and use sd-journal API to enhance logging for example. STEPS TO REPRODUCE 1. Launch a plasma session using systemd 2. Starts a terminal emulator (konsole, kitty, ...) 3. run `echo $JOURNAL_STREAM` OBSERVED RESULT Both `$INVOCATION_ID` and `$JOURNAL_STREAM` are defined and have the same values as within `plasmashell`. This is confirmed by `sudo strings /proc/$(pidof plasmashell)/environ | grep JOURNAL` EXPECTED RESULT `$INVOCATION_ID` and `$JOURNAL_STREAM` should NOT be defined. I checked the expected result with Ubuntu GDDM. SOFTWARE/OS VERSIONS Linux/KDE Plasma: 6.8.9-arch1-2 KDE Plasma Version: 6.0.4 KDE Frameworks Version: 6.2.0 Qt Version: 6.7.0 ADDITIONAL INFORMATION Tested on with a wayland session, will try with X11 in few hours. Documentation about those variables: https://www.freedesktop.org/software/systemd/man/latest/systemd.exec.html#%24JOURNAL_STREAM https://www.freedesktop.org/software/systemd/man/latest/systemd.exec.html#%24INVOCATION_ID Some comments on other unrelated bugs gives a full env dump, showing that those variables are also, wrongly, defined in their situations: https://bugs.kde.org/show_bug.cgi?id=453202 https://bugs.kde.org/show_bug.cgi?id=468460 https://bugs.kde.org/show_bug.cgi?id=469839
Just tried with an X11 session and I have the exact same issue.
In theory systemd application launching in combination with systemd services would not have this problem as the env would come from the application launch env. So it's potentially made worse by in 21fce404e05d7180afb897fde4d1c81ea6a5ae96 in kio.
FWIW gnome-shell behaves the same.
The systemd runner could/should simply remove these variables.
I discussed it a bit on the systemd's mailing list, but did not received a clear answer: https://lists.freedesktop.org/archives/systemd-devel/2024-May/050277.html I know that gnome-shell behave the same, but gnome-terminal remove these variables. To me it feels as the wrong place to do that, because it would mean that ALL terminal implementations have to do the exact same "workaround". And there is a lot of different terminal out there... I did not go deep in KDE's code, so I cannot say for sure that it should be systemd side or not. From what I understood, the systemd's part is fine. If called correctly, the spawned process should receive a correct INVOCATION_ID and JOURNAL_STREAM. So that it would means that KDE's way of using systemd to spawn processes is faulty? I tried to patch plasma-shell to remove the two variables (as stated in the mailing list), and everything worked well and solved my initial issue. In any case, if systemd runner or KDE's part is fixed so that systemd correctly provide the two variables to the spawned process, it would means that spawning a terminal (e.g. konsole) will provide a new INVOCATION_ID and JOURNAL_STREAM to that terminal, and the terminal's childs (shell and any application run from within that terminal) will inherit from it. Leading to applications having JOURNAL_STREAM defined and, consequently, writing to the sd-journal of the terminal, instead of the stdout. Does that means that an issue should be opened to all terminals? As stated above, gnome-shell is already exclude few variables, maybe all terminals should do the same? Actually, I was wondering if it should rather be an inclusion list instead? I mean, naively, when starting a terminal, I expect it to be a new fresh and clean environment, and I expect the launched shell to set any initial variables values, just like if it was a TTY.