Bug 433657 - [systemd] some environment variables got overriden when use plasma systemdBoot
Summary: [systemd] some environment variables got overriden when use plasma systemdBoot
Status: RESOLVED NOT A BUG
Alias: None
Product: plasmashell
Classification: Unclassified
Component: general (show other bugs)
Version: 5.21.1
Platform: Archlinux Packages Linux
: HI normal
Target Milestone: 1.0
Assignee: David Edmundson
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-02-26 14:04 UTC by Rocket Aaron
Modified: 2021-03-07 08:41 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Rocket Aaron 2021-02-26 14:04:04 UTC
SUMMARY

Bhen use plasma systemdBoot, some environemt variables defined in `~/.config/environment.d/*.conf`, like `PATH` and `XAUTHORITY`, got overriden after enter plasmashell.

But other environment variables, like `EDITOR` and `SSH_AUTH_SOCK`, work as expected.


STEPS TO REPRODUCE

1. enable plasma systemdBoot via `kwriteconfig5 --file startkderc --group General --key systemdBoot true`

2. create `~/.config/environment.d/99-env.conf` with content: 
```
PATH=${HOME}/.local/bin:${PATH}
XAUTHORITY=${XDG_RUNTIME_DIR}/Xauthority
```

3. logout and re-login, use `htop` to see environment of each process.


OBSERVED RESULT

plasmashell and other KDE processes doesn't have `~/.local/bin` in their `PATH` environment, but non-KDE user services' processes, such as dbus-daemon do have.

And environment `XAUTHORITY` has been set to `~/.Xauthority`, `~/.Xauthority` was generated.


EXPECTED RESULT

plasmashell and other KDE processes should have `~/.local/bin` in their `PATH` environment, and `XAUTHORITY` should be `/run/user/$UID/Xauthority`


SOFTWARE/OS VERSIONS
Linux/KDE Plasma: linux 5.11.1-arch1-1
(available in About System)
KDE Plasma Version: 5.21.1
KDE Frameworks Version: 5.79.0
Qt Version: 5.15.2

ADDITIONAL INFORMATION
Comment 1 Nate Graham 2021-02-26 16:13:49 UTC
The XAUTHORITY thing is causing Bug 433388.
Comment 2 David Edmundson 2021-03-06 00:53:03 UTC
>2. create `~/.config/environment.d/99-env.conf` with content: 
XAUTHORITY=${XDG_RUNTIME_DIR}/Xauthority


It's a good thing that's overridden, it's set by SDDM on login.

PATH I don't know of, but it's not our code directly.

We do correctly source a bunch of scripts during login /etc/X11/Xsession.d for example, anything set later overrides something set very early in the boot script.

I'm happy to investigate further if you can pinpoint something we're actually doing wrong, but so far I can't see anything
Comment 3 Rocket Aaron 2021-03-07 08:41:01 UTC
I wonder if there is a method to set `PATH` env for plasmashell process. Since Plasma has adopt systemd to handle service startup stuff, it's environment.d definition should be a reasonable choice.

I have several scripts in `~/.local/bin`, and want to invoke them via krunner.

And if possible, could you tell me that where are those environment vairables got  handled? Is it in sddm, plasma, or both? And in Arch Linux, there is no `/etc/X11/Xsession.d` directory...