Setting TeX Live path for root

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

If you add the symlinks then you won't need to make a script. You can do this two ways:

Using the GUI:

  1. sudo env PATH="$PATH" tlmgr --gui.
  2. Click 'Actions -> Handle symlinks in system dirs'.
  3. Click 'Update symbolic links'.

Using the command line (untested, since I used the GUI):

  1. sudo env PATH="$PATH" tlmgr path add. (find more information at tlmgr documentation)

What worked for me: I started tlmgr in gui mode with

sudo env PATH="$PATH" tlmgr --gui

and then in the third menu chose the last item but one (in my German menu, that is menu "Aktionen" (actions?) and item "Verwaltung der symbolischen Links" (administration of symbolic links?). In the ensuing dialogue window I clicked the button "Symbolische Links erneuern" (renew symbolic links?). Now

sudo tlmgr --OPTIONS

works without problems. I'm sure there's also a command line way of doing this ;)