latexxelatex

Fontconfig error: No writable cache directories


It seems that when I build my resume written in LaTeX using GitHub Actions there are no errors, However, when I run the build locally, I encounter thousands of errors like the one in the title of the question. (both uses Docker).

What could be the issue? I've already tried mounting a tmpfs on /tmp to see if it resolves the problem, but it didn't help.

docker run --interactive --tty --rm --name texlive \
        --user $(shell id -u):$(shell id -g) \
        --volume $(shell pwd):/home \
        --mount type=tmpfs,destination=/tmp \
        --workdir /home \
    texlive/texlive xelatex *.tex

Solution

  • The difference is in the user you use in the container.

    I suppose you don't bother setting the user, -u on the build server, so it runs as some default that has a HOME set to a directory where it can probably write. But when you run it locally, you give it your user ID and it does not have HOME set.

    Try adding --env HOME=/home (or whatever the mount is; I would normally use /src or /work or somesuch) option, then it should write the cache to the project directory.


    My preferred solution is to have libnss-unknown installed in the container, have ENV HOME=/home setting in the Dockerfile and have the /home directory world-writable. Then whatever -u option you pass, you'll get writable home inside for any program that needs it. But that means you'd have to make your own customized container. I often end up needing one anyway, because I need some extra packages.