41

I have a fresh installation of Ubuntu 20.04 with LaTeX (via packages texlive, texlive-latex-extra and texlive-lang-english), but cannot make work tlmgr. What I have done:

$ tlmgr install dirtree
(running on Debian, switching to user mode!)
/usr/bin/tlmgr: unexpected return value from verify_checksum: -5

For this I found in other thread that their key has expired recently: tlmgr: unexpected return value from verify_checksum: -5 for main repository. Hence next:

$ tlmgr install dirtree --verify-repo=none
(running on Debian, switching to user mode!)
tlmgr: Local TeX Live (2019) is older than remote repository (2020).
Cross release updates are only supported with
  update-tlmgr-latest(.sh/.exe) --update
See https://tug.org/texlive/upgrade.html for details.

OK. Downloaded and run the update-tlmgr-latest.sh script from http://mirror.ctan.org/systems/texlive/tlnet/update-tlmgr-latest.sh and got (btw the --update option is not recognized):

$ sh update-tlmgr-latest.sh
Verifying archive integrity... All good.
Uncompressing TeX Live Manager Updater  100%  
./runme.sh: Cannot find TeX Live root using kpsewhich --var-value=SELFAUTOPARENT.
./runme.sh: (no tlpkg/texlive.tlpdb and/or tlpkg/tlpobj/.)
./runme.sh: Please set your PATH as needed, otherwise it's hopeless.

I am also hopeless. What is "as needed" supposed to mean?

