LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 04-07-2008, 07:58 PM   #1
tennis_slacker
Member
 
Registered: Apr 2008
Location: Idaho
Distribution: Slackware
Posts: 92

Rep: Reputation: 17
Setting a root path


Hi,

First post to linuxquestions and new user of Slackware (gotta love Slackware).

I am unable to texhash as root and after a lot of googling I found that you can:

export PATH=$PATH:"/usr/share/texmf/bin"

This works for the current session but when I restart the computer I lose the settings. I've searched as much as I can through google and others and I can't figure out where this path is set. I assume there's just a test file somewhere that I can enter the path.

I've tried entering the path in /etc/profile under PATHS and also under the root section but neither worked.

Any suggestions? Thanks.

Cheers,
/Bob
 
Old 04-07-2008, 08:59 PM   #2
gbonvehi
Senior Member
 
Registered: Jun 2004
Location: Argentina (SR, LP)
Distribution: Slackware
Posts: 3,145

Rep: Reputation: 53
Bash reads /etc/profile, ~/.bash_profile, ~/.profile if invoked in login mode, else it will look at ~/.bashrc .
For more information you can read bash's man page, it's all detailed there.
If you want it to be global, you can put a script on /etc/profile.d/ (look inside the directory there are other programs that uses it) or /etc/profile, I recommend the first one since it less intrusive.

If you don't know, ~ (also $HOME) refers to your user's home directory, those files are not created by default, but they're just text files, create them without fear.

Oh, and answering your question, the default PATH is set on /etc/profile
Code:
# Set the default system $PATH:
PATH="/usr/local/bin:/usr/bin:/bin:/usr/games"
I don't know why it didn't work for you. Changing that to
Code:
PATH="/usr/local/bin:/usr/bin:/bin:/usr/games:/usr/share/texmf/bin"
should work

Welcome and happy slacking

PS: You can also search this forum, it has been discussed before.
PS2: If you follow the profile.d alternative, be sure the script has executable permissions.

Last edited by gbonvehi; 04-07-2008 at 09:06 PM.
 
Old 04-07-2008, 09:34 PM   #3
tennis_slacker
Member
 
Registered: Apr 2008
Location: Idaho
Distribution: Slackware
Posts: 92

Original Poster
Rep: Reputation: 17
Yeah, I do prefer to set the 'path' globally so anyone with root access could 'texhash'.

I don't know why changing /etc/profile isn't working, but I just tried it again. I added '/usr/share/texmf/bin' to the paths in the file, rebooted and then tried to texhash as root and it didn't work. I then entered 'export PATH=$PATH:="/usr/share/texmf/bin" and then ran texhash and once again it worked.

I haven't created any files that weren't created by installation. So, my question is when I use this 'export' command where is it setting the path to or why isn't editing /etc/profile working?

Thanks for the help.

/Bob
 
Old 04-07-2008, 10:12 PM   #4
T3slider
Senior Member
 
Registered: Jul 2007
Distribution: Slackware64-14.1
Posts: 2,367

Rep: Reputation: 843Reputation: 843Reputation: 843Reputation: 843Reputation: 843Reputation: 843Reputation: 843
I honestly don't know what I'm talking about here, but have you tried `source /etc/profile` as root?
 
Old 04-07-2008, 11:10 PM   #5
gilead
Senior Member
 
Registered: Dec 2005
Location: Brisbane, Australia
Distribution: Slackware64 14.0
Posts: 4,141

Rep: Reputation: 168Reputation: 168
Can you post the entry you added to /etc/profile please? Also, how are you getting to a command line? Since you're root I'm assuming that you're logging in to a console and not a GUI - can you post the output of echo $PATH as well please?
 
Old 04-08-2008, 05:46 PM   #6
tennis_slacker
Member
 
Registered: Apr 2008
Location: Idaho
Distribution: Slackware
Posts: 92

Original Poster
Rep: Reputation: 17
First, sorry for the delay. I was away from a computer all day.

Here's what I added to /etc/profile:

# Set the default system $PATH:
PATH="/usr/local/bin:/usr/bin:/bin:/usr/games:/usr/share/texmf/bin"

I get to command line by starting Konsole, then I su to root and here's the output of echo $PATH.

echo $PATH
/usr/local/sbin:/usr/local/bin:/sbin:/usr/sbin:/bin:/usr/bin

Obviously setting /usr/share/texmf/bin in the /etc/profile default system path, per above, is not affecting the root path as demonstrated by echo $PATH. There is also a section in /etc/profile that says 'For root users, ensure that /usr/local/sbin ... ' and I've added the path in there also but that didn't work either. So, there must be some other file to update the root path or I'm doing something completely wrong?

Thanks,
Bob
 
Old 04-08-2008, 05:53 PM   #7
titopoquito
Senior Member
 
Registered: Jul 2004
Location: Lower Rhine region, Germany
Distribution: Slackware64 14.2 and current, SlackwareARM current
Posts: 1,645

