Default Chromium fonts are missing after snapd has been updated

Default Chromium fonts (Liberation) are missing after snapd has been updated
How to recover them ?

chromium  89.0.4350.4  latest/edge

snap version
snap    2.48+git661.g2997c48
snapd   2.48+git661.g2997c48
series  16
ubuntu  20.10
kernel  5.8.0-33-generic

cc @osomon
This is probably a variant of https://bugs.launchpad.net/ubuntu/+source/snapd/+bug/1858636 which should now be totally avoided by the chromium snap since it now uses the gnome extension and thus has a snap-private font cache which snapd doesn’t touch or modify.

Does it work if you run:

sudo snap run --shell chromium -c 'FONTCONFIG_FILE="${SNAP_COMMON}/fontconfig/fonts.conf" "${SNAP_DESKTOP_RUNTIME}/usr/bin/fc-cache" --force --system-only --verbose'

and then restart chromium? also what is the output of that command regardless of whether it works afterwards?

1 Like

I will have to wait for the next snapd update…
I recovered my fonts by deleting the ‘~/snap/chromium/common’ directory which forced chromium to go and retrieve a ‘.config/chromium’ folder from an old ‘apt’ installation, taking care to update the ‘Default’ folder before

snapd update > 2.48+git667.g9adfb75
Fonts are missing again…

Running

sudo snap run --shell -c 'FONTCONFIG_FILE="${SNAP_COMMON}/fontconfig/fonts.conf" "${SNAP_DESKTOP_RUNTIME}/usr/bin/fc-cache" --force --system-only --verbose'

doesn’t change anything

error message:
error : unknown flag 'c'

error message without flag ‘c’:
error : cannot find current revision for snap FONTCONFIG_FILE="${SNAP_COMMON}/fontconfig/fonts: readlink /snap/FONTCONFIG_FILE="${SNAP_COMMON}/fontconfig/fonts/current: no such file or directory

snapd last update
(2.48+git703.g8f57b94)
2.48+git705.g4ee1ee8

same, fonts are missing again

Default fonts are missing in chromium after a snapd update

Nothing happens if I quit and reopen chromium the usual way, the fonts are still missing

But if I run a ‘sudo killall chrome’ command instead of simply quitting chromium then the fonts are no longer missing.
(same approach here: How to run chromium in another language?)

I don’t know if this is the logical approach but in any case it saves me tedious manipulations.

Had to run a ‘sudo killall chrome’ command because of this:

System Settings option “Continue to run background apps when Google Chrome is closed.” must be disabled for Chromium to quit properly (no background processes).

But the fonts are still missing after a snapd update and I still have to quit Chromium to get them back

Sorry I had a typo here, it should be:

sudo snap run --shell chromium -c 'FONTCONFIG_FILE="${SNAP_COMMON}/fontconfig/fonts.conf" "${SNAP_DESKTOP_RUNTIME}/usr/bin/fc-cache" --force --system-only --verbose'

Fonts are ok right now
Have to wait for the next snapd update

You can artificially trigger snapd snap updates by switching channels with

snap refresh snapd --candidate

etc.

1 Like

snapd update > missing default fonts:

