GDM is overriding my PATH environment variable
I use the pam_env.so
module with the user_readenv=1
option (though it's been deprecated recently, it still works as of PAM 1.5.1), in order to set per-user environment variables for the entire user session.
As far as I know, that's the only "sane" way of doing such thing on Linux DEs.
Anyway, these environment variables are set in a file named .pam_environment
on my home directory.
Starting from GDM 40, however, I noticed a few of my local programs (sitting on ~/.local/bin
) went "missing", because my $PATH
was being modified.
It actually took a while to find out who the culprit was, but now I'm 100% certain it's GDM, because after downgrading it to 3.38.2, my $PATH
stopped being modified.
Steps to reproduce
This is much easier to test on Arch Linux, because every distro uses a different name for PAM config files. Plus, Arch enables user_readenv=1
by default (and openSUSE Tumbleweed doesn't, for example), and that is required to reproduce this issue, so keep that in mind.
-
Make sure you have
user_readenv=1
for thepam_env.so
module in whatever file sitting on/etc/pam.d
(skip this if you're on Arch) -
Create a file named
.pam_environment
in your home directory with the following content:PATH DEFAULT="${PATH}:@{HOME}/.local/bin"
-
Re-login.
-
Open a terminal window and check that your
$PATH
does not have~/.local/bin
on it:$ echo $PATH /var/lib/flatpak/exports/bin:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl
Additional information
- OS: Arch Linux
- GDM: 40