[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Need help with PATH variable (i3/debian buster)



On Thu, Jul 30, 2020 at 11:21:54AM +0200, Benedikt Tuchen wrote:
> When I use no display manager like lightdm, I start i3 via startx in
> the console. If I do this dmenu and rofi are using my personal $PATH
> variable. For example it includes "$HOME/.local/bin". But when I
> use a display manager, dmenu and rofi do no longer have my personal
> $PATH entries. How can I change this behavior?

Every type of login follows a completely different set of steps for
configuring your environment.  Reconciling these and achieving a uniform
environment across all possible login types is *extremely* difficult,
if not impossible.

With a console login, your session consists of a login shell, with some
variables pre-populated by the login program, and by PAM.  The login
shell then reads various configuration files (in the case of bash, these
include /etc/profile and ~/.profile or possibly others; for other shells,
other files are read).

With a "regular" Display Manager login (lightdm, xdm, and so on), your
session is *not* a login shell, nor does it ever at any time include
a login shell, so files like /etc/profile and ~/.profile are never read.
At all.

With a GNOME (gdm3) login, you have *two* different session types: Wayland
or X11.  When gdm3 runs an X11 session, it's similar to the "regular" DM
from the previous paragraph.  However, when it runs a Wayland session,
a whole different set of configs is used.  I've never run Wayland in my
life, but people have said that the Debian Wayland session reads login
shell config files.  I don't know whether that's true, or which shell is
reading them, at what time, or anything.  You'll have to figure that out.

But you said lightdm and i3, not GNOME.  So we can skip all of the GNOME
horror for now.  And please believe me, there are *more* layers of GNOME
horror that I'm omitting here.  It's so much worse than you thought.

A lightdm login running a standard Debian X session reads one additional
file that is unique to Debian: ~/.xsessionrc .  You can configure
environment variables like PATH here, and they will be read and respected
by anything that runs a standard Debian X session.

See also <https://wiki.debian.org/Xsession>.


Now, after all of that, you still need to consider what your Desktop
Environment does to your environment.  You may go through all of these
steps to set your environment *just* how you like it, only to find out
that in the end, your DE takes over, wipes out some variables, and
changes others.

I suspect i3 is much more traditional and hands-off about it, but I've
never used i3, so I can't say for sure.  You may be totally fine with
just the knowledge contained in this post.  But if you find that some
variables work and others simply do not, it might be because i3 is
resetting them.  It's just a thing to keep in mind.


Reply to: