5

I migrated from MiKTeX on windows to TeXLive in ubuntu. At first I installed texlive-full from ubuntu repositories but I realized that I wanted to install more packages which isn't very convenient when there is no tlmgr.

So I decided to removeTeXLive and reinstall it from TUG. The installation had no problems. Then I added the following lines to bashrc

export PATH=$PATH:/usr/local/texlive/2014/bin/i386-linux
export PATH=$PATH:/usr/local/texlive/2014/tlpkg/

and then I run a simple document and it seemed to be working. I tried to install a package(i.e. units) through tlmgr but I don't have permission to write to a specific directory. What I did was to use sudo privilleges but again no luck. My effort is the following

thanos@thanos-laptop:~$ tlmgr install units
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.
thanos@thanos-laptop:~$ sudo tlmgr install units
[sudo] password for thanos: 
sudo: tlmgr: command not found

I also tried through the relevant tlmgr's gui but I get the same message as above.

What can I do to install packages through tlmgr?

  • If you do sudo su and then tlmgr .... should work. But be careful with commands as root. – Sigur Jun 28 '14 at 14:39
  • You don't need to add /usr/local/texlive/2014/tlpkg/ to PATH. You should add /usr/local/texlive/2014/bin/i386-linux at the beginning of PATH rather than the end. – cfr Jun 28 '14 at 15:03
2

What I did was to let sudo know about the modification of the $PATH variable. This was done typing the following command on terminal

sudo env PATH="$PATH" tlmgr

In this way, I somehow enabled sudo in tlmgr. After that packages can be installed using

sudo tlmgr install package
2

In case anyone else tried previous suggestions and they didn't work, this worked for me:

sudo /usr/local/texlive/2015/bin/x86_64-linux/tlmgr ...
  • Using the which construction in back quotes can be of help too. For example: sudo \`which tlmgr\` gui (it is rendered not the proper way, but one can get the idea, I hope) – Leonid Jan 6 at 10:39
1

Thanos' answer basically works, but the description of multiple commands is misleading.

All root actions will need to be explicitly paired with the env modification.
By design, the environmental variables for the root user are reset every time it is invoked. If you subsequently try to execute a regular sudo command, the PATH variable will have already been reset. This holds even in a sudo su environment. So for instance, if you wanted to use the --dry-run option to preview installing a package named package, the following would NOT work:

 sudo env PATH="$PATH" tlmgr install package --dry-run

 sudo tlmgr install package

Instead, you have to fix the PATH variable every time, like this:

 sudo env PATH="$PATH" tlmgr install package --dry-run

 sudo env PATH="$PATH" tlmgr install package

The underlying problem is that a standard TeX Live installation places the binaries in a non-standard directory, so the set of PATH locations that root is designed to recognize does not include anything that came with TeX Live. By design, you are not supposed to be able to permanently modify root's PATH variable, so any task that needs privilege elevation becomes tricky.

Approaches to fixing this issue more permanently are described on the Ubuntu forums. Doing so is more involved, and I haven't tried it myself.

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.