EGL-using snaps on impish seem to be broken when using the Nvidia proprietary driver

@Wimpress starting from your original snap recipe, does adding this to your wrapper script help:


(It is probably better not to do this on systems where the Nvidia drivers work, but a useful data point.)

1 Like

Yes, I am using the helpers from the GNOME extension.

The opengl interface in snapd does that:

Note that while snapd creates those files / mounts, it doesn’t set any env vars related to those

1 Like

Upgraded my system at home to 21.10, which is also NVIDIA only.

Built the OSB Studio snap (actually a test version called obs-demo) locally from my original yaml and added export LD_LIBRARY_PATH=${LD_LIBRARY_PATH#$SNAP_LIBRARY_PATH:} to the wrapper just before the exec.

OBS Studio is working.

I grabbed the LD_LIBRARY_PATH, before and after adding that export to the wrapper. This is the result. I’ve highlighted what is removed from the Before:

  • Before: /var/lib/snapd/lib/gl:/var/lib/snapd/lib/gl32:/var/lib/snapd/void:/snap/obs-demo/x18/opt/qt515/lib::/snap/obs-demo/x18/lib:/snap/obs-demo/x18/usr/lib:/snap/obs-demo/x18/lib/x86_64-linux-gnu:/snap/obs-demo/x18/usr/lib/x86_64-linux-gnu:/snap/obs-demo/x18/lib/x86_64-linux-gnu:/snap/obs-demo/x18/usr/lib/x86_64-linux-gnu:/snap/obs-demo/x18/usr/lib:/snap/obs-demo/x18/lib:/snap/obs-demo/x18/usr/lib/x86_64-linux-gnu/dri:/var/lib/snapd/lib/gl:/var/lib/snapd/lib/gl/vdpau:/snap/obs-demo/x18/usr/lib/x86_64-linux-gnu/pulseaudio

  • After: /snap/obs-demo/x18/opt/qt515/lib::/snap/obs-demo/x18/lib:/snap/obs-demo/x18/usr/lib:/snap/obs-demo/x18/lib/x86_64-linux-gnu:/snap/obs-demo/x18/usr/lib/x86_64-linux-gnu:/snap/obs-demo/x18/lib/x86_64-linux-gnu:/snap/obs-demo/x18/usr/lib/x86_64-linux-gnu:/snap/obs-demo/x18/usr/lib:/snap/obs-demo/x18/lib:/snap/obs-demo/x18/usr/lib/x86_64-linux-gnu/dri:/var/lib/snapd/lib/gl:/var/lib/snapd/lib/gl/vdpau:/snap/obs-demo/x18/usr/lib/x86_64-linux-gnu/pulseaudio

The NVIDIA drivers still work and that is due to lines 94 - 107 of the desktop-exports from the GNOME extension in Snapcraft:

@ijohnson What is /var/lib/snapd/void?

1 Like

That must be the root cause of How to set LD_LIBRARY_PATH properly? then.

1 Like

/var/lib/snapd/void is the directory where snap-confine will go when it is not safe/allowed to set the current working directory to anything else. If that directory is showing up in a variable then some part of the wrapper scripts is probably using $PWD (incorrectly).

The wrapper does not use $PWD at all. $SNAP_LIBRARY_PATH appears to be providing /var/lib/snapd/void.

It is using SNAP_LIBRARY_PATH, which is set by snapd

I added echo "SNAP_LIB: ${SNAP_LIBRARY_PATH}" to the wrapper, it outputs this:

SNAP_LIB: /var/lib/snapd/lib/gl:/var/lib/snapd/lib/gl32:/var/lib/snapd/void

Ah okay, I actually wasn’t aware of SNAP_LIBRARY_PATH, apparently we do set this and in fact hard-code /var/lib/snapd/void there for no apparent reason :thinking:

Ah I guess we include /var/lib/snapd/void there purely to prevent foot shooting mistakes:

Thanks for the info @ijohnson. So, my workaround to get the OBS Studio snap working on 21.10 for NVIDIA users, while preserving $SNAP_LIBRARY_PATH, is adding these two lines to my wrapper:


Perhaps snapd should append SNAP_LIBRARY_PATH to LD_LIBRARY_PATH, rather than prepend it?

Thanks to everyone who commented on this topic :bowing_man:

I think you mean the snapcraft extension helpers should be appending?

The desktop helpers and extensions in Snapcraft do not reference SNAP_LIBRARY_PATH at all. Looks like snapcraft does though:

Tagging @sergiusens :wave:

It’s this script (in the snap):


It’s snapcraft setting LD_LIBRARY_PATH, but the point of prepending is to pick up the host Nvidia GL library, not a mesa one from the snap content. Appending would defeat that. (The problem here is that it is problematic when the host and base userspace isn’t compatible.)

That LD_LIBRARY_PATH is baked into the snaps. Which means, if fixing this in snapcraft is the right place to address this, all affected snaps will need to be rebuilt and published in order that NVIDIA users can run them on 21.10 and the next LTS.

Perhaps updating the desktop extensions in Snapcraft and the legacy desktop-helpers, with a workaround like the one I am using, may also help. But still requires snaps are rebuilt and published.

1 Like

The only workaround that doesn’t require “all” snaps to be rebuilt is for snapd to not mount the drivers/export stuff in SNAP_LIBRARY_PATH unless the host userspace matches the snap base.


Maybe the option is to stop symlinking* into /var/lib/snapd/lib/gl. It’s not part of the Nvidia drivers, and a version provided by the snap should be able to load the Nvidia libraries (provided those binary blobs are in fact compatible).

The main questions in making that change would be:

  1. Are there supported systems out there not using glvnd but providing proprietary Nvidia drivers that snapd actually uses?
  2. Are there supported EGL snaps out there that are not shipping (or plugging a content snap that ships) glvnd to access the Mesa drivers?