Install of tevlive-full hangs: tex/context/base/mkiv/l-sandbox.lua:180: module 'socket.core' not found

Bug #2058409 reported by Stefan Staeglich
54
This bug affects 11 people
Affects Status Importance Assigned to Milestone
context (Ubuntu)
Confirmed
Undecided
Unassigned

Bug Description

Before 3 weeks at least it was possible to install texlive-full without any issues. Now this is not possible anymore. So the bug was probably introduced with one of the latest updates.

How to reproduce:
Install package texlive-full
$ apt install texlive-full

Install hangs:
texlive-lang-japanese (2021.20220204-1) wird eingerichtet ...
context (2021.03.05.20220211-1) wird eingerichtet ...
Running mtxrun --generate. This may take some time... done.
Pregenerating ConTeXt MarkIV format. This may take some time...

Related running processes:
root 18747 0.4 0.0 13936 7456 pts/2 Ss+ 17:47 0:01 /usr/bin/dpkg --status-fd 43 --configure --pending
root 20584 0.0 0.0 2892 960 pts/2 S+ 17:48 0:00 /bin/sh /var/lib/dpkg/info/context.postinst configure
root 20592 0.0 0.0 2892 1064 pts/2 S+ 17:48 0:00 /bin/sh /usr/bin/luatools --make cont-en
root 20593 0.1 0.9 92868 79952 pts/2 S+ 17:48 0:00 texlua /usr/bin/mtxrun --script base --make cont-en
root 20596 0.0 0.0 2892 1004 pts/2 S+ 17:48 0:00 sh -c /usr/bin/luatex --ini --lua=/usr/share/texmf/tex/context/base/mkiv/luat-cod.lua /usr/share/texmf/tex/context/base/mkiv/cont-en.mkiv
root 20597 0.0 0.3 40816 28684 pts/2 S+ 17:48 0:00 /usr/bin/luatex --ini --lua=/usr/share/texmf/tex/context/base/mkiv/luat-cod.lua /usr/share/texmf/tex/context/base/mkiv/cont-en.mkiv

Run luatex manually:
# /usr/bin/luatex --ini --lua=/usr/share/texmf/tex/context/base/mkiv/luat-cod.lua /usr/share/texmf/tex/context/base/mkiv/cont-en.mkiv
This is LuaTeX, Version 1.14.0 (TeX Live 2022/dev/Debian) (INITEX)
 system commands enabled.
