Nvidia GL libs access broken on Ubuntu 18.04

Hmm, i guess there is no Vulkan Support here…
Arch Linux

➜  ~ graphics-debug-tools-bboozzoo.vulkaninfo
===========
VULKAN INFO
===========

Vulkan API Version: 1.0.61

Cannot create Vulkan instance.
/build/vulkan-YO5iw0/vulkan-1.0.61.1+dfsg1/demos/vulkaninfo.c:704: failed with VK_ERROR_INCOMPATIBLE_DRIVER
1 Like

Doesn’t he mean the patch for 18.04 doesn’t cause a regression in 16.04?

1 Like

Maybe. English is only my first language, so I’m likely to have misread :-p Words I do good readie writer :smiley:

2 Likes

I’m aware. FWIW, it’s the same on Arch too, but I haven’t tried to debug it further yet.

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

3 Likes

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.

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

2 Likes

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

1 Like

@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.

1 Like

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.

1 Like

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.

1 Like

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?

1 Like

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?

1 Like

PR with the fix in snapd:
https://github.com/snapcore/snapd/pull/5172

1 Like

And here comes the snapcraft-desktop-helpers part:
https://github.com/ubuntu/snapcraft-desktop-helpers/pull/120

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.