Fontconfig error: No writable cache directories
Hi there!
It seems that this error popped up for me after a recent build:
Fontconfig error: No writable cache directories
Any idea what might be causing it? I'm pretty sure nothing has changed on our end :thinking:
Can you give more info on your setup? Important info would be how you are using the images, and it would be helpful to have a minimal input document to reproduce the error.
Hey! thanks for the quick response.
We use it in our dockerfile as such:
FROM pandoc/latex:latest
# Install latex libraries & dependencies
RUN tlmgr update --self \
&& tlmgr install \
pdfpages \
tocloft \
emptypage \
footmisc \
titlesec \
wallpaper \
roboto \
incgraph \
tcolorbox \
environ \
eso-pic \
datatool
RUN apk add sed ghostscript curl python3
# Install fonts
RUN /bin/sh -c \
"$(curl -fsSL https://raw.githubusercontent.com/JetBrains/JetBrainsMono/master/install_manual.sh)" \
&& cp /root/.local/share/fonts/fonts/ttf/* /usr/share/fonts \
&& curl -L -O https://github.com/googlefonts/roboto/releases/download/v2.138/roboto-unhinted.zip \
&& unzip -q roboto-unhinted.zip -d /usr/share/fonts
# Clean font cache
RUN fc-cache -f && rm -rf /var/cache/*
ENTRYPOINT ["sh", "-c"]
And run it sort of like this
docker run --rm --volume "$PWD":/data -u "$(id -u "$USER"):$(id -g "$USER")" docker-tag script.sh
where script.sh contains the actual pandoc command, among other things.
I've messed around with the script per se and the pandoc command but they don't seem to be related to that behavior :thinking:
I thought it might have something to do with the fc-cache command but no luck either.
Oh, I think I ran into something similar at some point. I solved it by changing permissions on a directory. Try
ENV OSFONTDIR=/usr/share/fonts
RUN chmod -R o+w /opt/texlive/texdir/texmf-var \
&& fc-cache --really-force --verbose
and, if you are using LuaLaTeX,
RUN TERM=dumb luaotfload-tool --update
You can take a look at the Dockefile in openjournals/inara for an example where we do something similar.
BTW, alpine has the package font-jetbrains-mono-nerd that might be easier to use than the installer.
Sadly no luck :disappointed: Not sure if it helps, but the actual pandoc command is:
pandoc --pdf-engine=xelatex --template=something/something.tex --listings -V documentclass=report -f markdown-implicit_figures -o something/something.pdf --resource-path=some/other/path/
Thanks a lot for the heads up on font-jetbrains-mono-nerd! I also happily discovered that font-roboto is also in the same repos, although for some reason I can't seem to install the latter:
ERROR: unable to select packages:
font-roboto (no such package):
required by: world[font-roboto]
But that seems like a problem for future me :smile:
Huh weird. I don't know. I'll look into it when I have some free time. I don't see it as a clear problem with the image, so it's not a priority right now.