Fontconfig Error: Cannot Load Default Config File Fix
Your fontconfig can't find or parse its config file. The fix is usually rebuilding the cache or fixing a broken symlink. Stop chasing font packages.
I know that "Fontconfig error: Cannot load default config file" message drives you nuts. It's popping up on login, in terminal, maybe even borking your GUI. Let's kill it fast.
The Quick Fix: Rebuild the Font Cache
Nine times out of ten, this error is just a corrupted or missing cache. Run this as your normal user:
fc-cache -fv
That forces a verbose rebuild of the font information cache. If the command isn't found, install fontconfig:
# Ubuntu/Debian
sudo apt install fontconfig
# Fedora/RHEL
sudo dnf install fontconfig
# Arch
sudo pacman -S fontconfig
After that, log out and back in. The error should be gone.
When That Doesn't Work: Check the Config File
If fc-cache didn't fix it, the problem is almost definitely a missing or broken /etc/fonts/fonts.conf. Let's check:
ls -la /etc/fonts/fonts.conf
If you see a symlink pointing to /etc/fonts/conf.d/ or something else, it might be broken. On a standard install, fonts.conf should be a real file, not a symlink. Reinstalling the package usually restores it:
sudo apt install --reinstall fontconfig
If that doesn't recreate it, manually create it:
sudo nano /etc/fonts/fonts.conf
Paste this minimal config:
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<dir>/usr/share/fonts</dir>
<dir>/usr/local/share/fonts</dir>
<dir>~/.fonts</dir>
<cachedir>/var/cache/fontconfig</cachedir>
<cachedir>~/.fontconfig</cachedir>
<config>
<rescan><int>30</int></rescan>
</config>
</fontconfig>
Then run fc-cache -fv again.
Why This Happens
Fontconfig is stupidly picky about its config file location and content. The default location is /etc/fonts/fonts.conf. If that file is missing, corrupted, or unreadable, fontconfig panics and throws this error. The cache rebuild works because it force-writes a fresh cache from the font directories listed in the config — but if the config itself is hosed, you have to fix that first.
Common triggers: a package update that failed halfway through, a user accidentally deleting /etc/fonts, or running fontconfig-related commands as root when they shouldn't have.
Less Common Variations and Fixes
Environmental Variables Pointing to Wrong Place
If you've set FONTCONFIG_PATH or FONTCONFIG_FILE in your shell profile, that overrides the default. Check with:
echo $FONTCONFIG_PATH
echo $FONTCONFIG_FILE
If those are set, unset them or point them to the correct location. Usually you don't need them set at all.
Flatpak or Snap Permissions
If the error only shows when running Flatpak apps, the sandbox might not have access to /etc/fonts. Grant it with:
sudo flatpak override --filesystem=/etc/fonts
For Snap apps, the fix is usually reinstalling the snap or restarting the snapd service.
WSL (Windows Subsystem for Linux)
WSL users hit this a lot. The culprit is Windows fonts being symlinked into the Linux filesystem and the symlinks break. Run this in WSL:
sudo apt install --reinstall fontconfig
sudo rm -rf /var/cache/fontconfig/*
fc-cache -fv
Also check if /mnt/c/Windows/Fonts is accessible. If not, your WSL distro might need a restart.
Prevention
Don't mess with /etc/fonts by hand unless you know exactly what you're doing. If you need custom font configs, put them in /etc/fonts/conf.d/ as .conf files — that's what the directory is for. Also, run fc-cache after installing any new fonts, not as root, but as your user. Keeps the cache clean.
Bottom line: 95% of the time,
fc-cache -fvfixes it. The other 5% is a missing or broken config file. Don't overthink it.
Was this solution helpful?