fakub
  • 513
  • 1
  • 4
  • 5
  • 1
    I can't help, but I banged my head on this too and then discovered that I could simply use apt to install the latex packages I needed. I'm not sure just what the tlmgr is, but I think it's supposed to be useful for more than just installing packages. So, it's unfortunate that it's broken like this. I hope someone can illuminate. – jjon Apr 28 '20 at 18:27
  • 1
    @jjon tlmgr is only used if you install TeX Live from the install script on the TeX Live website (https://www.tug.org/texlive/acquire-netinstall.html). If you install via apt then additional packages also need to be installed via apt. I usually install the apt package texlive-full to have everything installed at once. – Marijn May 17 '20 at 09:29
  • 2
    Basically tlmgr can/should not be used with TeX live distributions installed via your Linux distribution's package repository (i.e. via apt/apt-get/yum). In that case new packages can be installed by installing the relevant package collection from the Linux package repository. Usually these TeX live installations are frozen and can not be updated, but if they are updated they are updated via the package repository (apt, yum, ...) and not via tlmgr. – moewe May 21 '20 at 16:11

3 Answers3

32

I had the same issue and solved it by reinstalling TexLive.

Firstly, you should uninstall all existing TexLive installations:

sudo apt-get remove texlive*
rm -rf /usr/local/texlive/20*
rm -rf ~/.texlive20*

Next, you must create a place for your new TexLive distribution to live, and give your user ownership of this directory

sudo mkdir -p /usr/local/texlive/$(date +%Y)
sudo chown -R "$USER" /usr/local/texlive

Download and manually install TexLive

mkdir /tmp/texlive
cd /tmp/texlive
wget http://mirror.ctan.org/systems/texlive/tlnet/install-tl.zip
unzip ./install-tl.zip -d install-tl
cd install-tl/install-tl-$(date +%Y%m%d)
perl ./install-tl

When you are in perl console then press "i" to install

Enter command: i

Post-Installation: you need to add to the path environment (change the year accordingly to your installation)

export MANPATH="$MANPATH:/usr/local/texlive/2022/texmf-dist/doc/man"
export INFOPATH="$INFOPATH:/usr/local/texlive/2022/texmf-dist/doc/info"
export PATH=/usr/local/texlive/2022/bin/x86_64-linux:$PATH

Test your installation

latex small2e

If everything is correct, do not forget to remove the installation directory.

rm -rf /tmp/texlive
duylamvo
  • 456
  • 5
  • 5
  • 4
    Don’t forget to also update MANPATH and INFOPATH. Better yet, put them in /etc/profile. If you are the only user and all your accounts use bash, this doesn’t matter, but technically, in case any user selects a different shell such as tcsh or ash, you would want to use POSIX-compliant syntax: PATH=/usr/local/texlive/2020/bin/x86_64-linux:$PATH followed by export PATH. – Davislor May 21 '20 at 17:51
  • 3
    Step cd install-tl might require cding one more directory lower. Based on the date (today is 06/27/2020) the install-tl script was located in install-tl/install-tl-20200627. – quapka Jun 27 '20 at 13:34
  • 3
    Also had to manually create /usr/local/texlive/2020 and set its ownership to my user. – quapka Jun 27 '20 at 13:37
  • 2
    Why don't you use apt-get for the installation again? – user3072843 May 06 '21 at 18:20
  • 2
    These instructions are really super, and much clearer than the website! – Colin Feb 06 '22 at 08:17
  • 1
    The commands pdflatex and texlive do not work after this... I have also ran the export commands. – Shayan Jul 11 '22 at 11:01
  • Missing quotation marks in the "Post-Installation" step: export PATH="/usr/local/texlive/2022/bin/x86_64-linux:$PATH" – Kevin Nov 04 '23 at 16:03
17

the short solution is: this error is because your TexLive 2019 is trying to use a TexLive 2020 ftp repository. You should change to the right (correct) repository. Type this commands in a Terminal:

tlmgr repository add ftp://ftp.math.utah.edu/pub/tex/historic/systems/texlive/2019/tlnet-final
tlmgr repository list
tlmgr repository remove http://mirror.ctan.org/systems/texlive/tlnet
tlmgr option repository ftp://ftp.math.utah.edu/pub/tex/historic/systems/texlive/2019/tlnet-final

After that you can install the package with this command:

tlmgr --verify-repo=none install dirtree

I added the --verify-repo parameter to avoid get this error: tlmgr: unexpected return value from verify_checksum: -5 for main repository

This 2nd error is previously explained here: tlmgr: unexpected return value from verify_checksum: -5 for main repository

  • I cannot recommend this solution: /usr/bin/tlmgr: TLPDB::from_file could not initialize from: ftp://tug.org/historic/systems/texlive/2019/tlnet-final/tlpkg/texlive.tlpdb – user3072843 May 06 '21 at 18:17
  • yeah you can get ocassionally this error:
    
    
    – Rogelio Prieto Sep 23 '21 at 14:06
  • But this error is because the server is busy with too many connections. You can wait some minutes and try again!

    You can read this in documentation:

    "Using a mirror is recommended. The tug.org server has strict limits on the number of ftp connections, so if you have trouble connecting (e.g., to get an old TeX Live or MacTeX), please try one of the mirrors. Be advised that browsers generally report some vague problem on the server when the actual issue is simply too many connections. "

    Source: https://www.tug.org/historic/

    – Rogelio Prieto Sep 23 '21 at 14:14
  • Mine stalls forever, but when I used a mirror (ftp://ftp.math.utah.edu/pub/tex/historic/systems/texlive/2019/tlnet-final) instead, it worked. Just edited the answer to use the mirror instead. Here is a list of mirrors if that one doesn't work at some point in the future: https://www.tug.org/historic/ – Joshua Meyers Jan 04 '22 at 23:30
  • Just tlmgr repository add ftp://ftp.math.utah.edu/pub/tex/historic/systems/texlive/2019/tlnet-final tlmgr option repository ftp://ftp.math.utah.edu/pub/tex/historic/systems/texlive/2019/tlnet-final is enough – gijswijs Jul 05 '22 at 04:22
  • This should be the accepted answer - works like charm, thanks! – harald Oct 27 '22 at 19:19
3

I recently have the same problem, you need to edit the path correctly by going to your .bashrc running:

gedit /home/<username>/.bashrc

and setting in the .bashrc file:

export PATH=/usr/local/texlive/2020/bin/x86_64-linux:$PATH
export MANPATH=/usr/local/texlive/2020/texmf-dist/doc/man:$MANPATH
export INFOPATH=/usr/local/texlive/2020/texmf-dist/doc/info:$INFOPATH

(Maybe you need to check your installation folder for this, if it is default then you can use these code). Initially i have only this (Only for check, don´t use this):

export PATH=:$PATH/usr/local/texlive/2020/bin/x86_64-linux
export MANPATH=/usr/local/texlive/2020/texmf-dist/doc/man
export INFOPATH=/usr/local/texlive/2020/texmf-dist/doc/info

When you have corrected the PATH re-run the sh and you can get this:

sh update-tlmgr-latest.sh -- --upgrade
Verifying archive integrity... All good.
Uncompressing TeX Live Manager Updater  100%  
./runme.sh: updating in /usr/local/texlive/2020...
./runme.sh: tlmgr version says this is TeX Live 2020,
./runme.sh: and this updater script created: Wed Jun  3 00:11:12 CEST 2020.
./runme.sh: have TL 2020, new version also 2020;
./runme.sh: using --upgrade doesn't make sense; terminating.
(./runme.sh: makeself creation date = Wed Jun  3 00:11:12 CEST 2020.)

And finally update your tlmgr.

EDIT These steps don't solve the problem for install packages (at least for me). I want to give more steps for finally can install or use your tlmgr, ehwn I try to use tlmgr updated I got:

    You don't have permission to change the installation in any way,
specifically, the directory /usr/local/texlive/2020/tlpkg/ is not writable.
Please run this program as administrator, or contact your local admin.
tlmgr: An error has occurred. See above messages. Exiting.

For solve this you need to install programs following:

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

Reference: Last comment in Permission problem when installing package from tlmgr

And if you need, update tlmgr using:

sudo env PATH="$PATH" tlmgr update --self

Or if you want to update all your instalation try:

sudo env PATH="$PATH" tlmgr update --self --all