SlackwareThis Forum is for the discussion of Slackware Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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.
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
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.
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?
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?
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?
Distribution: Slackware64 14.2 and current, SlackwareARM current
Posts: 1,645
Rep:
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.
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.
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.
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.
Just a tought, are you testing all this by using su?
Yes, I was.
Quote:
Originally Posted by gbonvehi
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.
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.
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:
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.