我正在尝试使用 TeX Live 在我的 Linux 机器上手动安装我大学提供的 Latex 格式。我的 TEXMFLOCAL 文件夹是/usr/local/share/texmf
。我将所需的文件复制到此处的子目录中。但是,我无法mktexlsr
在此处运行。
以下是我尝试过的:
mycomp:/usr/local/share/texmf # whoami
root
mycomp:/usr/local/share/texmf # mktexlsr
mktexlsr: Updating /etc/texmf/ls-R...
/usr/lib/mktex/mktexlsr: line 184: /usr/local/share/texmf/ls-R: Permission denied
mktexlsr: could not create file '/usr/local/share/texmf/ls-R'. Skipping...
mktexlsr: Updating /var/lib/texmf/main/ls-R...
mktexlsr: Updating /var/cache/texmf/fonts/ls-R...
mktexlsr: Updating /var/lib/texmf/ls-R...
mktexlsr: Done.
mycomp:/usr/local/share/texmf # touch ls-R
mycomp:/usr/local/share/texmf # ls -l
total 8
drwxrwxr-x 5 root root 4096 Apr 20 16:36 doc
-rw-r--r-- 1 root root 0 Apr 25 17:33 ls-R
drwxr-xr-x 3 root root 4096 Apr 20 16:36 tex
mycomp:/usr/local/share/texmf # mktexlsr
warning: kpathsea: /usr/local/share/texmf/ls-R: No usable entries in ls-R.
warning: kpathsea: See the manual for how to generate ls-R.
warning: kpathsea: /usr/local/share/texmf/ls-R: No usable entries in ls-R.
warning: kpathsea: See the manual for how to generate ls-R.
mktexlsr: Updating /etc/texmf/ls-R...
mktexlsr: /usr/local/share/texmf/ls-R: no write permission, skipping...
mktexlsr: Updating /var/lib/texmf/main/ls-R...
mktexlsr: Updating /var/cache/texmf/fonts/ls-R...
mktexlsr: Updating /var/lib/texmf/ls-R...
mktexlsr: Done.
我在这里做错了什么?
编辑:
的输出ls -ld
为:
mycomp:/usr/local/share/texmf # ls -ld
drwxrwxr-x 4 root root 4096 Apr 25 17:33 .
答案1
问题是你的/usr/local/share/texmf
属于 组root
,而它应该来自mktex
。
这文档提到setgid
,但这里没有设置:
ls -l /usr/bin/mktexlsr
lrwxrwxrwx 1 root root 21 Nov 19 2014 /usr/bin/mktexlsr -> /usr/lib/mktex/public
ls -l /usr/lib/mktex/public
-rwxr-xr-x 1 root mktex 11032 Oct 15 2014 /usr/lib/mktex/public
我们希望有人能找到解释。
同时,下面介绍如何解决这个问题:
cd /usr/local/share/texmf/
# create ls-R if it does not exist yet
sudo touch ls-R
# change the ls-R group to mktex
sudo chgrp mktex ls-R
# change file mode bits (readable by all, writable by root and mktex group)
sudo chmod 664 ls-R
查看:
ls -l /usr/local/share/texmf/ls-R
-rw-rw-r-- 1 root mktex 246 Mar 13 11:39 /usr/local/share/texmf/ls-R