Bug 1212571

Summary: texlive-scheme-small produces broken installation
Product: [openSUSE] openSUSE Tumbleweed Reporter: Istvan Beregszaszi <pestaa>
Component: OtherAssignee: Dr. Werner Fink <werner>
Status: IN_PROGRESS --- QA Contact: E-mail List <qa-bugs>
Severity: Normal    
Priority: P5 - None CC: ihno, kukuk, radoslav.kolev
Version: Current   
Target Milestone: ---   
Hardware: Other   
OS: openSUSE Tumbleweed   
See Also: https://bugzilla.opensuse.org/show_bug.cgi?id=1181552
Whiteboard:
Found By: --- Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---
Bug Depends on: 1181552    
Bug Blocks:    
Attachments: After VERBOSE=debug /usr/share/texmf/texconfig/update force
zypper in --force texlive-filesystem

Description Istvan Beregszaszi 2023-06-21 11:22:59 UTC
$ docker run --rm -it opensuse/tumbleweed bash
# zypper in texlive-scheme-small

...
(651/651) Installing: texlive-scheme-small-2023.208.svn54191-59.1.noarch ...[done]
find: '/etc/texmf/ls-R': No such file or directory
update: This TeXLive installation is broken!
update: Only programs are found but no init file(s) at all. You might install
update: e.g. texlive-collection-latex or any other texlive-collection package.
Executing %posttrans scripts ...............................................[done]


texlive-scheme-medium works well. But this is for a container, so would prefer to minimize size.


Error msg is from: 
https://github.com/bmwiedemann/openSUSE/blob/master/packages/t/texlive-filesystem/update.texlive#L320

ls-R and formats are missing. 

Tried the following:


# mkdir -p /var/run/texlive
# > /var/run/texlive/run-fmtutil.refresh
# /usr/share/texmf/texconfig/update 
find: '/etc/texmf/ls-R': No such file or directory
[ ]Updating TeX hash data base.
[ ]Updating TeX links
update: This TeXLive installation is broken!
update: Only programs are found but no init file(s) at all. You might install
update: e.g. texlive-collection-latex or any other texlive-collection package.

# > /etc/texmf/ls-R
# chown mktex:mktex /etc/texmf/ls-R
# texhash
mktexlsr: Updating /etc/texmf...
mktexlsr: Updating /mktexlsr...
[...]

# mkdir -p /var/run/texlive
# > /var/run/texlive/run-fmtutil.refresh
# /usr/share/texmf/texconfig/update 
[ ]Updating TeX links
update: This TeXLive installation is broken!
update: Only programs are found but no init file(s) at all. You might install
update: e.g. texlive-collection-latex or any other texlive-collection package.


fmtutil.cnf is filled in, so also tried:

07f292c96f0f:/ # fmtutil-sys --all
fmtutil: fmtutil is using the following fmtutil.cnf files (in precedence order):
fmtutil:   /etc/texmf/web2c/fmtutil.cnf
fmtutil: fmtutil is using the following fmtutil.cnf file for writing changes:
fmtutil:   /etc/texmf/web2c/fmtutil.cnf
fmtutil [INFO]: writing formats under /var/lib/texmf/web2c
fmtutil [INFO]: --- remaking euptex with euptex
[...]
fmtutil [INFO]: --- remaking amstex with pdftex
fmtutil [WARNING]: You seem to have no formats defined in your fmtutil.cnf files!
fmtutil [INFO]: disabled formats: 1
fmtutil [INFO]: not available formats: 54
fmtutil [INFO]: total formats: 55
fmtutil [INFO]: exiting with status 0
Comment 1 Dr. Werner Fink 2023-08-03 10:39:37 UTC
Hmmm ...

 texlive/2023> rpm -qvf /etc/texmf/ls-R
 texlive-filesystem-2023.198-0.noarch

 texlive/2023> zypper info --requires texlive-scheme-small | grep texlive-collection-basic
     texlive-collection-basic >= 2023

 texlive/2023> zypper info --requires texlive-collection-basic | grep texlive-scripts
     texlive-scripts >= 2023

