I want to use latex inside WSL (Ubuntu 18.04 is what shows in my Apps and Features) because I want a linux-based install (to use bash scripts, etc.). I managed to install TeX Live following instructions for Installing TeX Live over the Internet. I have a /usr/local/texlive/2018 that is OK, and the latex commands, etc. work fine.

The trouble I have is with updates or installing other packages. tlmgr seems partially borked in WSL. For example, I want to install packages and fonts:

$ sudo tlmgr install collection-fontsrecommended

I get an error about Cannot find main repository, you have to tag one as main! (but there are also errors about missing xzdec).

So, I try to set the repository, and still get the xzdec error:

$ sudo tlmgr option repository http://mirror.ctan.org/systems/texlive/tlnet
(running on Debian, switching to user mode!)
/usr/bin/tlmgr: Initialization failed (in setup_unix_one):
/usr/bin/tlmgr: could not find a usable xzdec.
/usr/bin/tlmgr: Please install xzdec and try again.
tlmgr: Couldn't set up the necessary programs.
Installation of packages is not supported.
Please report to texlive@tug.org.
tlmgr: Continuing anyway ...
tlmgr: setting default package repository to http://mirror.ctan.org/systems/texlive/tlnet

Googling the xzdec package error, I found it can be installed with sudo apt-get install xzdec. But on my WSL I get the following:

$ sudo apt-get install xzdec
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package xzdec

Can xzdec be installed in WSL? What's the trick? More info about xzdec

Is TeX Live the best option for LaTeX under WSL?


I solved the problem by updating my Ubuntu 18.04:

$ sudo apt-get update

It installed a bunch of stuff (I apparently have never done that since installing WSL from the Microsoft Store).

Afterwards, the $ sudo apt-get install xzdec succeeds, and so do the $ sudo tlmgr ... commands.

However, I'm now realizing there's a conflict with the default Ubuntu 18.04 installs of latex. Before you install TeX Live (2018), make sure you remove the default install first.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.