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

Thanks. This looks promising. I think the snapd snap produced by the CI run is only accessible if one is logged in to their github account. Would it make sense to provide grab that snap and provide it at people.canonical.com leaving a link in the topic?

@jamesh that looks like a sensible approach: I hope we get confirmation that it works in practice.

I still wonder if we need, in principle, to hack __EGL_VENDOR_LIBRARY_DIRS (but that probably only enables hybrid setups that were already broken before 21.10)

Both the Snapcraft desktop extensions and the old snapcraft-desktop-helpers scripts already set __EGL_VENDOR_LIBRARY_DIRS. For example:

As well as enabling the Nvidia drivers, this is necessary to load the Mesa backend provided by e.g. the Gnome platform snap.

Oh right, I keep forgetting about those. (As, unfortunately, I don’t find them useful for IoT snaps.)

I’ve curated a list of snaps without a base that plug opengl, we should ensure some sampling of these are tested for regressions.

adrift
agent
ags
alarabiya-desktop
allow2automate
alphaapp
amoveo-wallet
ampareimagetopdf
amparepdftoimage
amparepngtoico
amparewakeonlan
anxing
ao
asarui
atomify
audovia
auryo
autoskola-free6
balls2
baugeschichte
bayam
bitshares2-light
blender-tpaw
bottle
buka
burdirc
bussard
buzyteam
bzflag
bzflag-tjhanson
caprice32
cass
castersoundboard
cclite
checksum-validator
chinese-cal
clari3d-lite-64
codebreakers
codenamelt
college-mastodon
collision
colmap-mardy
crrcsim-simulator
cumulonimbus
deepin-image-viewer
deepin-music
deepin-voice-recorder
demo-gtk-common-themes
desktop-habitica
devrantron
dino
djv
douban-fm
drmips
electronic-wechat
electron-quick-start
electrontestapp
eloleo
elrond
eos-voter
epipolar-consistency
e-tools
eureka-doom-editor
euruspro-desktop
evernote-web-client
exers
extia-webapp
facebook-webapp-mardy
facebook-webapp
fcole90-hexgl-webapp
fiwe
flacon-tabetai
flare-rpg
foobillard-plus
freeorion-agrrr3
fromscratch
fugio
functy
git-cola
goldendictionary
google-webapp
goxel
granatier
graphics-debug-tools-bboozzoo
grumpy
heb12-desktop
hello-world-electron
hexexplorer-snap
hiri
hmi-gspe
huggle
icq-im
idid
imagecomparer
imagenes
imaginary-teleprompter
instagraph
jimbodicomviewer
kanagame
kiosceditor
kiosc
konstructs-client
koombo
k-sudoku
langly
lanto
lattam
librealsense-chenhan
librealsense
love2d
lxi-tools
lyricpad
mcomix-tabetai
meshlab-mardy
minetest-luk3yx-3
mitk
mmex
molden
monento
moonplayer
morpion
movie-monad
mrxecplayer
musicarley
musixmatch
mve-mardy
mve
myposoid-windows
myteam
nanowallet
neuronify
nocturn-mardy
nordvpn-electron
notepadqq
numnom
offs
onlykey-app
openhantek
orangecalc
paintsupreme-3d
panorama
parity-ui
passwordlocker
pathplanner
pencilsheep
pin-town
planet-jumper
planetlander
plexmediaserver
pocketmine-server-manager
pockit
posecalib
postman
prboom-plus-beidl
programmer
protogrid
proton-wallet
pyside2-hello-world
qcheckers
qr-code-generator-desktop
qstamina-snap
quakespasm-beidl
quelea
realsense-samples
reicast
relay
remote
rfid-app
riminder
rockscissorspaperlizardspock-snap
sagudev-aranym
savagexr-seaeyeaya
scrumpy
seekwell
sftpclient
shipgunner
siilihai-client
simplescreenrecorder
sirrujak-sciencefair
sit-lpc-app
skrifa-lite
skrifa
slashlock
smallpasskeep
snapd-hacker-toolbelt
solitude
sololearn
soracom-console
special-delivery
spelunky
squarehead
ss-qt
starruler2
start-and-doc
stifts-terminal
stochsd-electron
stonscipap-snap
submix
supercalc-snap
sword
symgrpmad
tbinge
test872334
test-snapd-glxgears
theia-mardy
thunderdocs
todo-antrax
torgo
transtracdevice
tusk
twistypuzzle
typora-alanzanattadev
ubuntu-mate-launchpad
udemy
unofficial-zalo
vessel
viber-unofficial
viojh-snap10
virtualjaguar-jz
visualsfm-mardy
volleyball2d
voxelands-luk3yx
vtest13
vtest-chrome
webdingding
webengine-app
wmx-kiosk-session
wonder-reader
workchat
wps-office-all-lang-no-internet
wps-office-multilang
wps-office
wuziqi
wyzepal
xbts-light
yamagi-quake2-beidl
yd
youdaonote