and finally

 texlive/2023> rpm -q -R texlive-scripts | grep texlive-filesystem
 texlive-filesystem >= 2023
 texlive-filesystem >= 2023
 texlive-filesystem >= 2023

... also texlive-kpathsea and texlive-kpathsea-bin are required

Please try as root

  VERBOSE=debug /usr/share/texmf/texconfig/update force

and attach the resulting /tmp/update.<random_string>
Comment 2 Istvan Beregszaszi 2023-08-03 12:13:45 UTC
Created attachment 868616 [details]
After VERBOSE=debug /usr/share/texmf/texconfig/update force
Comment 3 Dr. Werner Fink 2023-08-03 12:28:35 UTC
(In reply to Istvan Beregszaszi from comment #2)
> Created attachment 868616 [details]
> After VERBOSE=debug /usr/share/texmf/texconfig/update force

Call as root

  mktexlsr --verbose

and show output here, thanks.
Comment 4 Istvan Beregszaszi 2023-08-03 12:37:43 UTC
# mktexlsr --verbose
mktexlsr: Updating /etc/texmf...
TeX::LSR: ls-R file does not exists, skipping: /etc/texmf/ls-R
mktexlsr: Updating /usr/local/share/texmf...
mktexlsr: cannot read files, skipping: /usr/local/share/texmf
mktexlsr: Updating /usr/share/texmf...
TeX::LSR: ls-R file does not exists, skipping: /usr/share/texmf/ls-R
mktexlsr: Updating /var/cache/texmf/fonts...
mktexlsr: Updating /var/cache/texmf/fonts/texmf...
mktexlsr: cannot read files, skipping: /var/cache/texmf/fonts/texmf
mktexlsr: Updating /var/lib/texmf...
TeX::LSR: ls-R file does not exists, skipping: /var/lib/texmf/ls-R
mktexlsr: Done.


# ls -l /usr/share/texmf/ls-R 
lrwxrwxrwx. 1 root root 24 Jul  5 13:37 /usr/share/texmf/ls-R -> /var/lib/texmf/main/ls-R

# ls -l /var/lib/texmf/main/ls-R
ls: cannot access '/var/lib/texmf/main/ls-R': No such file or directory
Comment 5 Dr. Werner Fink 2023-08-03 12:46:56 UTC
... strange as

rpm -qvl texlive-filesystem | grep ls-R
-rw-rw-r--    1 root     mktex                      67 Jul  5 13:37 /etc/texmf/ls-R
lrwxrwxrwx    1 root     root                       24 Jul  5 13:37 /usr/share/texmf/ls-R -> /var/lib/texmf/main/ls-R
-rw-rw-r--    1 mktex    mktex                      67 Jul  5 13:37 /var/cache/texmf/fonts/ls-R
-rw-rw-r--    1 root     mktex                  494341 Jul  5 13:37 /var/lib/texmf/dist/ls-R
-rw-rw-r--    1 root     mktex                      67 Jul  5 13:37 /var/lib/texmf/ls-R
-rw-rw-r--    1 root     mktex                  494341 Jul  5 13:37 /var/lib/texmf/main/ls-R

and I guess that texlive-filesystem is installed due to the
dependencies ... or do you have set a package lock .. please
check

  rpm -q texlive-filesystem
  ls -l /etc/texmf/ls-R
Comment 6 Istvan Beregszaszi 2023-08-03 13:08:24 UTC
# rpm -q texlive-filesystem
texlive-filesystem-2023.208-60.1.noarch
# ls -l /etc/texmf/ls-R
ls: cannot access '/etc/texmf/ls-R': No such file or directory

Running in fresh opensuse/tumbleweed:latest container, so everything's default.

This is a wild guess, but maybe these files owned by the mktex group could not install?

# rpm -qvl texlive-filesystem | grep mktex | grep ^-
-rw-rw-r-- 1 root  mktex      67 Jul  5 13:37 /etc/texmf/ls-R
-rw-rw-r-- 1 mktex mktex      67 Jul  5 13:37 /var/cache/texmf/fonts/ls-R
-rw-rw-r-- 1 root  mktex  494341 Jul  5 13:37 /var/lib/texmf/dist/ls-R
-rw-rw-r-- 1 root  mktex      67 Jul  5 13:37 /var/lib/texmf/ls-R
-rw-rw-r-- 1 root  mktex  494341 Jul  5 13:37 /var/lib/texmf/main/ls-R

None of them exists (except for /var/cache/texmf/fonts/ls-R, but seems it was generated later.)
Comment 7 Dr. Werner Fink 2023-08-03 13:33:53 UTC
... that would be mean that the dependencies

 Requires(pre):  user(mktex)
 Requires(pre):  group(mktex)

of texlive-filesystem are not fulfilled or in other words the
package system-user-mktex has not been installed or not done
its job during installation

 texlive/2023> rpm -q --whatprovides 'user(mktex)'
 system-user-mktex-1.0.0-2.7.noarch

...

 texlive/2023> rpm -qf /usr/lib/sysusers.d/system-user-mktex.conf
 system-user-mktex-1.0.0-2.7.noarch

... what I wonder is that a missing user/group does not break the installation of texlive-scheme-small
Comment 8 Dr. Werner Fink 2023-08-03 13:53:50 UTC
Normal installation in a minimal Tumbleweed VM (no TeXLive beside one font) requires with texlive-scheme-small automagic system-user-mktex and I see

  localhost:~ # grep mktex /etc/passwd
  mktex:x:467:467:System user for mktex:/var/cache/texmf/fonts/usr/sbin/nologin

... seems to be a container problem here
Comment 9 Istvan Beregszaszi 2023-08-03 13:57:10 UTC
Created attachment 868617 [details]
zypper in --force texlive-filesystem

User/group is correct:

# rpm -q --whatprovides 'group(mktex)'
system-user-mktex-1.0.0-2.7.noarch


However, force reinstalling texlive-filesystem reveals failed calls to /usr/bin/setpriv (see attachment).

Replacing busybox-util-linux with util-linux fixes the issue.
Comment 10 Dr. Werner Fink 2023-08-03 14:08:33 UTC
Indeed in post scriplet of texlive-filesystem there is shell code which does

 for dir in      %{_texmfconfdir}        \
                 %{_fontcache}           \
                 %{_texmfvardir}         \
                 %{_texmfvardir}/dist    \
                 %{_texmfvardir}/main
 do
     test "$dir" = %{_fontcache} && user=%{texusr} || user=root
     setpriv --reuid $user --regid %{texgrp} --init-groups /bin/sh -ec "
         tmp=\$(mktemp ${dir}/ls-R.XXXXXX)
         chmod 0664 \${tmp}
         echo '%% ls-R -- filename database for kpathsea; do not change this line.' > \${tmp}
         mv \${tmp} ${dir}/ls-R" || error=1
 done
Comment 11 Istvan Beregszaszi 2023-08-03 14:35:29 UTC
texlive-scheme-medium and up pulls in standard util-linux through transitive dependencies, so that's why it worked.

Filed a ticket upstream for good measure. https://bugs.busybox.net/show_bug.cgi?id=15712

Thank you for the help!
Comment 12 Dr. Werner Fink 2023-08-04 06:25:01 UTC
This setpriv approach I've choosen due to a bug report and suggestion of the security people here around.
Comment 13 Dr. Werner Fink 2023-08-14 13:34:00 UTC
Maybe I should add a conflict to busybox many builtins are not usable, also having TeXLive installed requires a powerful system which (IMHO) should make use of a powerful shell and powerful tools (like setpriv from util-linux, as well as ed from ed, find from findutils, sed from sed, and grep from grep)
Comment 14 OBSbugzilla Bot 2024-01-29 13:35:01 UTC
This is an autogenerated message for OBS integration:
This bug (1212571) was mentioned in
https://build.opensuse.org/request/show/1142250 Factory / texlive-filesystem
Comment 15 Dr. Werner Fink 2024-01-29 13:41:00 UTC
(In reply to OBSbugzilla Bot from comment #14)
> This is an autogenerated message for OBS integration:
> This bug (1212571) was mentioned in
> https://build.opensuse.org/request/show/1142250 Factory / texlive-filesystem

Try to avoid the missing features of setpriv from util-linux by require util-linux instead of /usr/bin/setpriv (we really depend on that)