DEV Community

Cover image for KDE Plasma crashes after system update on Kubuntu 26.04: fontconfig race condition fix
Mišo Oroz for Zerolock

Posted on

KDE Plasma crashes after system update on Kubuntu 26.04: fontconfig race condition fix

Last week I updated a Kubuntu 26.04 LTS workstation and came back to a broken desktop. KDE Plasma would start, the desktop would flash for a second, then disappear. plasmashell kept crashing in a loop. The machine was otherwise fine: Konsole worked, Firefox worked, Thunderbird worked, the system was responsive. Just no desktop.

This is what I found and how I fixed it permanently.

What was happening

The crash was a SIGSEGV in plasmashell, repeating every few seconds with Failed with result 'core-dump' in the service logs. After digging into the stack trace, the culprit was fontconfig.

The root cause is a race condition at login. When you log in after a system update that touches font packages, plasmashell starts reading the font cache at the same time something else triggers its regeneration. fontconfig ends up writing a new cache while plasmashell is already reading the old one, which causes a segfault inside FcCharSetHasChar.

It is a timing issue, which is why it does not happen on every update and why a simple restart sometimes appears to fix it temporarily.

Diagnosing

Before touching anything, confirm the crash is what I described:

coredumpctl list --since today --no-pager
Enter fullscreen mode Exit fullscreen mode

You should see plasmashell crashes. Then read the stack:

coredumpctl info plasmashell --no-pager | grep -A40 "Stack trace of thread"
Enter fullscreen mode Exit fullscreen mode

Look for FcCharSetHasChar in the trace. If it is there, you have the same issue.

Also worth checking the session log:

journalctl --user -b --no-pager -p warning | grep -iE "plasmashell|fontconfig" | tail -20
Enter fullscreen mode Exit fullscreen mode

Temporary fix

This gets the desktop back immediately without a reboot:

rm -rf ~/.cache/fontconfig
sudo rm -rf /var/cache/fontconfig/*
sudo fc-cache -r -f
fc-cache -r -f
systemctl --user reset-failed plasma-plasmashell
systemctl --user restart plasma-plasmashell
Enter fullscreen mode Exit fullscreen mode

The desktop should come back within a few seconds. This works until the next reboot, at which point the race condition can happen again.

Permanent fix

The real solution is to force a font cache regeneration before plasmashell starts. You do this with a systemd drop-in that adds an ExecStartPre directive to the plasmashell service:

mkdir -p ~/.config/systemd/user/plasma-plasmashell.service.d
Enter fullscreen mode Exit fullscreen mode

Then create the drop-in file:

cat > ~/.config/systemd/user/plasma-plasmashell.service.d/fontcache.conf << 'EOF'
[Service]
ExecStartPre=/usr/bin/fc-cache -f
EOF
Enter fullscreen mode Exit fullscreen mode

Reload systemd and reboot:

systemctl --user daemon-reload
sudo reboot
Enter fullscreen mode Exit fullscreen mode

After login, verify it worked:

systemctl --user status plasma-plasmashell | head -10
Enter fullscreen mode Exit fullscreen mode

You want to see this in the output:

Process: ExecStartPre=/usr/bin/fc-cache -f (code=exited, status=0/SUCCESS)
Active: active (running)
Enter fullscreen mode Exit fullscreen mode

If you see that, the drop-in is working and the font cache is being regenerated before plasmashell touches it on every boot.

Why this works

The systemd drop-in ensures fc-cache completes before plasmashell starts. No race, no partial file reads, no segfault. It adds a second or two to login time, which is a reasonable trade for a stable desktop.

The drop-in survives updates because it lives in your user config directory, not in the system service file. If a future KDE or fontconfig update changes the timing behavior, you can simply remove the drop-in and check if the issue is gone.

Environment

Kubuntu 26.04 LTS, KDE Plasma 6.6.6, kernel 7.0.0-34, Intel Raptor Lake i915. I deploy Kubuntu 26.04 on client workstations and hit this after a routine update. The fix has held across multiple reboots and subsequent updates.

If you are seeing something similar but the stack trace does not mention fontconfig, this drop-in will not help. The crash is something else. Check the coredumpctl output carefully before applying anything.

zerolock.it

Top comments (0)