3

I wanted to uninstall texlive on ubuntu and used apt remove texlive but some program still found /usr/bin/latex so I removed that by hand (rm). When I reinstalled texlive with apt install texlive the /usr/bin/latex file was not restored.

2
  • app remove texlive is not supposed to do anything. Did you mean apt remove texlive? Aug 3, 2021 at 12:36
  • 1
    Don't rm stuff in /usr/bin or you might break your system. Use dpkg -S to find the package that owns a file and remove that package.
    – eesiraed
    Aug 3, 2021 at 23:14

2 Answers 2

6

You can find out which installed package the file the you deleted belongs to using

dpkg -S /usr/bin/latex

Then reinstall that package (it's probably texlive-latex-base)

sudo apt install --reinstall texlive-latex-base
3

It may be a good idea to install texlive-full, so that all available LaTeX packages are installed as well (you won't get missing something.sty errors, and wouldn't have to manually find how to fix them).

The following command should reinstall any missing files.

sudo apt install --reinstall texlive-full
4
  • I tried sudo apt install --reinstall texlive, ls: cannot access '/usr/bin/latex': No such file or directory
    – Felix B.
    Aug 3, 2021 at 12:44
  • I want to avoid the additional ~5GB of texlive-full. I mean who installs all python packages whenever they install python? That seems like a weird practice. The ones I actually need will pile up soon enough
    – Felix B.
    Aug 3, 2021 at 12:46
  • 1
    @FelixB. when you use Ubuntu distribution packages for Tex Live (instead of the native tlmgr package manager) then you cannot (easily) install individual additonal LaTeX packages. There are a number of predefined package collections that you can install but it can take a bit of trouble to find out which collection you need for a specific LaTeX package. Therefore it is easier to just install texlive-full and be done with it, 5GB is not so much these days with terrabytes of disk space and fast internet (and some packages are not in a separate collection, only in texlive-full).
    – Marijn
    Aug 3, 2021 at 12:51
  • @Marijn okay fair enough. I am usually using miktex and this is ubuntu inside wsl which I did not want to clutter up immediately for some cross platform testing. I guess one should use tlmgr instead then
    – Felix B.
    Aug 3, 2021 at 12:54

Not the answer you're looking for? Browse other questions tagged .