Monday, April 29, 2024
 Popular · Latest · Hot · Upcoming
22
rated 0 times [  22] [ 0]  / answers: 1 / hits: 16967  / 1 Year ago, fri, march 3, 2023, 3:57:49

I have installed TeX Live 2011 vanilla and I have trouble setting the TeX Live path for root (in Ubuntu 11.10).



The problem is that when I run sudo tlmgr I get:



sudo: tlmgr: command not found


To fix the path for non-root it was sufficient to add



PATH=/usr/local/texlive/2011/bin/x86_64-linux:$PATH


to /etc/profile.



I have tried adding this same line to /root/.bashrc and I have also tried to add it to /etc/profile.d/zzz-texlive.sh like Herbert suggest in https://tex.stackexchange.com/questions/26624/tlmgr-inaccessible/26626#26626 but it does not help.


More From » sudo

 Answers
1

Quick fix: since you already have the correct $PATH set in your
environment (via the /etc/profile modifications) you can use:



sudo env PATH="$PATH" tlmgr


Basically, sudo resets the value of
$PATH (the whole environment, indeed) to a "known good" one, and is
thus ignoring any changes you made to your local environment. The
env command above sets the PATH variable
in the environment of the tlmgr it executes, so it runs with the
value of $PATH you specify on the command line.



To avoid typing all that for each TeXlive command, you can define an
alias in your shell: add the following line to the .bashrc file in
your home:



alias psudo='sudo env PATH="$PATH"'


and then you can simply issue this at a command prompt:



psudo tlmgr


In addition, sudo does not run a
login shell to execute the command, which is why your "profile.d"
tricks did not work for root. You can force
sudo to execute a command in a
shell, which is an alternate way of achieving the same effect:



sudo sh -l -c tlmgr


Again you can define a shell command alias to shorten this:



alias shsudo='sudo sh -l -c'


which can be used as:



shsudo tlmgr

[#43056] Saturday, March 4, 2023, 1 Year  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
percol

Total Points: 493
Total Questions: 116
Total Answers: 107

Location: Taiwan
Member since Mon, Sep 6, 2021
3 Years ago
;