sudo snap run --shell chromium -c 'FONTCONFIG_FILE="${SNAP_COMMON}/fontconfig/fonts.conf" "${SNAP_DESKTOP_RUNTIME}/usr/bin/fc-cache" --force --system-only --verbose'
mkdir: cannot create directory '/run/user/0': Permission denied
Fontconfig warning: "/etc/fonts/fonts.conf", line 5: unknown element "its:rules"
Fontconfig warning: "/etc/fonts/fonts.conf", line 6: unknown element "its:translateRule"
Fontconfig error: "/etc/fonts/fonts.conf", line 6: invalid attribute 'translate'
Fontconfig error: "/etc/fonts/fonts.conf", line 6: invalid attribute 'selector'
Fontconfig error: "/etc/fonts/fonts.conf", line 7: invalid attribute 'xmlns:its'
Fontconfig error: "/etc/fonts/fonts.conf", line 7: invalid attribute 'version'
Fontconfig warning: "/etc/fonts/fonts.conf", line 9: unknown element "description"
/usr/share/fonts: caching, new cache contents: 0 fonts, 9 dirs
/usr/share/fonts/X11: caching, new cache contents: 0 fonts, 4 dirs
/usr/share/fonts/X11/Type1: caching, new cache contents: 8 fonts, 0 dirs
/usr/share/fonts/X11/encodings: caching, new cache contents: 0 fonts, 1 dirs
/usr/share/fonts/X11/encodings/large: caching, new cache contents: 0 fonts, 0 dirs
/usr/share/fonts/X11/misc: caching, new cache contents: 89 fonts, 0 dirs
/usr/share/fonts/X11/util: caching, new cache contents: 0 fonts, 0 dirs
/usr/share/fonts/cMap: caching, new cache contents: 0 fonts, 0 dirs
/usr/share/fonts/cmap: caching, new cache contents: 0 fonts, 0 dirs
/usr/share/fonts/eot: caching, new cache contents: 0 fonts, 1 dirs
/usr/share/fonts/eot/font-awesome: caching, new cache contents: 0 fonts, 0 dirs
/usr/share/fonts/opentype: caching, new cache contents: 0 fonts, 6 dirs
/usr/share/fonts/opentype/font-awesome: caching, new cache contents: 0 fonts, 0 dirs
/usr/share/fonts/opentype/inter: caching, new cache contents: 18 fonts, 0 dirs
/usr/share/fonts/opentype/linux-libertine: caching, new cache contents: 13 fonts, 0 dirs
/usr/share/fonts/opentype/malayalam: caching, new cache contents: 7 fonts, 0 dirs
/usr/share/fonts/opentype/noto: caching, new cache contents: 28 fonts, 0 dirs
/usr/share/fonts/opentype/urw-base35: caching, new cache contents: 35 fonts, 0 dirs
/usr/share/fonts/svg: caching, new cache contents: 0 fonts, 1 dirs
/usr/share/fonts/svg/font-awesome: caching, new cache contents: 0 fonts, 0 dirs
/usr/share/fonts/truetype: caching, new cache contents: 0 fonts, 60 dirs
/usr/share/fonts/truetype/Gargi: caching, new cache contents: 1 fonts, 0 dirs
/usr/share/fonts/truetype/Gubbi: caching, new cache contents: 1 fonts, 0 dirs
/usr/share/fonts/truetype/Nakula: caching, new cache contents: 1 fonts, 0 dirs
/usr/share/fonts/truetype/Navilu: caching, new cache contents: 1 fonts, 0 dirs
/usr/share/fonts/truetype/Sahadeva: caching, new cache contents: 1 fonts, 0 dirs
/usr/share/fonts/truetype/Sarai: caching, new cache contents: 1 fonts, 0 dirs
/usr/share/fonts/truetype/abyssinica: caching, new cache contents: 1 fonts, 0 dirs
/usr/share/fonts/truetype/arphic: caching, new cache contents: 0 fonts, 0 dirs
/usr/share/fonts/truetype/crosextra: caching, new cache contents: 8 fonts, 0 dirs
/usr/share/fonts/truetype/dejavu: caching, new cache contents: 22 fonts, 0 dirs
/usr/share/fonts/truetype/droid: caching, new cache contents: 1 fonts, 0 dirs
/usr/share/fonts/truetype/font-awesome: caching, new cache contents: 0 fonts, 0 dirs
/usr/share/fonts/truetype/fonts-beng-extra: caching, new cache contents: 6 fonts, 0 dirs
/usr/share/fonts/truetype/fonts-deva-extra: caching, new cache contents: 3 fonts, 0 dirs
/usr/share/fonts/truetype/fonts-gujr-extra: caching, new cache contents: 5 fonts, 0 dirs
/usr/share/fonts/truetype/fonts-guru-extra: caching, new cache contents: 1 fonts, 0 dirs
/usr/share/fonts/truetype/fonts-kalapi: caching, new cache contents: 1 fonts, 0 dirs
/usr/share/fonts/truetype/fonts-orya-extra: caching, new cache contents: 1 fonts, 0 dirs
/usr/share/fonts/truetype/fonts-telu-extra: caching, new cache contents: 2 fonts, 0 dirs
/usr/share/fonts/truetype/fonts-yrsa-rasa: caching, new cache contents: 10 fonts, 0 dirs
/usr/share/fonts/truetype/freefont: caching, new cache contents: 12 fonts, 0 dirs
/usr/share/fonts/truetype/gentium: caching, new cache contents: 4 fonts, 0 dirs
/usr/share/fonts/truetype/gentium-basic: caching, new cache contents: 8 fonts, 0 dirs
/usr/share/fonts/truetype/glyphicons: caching, new cache contents: 1 fonts, 0 dirs
/usr/share/fonts/truetype/kacst: caching, new cache contents: 15 fonts, 0 dirs
/usr/share/fonts/truetype/kacst-one: caching, new cache contents: 2 fonts, 0 dirs
/usr/share/fonts/truetype/lao: caching, new cache contents: 1 fonts, 0 dirs
/usr/share/fonts/truetype/lato: caching, new cache contents: 18 fonts, 0 dirs
/usr/share/fonts/truetype/liberation: caching, new cache contents: 16 fonts, 0 dirs
/usr/share/fonts/truetype/liberation2: caching, new cache contents: 12 fonts, 0 dirs
/usr/share/fonts/truetype/libreoffice: caching, new cache contents: 1 fonts, 0 dirs
/usr/share/fonts/truetype/lohit-assamese: caching, new cache contents: 1 fonts, 0 dirs
/usr/share/fonts/truetype/lohit-bengali: caching, new cache contents: 1 fonts, 0 dirs
/usr/share/fonts/truetype/lohit-devanagari: caching, new cache contents: 1 fonts, 0 dirs
/usr/share/fonts/truetype/lohit-gujarati: caching, new cache contents: 1 fonts, 0 dirs
/usr/share/fonts/truetype/lohit-kannada: caching, new cache contents: 1 fonts, 0 dirs
/usr/share/fonts/truetype/lohit-malayalam: caching, new cache contents: 1 fonts, 0 dirs
/usr/share/fonts/truetype/lohit-oriya: caching, new cache contents: 1 fonts, 0 dirs
/usr/share/fonts/truetype/lohit-punjabi: caching, new cache contents: 1 fonts, 0 dirs
/usr/share/fonts/truetype/lohit-tamil: caching, new cache contents: 1 fonts, 0 dirs
/usr/share/fonts/truetype/lohit-tamil-classical: caching, new cache contents: 1 fonts, 0 dirs
/usr/share/fonts/truetype/lohit-telugu: caching, new cache contents: 1 fonts, 0 dirs
/usr/share/fonts/truetype/lyx: caching, new cache contents: 11 fonts, 0 dirs
/usr/share/fonts/truetype/malayalam: caching, new cache contents: 10 fonts, 0 dirs
/usr/share/fonts/truetype/msttcorefonts: caching, new cache contents: 0 fonts, 0 dirs
/usr/share/fonts/truetype/noto: caching, new cache contents: 1640 fonts, 0 dirs
/usr/share/fonts/truetype/open-sans: caching, new cache contents: 13 fonts, 0 dirs
/usr/share/fonts/truetype/openoffice: caching, new cache contents: 0 fonts, 0 dirs
/usr/share/fonts/truetype/padauk: caching, new cache contents: 4 fonts, 0 dirs
/usr/share/fonts/truetype/pagul: caching, new cache contents: 1 fonts, 0 dirs
/usr/share/fonts/truetype/roboto: caching, new cache contents: 0 fonts, 2 dirs
/usr/share/fonts/truetype/roboto/hinted: caching, new cache contents: 20 fonts, 0 dirs
/usr/share/fonts/truetype/roboto/unhinted: caching, new cache contents: 8 fonts, 1 dirs
/usr/share/fonts/truetype/roboto/unhinted/RobotoTTF: caching, new cache contents: 12 fonts, 0 dirs
/usr/share/fonts/truetype/samyak: caching, new cache contents: 1 fonts, 0 dirs
/usr/share/fonts/truetype/samyak-fonts: caching, new cache contents: 3 fonts, 0 dirs
/usr/share/fonts/truetype/sinhala: caching, new cache contents: 1 fonts, 0 dirs
/usr/share/fonts/truetype/teluguvijayam: caching, new cache contents: 3 fonts, 0 dirs
/usr/share/fonts/truetype/tibetan-machine: caching, new cache contents: 1 fonts, 0 dirs
/usr/share/fonts/truetype/tlwg: caching, new cache contents: 58 fonts, 0 dirs
/usr/share/fonts/truetype/ttf-bitstream-vera: caching, new cache contents: 10 fonts, 0 dirs
/usr/share/fonts/truetype/ttf-khmeros-core: caching, new cache contents: 2 fonts, 0 dirs
/usr/share/fonts/truetype/ubuntu: caching, new cache contents: 14 fonts, 0 dirs
/usr/share/fonts/type1: caching, new cache contents: 0 fonts, 2 dirs
/usr/share/fonts/type1/gsfonts: caching, new cache contents: 35 fonts, 0 dirs
/usr/share/fonts/type1/urw-base35: caching, new cache contents: 35 fonts, 0 dirs
/usr/share/fonts/woff: caching, new cache contents: 0 fonts, 1 dirs
/usr/share/fonts/woff/font-awesome: caching, new cache contents: 0 fonts, 0 dirs
/usr/local/share/fonts: caching, new cache contents: 0 fonts, 0 dirs
/var/snap/chromium/common/fontconfig: cleaning cache directory
/var/cache/fontconfig: not cleaning unwritable cache directory
/snap/chromium/1434/gnome-platform/usr/bin/fc-cache: succeeded

