Hi, I had/have a very similar problem on FreeBSD with TeXLive 2021, with the same context.lua not found message.
I “resolved” it by setting TEXMF to point to my texmf-dist directory, in my case /usr/local/share/texmf-dist. It would be nice for it to work without setting TEXMF. Without setting TEXMF, running "mtxrun —generate” guesses a little differently, then attempts to scan all of /usr, and then fails when parts have no read permission. (See log at the end of this message.) I suspect it is working when you are in /usr/share/texmf-dist because the “collapsepath” function in mtxrun is collapsing “/../..” from /usr/bin to “.” instead of “/“. (Which seems like a bug, but I’m not sure.) If I run “TEXMF=/usr/local/share/texmf-dist context file.tex” things run correctly, and a ~/.texlive2021 directory is created. Running “TEXMF=/usr/local/shared/texmf-dist mtxrun —generate” runs without error but also doesn’t generate a ~/.texlive2021 directory. The real problem seems to be that mtxrun doesn’t deal well with the filesystem layout case of “/top-level/bin/mtxrun” and “/top-level/share/texmf-dist”. Regards, Jan M. resolvers | resolving | variable 'SELFAUTOLOC' set to '/usr/local/bin' resolvers | resolving | variable 'SELFAUTODIR' set to '/usr/local' resolvers | resolving | variable 'SELFAUTOPARENT' set to '/usr' resolvers | resolving | variable 'TEXMFCNF' set to '' resolvers | resolving | variable 'TEXMF' set to '' resolvers | resolving | variable 'TEXOS' set to 'local' resolvers | resolving | resolvers | resolving | using configuration specification 'home:texmf/web2c;{selfautoloc:,selfautoloc:/share/texmf-local/web2c,selfautoloc:/share/texmf-dist/web2c,selfautoloc:/share/texmf/web2c,selfautoloc:/texmf-local/web2c,selfautoloc:/texmf-dist/web2c,selfautoloc:/texmf/web2c,/var/db/tlpkg,selfautodir:,selfautodir:/share/texmf-local/web2c,selfautodir:/share/texmf-dist/web2c,selfautodir:/share/texmf/web2c,selfautodir:/texmf-local/web2c,selfautodir:/texmf-dist/web2c,selfautodir:/texmf/web2c,$SELFAUTOGRANDPARENT/texmf-local/web2c,selfautoparent:,selfautoparent:/share/texmf-local/web2c,selfautoparent:/share/texmf-dist/web2c,selfautoparent:/share/texmf/web2c,selfautoparent:/texmf-local/web2c,selfautoparent:/texmf-dist/web2c,selfautoparent:/texmf/web2c}' resolvers | resolving | resolvers | resolving | looking for regular 'texmfcnf.lua' on given path '/home/janm/texmf/web2c' from specification 'home:texmf/web2c' resolvers | resolving | looking for regular 'texmfcnf.lua' on weird path '/usr/local/bin' from specification 'selfautoloc:' resolvers | resolving | looking for regular 'texmfcnf.lua' on given path '/usr/local/bin/share/texmf-local/web2c' from specification 'selfautoloc:/share/texmf-local/web2c' resolvers | resolving | looking for regular 'texmfcnf.lua' on given path '/usr/local/bin/share/texmf-dist/web2c' from specification 'selfautoloc:/share/texmf-dist/web2c' resolvers | resolving | looking for regular 'texmfcnf.lua' on given path '/usr/local/bin/share/texmf/web2c' from specification 'selfautoloc:/share/texmf/web2c' resolvers | resolving | looking for regular 'texmfcnf.lua' on given path '/usr/local/bin/texmf-local/web2c' from specification 'selfautoloc:/texmf-local/web2c' resolvers | resolving | looking for regular 'texmfcnf.lua' on given path '/usr/local/bin/texmf-dist/web2c' from specification 'selfautoloc:/texmf-dist/web2c' resolvers | resolving | looking for regular 'texmfcnf.lua' on given path '/usr/local/bin/texmf/web2c' from specification 'selfautoloc:/texmf/web2c' resolvers | resolving | looking for regular 'texmfcnf.lua' on weird path '/var/db/tlpkg' from specification '/var/db/tlpkg' resolvers | resolving | looking for regular 'texmfcnf.lua' on weird path '/usr/local' from specification 'selfautodir:' resolvers | resolving | looking for regular 'texmfcnf.lua' on given path '/usr/local/share/texmf-local/web2c' from specification 'selfautodir:/share/texmf-local/web2c' resolvers | resolving | looking for regular 'texmfcnf.lua' on given path '/usr/local/share/texmf-dist/web2c' from specification 'selfautodir:/share/texmf-dist/web2c' resolvers | resolving | found regular configuration file '/usr/local/share/texmf-dist/web2c/texmfcnf.lua' resolvers | resolving | looking for regular 'texmfcnf.lua' on given path '/usr/local/share/texmf/web2c' from specification 'selfautodir:/share/texmf/web2c' resolvers | resolving | looking for regular 'texmfcnf.lua' on given path '/usr/local/texmf-local/web2c' from specification 'selfautodir:/texmf-local/web2c' resolvers | resolving | looking for regular 'texmfcnf.lua' on given path '/usr/local/texmf-dist/web2c' from specification 'selfautodir:/texmf-dist/web2c' resolvers | resolving | looking for regular 'texmfcnf.lua' on given path '/usr/local/texmf/web2c' from specification 'selfautodir:/texmf/web2c' resolvers | resolving | looking for regular 'texmfcnf.lua' on given path '$SELFAUTOGRANDPARENT/texmf-local/web2c' from specification '$SELFAUTOGRANDPARENT/texmf-local/web2c' resolvers | resolving | looking for regular 'texmfcnf.lua' on weird path '/usr' from specification 'selfautoparent:' resolvers | resolving | looking for regular 'texmfcnf.lua' on given path '/usr/share/texmf-local/web2c' from specification 'selfautoparent:/share/texmf-local/web2c' resolvers | resolving | looking for regular 'texmfcnf.lua' on given path '/usr/share/texmf-dist/web2c' from specification 'selfautoparent:/share/texmf-dist/web2c' resolvers | resolving | looking for regular 'texmfcnf.lua' on given path '/usr/share/texmf/web2c' from specification 'selfautoparent:/share/texmf/web2c' resolvers | resolving | looking for regular 'texmfcnf.lua' on given path '/usr/texmf-local/web2c' from specification 'selfautoparent:/texmf-local/web2c' resolvers | resolving | looking for regular 'texmfcnf.lua' on given path '/usr/texmf-dist/web2c' from specification 'selfautoparent:/texmf-dist/web2c' resolvers | resolving | looking for regular 'texmfcnf.lua' on given path '/usr/texmf/web2c' from specification 'selfautoparent:/texmf/web2c' resolvers | resolving | resolvers | resolving | loading configuration file 'selfautodir:/share/texmf-dist/web2c/texmfcnf.lua' resolvers | resolving | resolvers | resolving | locating list of 'home:.texlive2021/texmf-config' (runtime) (tree:///home:.texlive2021/texmf-config) resolvers | methods | resolving, method 'locators', how 'uri', handler 'tree', argument 'tree:///home:.texlive2021/texmf-config' resolvers | trees | locator 'home:.texlive2021/texmf-config' not found resolvers | resolving | locating list of 'home:texmf' (runtime) (tree:///home:texmf) resolvers | methods | resolving, method 'locators', how 'uri', handler 'tree', argument 'tree:///home:texmf' resolvers | trees | locator 'home:texmf' not found resolvers | resolving | locating list of 'selfautoparent:texmf-config' (cached) resolvers | methods | resolving, method 'locators', how 'uri', handler 'file', argument 'selfautoparent:texmf-config' resolvers | files | file locator 'selfautoparent:texmf-config' not found resolvers | resolving | locating list of 'selfautoparent:texmf-var' (cached) resolvers | methods | resolving, method 'locators', how 'uri', handler 'file', argument 'selfautoparent:texmf-var' resolvers | files | file locator 'selfautoparent:texmf-var' not found resolvers | resolving | locating list of 'selfautoparent:texmf-project' (cached) resolvers | methods | resolving, method 'locators', how 'uri', handler 'file', argument 'selfautoparent:texmf-project' resolvers | files | file locator 'selfautoparent:texmf-project' not found resolvers | resolving | locating list of 'selfautoparent:texmf-fonts' (cached) resolvers | methods | resolving, method 'locators', how 'uri', handler 'file', argument 'selfautoparent:texmf-fonts' resolvers | files | file locator 'selfautoparent:texmf-fonts' not found resolvers | resolving | locating list of '/usr' (cached) resolvers | methods | resolving, method 'locators', how 'uri', handler 'file', argument '/usr' resolvers | files | file locator '/usr' found as '/usr' resolvers | resolving | hash '/usr' appended resolvers | resolving | locating list of 'selfautoparent:texmf-dist' (cached) resolvers | methods | resolving, method 'locators', how 'uri', handler 'file', argument 'selfautoparent:texmf-dist' resolvers | files | file locator 'selfautoparent:texmf-dist' not found resolvers | resolving | resolvers | methods | resolving, method 'generators', how 'uri', handler 'file', argument '/usr' resolvers | expansions | scanning path '/usr', branch '/usr' /usr/local/bin/mtxrun:649: cannot open /usr/local/etc/cups/ssl/: Permission denied > On 13 May 2022, at 01:57, Gerion Entrup via ntg-context <ntg-context@ntg.nl> > wrote: > > Hi, > > I'm having a problem with TeXLive 2021 in conjunction with MkIV. > Basically, executing context results in: > > % context > mtxrun | unknown script 'context.lua' or 'mtx-context.lua > > I researched this and found that probably there is a path problem. > LaTeX seems to be using kpathsea and /etc/texmf.cnf while context uses > texmfcnf.lua. > > Looking into this file, it defines nearly all paths relative to "home:" > or "selfautoparent:". Home is self explaining. I have no clue what > selfautoparent is and also did not find an explanation in the internet. > > Anyway, selfautoparent seems not to be resolved correctly. I figured > this by running `mtxrun --variables`. Here is a little excerpt: > > resolvers | lists | TEXMF > resolvers | lists | env: > {$TEXMFCONFIG,$TEXMFHOME,!!$TEXMFSYSCONFIG,!!$TEXMFSYSVAR,!!$TEXMFPROJECT,!!$TEXMFFONTS,!!$TEXMFLOCAL,!!$TEXMFDIST} > resolvers | lists | var: TEXMF > resolvers | lists | exp: > {home:.texlive2020/texmf-config,home:texmf,!!selfautoparent:texmf-config,!!selfautoparent:texmf-var,!!selfautoparent:texmf-project,!!selfautoparent:texmf-fonts,!!.,!!selfautoparent:texmf-dist} > resolvers | lists | res: > {/home/gerion/.texlive2020/texmf-config,/home/gerion/texmf,!!./texmf-config,!!./texmf-var,!!./texmf-project,!!./texmf-fonts,!!.,!!./texmf-dist} > ... > resolvers | lists | TEXMFSYSVAR > resolvers | lists | env: selfautoparent:texmf-var > resolvers | lists | var: TEXMFSYSVAR > resolvers | lists | exp: selfautoparent:texmf-var > resolvers | lists | res: ./texmf-var > resolvers | lists | TEXMFVAR > resolvers | lists | env: unset > resolvers | lists | var: TEXMFVAR > resolvers | lists | exp: home:.texlive2020/texmf-var > resolvers | lists | res: /home/gerion/.texlive2020/texmf-var > > "home:" seems to be resolved correctly to "/home/gerion". "selfautoparent" > seems to be resolved to "." (the current directory?). > My context (and TeXLive) installation is in /usr/share/texmf-dist. > So running mtxrun --generate in exactly this directory and running > context after that works: > > % mtxrun --generate > resolvers | resolving | variable 'SELFAUTOLOC' set to '/usr/bin' > resolvers | resolving | variable 'SELFAUTODIR' set to '/usr' > resolvers | resolving | variable 'SELFAUTOPARENT' set to '.' > resolvers | resolving | variable 'TEXMFCNF' set to '' > resolvers | resolving | variable 'TEXMF' set to '' > resolvers | resolving | variable 'TEXOS' set to 'usr' > resolvers | resolving | > resolvers | resolving | using configuration specification > 'home:texmf/web2c;{selfautoloc:,selfautoloc:/share/texmf-local/web2c,selfautoloc:/share/texmf-dist/web2c,selfautoloc:/share/texmf/web2c,selfautoloc:/texmf-local/web2c,selfautoloc:/texmf-dist/web2c,selfautoloc:/texmf/web2c,selfautodir:,selfautodir:/share/texmf-local/web2c,selfautodir:/share/texmf-dist/web2c,selfautodir:/share/texmf/web2c,selfautodir:/texmf-local/web2c,selfautodir:/texmf-dist/web2c,selfautodir:/texmf/web2c,$SELFAUTOGRANDPARENT/texmf-local/web2c,selfautoparent:,selfautoparent:/share/texmf-local/web2c,selfautoparent:/share/texmf-dist/web2c,selfautoparent:/share/texmf/web2c,selfautoparent:/texmf-local/web2c,selfautoparent:/texmf-dist/web2c,selfautoparent:/texmf/web2c}' > resolvers | resolving | > resolvers | resolving | looking for regular 'texmfcnf.lua' on > given path '/home/gerion/texmf/web2c' from specification 'home:texmf/web2c' > resolvers | resolving | looking for regular 'texmfcnf.lua' on > weird path '/usr/bin' from specification 'selfautoloc:' > resolvers | resolving | looking for regular 'texmfcnf.lua' on > given path '/usr/bin/share/texmf-local/web2c' from specification > 'selfautoloc:/share/texmf-local/web2c' > resolvers | resolving | looking for regular 'texmfcnf.lua' on > given path '/usr/bin/share/texmf-dist/web2c' from specification > 'selfautoloc:/share/texmf-dist/web2c' > resolvers | resolving | looking for regular 'texmfcnf.lua' on > given path '/usr/bin/share/texmf/web2c' from specification > 'selfautoloc:/share/texmf/web2c' > resolvers | resolving | looking for regular 'texmfcnf.lua' on > given path '/usr/bin/texmf-local/web2c' from specification > 'selfautoloc:/texmf-local/web2c' > resolvers | resolving | looking for regular 'texmfcnf.lua' on > given path '/usr/bin/texmf-dist/web2c' from specification > 'selfautoloc:/texmf-dist/web2c' > resolvers | resolving | looking for regular 'texmfcnf.lua' on > given path '/usr/bin/texmf/web2c' from specification > 'selfautoloc:/texmf/web2c' > resolvers | resolving | looking for regular 'texmfcnf.lua' on > weird path '/usr' from specification 'selfautodir:' > resolvers | resolving | looking for regular 'texmfcnf.lua' on > given path '/usr/share/texmf-local/web2c' from specification > 'selfautodir:/share/texmf-local/web2c' > resolvers | resolving | looking for regular 'texmfcnf.lua' on > given path '/usr/share/texmf-dist/web2c' from specification > 'selfautodir:/share/texmf-dist/web2c' > resolvers | resolving | found regular configuration file > '/usr/share/texmf-dist/web2c/texmfcnf.lua' > resolvers | resolving | looking for regular 'texmfcnf.lua' on > given path '/usr/share/texmf/web2c' from specification > 'selfautodir:/share/texmf/web2c' > resolvers | resolving | looking for regular 'texmfcnf.lua' on > given path '/usr/texmf-local/web2c' from specification > 'selfautodir:/texmf-local/web2c' > resolvers | resolving | looking for regular 'texmfcnf.lua' on > given path '/usr/texmf-dist/web2c' from specification > 'selfautodir:/texmf-dist/web2c' > resolvers | resolving | looking for regular 'texmfcnf.lua' on > given path '/usr/texmf/web2c' from specification 'selfautodir:/texmf/web2c' > resolvers | resolving | looking for regular 'texmfcnf.lua' on > given path '$SELFAUTOGRANDPARENT/texmf-local/web2c' from specification > '$SELFAUTOGRANDPARENT/texmf-local/web2c' > resolvers | resolving | looking for regular 'texmfcnf.lua' on > weird path '.' from specification 'selfautoparent:' > resolvers | resolving | looking for regular 'texmfcnf.lua' on > given path './share/texmf-local/web2c' from specification > 'selfautoparent:/share/texmf-local/web2c' > resolvers | resolving | looking for regular 'texmfcnf.lua' on > given path './share/texmf-dist/web2c' from specification > 'selfautoparent:/share/texmf-dist/web2c' > resolvers | resolving | looking for regular 'texmfcnf.lua' on > given path './share/texmf/web2c' from specification > 'selfautoparent:/share/texmf/web2c' > resolvers | resolving | looking for regular 'texmfcnf.lua' on > given path './texmf-local/web2c' from specification > 'selfautoparent:/texmf-local/web2c' > resolvers | resolving | looking for regular 'texmfcnf.lua' on > given path './texmf-dist/web2c' from specification > 'selfautoparent:/texmf-dist/web2c' > resolvers | resolving | looking for regular 'texmfcnf.lua' on > given path './texmf/web2c' from specification 'selfautoparent:/texmf/web2c' > resolvers | resolving | > resolvers | resolving | loading configuration file > 'selfautodir:/share/texmf-dist/web2c/texmfcnf.lua' > resolvers | resolving | > resolvers | resolving | locating list of > 'home:.texlive2020/texmf-config' (runtime) > (tree:///home:.texlive2020/texmf-config) > resolvers | methods | resolving, method 'locators', how 'uri', > handler 'tree', argument 'tree:///home:.texlive2020/texmf-config' > resolvers | trees | locator 'home:.texlive2020/texmf-config' not > found > resolvers | resolving | locating list of 'home:texmf' (runtime) > (tree:///home:texmf) > resolvers | methods | resolving, method 'locators', how 'uri', > handler 'tree', argument 'tree:///home:texmf' > resolvers | trees | locator 'home:texmf' not found > resolvers | resolving | locating list of > 'selfautoparent:texmf-config' (cached) > resolvers | methods | resolving, method 'locators', how 'uri', > handler 'file', argument 'selfautoparent:texmf-config' > resolvers | files | file locator 'selfautoparent:texmf-config' > not found > resolvers | resolving | locating list of > 'selfautoparent:texmf-var' (cached) > resolvers | methods | resolving, method 'locators', how 'uri', > handler 'file', argument 'selfautoparent:texmf-var' > resolvers | files | file locator 'selfautoparent:texmf-var' not > found > resolvers | resolving | locating list of > 'selfautoparent:texmf-project' (cached) > resolvers | methods | resolving, method 'locators', how 'uri', > handler 'file', argument 'selfautoparent:texmf-project' > resolvers | files | file locator 'selfautoparent:texmf-project' > not found > resolvers | resolving | locating list of > 'selfautoparent:texmf-fonts' (cached) > resolvers | methods | resolving, method 'locators', how 'uri', > handler 'file', argument 'selfautoparent:texmf-fonts' > resolvers | files | file locator 'selfautoparent:texmf-fonts' not > found > resolvers | resolving | locating list of '.' (cached) > resolvers | methods | resolving, method 'locators', how 'uri', > handler 'file', argument '.' > resolvers | files | file locator '.' found as '.' > resolvers | resolving | hash '.' appended > resolvers | resolving | locating list of > 'selfautoparent:texmf-dist' (cached) > resolvers | methods | resolving, method 'locators', how 'uri', > handler 'file', argument 'selfautoparent:texmf-dist' > resolvers | files | file locator 'selfautoparent:texmf-dist' not > found > resolvers | resolving | > resolvers | methods | resolving, method 'generators', how 'uri', > handler 'file', argument '.' > resolvers | expansions | scanning path '.', branch '.' > resolvers | globbing | confusing filename, name: > 'custMatTransform.py', lower: 'custmattransform.py', already: > 'CustMatTransform.py' > resolvers | globbing | confusing filename, name: > 'setCustomAnchor.py', lower: 'setcustomanchor.py', already: > 'SetCustomAnchor.py' > resolvers | globbing | confusing filename, name: > 'widg_addLabel.py', lower: 'widg_addlabel.py', already: 'Widg_addLabel.py' > resolvers | globbing | confusing filename, name: > 'widg_addPolyOpt.py', lower: 'widg_addpolyopt.py', already: > 'Widg_addPolyOpt.py' > resolvers | globbing | confusing filename, name: > 'widg_editBezier.py', lower: 'widg_editbezier.py', already: > 'Widg_editBezier.py' > resolvers | expansions | 126789 files found on 6128 directories > with 72213 uppercase remappings > resolvers | resolving | > resolvers | resolving | saving tree '.' > resolvers | caches | hashing tree '.', hash > '5058f1af8388633f609cadb75a75dc9d' > resolvers | caches | hashing tree > 'selfautodir:/share/texmf-dist/web2c/texmfcnf.lua', hash > '0399a8df3aef8d154781d0a9c2b8e28d' > resolvers | caching | preparing 'files' for '.' > resolvers | caching | category 'files', cachename '.' saved in > '/home/gerion/.texlive2020/texmf-var/luatex-cache/context/0399a8df3aef8d154781d0a9c2b8e28d/trees/5058f1af8388633f609cadb75a75dc9d.lua' > system | lua | compiling > '/home/gerion/.texlive2020/texmf-var/luatex-cache/context/0399a8df3aef8d154781d0a9c2b8e28d/trees/5058f1af8388633f609cadb75a75dc9d.lua' > into > '/home/gerion/.texlive2020/texmf-var/luatex-cache/context/0399a8df3aef8d154781d0a9c2b8e28d/trees/5058f1af8388633f609cadb75a75dc9d.luc' > system | lua | dumping > '/home/gerion/.texlive2020/texmf-var/luatex-cache/context/0399a8df3aef8d154781d0a9c2b8e28d/trees/5058f1af8388633f609cadb75a75dc9d.lua' > into > '/home/gerion/.texlive2020/texmf-var/luatex-cache/context/0399a8df3aef8d154781d0a9c2b8e28d/trees/5058f1af8388633f609cadb75a75dc9d.luc' > stripped > resolvers | caching | 'files' compiled to > '/home/gerion/.texlive2020/texmf-var/luatex-cache/context/0399a8df3aef8d154781d0a9c2b8e28d/trees/5058f1af8388633f609cadb75a75dc9d.luc' > mtxrun | > mtxrun | elapsed lua time: 1.427 seconds > % context --version > mtx-context | ConTeXt Process Management 1.03 > mtx-context | > mtx-context | main context file: tex/context/base/mkiv/context.mkiv > mtx-context | current version: 2020.03.10 14:44 > mtx-context | main context file: tex/context/base/mkiv/context.mkxl > mtx-context | current version: 2020.03.10 14:44 > > However, this is specific to exactly that directory. Running context or > mtxrun anywhere else does not work. > > Can you help me fixing that? Do I need to edit texmfcnf.lua or is there > a correct place for setting the tex installation directory? > > My distribution is Gentoo. I use the texlive packages from there. Also, > this Gentoo bug is related: https://bugs.gentoo.org/740442 > So probably, this is a Gentoo packaging problem. However, I'm asking > here because I think that you know best about the search path internals. > > My main problem is to understand the path and variable resolving of > context. Which files does it look at and what is selfautoparent? > > Best, > Gerion > ___________________________________________________________________________________ > If your question is of interest to others as well, please add an entry to the > Wiki! > > maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context > webpage : http://www.pragma-ade.nl / http://context.aanhet.net > archive : https://bitbucket.org/phg/context-mirror/commits/ > wiki : http://contextgarden.net > ___________________________________________________________________________________ ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___________________________________________________________________________________