Nvidia GL libs access broken on Ubuntu 18.04



The proposed fix for 18.04 does not cause a regression on 16.04.


Hello, using ubuntu 18.04, snap version 16-2.32+git622.ab40e67 and nvidia 390 driver.

I have issues with spotify and some other snaps, issue looks like this:

snap run spotify
failed to create prefix path: /tmp/snap.rootfs_zTBDGl/var/lib/snapd/lib/vulkan/icd.d: Permission denied

snap run flare-rpg
failed to create prefix path: /tmp/snap.rootfs_smuH38/var/lib/snapd/lib/vulkan/icd.d: Permission denied

But skype and atom works.

If i switch to intel card all snaps works.

Failed to run snaps on 18.04

2.32.2 with the fixes is in beta now, can you try snap refresh --beta core and check if opengl works for you?


Works for me with my ubuntu-18.04 with nvidia-340 driver. Thanks for the fix!


@mborzecki It would be great if we can get Vulkan support in near future?


I’m afraid vulkan support is a subject to further research. I’ve played a bit with it and got to a state where vulkaninfo properly reports Nvidia ICD. The problem was that ICD discovery is somewhat awkward and while you can pass a path to specific icd in VK_ICD_FILENAMES, I have not found a way to override the ICD search paths. I hope that we will be able to sort it out with proper layout adjustments.


Hi @mborzecki . Sorry to dig up an old thread.

I’ve had a bug report about a snap I’ve made which fails to run under 18.04, after an update from 17.10. I can’t reproduce the issue but the snap is complaining about gl libraries. I was wondering if it is significant that the reporter is running a laptop nvidia card? Would hybrid graphics/optimus be supported with your fix? Do you have any suggestions about what I could do to debug this?


@mcphail left a comment asking for more logs

IIRC @chipaca ran some snaps on a system with integrated nvidia card, albeit this might have been a 16.04 system at the time. As far as the snaps are concerned, the current setup will first probe if the NVIDIA driver is loaded and then verify if matching NVIDIA libraries are available in /usr/lib/<arch-tuple>/. That’s all there is to it.
If I correctly understand what PRIME does, you should be able to select your nvidia card as the sink and then set DRI_PRIME=<idx> to use the card. Given how messy (and useless) it has been for Linux users, I’d recommend to first get it working outside of snaps.


One thing to note is that you currently need to use snap-discard-ns on a snap if you run an app from the snap with the intel card and then switch to the nvidia card.


Ah - thanks @mborzecki and @chipaca. I think this will be the answer, and I’ve learned something new. Much appreciated.


@mborzecki Thanks for all the work so far!

I fear I found another missing thing: GLVND adds /usr/share/glvnd/egl_vendor.d/ which the Nvidia and Mesa drivers fill with .json files which contain details how to load the driver. See https://github.com/NVIDIA/libglvnd/blob/e202ebf27f5783400fa12b33ed18bb3599ec98ed/src/EGL/libeglvendor.c#L35 for details. This is how the nvidia one looks on my Ubuntu 18.04 system:

$ cat /usr/share/glvnd/egl_vendor.d/10_nvidia.json                 
    "file_format_version" : "1.0.0",
    "ICD" : {
        "library_path" : "libEGL_nvidia.so.0"

This doesn’t seem to be an issue when the application is linked against libGL like your glxinfo is (I don’t know yet how exactly GLVND is figuring out which driver to use in this case but maybe its talking to X11) but causes problems for those which load the GL driver via dlopen/dlsym at runtime. For those we need to have the egl_vendor.d dir available. Happily GLVND has a environment variable for this __EGL_VENDOR_LIBRARY_DIRS which can be used to provide access to a copy of possible vendor configurations within a snap.

However we should support this the right way by maybe mapping /usr/share/glvnd/egl_vendor.d onto something in /var/lib/snapd/ within the snap mount namespace and then set the __EGL_VENDOR_LIBRARY_DIRS environment variable automatically for this or let the desktop launchers do that. What do you think?


Thanks for finding this. Fortunately this looks much saner than Vulkan and should be an easy fix. Do you have a snap I could use to testing by any chance?


PR with the fix in snapd:


And here comes the snapcraft-desktop-helpers part:


I’ve pushed a change adding eglinfo tool to graphics-debug-tools-bboozzoo snap. It’s available in rev 4.


@mborzecki Thanks for the quick help! Will try this out once its in edge or beta.


The snapd changes are in in edge already.