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?

- 307
1 Answers
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.

- 12,628
-
-
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
-
1As of systemd 233 (March 2017) there is
~/.config/environment.d
. See also https://unix.stackexchange.com/a/403196/23305. I've filed a bug for Gnome to update that wiki page. – Jack O'Connor Nov 07 '17 at 23:32
.profile
and your PATH modification seems to be in.zprofile
? – muru Dec 26 '16 at 06:01/etc/profile
. I also get the same behavior using bash. – carloabelli Dec 26 '16 at 06:05