Debian – How to fix Fontconfig error: failed reading config file

debianfirefoxfontconfigsnap

On Debian testing, whenever I run a browser from the terminal, I get four lines of the following error:

Fontconfig error: failed reading config file

This doesn't seem to cause any problems in any application, only in Firefox Quantum installed via snap font rendering doesn't work correctly, just like here and here.

I have already tried all the steps mentioned in the two posts, apart from installing the tar, since I'd like to keep the snap version. When I first installed the browser, I had rendering issues on more websites (like Stackoverflow), but installing Microsoft core fonts fixed this. Now, the issue seems to be with Helvetica only, however, fc-match Helvetica shows that Helvetica is correctly matched with Arial.

So my conclusion is that somehow the "snap Firefox" is not able to read the fontconfig files (firefox-esr works fine, just like Opera and other browsers). I think the problem is not confined to Firefox Quantum though, because the error appears when I run another browser from command line as well. It just doesn't cause any issue there.

So the question is really how to fix the fontconfig setup? I have already reinstalled and ran dpkg-reconfigure fontconfig-config.

Best Answer

Have a look at /etc/fonts/conf.avail and /etc/fonts/conf.d . I came across this question because I had the same problem. Finally

FC_DEBUG=1024 fc-cache 2>&1|less did not tell anything helpful. So I ran the following command looking for missing configuration files.

FC_DEBUG=1024 strace fc-cache 2>&1|less

It turned out that the configuration file from the fonts-guru-extra package was messed up. It was stored as /etc/fonts/conf.avail/65-0-fonts-guru-extra.conf/65-0-fonts-guru-extra.conf and the symlink from /etc/fonts/conf.avail/65-0-fonts-guru-extra.conf was somehow broken. At least it was not a file.

So I ran dpkg --force-depends --purge fonts-guru-extra and dpkg complained about a non-empty directory /etc/fonts/conf.avail/65-0-fonts-guru-extra.conf I deleted this directory by hand and ran

apt-get install fonts-guru-extra

and afterwards the error message was gone.

Related Question