So this is interesting, this directory inside the snap is actually a bind mount from the host system, so what I would be curious to see is if you make this directory temporarily empty and then re-run things if it works. We have talked about getting rid of or otherwise disabling this mounting code in snapd because most snaps now shouldn’t need it since they will be using their own snap-private font caches, so perhaps we need to do that.

Can you try the following and see what happens:

snap disable chromium
sudo mount -t tmpfs tmpfs /var/cache/fontconfig
snap enable chromium
snap run --shell chromium -c 'ls -lah /var/cache/fontconfig' # this should be an empty dir
snap run chromium # check if fonts work
# trigger a snapd refresh
snap refresh snapd --edge # or some other channel than what you are currently following
snap run chromium # check if fonts work now
# if fonts don't work, then try this:
sudo snap run --shell chromium -c 'FONTCONFIG_FILE="${SNAP_COMMON}/fontconfig/fonts.conf" "${SNAP_DESKTOP_RUNTIME}/usr/bin/fc-cache" --force --system-only --verbose'
snap run chromium # check fonts again

to undo the empty /var/cache/fontconfig above, do this:

sudo umount /var/cache/fontconfig
2 Likes

It worked after running all commands
No more missing fonts after snapd update :+1:

No need to run that so ?

to undo the empty /var/cache/fontconfig above, do this:

sudo umount /var/cache/fontconfig

missing fonts again after last snapd update… :slightly_frowning_face:

Thanks for testing this out, we understand the problem and unfortunately you will keep hitting the issue where the fonts disappear until we have merged the fix into edge, but it is currently under active review in snapd, then once it is in snapd, the chromium snap will need to be updated to use it.