The CI job has finished, so there is a build available here as an artifact:

If you are logged in to Github, it should be possible to download the “snap-files” artifact at the bottom of that page. You can install the modified snapd with the following commands:

unzip snap-files.zip
sudo snap install --dangerous snapd_*.snap

After you’ve finished testing, switch back to the stable release from the store by running the following:

sudo snap refresh --amend --stable snapd

If you’ve got a system with an Nvidia GPU, I’d appreciate feedback on how this build runs. Some things that would be useful to test:

  1. If you’re running Ubuntu 21.10, does this fix any snaps you use that are broken with stable snapd? Before testing the snap, run the following command:

    sudo /usr/lib/snapd/snap-discard-ns $snap_name`
    

    This will ensure you’re not using a sandbox set up by the old snapd version.

  2. If you’re running an older version of Ubuntu, it would also be useful to test that this doesn’t cause regressions for apps you use.

  3. Do old base: core snaps work? @kenvandine’s post above contains a list, but it’s probably best to pick snaps that appear to be somewhat actively maintained. Some look abandoned or uploaded as tests.

    If you find snaps that malfunction with this snapd build, it would also be useful to know whether they function correctly with stable snapd.

Reports of both successes and failures are appreciated.

1 Like

telegram-desktop started working again for me with an update in the last few days. It now uses core20, so that’s where that’s coming from.

maxi@maxi-desktop:~$ snap install flokk-contacts
flokk-contacts 1.0.1 from gskinner (gskinner-apps) installed
maxi@maxi-desktop:~$ snap run flokk-contacts
/snap/flokk-contacts/11/flokk-contacts: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.33' not found (required by /var/lib/snapd/lib/gl/libEGL.so.1)
maxi@maxi-desktop:~$ sudo snap install --dangerous ~/Downloads/snapd_2.53.1+gitafcf491.afcf491-dirty_amd64.snap 
[sudo] password for maxi: 
2021-11-08T16:17:49+01:00 INFO Waiting for automatic snapd restart...
snapd 2.53.1+gitafcf491.afcf491-dirty installed
maxi@maxi-desktop:~$ sudo /usr/lib/snapd/snap-discard-ns flokk-contacts
maxi@maxi-desktop:~$ snap run flokk-contacts
[...]

flokk-contacts was broken with stable snapd, but launches again with this fix : )

1 Like

Great suggestion, I made this available via a branch for testing now:

$ snap refresh --channel=edge/pr11023 snapd
2 Likes

It seems telegram-desktop has been updated since these problems were reported, so I’ve removed mentions of it in the testing instructions.

It’s still good feedback to know that we haven’t regressed telegram-desktop as a working snap though. Thanks.

To help narrow down which opengl-using core16 snaps to test, I’ve created some shorter lists of the more active snaps.

Here’s the 20 most recently updated snaps matching that criteria:

plexmediaserver
audovia
starruler2
hw-probe
quelea
kiosceditor
kiosc
adrift
offs
myteam
agent
icq-im
bzflag
bitshares2-light
programmer
flare-rpg
sftpclient
openhantek
xbts-light
sagudev-aranym

And here are the 20 with the highest stable revision numbers:

huggle
hw-probe
lxi-tools
mmex
notepadqq
goxel
quelea
fugio
sagudev-aranym
reicast
qr-code-generator-desktop
plexmediaserver
auryo
panorama
imagecomparer
atomify
git-cola
ags
starruler2
flare-rpg

If you recognise any of these snaps, then it would be useful to get some test feedback.

Ideally we’d look at popularity, but I was working with the information available through the public API.

Can confirm that this solves this problem for my core20 snap anki-ppd:

/snap/anki-ppd/3/usr/bin/mpv: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.33' not found (required by /var/lib/snapd/lib/gl/libEGL.so.1)

Thanks for the list. I tried several of the snaps on a new impish installation, xorg and nvidia and most are working. I did found a few with issues in the list though Imagecompared was failing with a GLX init error and a coredump git-cola was displaying an OpenGL init error and a rendering fallback message anki-ppd was displaying a libEGL GLIBC_2.33 warning

Those issues have been resolved after refreshing the snapd to channel=edge/pr11023 and using snapd-discard-ns

The other snaps still seem to work corectly

Looks like problem is still here for me (Fedora 35):

[r0ck3r@desktop ~]$ snap refresh --channel=edge/pr11023 snapd
[r0ck3r@desktop ~]$ snap run sqlitebrowser
WARNING: cgroup v2 is not fully supported yet, proceeding with partial confinement
/snap/sqlitebrowser/3233/bin/sqlitebrowser: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.34' not found (required by /var/lib/snapd/lib/gl/libGLX.so.0)
/snap/sqlitebrowser/3233/bin/sqlitebrowser: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.34' not found (required by /var/lib/snapd/lib/gl/libGLdispatch.so.0)

The instructions included:

after refreshing the snapd snap. Did you forget to run that, maybe?

There isn’t a quick way to test this on Fedora, as snapd doesn’t enable re-exec on that distro.

On distros where we have re-exec enabled (currently just Debian and Ubuntu), when the distro packaged snapd starts, it will check to see if a newer version has been installed as a snap and call exec() on that binary.

That doesn’t happen on Fedora, where a new RPM packaged version of snapd would need to be released to see this fix. The cases we’re trying to test here mostly revolve around what’s going on within the sandbox though. So I’m reasonably certain that the results we collect on Ubuntu will apply to Fedora too.

I’ve tried

sudo /usr/libexec/snapd/snap-discard-ns sqlitebrowser

but it did not help

Snapd on Fedora does not support reexec. You’ll have to clone the source tree from that branch and build it yourself. FWIW it’s enough to build snap-confine which is rather simple, after you get the source tree run cd cmd && ./autogen.sh && make hack.

You may need to get the builds deps before but you can run dnf build-dep snapd -y for this.

In the pull request, @mvo noted a failure in one of the old core16 snaps:

I think what is happening here is that the Ubuntu 16.04 version of libGL tries to fall back to the swrast DRI driver. While that driver doesn’t require any special hardware to run, I suspect it relies on the X server running Mesa’s GLX code.

One thing that would be useful to try in cases like this would be to run the app with the environment variable LIBGL_ALWAYS_INDIRECT=true set (as documented here: https://docs.mesa3d.org/envvars.html). This should get the Mesa libGL to try indirect rendering (i.e. forward GL calls to the X server via GLX) instead of the swrast driver, which will hopefully avoid the segfault.

It won’t be as fast as direct rendering with the Nvidia binary drivers, but should be faster than software rendering. If this works, perhaps we can inject that environment variable when running these old snaps.

The branch from @jamesh has landed. Has anyone tried using it on Fedora/openSUSE/Debian/Arch maybe?

Have installed snapd-2.53.4-1.fc35.x86_64 from repo and snap version 2.53.4 in snap list

vlc and acestreamplayer started to work, but sqlitebrowser do not start with message:

[r0ck3r@desktop ~]$ snap run sqlitebrowser
/snap/sqlitebrowser/3233/bin/sqlitebrowser: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.34' not found (required by /var/lib/snapd/lib/gl/libGLX.so.0)
/snap/sqlitebrowser/3233/bin/sqlitebrowser: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.34' not found (required by /var/lib/snapd/lib/gl/libGLdispatch.so.0)