10

I have just installed texlive 2014 on a machine running Ubuntu 14.04 LTS at work. When I enter tlmgr update --self to the terminal for example, it returns the following:

tlmgr: package repository http://mirror.switch.ch/ftp/mirror/tex/systems/texlive/tlnet
You don't have permission to change the installation in any way,
specifically, the directory /usr/local/texlive/2014/tlpkg/ is not writable.
Please run this program as administrator, or contact your local admin.

as expected.

When I use sudo, however, the answer is as follows:

sudo: tlmgr: command not found

Interestingly enough though, when I enter sudo su, the command is well known. Moreover, when I enter sudo -i and then echo $PATH, the output is:

/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/texlive/2014/bin/x86_64-linux

As well as the output for echo $PATH when entered without sudo -i:

/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/local/texlive/2014/bin/x86_64-linux

Does anybody have a solution to this?

  • 1
    It seems the super user (root) doesn't have the installation directory of tlmgr in its PATH. If the OS should be able to find tlmgr for root, then use PATH=${PATH}:<installation directory of tlmgr>. (You may have to add export PATH too.) If I had to do this, I'd put the PATH=... statement in the root's login file, which I suspect is .bashrc in the root's home directory. – user10274 Sep 30 '14 at 13:38
  • 1
    My advice is to place the path to TeX binaries at the head of PATH and not at the tail. Usually I make an alias or shell function sutlmgr that does sudo /path/to/tlmgr explicitly. – egreg Sep 30 '14 at 14:06
  • the super user does indeed not have the installation directory, when I enter sudo su and then echo $PATH the directory is not printed. I added the line export PATH=/usr/local/texlive/2014/bin/x86_64-linux:$PATH to the /root/.bashrc file, but sudo will still not find the command. sudo su still works. If possible, I would like to change the root's PATH variable instead of writing an alias or shell function, though... – David Wright Sep 30 '14 at 14:22
  • I usually make a pseudo sudo called psudo: in .bashrc or a file sourced by it, I use: alias psudo='sudo env PATH="$PATH"' # usage: psudo tlmgr <whatever>. (This assumes your paths are set up normally according to the installation directions. – jon Sep 30 '14 at 15:41
  • 1
    Just an other way that works for me: sudo -i tlmgr update --all. – cjorssen Sep 30 '14 at 21:12
11

This is a more general UNIX sysadmin question, but you can use visudo to add

Defaults secure_path="/usr/local/texlive/2014/bin/x86_64-linux:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"

Edit that path for your environment! See https://wiki.debian.org/sudo or https://www.google.com/search?&q=sudo+secure_path on the web, and the manual page for sudoers(5).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.