Find the answer to your Linux question:
Results 1 to 10 of 10
Hi. I moved /usr/local to a different partition and now I'm seeing a problem with the PATH variable. Under Gnome, or a Gnome terminal, it's dropped /usr/local/bin. If I log ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Feb 2006
    Location
    Halifax, UK
    Posts
    5

    PATH environment variable initialization


    Hi.

    I moved /usr/local to a different partition and now I'm seeing a problem with the PATH variable. Under Gnome, or a Gnome terminal, it's dropped /usr/local/bin.

    If I log in to command line my PATH variable starts /usr/local/bin:/bin:/usr/bin...

    A Gnome terminal gives me /bin:/usr/bin...

    Consequently I can't run applications in /usr/local/bin unless I specify the full path. I know I can add the path in my own profile, but that's not the point.

    Please can anyone point me to the correct file to change so that all regular users have /usr/local/bin in their PATH env. variable. (RedHat 9 with Gnome 2.10)

    TIA

  2. #2
    Linux Engineer Zelmo's Avatar
    Join Date
    Jan 2006
    Location
    Riverton, UT, USA
    Posts
    1,001
    Check your /etc/profile for a PATH statement (near the top in mine). This file gets sourced by all shells. If the path is correct in there, then Gnome is probably overriding it.
    Stand up and be counted as a Linux user!

  3. #3
    Just Joined!
    Join Date
    Feb 2006
    Location
    Halifax, UK
    Posts
    5
    Thanks Zelmo,

    Yeh, checked /etc/profile. It adds /usr/X11R6/bin to PATH (and various sbin folders for root). But it doesn't add /usr/local/bin:/bin:/usr/bin as I see with a command line login.

    Looked through /etc/inittab and various files in /etc/rc.d. Also /etc/bashrc and the files in /etc/profile.d. Also done a search for files that changed around that time. Not making much progress.

  4. #4
    Just Joined!
    Join Date
    Jan 2006
    Posts
    77
    maybe i didn't understand correctly, but if it doesn't add it, add it yourself...just type :/usr/local/bin in /etc/profile where the other paths are.

  5. #5
    Just Joined!
    Join Date
    Feb 2006
    Location
    Halifax, UK
    Posts
    5
    Cheers Marlowe,

    you do understand I think. I can add it myself, but I wondered what had changed. I moved /usr/local to a different partition, which broke something. I don't know what it broke, but the result is that /usr/local/bin is no longer in the PATH. I want to understand and fix the problem rather than just change something else to work around it.

  6. #6
    Linux User DThor's Avatar
    Join Date
    Jan 2006
    Location
    Ca..na...daaa....
    Posts
    319
    If I could make a suggestion, a far better and less stress-causing approach to this(which I assume is based on available disk space?) is to move the contents of /usr/local/ to your other partition and then create a link to it at the correct location e.g. after moving /usr/local to /part2/new_local_location and ensuring /usr/local no longer exists, then enter(as root):

    ln -s /part2/new_local_location /usr/local

    This is by far a more recommended approach.

    However, it's a valid point that you want to figure out what's going on. I'm a little confused, however, since none of this has any effect at all on how user's PATHs are set. You can move directories around at will, but it doesn't affect that. The other confusion I'm having is that you say you moved /usr/local and somehow user PATHs changed. The only way that is possible is if you somehow sourced a file in that location that altered your PATH, and with it gone, it doesn't work. Again, not knowing why you did this in the first place makes it harder to debug.

    DT

  7. #7
    Just Joined!
    Join Date
    Jan 2006
    Posts
    77
    i don't think this is a workaround....i think it's just a solution. of course there might be other ways to solve this but is it really worth it?

    cheers

  8. #8
    Just Joined!
    Join Date
    Feb 2006
    Location
    Halifax, UK
    Posts
    5
    Cheers DT. Yes, low on space and this got some more. I didn't expect it to make any difference to paths either.

    Marlowe, thanks again.

    Let me ask a slightly different question then please. Logging in to command line gives me a path of /usr/local/bin:/bin:/usr/bin:/usr/X11R6/bin... it then continues with the items I add in my profile.

    The /usr/X11R6/bin part is added to the existing $PATH in /etc/profile. So, where is $PATH set before /etc/profile adds it's bit?

    Can't find anything in my Linux admin guide and Google isn't turning up anything on various searchs.

    Many thanks for thanking the time to reply. I have (as you suggested Marlowe) added /usr/local/bin to my own profile.

  9. #9
    Just Joined!
    Join Date
    Jan 2006
    Posts
    77
    "So, where is $PATH set before /etc/profile adds it's bit?"

    that's a good question.i'm guessing that those are "built-in" so to speak. i'll search around and post back if i find anything.

  10. #10
    Just Joined!
    Join Date
    Feb 2006
    Location
    Halifax, UK
    Posts
    5
    Hi All,
    feel I'm making some progress with this at last, though not there yet. Found this web site:

    http://www.faqs.org/docs/Linux-mini/Path.html

    which seems to detail path settings. Need to play around a little, but will report back here with anything useful.

    Regards
    Steve Lilley

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •