Gimp : some fonts not seen

Hi,

On computer B, Gimp 2.10.22 on an UbuntuBudgie 20.04.2

Some fonts are missing - only the default installed ones in /usr/share/fonts are available.

If I put the missing fonts in ~/snap/gimp/current/.config/GIMP/2.10/fonts/ then launch of Gimp halts on « fonts » for 30~40 seconds, and of course fonts are then available in Gimp. But this long halt is a pain.

I removed those fonts from there. Next launch is normal without halting on « fonts ».

So I tried to do on computer B what I used to do on computer A, which is a binding between
/media/DATA/USERS-EXTRA/my_folder_of_dear_fonts
and
/usr/share/fonts/EXTRA
throught that line in /etc/fstab
/media/DATA/USERS-EXTRA/FONTS /usr/share/fonts/EXTRAS none bind

On computer A it’s enough to have all fonts available in Gimp.
Computer A is also UbuntuBudgie 20.04.2 and Gimp 2.10.2.

On computer B, I still can’t find in Gimp fonts from EXTRAS.

The binding in itself works :

palace@PROLiANT:~$ ls -la /usr/share/fonts/EXTRAS/
total 32
drwxr-xr-x  7 palace users 4096 mars  25 22:08 .
drwxr-xr-x  9 root   root  4096 avril 21 17:46 ..
drwxr-xr-x  2 palace users 4096 janv.  3  2018 cmap
drwxr-xr-x  9 palace users 4096 juin   8  2018 opentype
drwxr-xr-x 42 palace users 4096 janv.  3  2018 truetype
drwxr-xr-x  3 palace users 4096 janv.  3  2018 type1
-rw-r--r--  1 palace users   36 mars  25 22:08 .uuid
drwxr-xr-x  6 palace users 4096 juil. 23  2014 X11
palace@PROLiANT:~$ 

I think Gimp ( on computer B ) has all necessary connections :

palace@PROLiANT:~$ snap connections gimp
Interface                             Connecteur                  Prise                                                 Notes
content[gnome-3-28-1804]              gimp:gnome-3-28-1804        gnome-3-28-1804:gnome-3-28-1804                       -
content[gtk-3-themes]                 gimp:gtk-3-themes           adapta-gtk-snap:gtk-3-themes                          manual
content[gtk-3-themes]                 gimp:gtk-3-themes           adapta-theme-colorpack:gtk-3-themes                   manual
content[gtk-3-themes]                 gimp:gtk-3-themes           gtk-common-themes:gtk-3-themes                        -
content[gtk-3-themes]                 gimp:gtk-3-themes           vimix-themes:gtk-3-themes                             manual
content[icon-themes]                  gimp:icon-themes            adapta-gtk-snap:icon-themes                           manual
content[icon-themes]                  gimp:icon-themes            gtk-common-themes:icon-themes                         -
content[kde-frameworks-5-core18-all]  gimp:kde-frameworks-5-plug  kde-frameworks-5-core18:kde-frameworks-5-core18-slot  -
content[sound-themes]                 gimp:sound-themes           gtk-common-themes:sound-themes                        -
cups-control                          gimp:cups-control           :cups-control                                         manual
dbus                                  -                           gimp:dbus-gimp                                        -
desktop                               gimp:desktop                :desktop                                              -
desktop-legacy                        gimp:desktop-legacy         :desktop-legacy                                       -
gsettings                             gimp:gsettings              :gsettings                                            -
home                                  gimp:home                   :home                                                 -
network                               gimp:network                :network                                              -
opengl                                gimp:opengl                 :opengl                                               -
removable-media                       gimp:removable-media        :removable-media                                      manual
unity7                                gimp:unity7                 :unity7                                               -
wayland                               gimp:wayland                :wayland                                              -
x11                                   gimp:x11                    :x11                                                  -
palace@PROLiANT:~$

I have same answer on computer A.

Now am a bit lost why does it work on A and not on B ?

Same failure after
(sudo) fc-cache -f -v

Should I just install Gimp from https://launchpad.net/~ubuntuhandbook1/+archive/ubuntu/gimp instead ?

I have also this problem in Gimp : Gimp : no access to « help » [ F1 ] or [ Shift ] + [ F1 ]

1 Like

Looking at the code in the desktop interface, we mount the host system /usr/share/fonts with the bind flag rather than rbind (aka recursive bind). This means that the the host system /usr/share/fonts directory will be available in the sandbox’s mount namespace, but none of the mounts from below that directory.

You should be able to inspect the sandbox mount namespace using snap run --shell gimp, and then see what’s visible in the fonts directory. It would also be worth running sudo /usr/lib/snapd/snap-discard-ns gimp to see if snapd has become confused trying to update an existing mount namespace. It would make sense to try snap-discard-ns on both systems: it may not make things work, but it will hopefully get both computers to give the same result.

If it does look like the problem is use of bind instead of rbind, we can probably fix that. I didn’t consciously choose not to make it recursive.

As for solutions that will work with the current version of snapd, a bind mount into your home directory under either ~/.local/share/fonts or ~/.fonts should work. It will only make the fonts available to the current user, but that’s probably all you need.

3 Likes

answers nothing on computer B ( the one where fonts are missing ) : is it expected ?

I’ve tried also

palace@PROLiANT:/$ ls -l ~/.local/share/fonts/
total 0
lrwxrwxrwx 1 palace palace 29 avril 21 19:19 'Lien vers FONTS' -> /media/DATA/USERS-EXTRA/FONTS
palace@PROLiANT:/$ 

and fonts are still missing. But here am less surprised : I thought a snap would not see anything hidden like ~/.local/… ?

So are you actually suggesting the situation on computer A ( where I can see all my fonts ) is « broken » ?

As is from a terminal in my ( graphical ) user session I get


Should I run it as sudo ?

And snap run gimp shows :


The error concerns a plugin ( guide Lab ) so unrelated to my missing fonts.

Lots of questions. I’ll see if I can answer them all:

  1. the snap-discard-ns command discards the sandbox mount namespace created for past runs of the application, so future invocations will start with a fresh mount namespace. The hope was that this might get both of your computers to give the same result, which would remove one of the variables.

  2. Plugging the desktop interface grants read access to ~/.fonts and ~/.local/share/fonts. It doesn’t grant access to arbitrary dot files, but these ones are allowed. A symlink in those directories will only help if it is to a location that (a) exists in the snap’s mount namespace, and (b) is readable. This particular one might work if the snap plugs removable-media. A bind mount under one of these directories should work, since /home is brought into the sandbox mount namespace with a recursive bind mount.

  3. snap run --shell gimp will drop you into a bash shell that uses the same permissions and environment as the named snap (note that the shell prompt changed a bit when you ran it). You can get out of this shell by running exit or ctrl+D.

    The idea was that you could use this sandboxed shell to see whether the the missing font files were actually visible under /usr/share/fonts in this environment. If the bind mount point just appeared as an empty directory, then this probably is something we could fix by switching the desktop interface to use a recursive bind mount.

1 Like
  1. I understood you need me to do that on both machines, but on machine A ( where fonts are available as I expected ) is a multi-users context I can’t « annoy » right now with testings. We need those fonts available - and they are shared with other machines through syncthing.

Oh wait. I have a machine C at hand, with more or less same kinds of config’ I could compare.

  1. Ok. So - even if it’s not meaningful - I should be able to browse ~/.local/share/fonts from within Gimp-snap ?

    …permission denied. Here is machine A.

But browsing to ~./fonts is ok → oh damn, here is a potential difference : if ~./fonts or ~/.local/share/fonts is itself a link ( instead of a regular folder ) then snap can’t access it.
Grrrr.

If of any interest ( well ok it’s a bit of a mess, link to link, because in some app’s if ~/.fonts itself is a link it gets ignored ) :

django@ASGARD:~$ ls -la ~/.local/share/fonts
lrwxrwxrwx 1 django django 19 déc.  14 04:18 /home/django/.local/share/fonts -> /home/django/.fonts

django@ASGARD:~$ ls -la ~/.fonts/
total 12
drwxrwxr-x  2 django django 4096 déc.  14 04:17  .
drwxrwxr-x 31 django django 4096 avril 22 16:43  ..
lrwxrwxrwx  1 django django   41 déc.  14 04:17 'Lien vers aacursive' -> '/media/DATA/Bibliothèque Fonts/aacursive'
lrwxrwxrwx  1 django django   38 déc.  14 04:17 'Lien vers cinema' -> '/media/DATA/Bibliothèque Fonts/cinema'
lrwxrwxrwx  1 django django   41 déc.  14 04:17 'Lien vers open type' -> '/media/DATA/Bibliothèque Fonts/open type'
lrwxrwxrwx  1 django django   41 déc.  14 04:17 'Lien vers true type' -> '/media/DATA/Bibliothèque Fonts/true type'
lrwxrwxrwx  1 django django   43 déc.  14 04:17 'Lien vers typewriters' -> '/media/DATA/Bibliothèque Fonts/typewriters'
-rw-r--r--  1 django django   36 déc.   5 03:09  .uuid

django@ASGARD:~$ ls -la /media/DATA/Bibliothèque\ Fonts/
total 36
drwxrwsr-x  8 root       users 4096 avril 23 04:22  .
drwxr-xr-x 13 root       root  4096 avril 16 18:14  ..
drwxrwxr-x  2 django     users 4096 déc.  14 04:08  aacursive
drwxrwsr-x  4 cinema     users 4096 déc.   9 20:03  cinema
drwxrwsr-x  9 alessandra users 4096 déc.   9 20:39 'open type'
drwxrwsr-x  2 alessandra users 4096 janv. 13 13:58  .stfolder
drwxrwsr-x  8 alessandra users 4096 déc.   5 01:12 'true type'
drwxrwsr-x  9 django     users 4096 déc.   5 04:02  typewriters
-rw-rw-r--  1 alessandra users   36 janv. 13 14:01  .uuid
django@ASGARD:~$  

↑ this « mess » works as expected everywhere - except in snap app’s ( same permission denied in Chromium ).

  1. Sorry for my little knowledge here. If I launch snap run --shell gimp gimp is not launched. All I had is
bash:  /usr/bin/snap: permission denied

And if I understand correctly I am not supposed to run sudo here in my personal space.
I assume I don’t do what you expect here → to inspect the sandbox mount namespace
Do I have to launch gimp as usual first then launch the command ?

tl;dr :
would you confirm if ~/.fonts or ~/.local/share/fonts are themselves links, they won’t be followed by snap ?

So I may not need the bind in fstab after all.

Ok comparing the three machines :

A B C : Gimp as snap can’t access ~/.local/share/fonts ( regular folder, not link ) but do access ~/.fonts ( which by default does not exist ).
A B C : if I put inside ~/.fonts links to my folder of fonts on another disc, they will be available in Gimp-snap
⋅ BUT, there’s a but, on A and B as soon as I do that ↑ launching of gimp halts 30~40 on the « fonts » loading.
⋅ so now I have to find what’s different on machine C ( where fonts are linked and launching of gimp is normal )

Mmm… on machine C, I did not bind my extra folder of fonts through fstab inside /usr/share/fonts/EXTRAS because there is only one disc inside and only one partition on that disc.

The 30~40s halting may come from Gimp seeing twice the same fonts ( once through the bind in /usr/share/fonts/EXTRAS and another once in ~/fonts/link which actually both target the same resource ).

So, what remains to confirm ?
Are you sure gimp-snap can access ~/.local/share/fonts ?
And if so why on my three installations ( all Ubuntu 20.04 ) Gimp-snap
⋅ shows permission denied if trying to browse ~/.local/share/fonts
⋅ is fine with ~/.fonts which is not there by default.

It’s normal that snap run --shell will not launch the application. It’s kind of doing the equivalent of taking the snap and replacing the application executable with bash. It’s intended as a debugging aid so you can see what your system looks like from the inside of the sandbox. If you can’t see the font files from this shell, then neither can the application itself.

yes, but not ~/.local nor ~/.local/share, only exactly the fonts directory under it …

while this is true, it does not matter for your permission denied error, you are inside the snap confinement when doing snap run --shell so you can not just execute things in /usr/bin (unless any interface explicitly allows it … and no interface allows /usr/bin/snap)

Ok, that explains why Gimp itself can open ~/.fonts but can’t open ~/.local/…/…
and this is annoying because Gimp-snap won’t by default « fetch » fonts from there unless you go to edit / preferences and folder paths :

So for the moment Gimp-snap is unable to use ~/.local/share/fonts
Would you confirm that ?

I’ll check my other machine with snap run --shell and see if from that shell I can do any ls -l /path/to/fonts ( that’s the idea, correct ? )

palace@PROLiANT:~$ snap run --shell gimp
To run a command as administrator (user "root"), use "sudo <command>".
See "man sudo_root" for details.

palace@PROLiANT:/home/palace$ ls -la /home/palace/.local/share/fonts
total 12
drwxrwxr-x  2 palace palace 4096 avril 23 05:07 .
drwxr-xr-x 20 palace palace 4096 avril 22 19:16 ..
-rw-r--r--  1 palace palace   36 avril 23 05:07 .uuid
palace@PROLiANT:/home/palace$ ls -la /home/palace/.fonts
total 12
drwxrwxr-x  2 palace palace 4096 avril 23 05:07  .
drwxr-xr-x 15 palace palace 4096 avril 23 05:07  ..
lrwxrwxrwx  1 palace palace   29 avril 21 19:19 'Lien vers FONTS' -> /media/DATA/USERS-EXTRA/FONTS
-rw-r--r--  1 palace palace   36 avril 23 05:07  .uuid
palace@PROLiANT:/home/palace$ 

