[Tex/LaTex] tlmgr in Ubuntu 20.04: “Local TeX Live (2019) is older than remote repository (2020)” (and subsequent issues)

tlmgrUbuntu

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?

Best Answer

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

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