1

I installed TeX Live 2023 using the script instead of the Arch Linux repository. However while installing other software some TeX Live packages made it into my desktop anyway, causing issues. So I tried to remove all texlive packages.

Here is the list of packages texlive packages installed on the system.

$ sudo pacman -Qs texlive*
local/texlive-basic 2023.66594-19 (texlive)
    TeX Live - Essential programs and files
local/texlive-bin 2023.66984-16
    TeX Live binaries
local/texlive-binextra 2023.66594-19 (texlive)
    TeX Live - TeX auxiliary programs
local/texlive-context 2023.66594-19 (texlive)
    TeX Live - ConTeXt and packages
local/texlive-fontsextra 2023.66594-19 (texlive)
    TeX Live - Additional fonts
local/texlive-fontsrecommended 2023.66594-19 (texlive)
    TeX Live - Recommended fonts
local/texlive-fontutils 2023.66594-19 (texlive)
    TeX Live - Graphics and font utilities
local/texlive-games 2023.66594-19 (texlive)
    TeX Live - Games typesetting
local/texlive-langcjk 2023.66594-19 (texlive-lang)
    TeX Live - Chinese/Japanese/Korean (base)
local/texlive-langenglish 2023.66594-19 (texlive-lang)
    TeX Live - US and UK English
local/texlive-langgreek 2023.66594-19 (texlive-lang)
    TeX Live - Greek
local/texlive-langjapanese 2023.66594-19 (texlive-lang)
    TeX Live - Japanese
local/texlive-langkorean 2023.66594-19 (texlive-lang)
    TeX Live - Korean
local/texlive-langother 2023.66594-19 (texlive-lang)
    TeX Live - Other languages
local/texlive-latex 2023.66594-19 (texlive)
    TeX Live - LaTeX fundamental packages
local/texlive-latexextra 2023.66594-19 (texlive)
    TeX Live - LaTeX additional packages
local/texlive-latexrecommended 2023.66594-19 (texlive)
    TeX Live - LaTeX recommended packages
local/texlive-luatex 2023.66594-19 (texlive)
    TeX Live - LuaTeX packages
local/texlive-mathscience 2023.66594-19 (texlive)
    TeX Live - Mathematics, natural sciences, computer science packages
local/texlive-metapost 2023.66594-19 (texlive)
    TeX Live - MetaPost and Metafont packages
local/texlive-music 2023.66594-19 (texlive)
    TeX Live - Music packages
local/texlive-pictures 2023.66594-19 (texlive)
    TeX Live - Graphics, pictures, diagrams
local/texlive-plaingeneric 2023.66594-19 (texlive)
    TeX Live - Plain (La)TeX packages
local/texlive-xetex 2023.66594-19 (texlive)
    TeX Live - XeTeX and packages

First, I attempted feeding pacman -S to pacman -R but since not every texlive package was installed it did not go forward.

$ sudo pacman -R $(pacman -Ssq texlive*)
error: target not found: tectonic
error: target not found: texlive-bibtexextra
error: target not found: texlive-doc
error: target not found: texlive-formatsextra
error: target not found: texlive-humanities
error: target not found: texlive-langarabic
error: target not found: texlive-langchinese
error: target not found: texlive-langcyrillic
error: target not found: texlive-langczechslovak
error: target not found: texlive-langeuropean
error: target not found: texlive-langfrench
error: target not found: texlive-langgerman
error: target not found: texlive-langitalian
error: target not found: texlive-langpolish
error: target not found: texlive-langportuguese
error: target not found: texlive-langspanish
error: target not found: texlive-meta
error: target not found: texlive-pstricks
error: target not found: texlive-publishers

So I needed to somehow filter pacman -Q instead. After a lot of attempts with my limited knowledge of grep and parameter expansion I extracted the package names.

$ for i in $(sudo pacman -Qs texlive* | grep -Eo '^local/[[:alpha:]]+-[[:alpha:]]+')
do
    echo ${i:6}
