LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 03-03-2012, 10:21 PM   #1
yaximik
Member
 
Registered: Nov 2010
Posts: 87

Rep: Reputation: 0
Question Problems setting PATH for specific application installed in /opt


Dear Linux gurus,

I have a rather stupid question, but I just cannot get what is wrong. A while ago I installed (as root) 454 analysis software, which by deafault installs in /opt/454/. Now, either as root, or as a user, I was supposed to modify corresponding .bash_profile files to include the installation directory, which I did by adding the following line to .bash_profile:

export PATH=$PATH:$HOME/bin:/opt/454/bin

However, when I log in, either as root or as a user, this directory is not included in $PATH, that is issuing any command that targets any entry in the /opt/454/bin folder results in the same response:

[yaximik@G5NNJN1~]$ gsAssembler
bash: gsAssembler: command not found
[yaximik@G5NNJN1~]$
[yaximik@G5NNJN1~]$ export PATH=$PATH:/opt/454/bin
[yaximik@G5NNJN1~]$ gsAssembler
<the program is launched normally>

However, after logoff and login again, the same occurs, even if the .bash_profile has the correct entry mentioned above:

[yaximik@G5NNJN1 ~]$ gsAssembler
bash: gsAssembler: command not found
[yaximik@G5NNJN1 ~]$ echo $PATH
/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin
[yaximik@G5NNJN1 ~]$ export PATH=$PATH:/opt/454/bin
[yaximik@G5NNJN1 ~]$ gsAssembler
<the program launches normally>

[yaximik@G5NNJN1 ~]$ echo $PATH
/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin:/opt/454/bin
[yaximik@G5NNJN1 ~]$

The same occurs when login as root.

What I am doing wrong?
 
Old 03-04-2012, 12:34 AM   #2
xeleema
Member
 
Registered: Aug 2005
Location: D.i.t.h.o, Texas
Distribution: Slackware 13.x, rhel3/5, Solaris 8-10(sparc), HP-UX 11.x (pa-risc)
Posts: 987
Blog Entries: 4

Rep: Reputation: 252Reputation: 252Reputation: 252
Greetingz!

You noted that you were supposed to...
Quote:
I was supposed to modify corresponding .bash_profile files to include the installation directory, which I did by adding the following line to .bash_profile:
export PATH=$PATH:$HOME/bin:/opt/454/bin
1) Are you actually using bash as your shell?
Just do "ps" and see if bash is listed.
Code:
server$ ps
  PID TTY          TIME CMD
 5051 pts/33   00:00:00 bash
 5111 pts/33   00:00:00 ps
2) Did you actually modify the .bash_profile file in your home directory?
a) Login as yourself and do this; "grep 454 ~/.bash_profile"
b) Login as root and do this; "grep 454 ~/.bash_profile"
3) If you do not see that "PATH=$PATH:/opt/454/bin" line in either .bash_profile, add it.
4) If you *do* see that line in one of the .bash_profile files, then you need to see if you have a .bashrc file, too. (If you do, add that line in that file.)
 
Old 03-04-2012, 12:54 AM   #3
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,576
Blog Entries: 31

Rep: Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195
Maybe you are using sh, not bash, in which case ~/.bash_profile is not run and any ~/.profile is run instead. What is the seventh field in /etc/passwd for your user and root?

If you are using bash, maybe ~/.bash_profile sources some more bash code that undoes the PATH setting. You could test this by adding set -xv at the beginning of ~/.bash_profile and running bash --login
 
Old 03-06-2012, 08:52 AM   #4
yaximik
Member
 
Registered: Nov 2010
Posts: 87

Original Poster
Rep: Reputation: 0
Hi all,

Thanks for your responses.

1) Yes, I am using bash both as root and user.

2) Yes, I did modify the corresponding files in their correct directories, that is both in user's and root's directories.

2a,b; 3) Obviously not, and this is the problem, I guess, that I cannot understand. In root's .bash_profile, there is an entry at the very end of the file:

export PATH=$PATH:$HOME/bin:/opt/454/bin

In user's .bash_profile, there is no such entry.

But result is the same. Right after login, $PATH does not include the path to /opt/454/bin directory, since neither of the programs, scripts or aliases from that directory are recognized:

bash: sfffile: command not found

Also, the string returned after echo $PATH does not include any reference to /opt/454/bin

All this is fixed by entering export PATH=$PATH:/opt/454/bin from the command line in either account. The programs from that folder now launch normally and the string returned after echo $PATH now includes the correct reference.

But this all get lost after logout. Even if I manually add the reference line in .bash_profile, save it, and reopen to make sure the reference line stays in the file, nothing changes - reference to /opt/454/bin has to be added to $PATH manually after log-in in order to execute any programs from this directory.

4) I inspected .bashrc files, both have the same entry:

#source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi


I certainly can try to add the line to .bashrc and see what happens, but I just want to understand why I need to do this, I mean what makes my installs of RHEL55 or CentOS54 to require what was not recommended by installation instructions?
 
Old 03-06-2012, 09:15 PM   #5
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,576
Blog Entries: 31

Rep: Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195
Quote:
Originally Posted by yaximik View Post
4) I inspected .bashrc files, both have the same entry:

#source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
That's a typo for "I inspected .bash_profile files", no?

Did you try the set -xv technique I suggested to see what is happening?
 
Old 03-06-2012, 09:53 PM   #6
yaximik
Member
 
Registered: Nov 2010
Posts: 87

Original Poster
Rep: Reputation: 0
Catkin,

That was not mistype, that was response to comment 4) from xeleema. I missed your advice. Now I added entry set -xv to .bash_profile. After bash --login I got long output, which does not mean much to me as a novice. But after bash --login I got the /opt/454/bin added to $PATH. Still after logout and re-login the same story - the path is not added until I run bash --login from the command line. If I comment set -xv out, I get the same effect after bash --login, that is the directory is added to $PATH, but only for the current session and it is lost after logout.
 
Old 03-06-2012, 10:24 PM   #7
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,576
Blog Entries: 31

Rep: Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195
Sorry -- I misread /etc/bashrc as ~/bashrc

Thanks for trying the set -xv experiment. The results imply that the normal way you login is somehow different from bash --login. That's unexpected.

If you have an /etc/profile.d directory, please move all the files in it to somewhere else. I'm not sure how bash would cope with that directory being empty so create a single empty file in there called empty.sh Then re-test.

If you still have the same problem, please post all the bash startup files: /etc/profile, ~/.bash_profile and any files they source, either via the source command or the . command.

If you no longer have the same problem, you know it was caused by something in the /etc/profile.d directory and you can progressively move the original files back into it until you find which one(s) trigger the problem. And remove empty.sh.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
convert dos2unix /opt/SV DC/*.* using system command.Here path is having space. nagendrar Linux - Newbie 1 08-06-2009 06:27 AM
want to install third part application under /opt yogesh619 Linux - Newbie 3 07-21-2008 12:51 PM
Problems setting $PATH Lord Zoltar Slackware 2 02-08-2005 12:19 AM
problems setting up PATH in ubuntu lemuel Linux - General 7 01-15-2005 12:51 AM
setting PATH problems. CORE3 maddoggames Fedora 8 12-29-2004 03:57 PM


All times are GMT -5. The time now is 08:38 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration