gnome3.gdm: Always reset the environment for new sessions #48517
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation for this change
When GDM launches a new session it will inherit the user's systemd
environment (but only unset variables). If
__NIXOS_SET_ENVIRONMENT_DONE
is setin the user's systemd environment it will prevent the environment to be set
properly or updated (eg. after having done a system rebuild).
Gnome sessions exports their environment to systemd at startup. If something
is keeping the user's systemd process alive (eg. ssh) launching a new gnome
session after logging out will result in a broken PATH. Specifically the PATH
will be inherited from GDM and never reset.
We patch GDM to never inherit
__NIXOS_SET_ENVIRONMENT_DONE
so new sessionswill always reset their base environment.
fixes #48255
For more info about the environment setup:
#45784
cc @jtojnar
The issue is also present in 18.09 so this fix should be backported.
Things done
Tested in a VM that logging into a new gnome session works properly when ssh is active after logging out once.