(/usr/share/texmf/tex/context/base/mkiv/cont-en.mkiv (/usr/share/texmf/tex/context/base/mkiv/context.mkiv (/usr/share/texmf/tex/context/base/mkiv/syst-ini.mkiv) (/usr/share/texmf/tex/context/base/mkiv/norm-ctx.mkiv) (/usr/share/texmf/tex/context/base/mkiv/syst-pln.mkiv) (/usr/share/texmf/tex/context/base/mkiv/syst-mes.mkiv) (/usr/share/texmf/tex/context/base/mkiv/luat-cod.mkiv<+ /usr/share/texmf/tex/context/base/mkiv/luat-cod.lua>) (/usr/share/texmf/tex/context/base/mkiv/luat-bas.mkiv loading: ConTeXt Lua Macros / Basic Lua Libraries<+ /usr/share/texmf/tex/context/base/mkiv/l-bit32.lua><+ /usr/share/texmf/tex/context/base/mkiv/l-lua.lua><+ /usr/share/texmf/tex/context/base/mkiv/l-macro.lua><+ /usr/share/texmf/tex/context/base/mkiv/l-sandbox.lua><+ /usr/share/texmf/tex/context/base/mkiv/l-package.lua><+ /usr/share/texmf/tex/context/base/mkiv/l-lpeg.lua><+ /usr/share/texmf/tex/context/base/mkiv/l-function.lua><+ /usr/share/texmf/tex/context/base/mkiv/l-string.lua><+ /usr/share/texmf/tex/context/base/mkiv/l-table.lua><+ /usr/share/texmf/tex/context/base/mkiv/l-boolean.lua><+ /usr/share/texmf/tex/context/base/mkiv/l-number.lua><+ /usr/share/texmf/tex/context/base/mkiv/l-math.lua><+ /usr/share/texmf/tex/context/base/mkiv/l-io.lua><+ /usr/share/texmf/tex/context/base/mkiv/l-os.lua><+ /usr/share/texmf/tex/context/base/mkiv/l-file.lua><+ /usr/share/texmf/tex/context/base/mkiv/l-gzip.lua><+ /usr/share/texmf/tex/context/base/mkiv/l-md5.lua><+ /usr/share/texmf/tex/context/base/mkiv/l-sha.lua><+ /usr/share/texmf/tex/context/base/mkiv/l-dir.lua><+ /usr/share/texmf/tex/context/base/mkiv/l-unicode.lua><+ /usr/share/texmf/tex/context/base/mkiv/l-url.lua><+ /usr/share/texmf/tex/context/base/mkiv/l-set.lua><+ /usr/share/texmf/tex/context/base/mkiv/l-macro-imp-optimize.lua>) (/usr/share/texmf/tex/context/base/mkiv/luat-lib.mkiv loading: ConTeXt Lua Macros / Libraries<+ /usr/share/texmf/tex/context/base/mkiv/util-str.lua><+ /usr/share/texmf/tex/context/base/mkiv/util-tab.lua><+ /usr/share/texmf/tex/context/base/mkiv/util-fil.lua><+ /usr/share/texmf/tex/context/base/mkiv/util-sac.lua><+ /usr/share/texmf/tex/context/base/mkiv/util-sto.lua><+ /usr/share/texmf/tex/context/base/mkiv/util-pck.lua><+ /usr/share/texmf/tex/context/base/mkiv/util-prs.lua><+ /usr/share/texmf/tex/context/base/mkiv/util-fmt.lua><+ /usr/share/texmf/tex/context/base/mkiv/util-dim.lua><+ /usr/share/texmf/tex/context/base/mkiv/trac-set.lua><+ /usr/share/texmf/tex/context/base/mkiv/luat-log.lua><+ /usr/share/texmf/tex/context/base/mkiv/trac-inf.lua><+ /usr/share/texmf/tex/context/base/mkiv/util-lua.lua><+ /usr/share/texmf/tex/context/base/mkiv/util-deb.lua><+ /usr/share/texmf/tex/context/base/mkiv/util-tpl.lua><+ /usr/share/texmf/tex/context/base/mkiv/util-seq.lua><+ /usr/share/texmf/tex/context/base/mkiv/util-sta.lua><+ /usr/share/texmf/tex/context/base/mkiv/util-sbx.lua><+ /usr/share/texmf/tex/context/base/mkiv/util-soc-imp-reset.lua><+ /usr/share/texmf/tex/context/base/mkiv/util-soc-imp-socket.lua>/usr/share/texmf/tex/context/base/mkiv/l-sandbox.lua:180: module 'socket.core' not found:
        no field package.preload['socket.core']
        no file '/usr/local/share/lua/5.3/socket/core.lua'
        no file '/usr/local/share/lua/5.3/socket/core/init.lua'
        no file '/usr/local/lib/lua/5.3/socket/core.lua'
        no file '/usr/local/lib/lua/5.3/socket/core/init.lua'
        no file './socket/core.lua'
        no file './socket/core/init.lua'
        no file '/usr/local/lib/lua/5.3/socket/core.so'
        no file '/usr/local/lib/lua/5.3/loadall.so'
        no file './socket/core.so'
        no file '/usr/local/lib/lua/5.3/socket.so'
        no file '/usr/local/lib/lua/5.3/loadall.so'
        no file './socket.so'
stack traceback:
        [C]: in upvalue 'requiem'
        /usr/share/texmf/tex/context/base/mkiv/l-sandbox.lua:180: in function 'require'
        ...hare/texmf/tex/context/base/mkiv/util-soc-imp-socket.lua:8: in local 'data'
        /usr/share/texmf/tex/context/base/mkiv/luat-cod.lua:184: in field 'luafilechunk'
        /usr/share/texmf/tex/context/base/mkiv/luat-cod.lua:75: in function 'lua.registercode'
        [\directlua]:1: in main chunk.
\registerctxluafile #1#2->\ctxlua {lua.registercode("#1","#2")}

l.40 \registerctxluafile{util-soc-imp-socket} {}

?

ProblemType: Bug
DistroRelease: Ubuntu 22.04
Package: texlive-full 2021.20220204-1
ProcVersionSignature: Ubuntu 5.15.0-101.111-generic 5.15.143
Uname: Linux 5.15.0-101-generic x86_64
ApportVersion: 2.20.11-0ubuntu82.5
Architecture: amd64
CasperMD5CheckResult: unknown
Date: Tue Mar 19 17:49:44 2024
PackageArchitecture: all
ProcEnviron:
 LANGUAGE=de
 TERM=xterm-256color
 PATH=(custom, no user)
 LANG=de_DE.UTF-8
 SHELL=/bin/bash
SourcePackage: texlive-base
UpgradeStatus: No upgrade log present (probably fresh install)

CVE References

Revision history for this message
Stefan Staeglich (staeglis) wrote :
description: updated
Revision history for this message
Stefan Staeglich (staeglis) wrote :

This worked at least until 13th of March

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in texlive-base (Ubuntu):
status: New → Confirmed
Revision history for this message
Amartyo Banerjee (amartyo) wrote :

I came across this bug while trying to install texlive-full. The installation process would hang on this line: Pregenerating ConTeXt MarkIV format. This may take some time...

Running luatex manually as listed above results in an identical stack trace. While doing so I typed 'quit' at the debugger prompt '?'. Doing so resulted in the program continuing to run till the end with no more errors.

I then tried to install texlive-full again, and at the point where it would hang earlier, I typed 'quit' then the Enter key. This made the configuration of the context package continue, followed by context-modules and then texlive-full. All other packages pulled in by texlive-full installed successfully earlier.

The bug can be reproduced by doing 'sudo apt-get install context'.

As of now the installation of texlive-full has completed as far as apt-get is concerned, but I guess the context package is broken.

Hope this information helps.

Revision history for this message
Peter Benie (pjb1008) wrote :

The postinstall runs fails because luatex now has the 'socket' functionality disabled by default. [CVE-2023-32668]

The upstream source for mtxrun has --socket added to the luatex command line to reenable the functionality while running 'mtxrun --make'. See lines having '--socket' in https://source.contextgarden.net/mtxrun.lua

I think that there are two bugs here:
1) The mismatch between luatex and context regarding --socket, and
2) The post-install hangs indefinitely rather than returning an error.

Revision history for this message
UBTJCav (ubtjcav) wrote (last edit ):

I am suffering from this bug, too. Does anyone know any workaround? I am writing my bechelor thesis now so texlive is really important to me.

-- update --

Those who need texlive urgently can install the latest texlive 2024 from its offical script. Refer to https://www.tug.org/texlive/quickinstall.html for detailed information. I have successfully installed it without any problems.

I checked the texlive version provided by APT, "texlive-full/jammy 2021.20220204-1", which is really old compared to texlive official.

Revision history for this message
Jakob Pinggera (jakobpinggera) wrote (last edit ):

We are experiencing the same issue on Ubuntu 22.04 LTS. The installation gets stuck at

Pregenerating ConTeXt MarkIV format. This may take some time...

I can confirm that this has worked a few weeks ago as I am setting up servers using ansible on a regular basis, running the same playbook all the time.

When searching for this, I came across this thread: https://askubuntu.com/questions/956006/pregenerating-context-markiv-format-this-may-take-some-time-takes-forever

As suggested, pressing Enter *several times* during the installation "resolves" the problem and the installation continues (<Enter> lines in the following output are the number of times I pressed enter):

---
Pregenerating ConTeXt MarkIV format. This may take some time...
<Enter>
<Enter>
<Enter>
<Enter>
<Enter>
<Enter>
<Enter>
<Enter>
<Enter>
<Enter>
<Enter>
done.
---

Unfortunately, pressing enter can merely be a workaround, as we need to be able to set up machines automatically using ansible. Therefore a solution would be highly appreciated :)

