You are not logged in.

#1 2025-04-12 21:58:18

ShaiAvr
Member
From: Israel
Registered: 2025-03-30
Posts: 24

Can't update latex packages with tlmgr (tlmgr not found with sudo)

I am new to Arch, and I tried to install TeX Live. I read the article https://wiki.archlinux.org/title/TeX_Live. I chose to go with the native installer since I prefer to have daily updates to packages. After the installer finished, I added the paths it gave me to the `MANPATH`, `INFOPATH` and `PATH` variables and restarted the shell. According to the wiki page, running `tlmgr update --all` should upgrade all the packages I have. I tried to run that command, but it complained that I don't have permissions:

tlmgr: package repository https://ctan.mc1.root.project-creative.net/systems/texlive/tlnet (verified)
You don't have permission to change the installation in any way,
specifically, the directory /usr/local/texlive/2025/tlpkg/ is not writable.
Please run this program as administrator, or contact your local admin.
tlmgr: An error has occurred. See above messages. Exiting.

So I tried to run it as sudo: `sudo tlmgr update --all`, but then it couldn't find the `tlmgr` command at all:

sudo: tlmgr: command not found

Clearly, the paths are set correctly since `tlmgr` worked without sudo, and other commands such as `latex`, `lualatex`, etc also work. However, trying to run `tlmgr` as sudo caused it not to recognize the command. How is it even possible that the command works normally, but doesn't work with sudo, and how can I fix this?

Offline

#2 2025-04-13 10:00:03

Lone_Wolf
Administrator
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 13,540

Re: Can't update latex packages with tlmgr (tlmgr not found with sudo)

Post the outputs of

$ echo $PATH
$ type -a tlmgr
$ sudo echo $PATH
$ sudo type -a tlmgr
$ ls -al /usr/local/texlive/2025/tlpkg/

Moderator Note
texlive native install is not using pacman or archlinux repos, moving  to GNU/Linux Discussion


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.

clean chroot building not flexible enough ?
Try clean chroot manager by graysky

Offline

#3 2025-04-13 13:43:44

bobbes
Member
Registered: 2025-04-13
Posts: 1

Re: Can't update latex packages with tlmgr (tlmgr not found with sudo)

The behavior you're experiencing is most likely related to the following option being enabled in your /etc/sudoers:

## Use a hard-coded PATH instead of the user's to find commands.
## This also helps prevent poorly written scripts from running
## arbitrary commands under sudo.
Defaults secure_path="/usr/local/sbin:/usr/local/bin:/usr/bin"

You may want to add your TeX Live installation directory to this list, or you could simply run the command this way:

sudo $(which tlmgr)

Offline

#4 2025-04-13 14:42:09

ReDress
Member
From: Nairobi
Registered: 2024-11-30
Posts: 133

Re: Can't update latex packages with tlmgr (tlmgr not found with sudo)

bobbes wrote:
sudo $(which tlmgr)

Aah, that's an interesting one. Never thought about it this way.

Offline

#5 2025-04-13 15:41:42

ShaiAvr
Member
From: Israel
Registered: 2025-03-30
Posts: 24

Re: Can't update latex packages with tlmgr (tlmgr not found with sudo)

Adding the TeX installation directory to the secure_path indeed solved this. Thank you.
Is there a recommended approach to secure_path? Should I just add my custom paths to it, or is there a more secure or preferred approach?

Offline

Board footer

Powered by FluxBB