LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Why I can't store LD_LIBRARY_PATH in profile ? (https://www.linuxquestions.org/questions/linux-newbie-8/why-i-cant-store-ld_library_path-in-profile-874743/)

shaen777 04-13-2011 06:01 AM

Why I can't store LD_LIBRARY_PATH in profile ?
 
Hi,

I can't store LD_LIBRARY_PATH in /etc/profile. After restart the variable is empty. All OK with any other variable, for example INFORMIXDIR, but not with LD_LIBRARY_PATH.
If I use EXPORT command in the console all OK. I'm using Ubuntu 10.04. What's wrong?

bathory 04-13-2011 06:20 AM

Are you sure you add:
Code:

export LD_LIBRARY_PATH=/some/path:/some/other/path
in /etc/profile and it's not unset by some settings in .profile?

shaen777 04-13-2011 06:35 AM

yes, I'm sure. It looks like something unset this variable. I also tried to set in .profile, the same result. Any other variable works fine.

bathory 04-13-2011 07:04 AM

Just tested on an Ubuntu server (no X) and it works. In fact I can set it either through /etc/profile, /etc/bash.bashrc or in a file /etc/profile.d/ld_library.sh

Reading this, looks like it's unset when gdm starts. There are 2 workarounds (posts #17 and #21) there, so try any of them and see if you manage to keep the variable set.

shaen777 04-13-2011 07:22 AM

Dear bathory, thank you for your prompt and quick response. Post 17 from your link resolved my problem.

shaen777 04-14-2011 02:32 AM

LD_LIBRARY_PATH is still empty in xterm. How to store the variable for xterm too?
PATH is OK in xterm but not LD_LIBRARY_PATH.

bathory 04-14-2011 03:08 AM

Does this happen only for xterm, or for other terminals too? I don't get it. If the variable is set globally, how can it be unset per application.
Anyway you can create an alias
Code:

alias xterm='LD_LIBRARY_PATH=/some/path:/other/path /usr/bin/xtern'

shaen777 04-14-2011 03:20 AM

where can I type it? in the console or store in some file? I checked only xterm and terminal. terminal is OK.

bathory 04-14-2011 03:42 AM

If you want to set it only for you, you can put it in ~/.bashrc. In general in /etc/bash.bashrc, but you should check if it works

shaen777 04-14-2011 04:56 AM

thanks for the idea, but it doesn't work for me

I've added

alias xterm='LD_LIBRARY_PATH=/mypath1:/mypath2 /usr/bin/xterm'

to ~/.bashrc

LD_LIBRARY_PATH still empty in xterm.
Any other variables are OK - PATH, ORACLE_HOME, etc.

bathory 04-14-2011 05:24 AM

Another ubuntu "bug"! Solution on post #3 (remove suid/sgid)

shaen777 04-14-2011 05:46 AM

thanks for the link, how can I remove the s-flags from xterm?

bathory 04-14-2011 06:21 AM

Run either one:
Code:

chmod -s /usr/bin/xterm
chmod 755 /usr/bin/xterm


shaen777 04-14-2011 06:30 AM

BIG THANKS!!!
it works!!!


All times are GMT -5. The time now is 02:48 PM.