Revision history for this message
Philip Caesar Flores (pmflores2-alumup) wrote :

Pressing enter multiple times as @jakobpinggera mentioned also worked for me

Revision history for this message
Stefan Staeglich (staeglis) wrote (last edit ):

I've prepared a patch like suggested by @pjb1008 but I wasn't able to build a package with this patch.

EDIT: But I can confirm that adding the option "--socket" to the luatex command fixes the issue.

affects: texlive-base (Ubuntu) → context (Ubuntu)
Revision history for this message
Stefan Staeglich (staeglis) wrote :

There seems to be an identical file texmf-dist/scripts/context/stubs/unix/mtxrun. The new patch addresses it. I can confirm that the problem is solved.

The fix should be available for testing via PPA soon:

https://launchpad.net/~staeglis/+archive/ubuntu/texlive-bugfix-2058409

I hope that the fix will be applied soon. I would like to avoid investing time in workarounds for our deployment scripts, where I have already invested enough time in the fix.

Revision history for this message
Ubuntu Foundations Team Bug Bot (crichton) wrote :

The attachment "fix_for_lua-socket_2058409" seems to be a patch. If it isn't, please remove the "patch" flag from the attachment, remove the "patch" tag, and if you are a member of the ~ubuntu-reviewers, unsubscribe the team.

[This is an automated message performed by a Launchpad user owned by ~brian-murray, for any issues please contact him.]

tags: added: patch
Revision history for this message
Stefan Staeglich (staeglis) wrote :

Has there been any progress in this matter? What else can I do to speed up the process?

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.