Rep: Reputation: 146Reputation: 146
Bob, have you logged out after you made the change and again logged in to take the changes effect? You can also source /etc/profile ". /etc/profile" (dot space /etc/profile) instead.
 
Old 04-08-2008, 08:23 PM   #8
tennis_slacker
Member
 
Registered: Apr 2008
Location: Idaho
Distribution: Slackware
Posts: 92

Original Poster
Rep: Reputation: 17
Quote:
Originally Posted by titopoquito View Post
Bob, have you logged out after you made the change and again logged in to take the changes effect? You can also source /etc/profile ". /etc/profile" (dot space /etc/profile) instead.
Yes, I've restarted every time I make a change. From what I googled about source /etc/profile this is temporary it sets your changes for immediate use without the need to restart. Anyways, I did '. /etc/profile' and yes it worked I was able to 'texhash' as root. However, when I restarted and tried to texhash again it gave me the usual 'texhash: command not found' error.

I then found a post on Gentoo that said to set:

ROOTPATH="stuff"

in /etc/profile which I tried. Restarted and once again 'texhash: command not found'.

Is it possible that /etc/profile.d/tetex.sh is overwriting /etc/profile upon restart or something similar. I say this because I can 'export PATH=$PATH:"/usr/share/texmf/bin" or '. /etc/profile' and texhash works just fine, BUT if I restart it all goes away.

Thanks,
/Bob
 
Old 04-08-2008, 09:02 PM   #9
gbonvehi
Senior Member
 
Registered: Jun 2004
Location: Argentina (SR, LP)
Distribution: Slackware
Posts: 3,145

Rep: Reputation: 53
Just a tought, are you testing all this by using su? If you're, try using su - instead, that will sure it will read all startup files. For more information on that, read INVOCATION section on bash's man page, and probably you may want to see if konsole has a setting for starting the shell as login shell or not.
 
Old 04-08-2008, 10:29 PM   #10
T3slider
Senior Member
 
Registered: Jul 2007
Distribution: Slackware64-14.1
Posts: 2,367

Rep: Reputation: 843Reputation: 843Reputation: 843Reputation: 843Reputation: 843Reputation: 843Reputation: 843
gbonvehi makes a good point (if you are indeed using just `su`) -- `su` uses (mostly) the same system variables as the user you're `su`ing from, whereas `su -` reads the startup files and truly emulates a full root login.
 
Old 04-08-2008, 10:42 PM   #11
tennis_slacker
Member
 
Registered: Apr 2008
Location: Idaho
Distribution: Slackware
Posts: 92

Original Poster
Rep: Reputation: 17
Quote:
Originally Posted by gbonvehi View Post
Just a tought, are you testing all this by using su?
Yes, I was.

Quote:
Originally Posted by gbonvehi View Post
If you're, try using su - instead, that will sure it will read all startup files. For more information on that, read INVOCATION section on bash's man page, and probably you may want to see if konsole has a setting for starting the shell as login shell or not.
Right. Using 'su -' worked. As explained in bash's man page. Using 'su' only reads ./bashrc while 'su -' reads (in order) /etc/profile, ~/.bash_profile, ~/.bash_login, and ~/.profile.

Thanks for the tip. I had no idea (too new to linux). Although I swear I've used other distro's and been able to texhash with a simple su. Oh well, I know better know.

Thanks,
/Bob
 
Old 04-08-2008, 11:01 PM   #12
T3slider
Senior Member
 
Registered: Jul 2007
Distribution: Slackware64-14.1
Posts: 2,367

Rep: Reputation: 843Reputation: 843Reputation: 843Reputation: 843Reputation: 843Reputation: 843Reputation: 843
tennis_slacker, if you want to have texhash in your PATH using just `su` you're going to have to have it in your path for your normal user as well (you could add a line in ~/.bash_profile if you want). Unless there's another more sophisticated way of doing it, you're stuck.
 
Old 04-08-2008, 11:06 PM   #13
gbonvehi
Senior Member
 
Registered: Jun 2004
Location: Argentina (SR, LP)
Distribution: Slackware
Posts: 3,145

Rep: Reputation: 53
You're welcome. It's a normal practice (don't know if good or bad) to make su an alias for su - in your .bashrc so you don't have to type su - (I personally type it this way).
To make that alias edit your .bashrc/.bash_profile, what you use and add:
Code:
alias su='su -'
Maybe this is why all confusion was generated.

Happy slacking again
 
  


Reply



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
How do I retain the PATH in the root account even when I switch to root using su? thearchitect Linux - Newbie 1 08-13-2005 12:02 AM
Change root PATH setting ust Linux - Distributions 1 05-16-2005 07:47 AM
Setting the path davee Linux - General 7 09-26-2003 02:17 PM
Setting Java path for root adcripps Linux - General 3 03-16-2002 02:36 PM
Setting up PATH Sonny Linux - Newbie 4 01-28-2002 01:02 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 05:32 AM.

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
Open Source Consulting | Domain Registration