Skip to content

Commit e4c68aa

Browse files
committed
Avoid clobbering environment variables loaded from /etc/profile.d
qubes-session loads environment variables from `systemctl --user show-environment`, so that variables set using systemd environment generators are present in the user session. Previously, when one of those generators provided an environment variable that was already set by a script under /etc/profile.d, the variable from the environment generator would clobber the variable from /etc/profile.d. This is backwards - variables from /etc/profile.d should take precedence over those defined in systemd environment generators. To fix this, update the systemd user manager's environment with the contents of the session's environment immediately before updating the session's environment with the environment from the systemd user manager. This two-way sync means that all variables defined in both environment generators and profile scripts end up in the user's environment, while making variable definitions from the profile scripts take priority over variable definitions from environment generators. Fixes: QubesOS/qubes-issues#10299
1 parent b1c52ac commit e4c68aa

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

appvm-scripts/usrbin/qubes-session

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@
2727

2828
loginctl activate "$XDG_SESSION_ID"
2929

30+
# Inform systemd about environment variables loaded from /etc/profile(.d).
31+
dbus-update-activation-environment --systemd --all
32+
3033
# Now import the environment from the systemd user session.
3134
# This is necessary to enable users to configure their
3235
# Qubes environment using the standard environment.d

0 commit comments

Comments
 (0)