Setting LD_LIBRARY_PATH on a per-user basis during login
- Date: Sun, 18 Jun 2017 13:52:05 +0200
- From: "Martin R. Neuhaeusser" <post@xxxxxxxxxx>
- Subject: Setting LD_LIBRARY_PATH on a per-user basis during login
I am trying to set the LD_LIBRARY_PATH environment variable during the
login process on a per user basis in Debian stretch. According to the
documentation here https://wiki.debian.org/EnvironmentVariables,
it should be enough to set the environment variable in $HOME/.profile.
And this really works flawlessly for non-graphical logins. The first
bad thing that I had to realize is that for graphical logins, .profile
is just not read. As it seems, one has to source .profile in a (Debian-
specific) file which is called $HOME/.xsessionrc to ensure that
.profile is read during graphical logins.
Is it really expected behaviour that by default, all setting in
.profile are ignored for graphical logins whereas they are evaluated
for non-grahical ones?
But sadly, the story for setting LD_LIBRARY_PATH on a per-user basis
does not end here. And this leads me to my actual question:
Once I source $HOME/.profile from $HOME/.xsessionrc and login
graphically, all variables that I define within $HOME/.profile are set
as expected _except_ LD_LIBRARY_PATH. It seems that someone clears
exactly this variable (on purpose?) without caring at all about its
content. After some hours of trial-and-error, I finally gave up. Has
anyone else encountered this problem and knows a solution? I do not
even know which package to raise a bug report against...
It might be related to a similar discussion on Ubuntu:
I believe there are very good reasons to allow different users to
adjust the LD_LIBRARY_PATH according to their build environments and
local libraries. Why this variable is handled in such an exceptional
way only when logging in graphically, is hard to explain, I believe.
Any hints or help is highly appreciated.