Snapped app not loading fonts on Fedora (and Arch)

I am trying to follow along with all of you but wondering if this is the same error.

$ cloudcompare.CloudCompare

QSocketNotifier: Can only be used with threads started with QThread
Gtk-Message: 21:49:04.756: Failed to load module ā€œcanberra-gtk-moduleā€
Gtk-Message: 21:49:04.790: Failed to load module ā€œcolorreload-gtk-moduleā€
Fontconfig warning: FcPattern object weight does not accept value [40 210)
Segmentation fault (core dumped)

Confirm this works for me too (in my case, testing with joplin-james-carroll.joplin)

I maintain Beekeeper Studio and users have reported this issue on Fedora 32 and Manjaro. Iā€™ve confirmed the broken fonts with a totally fresh VM.

Iā€™ve tried all the workarounds listed here and nothing seems to fix the fonts.

Did anyone find the correct workaround?

Any way to fix this issue in my Electron build process?

2 Likes

This does not work for me on Manjaro KDE and trying to use CloudCompare:

rm ~/.cache/fontconfig/*
[somebody ~]$ fc-cache -r
[somebody ~]$ cloudcompare.CloudCompare       
QSocketNotifier: Can only be used with threads started with QThread
Gtk-Message: 21:14:02.771: Failed to load module "canberra-gtk-module"
Gtk-Message: 21:14:02.806: Failed to load module "colorreload-gtk-module"
Fontconfig warning: FcPattern object weight does not accept value [40 210)
Segmentation fault (core dumped)

I know there is some ongoing work to make the snap caches private to respective snaps. @kenvandine did a PoC with Inkscape snap which worked well when I tried it. Perhaps he or @jamesh can comment on the current status.

2 Likes

@mborzecki thanks so much.

@kenvandine @jamesh would love to learn more about your work and how you worked around this problem. Even if I have to hard-code a font into my app or something it would be a big improvement.

Thanks for your time on this bug :pray:

I am also having this problem with Manjaro ARM. None of the solutions above have worked.

Any thoughts here? This is a big issue for my app as it makes my Snap unusable on Fedora and Manjaro for anyone who needs to open the file open dialog.

2 Likes

Although that above did not get the app to work, this, slightly different set of commands, DID work to allow me to run the app. **I am on Manjaro

$ sudo rm -f /var/cache/fontconfig/*
$ rm -f ~/.cache/fontconfig/*

That came from philm of Manjaro: https://forum.manjaro.org/u/philm
**I could not find the post where he offered it.

the DASH EFF seems to do the trick. (-f)

2 Likes

These commands worked for me except I got the ā€˜Argument list too longā€™ error on the second command so I deleted the fontconfig dir and added an empty one. I am using Manjaro KDE. Thanks for this solution. :clap:

FWIW ā€“ Saw this problem with stock Ubuntu 20.04 with a custom gnome theme installed (have no idea if that makes a difference ā€“ just saying).

Again, this fixes it:

The snap that displays this problem for me is ā€œnamegenā€ ā€“ a GTK3-based random name generator. I have since taken it private until I have time to work this more carefully or until the solution is found.

I think Iā€™m running into this on Ubuntu 20.04 when testing a 18.04-based rst2pdf snap before publishing (pull request here https://github.com/rst2pdf/rst2pdf/pull/928). The tool produces PDFs, so it does need to access the fonts on the userā€™s system, and we know our user base has a mix of geekiness, so we canā€™t recommend people run command to clear their font caches as a general thing :confused: Is there a way to manage the font config/cache from within the snap so we can publish a new version? At the moment trying to do anything with fonts is producing FileNotFoundError: [Errno 2] No such file or directory: 'fc-match': 'fc-match' and no output. Advice gratefully received ā€¦

If thereā€™s a better way (or something integrated in the extensions) it would be very niceā€¦
In a snap I maintain (the swi-prolog snap: https://snapcraft.io/swi-prolog) this issue appears from time to time, and while it can be solved by removing the fontconfig cache it is not convenient.
In my case the snap is using the kde-neon extension, if that makes any difference

Will this ever get fixed? None of the workarounds work anymore, on some snapsā€¦

on which snaps ?

alfacast for example

Spotify here, currently.

Less than ideal removing my font configs. Can a package maintainer take some responsibility for this please.

well, it is not your configs but only the cached data (the cache gets automatically re-generated).

there have been fixes in various areas (snaps that use snapcraft extensions (i.e. the qt one or the gnome ones) should already behave fine, snaps that use the older desktop launchers and have not been re-built in a while might still be stuck on old behaviour though (thus my quetion above about ā€œwhich snapsā€))

Thanks @ogra. Looking at your github looks like you have made quite a few contributions to snap.

This fix has worked for me. Just to better uunderstand and to move towards a full resolution to this issue. Could you descibe the actual fault to me. I am sure that there is something we can suggest or build for snap to deal with this in a better way.