done
texlive-basic
texlive-bin
texlive-binextra
texlive-context
texlive-fontsextra
texlive-fontsrecommended
texlive-fontutils
texlive-games
texlive-langcjk
texlive-langenglish
texlive-langgreek
texlive-langjapanese
texlive-langkorean
texlive-langother
texlive-latex
texlive-latexextra
texlive-latexrecommended
texlive-luatex
texlive-mathscience
texlive-metapost
texlive-music
texlive-pictures
texlive-plaingeneric
texlive-xetex

Then I replaced echo with sudo pacman -R and ran the code.

$ for i in $(sudo pacman -Qs texlive* | grep -Eo '^local/[[:alpha:]]+-[[:alpha:]]+')
do
    sudo pacman -R ${i:6}
done
checking dependencies...
error: failed to prepare transaction (could not satisfy dependencies)
:: removing texlive-basic breaks dependency 'texlive-basic' required by texlive-binextra
:: removing texlive-basic breaks dependency 'texlive-basic' required by texlive-context
:: removing texlive-basic breaks dependency 'texlive-basic' required by texlive-fontsextra
:: removing texlive-basic breaks dependency 'texlive-basic' required by texlive-fontsrecommended
:: removing texlive-basic breaks dependency 'texlive-basic' required by texlive-fontutils
:: removing texlive-basic breaks dependency 'texlive-basic' required by texlive-langcjk
:: removing texlive-basic breaks dependency 'texlive-basic' required by texlive-langenglish
:: removing texlive-basic breaks dependency 'texlive-basic' required by texlive-langgreek
:: removing texlive-basic breaks dependency 'texlive-basic' required by texlive-langother
:: removing texlive-basic breaks dependency 'texlive-basic' required by texlive-latex
:: removing texlive-basic breaks dependency 'texlive-basic' required by texlive-luatex
:: removing texlive-basic breaks dependency 'texlive-basic' required by texlive-metapost
:: removing texlive-basic breaks dependency 'texlive-basic' required by texlive-pictures
:: removing texlive-basic breaks dependency 'texlive-basic' required by texlive-plaingeneric
:: removing texlive-basic breaks dependency 'texlive-basic' required by texlive-xetex
checking dependencies...
error: failed to prepare transaction (could not satisfy dependencies)
:: removing texlive-bin breaks dependency 'texlive-bin' required by dvisvgm
:: removing texlive-bin breaks dependency 'texlive-bin' required by texlive-basic
:: removing texlive-bin breaks dependency 'texlive-bin' required by texlive-binextra
:: removing texlive-bin breaks dependency 'texlive-bin' required by texlive-context
:: removing texlive-bin breaks dependency 'texlive-bin' required by texlive-fontsextra
:: removing texlive-bin breaks dependency 'texlive-bin' required by texlive-fontsrecommended
:: removing texlive-bin breaks dependency 'texlive-bin' required by texlive-fontutils
:: removing texlive-bin breaks dependency 'texlive-bin' required by texlive-games
:: removing texlive-bin breaks dependency 'texlive-bin' required by texlive-langcjk
:: removing texlive-bin breaks dependency 'texlive-bin' required by texlive-langenglish
:: removing texlive-bin breaks dependency 'texlive-bin' required by texlive-langgreek
:: removing texlive-bin breaks dependency 'texlive-bin' required by texlive-langjapanese
:: removing texlive-bin breaks dependency 'texlive-bin' required by texlive-langkorean
:: removing texlive-bin breaks dependency 'texlive-bin' required by texlive-langother
:: removing texlive-bin breaks dependency 'texlive-bin' required by texlive-latex
:: removing texlive-bin breaks dependency 'texlive-bin' required by texlive-latexextra
:: removing texlive-bin breaks dependency 'texlive-bin' required by texlive-latexrecommended
:: removing texlive-bin breaks dependency 'texlive-bin' required by texlive-luatex
:: removing texlive-bin breaks dependency 'texlive-bin' required by texlive-mathscience
:: removing texlive-bin breaks dependency 'texlive-bin' required by texlive-metapost
:: removing texlive-bin breaks dependency 'texlive-bin' required by texlive-music
:: removing texlive-bin breaks dependency 'texlive-bin' required by texlive-pictures
:: removing texlive-bin breaks dependency 'texlive-bin' required by texlive-plaingeneric
:: removing texlive-bin breaks dependency 'texlive-bin' required by texlive-xetex
checking dependencies...
:: python-matplotlib optionally requires texlive-binextra: usetex dependencies