So Gimp-shell has access to both places as you assumed BUT it’s not true from Gimp itself once « graphically » running.

Regarding the EXTRAS binding, it seems here on machine B it won’t follow the bind

palace@PROLiANT:/home/palace$ ls -la /usr/share/fonts
total 36
drwxr-xr-x  9 root root 4096 avril 21 17:46 .
drwxr-xr-x 63 root root 1260 avril 22 16:54 ..
drwxr-xr-x  2 root root 4096 avril 23  2020 cmap
drwxr-xr-x  2 root root 4096 avril 23  2020 cMap
drwxr-xr-x  2 root root 4096 avril 21 17:46 EXTRAS
drwxr-xr-x  3 root root 4096 avril 21 22:48 opentype
drwxr-xr-x 14 root root 4096 avril 21 22:58 truetype
drwxr-xr-x  5 root root 4096 avril 21 22:54 type1
-rw-r--r--  1 root root   36 avril 23  2020 .uuid
drwxr-xr-x  6 root root 4096 avril 23  2020 X11

palace@PROLiANT:/home/palace$ ls -la /usr/share/fonts/EXTRAS
total 12
drwxr-xr-x 2 root root 4096 avril 21 17:46 .
drwxr-xr-x 9 root root 4096 avril 21 17:46 ..
-rw-r--r-- 1 root root   36 avril 21 17:49 .uuid

palace@PROLiANT:/home/palace$ cat /etc/fstab
cat: /etc/fstab: Permission denied
palace@PROLiANT:/home/palace$ exit
exit

palace@PROLiANT:~$ cat /etc/fstab
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
# / was on /dev/sda1 during installation
UUID=69ced3cf-ecc5-4b98-aa28-f19dc004ff1d /               ext4    errors=remount-ro 0       1
# /media/DATA was on /dev/sdb2 during installation
UUID=655d5b0e-0fdf-40bd-a4e8-176ab6a27d7f /media/DATA     ext4    defaults        0       2
# fichier d'échange
/swapfile                                 none            swap    sw              0       0
# vignettes .xcf gimp snap
/home/palace/.cache/thumbnails  /home/palace/snap/gimp/common/.cache/thumbnails none    bind
# dossier fonts EXTRAS
/media/DATA/USERS-EXTRA/FONTS   /usr/share/fonts/EXTRAS none    bind
#

palace@PROLiANT:~$ ls -la /media/DATA/USERS-EXTRA/FONTS/
total 32
drwxr-xr-x  7 palace users 4096 mars  25 22:08 .
drwxr-xr-x  4 palace users 4096 avril 21 19:19 ..
drwxr-xr-x  2 palace users 4096 janv.  3  2018 cmap
drwxr-xr-x  9 palace users 4096 juin   8  2018 opentype
drwxr-xr-x 42 palace users 4096 janv.  3  2018 truetype
drwxr-xr-x  3 palace users 4096 janv.  3  2018 type1
-rw-r--r--  1 palace users   36 mars  25 22:08 .uuid
drwxr-xr-x  6 palace users 4096 juil. 23  2014 X11
palace@PROLiANT:~$ 

Let’s see how it works on machine A.

Machine A

django@ASGARD:~$ snap run --shell gimp
To run a command as administrator (user "root"), use "sudo <command>".
See "man sudo_root" for details.

django@ASGARD:/home/django$ ls -la ~/.fonts
ls: cannot access '/home/django/snap/gimp/347/.fonts': No such file or directory

django@ASGARD:/home/django$ ls -la /home/django/.fonts
total 12
drwxrwxr-x  2 django django 4096 déc.  14 04:17  .
drwxrwxr-x 31 django django 4096 avril 23 17:24  ..
lrwxrwxrwx  1 django django   41 déc.  14 04:17 'Lien vers aacursive' -> '/media/DATA/Bibliothèque Fonts/aacursive'
lrwxrwxrwx  1 django django   38 déc.  14 04:17 'Lien vers cinema' -> '/media/DATA/Bibliothèque Fonts/cinema'
lrwxrwxrwx  1 django django   41 déc.  14 04:17 'Lien vers open type' -> '/media/DATA/Bibliothèque Fonts/open type'
lrwxrwxrwx  1 django django   41 déc.  14 04:17 'Lien vers true type' -> '/media/DATA/Bibliothèque Fonts/true type'
lrwxrwxrwx  1 django django   43 déc.  14 04:17 'Lien vers typewriters' -> '/media/DATA/Bibliothèque Fonts/typewriters'
-rw-r--r--  1 django django   36 déc.   5 03:09  .uuid

django@ASGARD:/home/django$ ls -la /home/django/.local/share/fonts
lrwxrwxrwx 1 django django 19 déc.  14 04:18 /home/django/.local/share/fonts -> /home/django/.fonts

django@ASGARD:/home/django$ ls -la /media/DATA/Bibliothèque\ Fonts/
total 36
drwxrwsr-x  8 root       users 4096 avril 23 04:22  .
drwxr-xr-x 13 root       root  4096 avril 16 18:14  ..
drwxrwxr-x  2 django     users 4096 déc.  14 04:08  aacursive
drwxrwsr-x  4 cinema     users 4096 déc.   9 20:03  cinema
drwxrwsr-x  9 alessandra users 4096 déc.   9 20:39 'open type'
drwxrwsr-x  2 alessandra users 4096 janv. 13 13:58  .stfolder
drwxrwsr-x  8 alessandra users 4096 déc.   5 01:12 'true type'
drwxrwsr-x  9 django     users 4096 déc.   5 04:02  typewriters
-rw-rw-r--  1 alessandra users   36 janv. 13 14:01  .uuid

django@ASGARD:/home/django$ ls -la /media/DATA/Bibliothèque\ Fonts/cinema/
total 20
drwxrwsr-x  4 cinema users 4096 déc.   9 20:03 .
drwxrwsr-x  8 root   users 4096 avril 23 04:22 ..
drwxrwsr-x 15 cinema users 4096 déc.   9 20:07 opentype
drwxrwsr-x 24 cinema users 4096 déc.  14 04:09 truetype
-rw-rw-r--  1 cinema users   36 déc.   9 19:51 .uuid

django@ASGARD:/home/django$ ls -la /usr/share/fonts/PERSO/
total 12
drwxrwxr-x 2 root root 4096 déc.   5 02:49 .
drwxr-xr-x 9 root root 4096 déc.   5 02:49 ..
-rw-r--r-- 1 root root   36 déc.   5 02:50 .uuid

django@ASGARD:/home/django$ ls -la /usr/share/fonts/PERSO/
total 12
drwxrwxr-x 2 root root 4096 déc.   5 02:49 .
drwxr-xr-x 9 root root 4096 déc.   5 02:49 ..
-rw-r--r-- 1 root root   36 déc.   5 02:50 .uuid

django@ASGARD:/home/django$ exit
exit

django@ASGARD:~$ cat /etc/fstab
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
#
# / [ sda1 sur ssd ]
UUID=25c341fb-320d-4a4a-9d64-b08c5fe55540	/	ext4	errors=remount-ro	0	1
#
# DATA
UUID=b19322e6-8a6d-4e24-b87f-4b0155b41963	/media/DATA	ext4	defaults	0	2
#
# fichier d'échange
/swapfile                                 none            swap    sw              0       0
#
# vignettes .xcf et gimp snap
/home/django/.cache/thumbnails/	/home/django/snap/gimp/common/.cache/thumbnails/	none	bind
/home/alessandra/.cache/thumbnails/	/home/alessandra/snap/gimp/common/.cache/thumbnails/	none	bind
/home/cinema/.cache/thumbnails/	/home/cinema/snap/gimp/common/.cache/thumbnails/	none	bind
#
# partage des fonts
/media/DATA/Bibliothèque\040Fonts	/usr/share/fonts/PERSO	none	bind
#
django@ASGARD:~$ 

So there is a no difference in behavior between machine A and machine B regarding bind : none of Gimp-snap will follow it

I think we can narrow the problems down to :
⋅ Gimp itself won’t see what’s inside /home/$USER/.local/share/fonts whilst that’s needed.
⋅ Gimp needs to be manually informed to look inside /home/$USER/.fonts or /home/$USER/.local/share/fonts through its edit / preferences menu and that should not be necessary as these are « normal » folders for fonts.
⋅ binding extras things into /usr/share/fonts/… is useless so I will remove that from all my fstab.

Other point still to « fix » : gimp-snap can’t launch help ( F1 or Shift+F1 ).

A bit of rant : using Gimp 2.10.24 from Panda Jim’s ppa is much more easier than using the snap Gimp package. I’m not playing here, those machines are for real people in their work / professional context and trying to use snap in such context shouldn’t be so time consuming.

O.o

Now most of the time any launching of gimp-snap will halt 30~40s on « searching datas … fonts » on the 3 machines.

So maybe the bind into /usr/share/fonts/… helped with speed launching after all ?

Another difference now : I can remove /home/$USER/.fonts from folder paths in Gimp’s edit / preferences and the fonts are still available.

I’m totally losing sight here.

@daniel maybe ?