20

Having issues when I start most graphical programs. Simply just says

Fontconfig error: Cannot load default config file

I can confirm that /etc/fonts/fonts.conf exists and has the correct permissions.

-rw-r--r--   1 root root  5497 Jan 16 09:55 fonts.conf

I'm not getting any other information associated with this error, and searching hasn't provided any helpful information either.

What can I do to fix this?

running gedit, geany, chromium-browser, firefox, libreoffice... Basically any graphical program that uses fonts

EDIT using strace i've found the problem stems from here:

access("/data/jenkins/pms-deps-universal/BUILD_TAG/linux-ubuntu-i686/output/pms-depends-linux-ubuntu-i686-release-8400c3b/etc/fonts/fonts.conf", R_OK) = -1 ENOENT (No such file or directory)
write(2, "Fontconfig error: ", 18Fontconfig error: )      = 18
write(2, "Cannot load default config file", 31Cannot load default config file) = 31

I've never used Jenkins before, I'll try removing it and see what happens

sudo apt-get purge jenkins

This returns that jenkins is not installed...

I don't even have a /data/ partition.

How can I change the path for Fontconfig?

8
  • Could you provide an example of which programs and/or commands that return this error.
    – Xweque
    Jul 5, 2014 at 18:57
  • edited. no special commands Jul 5, 2014 at 19:28
  • I meant if you could give at least one example of something so one could recreate the error.
    – Xweque
    Jul 5, 2014 at 19:30
  • I did! simply open a terminal and type gedit. that's exactly what I'm doing. Everything still works fine, I just get that annoying error. Jul 5, 2014 at 19:32
  • 1
    I've just now noticed that if I use sudo to open any program I no longer have fontconfig errors. What could be going on with this? Jul 23, 2014 at 2:21

2 Answers 2

31

You need to set the $FONTCONFIG_PATH properly. Usually it is set in /etc/profile but, if you are executing the command from a non login shell (e.g., through cron), then you need to set it explicitly by doing the following:

export FONTCONFIG_PATH=/etc/fonts
1
  • 1
    This is an actual answer to the question I actually asked! Too bad I can't test and see if it helps as it's been over a year since I asked the question, I've since updated, upgraded, and moved on from this issue. Thank you though, for actually answering the actual question. Dec 11, 2015 at 19:05
8

Just before fontconfig is built, it is configured. This hard codes the paths where it looks for various files. The fontconfig your program is linked to is not configured correctly. Fontconfig should be configured like this:

./configure --enable-static --sysconfdir=/etc --localstatedir=/var

This will make fontconfig look for fonts.conf in /etc/fonts instead of /data/jenkins/pms-deps-universal/BUILD_TAG/linux-ubuntu-i686/output/pms-depends-linux-ubuntu-i686-release-8400c3b/etc/fonts.

2
  • 4
    To those who want to delete this answer. What's wrong with it? This is the correct answer to why fontconfig displays the referenced error message. Just because you don't like the idea of rebuilding fontconfig from source does not make it an invalid answer.
    – jcoffland
    Sep 8, 2015 at 22:40
  • It doesn't work with me that command ! please help me
    – BKF
    Jun 1, 2018 at 14:05

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .