I am using zsh within Terminator. I also use Gnome. When I open up Terminator I found that my $PATH variable was set incorrectly. Checking the box to have zsh run as a login shell corrects the issue. Why does Gnome or GDM not set the proper environment variables when I do actually log in?

  • Because they source .profile and your PATH modification seems to be in .zprofile? – muru Dec 26 '16 at 6:01
  • @muru Thanks for the reply, but I don't think so. All the correct path settings are located in /etc/profile. I also get the same behavior using bash. – carloabelli Dec 26 '16 at 6:05
  • related: unix.stackexchange.com/questions/317282/… – lesmana Dec 26 '16 at 10:36

You didn't specify what operating system you are using, but from your description of the problem it sounds like you are using one of the new operating systems that use Wayland as the graphical session protocol instead of X11 - such as Fedora.

Under Wayland (at least under GNOME), the profile files (/etc/profile, ~/.profile and others) are not loaded as part of the graphical desktop session - see here for the GNOME pseudo-explanation of this behavior.

Generally running script files under a Wayland sessions is not preferable/doable (depending on context). There is ongoing work to solve some of the problems with this, including loading static environment descriptors from various locations. See this Arch forum discussion for some suggestions, but in general this is a current problem that is being worked on.

The best work around for this problem, as far as I can tell, is indeed setting your terminal program to invoke the shell as a login shell (and almost all terminal emulators today have that option if not the option of manually specifying the command line with the correct flags). There are other workarounds documented around the web and on this stack exchange site.

  • Hmm. Any idea how well pam_env works with Wayland? – muru Dec 26 '16 at 9:58
  • Supposed to work just fine, but note that its configuration files syntax is not very obvious and not very flexible - you can't source other files, you can't run programs to get values, etc. The way the GNOME/Wayland/systemd guys see the world, is that scripts should not be used for setting up things because this expressive power is too much for most uses and running them is slow and a security problem. I'm not a fan of this approach, but I can see what they're getting at. – Guss Dec 26 '16 at 12:57
  • 1
    As of systemd 233 (March 2017) there is ~/.config/environment.d. See also unix.stackexchange.com/a/403196/23305. I've filed a bug for Gnome to update that wiki page. – Jack O'Connor Nov 7 '17 at 23:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.