Packages (1) texlive-binextra-2023.66594-19

Total Removed Size:  112.67 MiB

:: Do you want to remove these packages? [Y/n] y
:: Processing package changes...
(1/1) removing texlive-binextra                                 [##################################] 100%
:: Running post-transaction hooks...
(1/3) Arming ConditionNeedsUpdate...
(2/3) Updating TeXLive filename database...
(3/3) Updating TeXLive format files...
Can't locate mktexlsr.pl in @INC (@INC entries checked: //tlpkg //texmf-dist/scripts/texlive /usr/lib/perl5/5.38/site_perl /usr/share/perl5/site_perl /usr/lib/perl5/5.38/vendor_perl /usr/share/perl5/vendor_perl /usr/lib/perl5/5.38/core_perl /usr/share/perl5/core_perl) at /usr/bin/fmtutil line 23.
BEGIN failed--compilation aborted at /usr/bin/fmtutil line 25.
error: command failed to execute correctly
checking dependencies...

Packages (1) texlive-context-2023.66594-19

Total Removed Size:  52.81 MiB

:: Do you want to remove these packages? [Y/n] y   
:: Processing package changes...
(1/1) removing texlive-context                                  [##################################] 100%
:: Running post-transaction hooks...
(1/3) Arming ConditionNeedsUpdate...
(2/3) Updating TeXLive filename database...
(3/3) Updating TeXLive font maps...
Use of uninitialized value $fn in concatenation (.) or string at /usr/bin/updmap line 2158.
Use of uninitialized value $fn in concatenation (.) or string at /usr/bin/updmap line 2159.
updmap: open() failed: No such file or directory at /usr/bin/updmap line 2159.
Use of uninitialized value $fn in concatenation (.) or string at /usr/bin/updmap line 2158.
Use of uninitialized value $fn in concatenation (.) or string at /usr/bin/updmap line 2159.
updmap: open() failed: No such file or directory at /usr/bin/updmap line 2159.
Use of uninitialized value $fn in concatenation (.) or string at /usr/bin/updmap line 2158.
Use of uninitialized value $fn in concatenation (.) or string at /usr/bin/updmap line 2159.
updmap: open() failed: No such file or directory at /usr/bin/updmap line 2159.
updmap [ERROR]: The following map file(s) couldn't be found:
updmap [ERROR]:     dvips35.map (in builtin)
updmap [ERROR]:     pdftex35.map (in builtin)
updmap [ERROR]:     ps2pk35.map (in builtin)
updmap [ERROR]: Did you run mktexlsr?

    You can disable non-existent map entries using the option
      --syncwithtrees.

error: command failed to execute correctly
checking dependencies...

Packages (1) texlive-fontsextra-2023.66594-19

Total Removed Size:  1433.62 MiB

:: Do you want to remove these packages? [Y/n] y
:: Processing package changes...
(1/1) removing texlive-fontsextra                               [##################################] 100%
:: Running post-transaction hooks...
(1/3) Arming ConditionNeedsUpdate...
(2/3) Updating TeXLive filename database...
(3/3) Updating TeXLive font maps...
Use of uninitialized value $fn in concatenation (.) or string at /usr/bin/updmap line 2158.
Use of uninitialized value $fn in concatenation (.) or string at /usr/bin/updmap line 2159.
updmap: open() failed: No such file or directory at /usr/bin/updmap line 2159.
Use of uninitialized value $fn in concatenation (.) or string at /usr/bin/updmap line 2158.
Use of uninitialized value $fn in concatenation (.) or string at /usr/bin/updmap line 2159.
updmap: open() failed: No such file or directory at /usr/bin/updmap line 2159.
Use of uninitialized value $fn in concatenation (.) or string at /usr/bin/updmap line 2158.
Use of uninitialized value $fn in concatenation (.) or string at /usr/bin/updmap line 2159.
updmap: open() failed: No such file or directory at /usr/bin/updmap line 2159.
updmap [ERROR]: The following map file(s) couldn't be found:
updmap [ERROR]:     dvips35.map (in builtin)
updmap [ERROR]:     pdftex35.map (in builtin)
updmap [ERROR]:     ps2pk35.map (in builtin)
updmap [ERROR]: Did you run mktexlsr?
...

I had to run the above multiple times because the packages that were to be removed depended on each other. After a few runs texlive packages were completely gone.

$ sudo pacman -Qs texlive*

While it did work in this case, this is not reliable since I queried using regex then grep'd again relying on another regex. Had any of the texlive packages contained numbers in the name that method would not have worked. Is there a more concise way of purging packages that all match a single regex, using only pacman if possible? Also can I remove them without being prompted to say yes for every package?

1 Answer 1

1

You can make -Q list only package names if you use the q option. So this should provide the list of installed packages (output from y system, yours will be different):

$ pacman -Qsq 'texlive*'
texlive-basic
texlive-bin
texlive-fontsextra
texlive-langgreek
texlive-latex
texlive-latexextra
texlive-latexrecommended
texlive-pictures

By the way, note how the 'texlive*' is in quotes. This is essential because an unquoted * will be expanded by the shell before calling pacman, so if you have any files or directories matching texlive* in your current directory, then those are what would be passed to pacman if you don't quote.

Now that we have the list, we also need to make sure we remove all dependencies as well as any packages that depend on what you are removing. So we want the following remove options (from man pacman):

REMOVE OPTIONS (APPLY TO -R)

-c, --cascade

Remove all target packages, as well as all packages that depend on one or more target packages. This operation is recursive and must be used with care, since it can remove many potentially needed packages.

-s, --recursive

Remove each target specified including all of their dependencies, provided that (A) they are not required by other packages; and (B) they were not explicitly installed by the user. This operation is recursive and analogous to a backwards --sync operation, and it helps keep a clean system without orphans. If you want to omit condition (B), pass this option twice.

So, to remove all relevant packages, use:

sudo pacman -Rcs $(pacman -Qsq 'texlive*')

On my system, that would be:

$ sudo pacman -Rcs $(pacman -Qsq 'texlive*')
checking dependencies...
:: evince optionally requires texlive-bin: DVI support
:: python-matplotlib optionally requires texlive-latexrecommended: usetex usage with pdflatex
:: python-sphinx optionally requires texlive-latexextra: for generation of PDF documentation
:: r optionally requires texlive-bin: latex sty files
:: xournalpp optionally requires texlive-latexextra: LaTeX package

Packages (15) dvisvgm-3.1.1-1  ffcall-2.4-2  fontawesome.sty-4.6.3.2-1  libsigsegv-2.14-2  otf-font-awesome-6.4.2-1
              t1lib-5.1.2-8  zziplib-0.13.72-2  texlive-basic-2023.66594-19  texlive-bin-2023.66984-16
              texlive-fontsextra-2023.66594-19  texlive-langgreek-2023.66594-19  texlive-latex-2023.66594-19
              texlive-latexextra-2023.66594-19  texlive-latexrecommended-2023.66594-19  texlive-pictures-2023.66594-19

Total Removed Size:  1786.02 MiB

You must log in to answer this question.

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