Electron snap GPU hardware acceleration disabled

I’ve been going around in circles for hours trying to figure out why my snap (an electron app) on a Raspberry Pi (latest OS) does not have any GPU acceleration enabled. Iv googlged and search these forums and im still stuck, would love some help here.

As you can see from the attached image, all acceleration has been disabled. The app runs terribly.

It looks like theres some sort of driver issue as im seeing in the logs:

  • libGL Error: Failed to load driver: vc4
  • MESA-LOADER: failed to open vc4
  • vkCreateInstance: Found no drivers!

Im using the standard plugs as mentioned in the builder docs here: https://www.electron.build/configuration/snap.html

Also tried adding the libglu1-mesa package to stage packages, which I picked up from this article: snapcraft.io/docs/gpu-support

Im using electron-builder however and I cannot see a way to specify the “desktop-glib-only” part of that config in the electron-builder config (config in above link)

I feel like this should be a pretty common issue, what am I missing here? can any assist before i pull all my hair out? Thanks in advance

More info

  • Raspberry Pi 4B / Latest Raspberry Pi OS
  • The snap in question: vuepilot

Context (The full trace on app start up):


libGL error: MESA-LOADER: failed to open vc4 (search paths /snap/vuepilot/101/gnome-platform/usr/lib/aarch64-linux-gnu/dri)
libGL error: failed to load driver: vc4
libGL error: MESA-LOADER: failed to open vc4 (search paths /snap/vuepilot/101/gnome-platform/usr/lib/aarch64-linux-gnu/dri)
libGL error: failed to load driver: vc4
libGL error: MESA-LOADER: failed to open swrast (search paths /snap/vuepilot/101/gnome-platform/usr/lib/aarch64-linux-gnu/dri)
libGL error: failed to load driver: swrast
11:13:27.923 ⺠SNAP env is defined, updater is disabled
11:13:27.935 ⺠checkForUpdatesAndNotify called, downloadPromise is null
[2967773:0212/111327.935597:ERROR:angle_platform_impl.cc(44)] Display.cpp:1056 (initialize): ANGLE Display::initialize error 12289: Could not create a backing OpenGL context.
ERR: Display.cpp:1056 (initialize): ANGLE Display::initialize error 12289: Could not create a backing OpenGL context.
[2967773:0212/111327.936900:ERROR:gl_display.cc(520)] EGL Driver message (Critical) eglInitialize: Could not create a backing OpenGL context.
[2967773:0212/111327.937188:ERROR:gl_display.cc(795)] eglInitialize OpenGL failed with error EGL_NOT_INITIALIZED, trying next display type
[2967773:0212/111327.944836:ERROR:angle_platform_impl.cc(44)] Display.cpp:1056 (initialize): ANGLE Display::initialize error 12289: Could not create a backing OpenGL context.
ERR: Display.cpp:1056 (initialize): ANGLE Display::initialize error 12289: Could not create a backing OpenGL context.
[2967773:0212/111327.945113:ERROR:gl_display.cc(520)] EGL Driver message (Critical) eglInitialize: Could not create a backing OpenGL context.
[2967773:0212/111327.945604:ERROR:gl_display.cc(795)] eglInitialize OpenGLES failed with error EGL_NOT_INITIALIZED
[2967773:0212/111327.945902:ERROR:gl_display.cc(829)] Initialization of all EGL display types failed.
[2967773:0212/111327.946236:ERROR:gl_ozone_egl.cc(26)] GLDisplayEGL::Initialize failed.
[2967773:0212/111328.003820:ERROR:angle_platform_impl.cc(44)] Display.cpp:1056 (initialize): ANGLE Display::initialize error 12289: Could not create a backing OpenGL context.
ERR: Display.cpp:1056 (initialize): ANGLE Display::initialize error 12289: Could not create a backing OpenGL context.
[2967773:0212/111328.004147:ERROR:gl_display.cc(520)] EGL Driver message (Critical) eglInitialize: Could not create a backing OpenGL context.
[2967773:0212/111328.004316:ERROR:gl_display.cc(795)] eglInitialize OpenGL failed with error EGL_NOT_INITIALIZED, trying next display type
[2967773:0212/111328.008252:ERROR:angle_platform_impl.cc(44)] Display.cpp:1056 (initialize): ANGLE Display::initialize error 12289: Could not create a backing OpenGL context.
ERR: Display.cpp:1056 (initialize): ANGLE Display::initialize error 12289: Could not create a backing OpenGL context.
[2967773:0212/111328.008547:ERROR:gl_display.cc(520)] EGL Driver message (Critical) eglInitialize: Could not create a backing OpenGL context.
[2967773:0212/111328.008692:ERROR:gl_display.cc(795)] eglInitialize OpenGLES failed with error EGL_NOT_INITIALIZED
[2967773:0212/111328.008826:ERROR:gl_display.cc(829)] Initialization of all EGL display types failed.
[2967773:0212/111328.008966:ERROR:gl_ozone_egl.cc(26)] GLDisplayEGL::Initialize failed.
[2967773:0212/111328.014692:ERROR:viz_main_impl.cc(196)] Exiting GPU process due to errors during initialization
libGL error: MESA-LOADER: failed to open vc4 (search paths /snap/vuepilot/101/gnome-platform/usr/lib/aarch64-linux-gnu/dri)
libGL error: failed to load driver: vc4
libGL error: MESA-LOADER: failed to open vc4 (search paths /snap/vuepilot/101/gnome-platform/usr/lib/aarch64-linux-gnu/dri)
libGL error: failed to load driver: vc4
libGL error: MESA-LOADER: failed to open swrast (search paths /snap/vuepilot/101/gnome-platform/usr/lib/aarch64-linux-gnu/dri)
libGL error: failed to load driver: swrast
[2967818:0212/111328.386543:ERROR:angle_platform_impl.cc(44)] Display.cpp:1056 (initialize): ANGLE Display::initialize error 12289: Could not create a backing OpenGL context.
ERR: Display.cpp:1056 (initialize): ANGLE Display::initialize error 12289: Could not create a backing OpenGL context.
[2967818:0212/111328.387101:ERROR:gl_display.cc(520)] EGL Driver message (Critical) eglInitialize: Could not create a backing OpenGL context.

I’m not a expert, but what I would do is launch the vscode (code) snap on your device.

If it has the same “error 12289”, then that eliminates your snap setup being the (at least the only) problem, and one should check GPU acceleration is working at all on the host system.

If it doesn’t then, I would compare how code launches electron vs how your snap is launching electron.

Of course if the snap ‘base’ differs (vscode is using core20), then this might not be that helpful.

An easy way to get (vscode) code to display it GPU Status is to run code -s (as code by default will hide any gpu error messages)

Thanks for the reply,

After some investigation, and reading we added libglu1-mesa to the stage packages, which DOES seem to add the files the error is complaining about into the $SNAP/usr/lib/aarch64-linux-gnu/dri path except that as you can see from the log above, the app is looking in the directory $SNAP/gnome-platform.... So it seems for whatever reason its looking in the wrong place.

There is nothing in the directory $SNAP/gnome-platform … its empty, the driver files are available at $SNAP/usr/lib/aarch64-linux-gnu/dri but I cannot seem to get electron builder to use this path with the final snap output.

Iv asked about this on the github repo, and stackoverflow and on these forums but im not getting any answers unfortunately.

Have you checked from inside the snap ? It will only be populated at app startup and onlybe visible from within the snap env… use the snap run --shell ... command to actually inspect it… the content comes from the gnome extension which should actually ship vc4 drivers on armhf and arm64

Ok interesting, I did not know about that, thank you for the tip. You’re absolutely right, that gnome-platform directory is populated inside of the snap shell env, although thats also confusing as i’m not sure why its not finding what it needs.

So, here’s the current state:

Errors being reporting in logs on starting the snap app

libGL error: MESA-LOADER: failed to open vc4: libtinfo.so.5: cannot open shared object file: No such file or directory (search paths /snap/vuepilot/111/gnome-platform/usr/lib/aarch64-linux-gnu/dri, suffix _dri) libGL error: failed to load driver: vc4 libGL error: MESA-LOADER: failed to open vc4: libtinfo.so.5: cannot open shared object file: No such file or directory (search paths /snap/vuepilot/111/gnome-platform/usr/lib/aarch64-linux-gnu/dri, suffix _dri) libGL error: failed to load driver: vc4 libGL error: MESA-LOADER: failed to open swrast: libtinfo.so.5: cannot open shared object file: No such file or directory (search paths /snap/vuepilot/111/gnome-platform/usr/lib/aarch64-linux-gnu/dri, suffix _dri) libGL error: failed to load driver: swrast

Im including both libglu1-mesa & libgl1-mesa-dri in the stagePackages (because iv read posts about both packages with regards to GPU issues but its unclear which is required)

When I snap run --shell and navigate to /snap/vuepilot/111/gnome-platform/usr/lib/aarch64-linux-gnu/dri I can see files (see below)

So now im stuck as to what that “cannot open shared object file” is referring to, as it appears as though the files it needs are there (there goes my empty dir theory)

Im a little lost in the snap environment now, any further suggestions would be greatly appreciated.

You can also pull down the beta snap your self im testing with in the vuepilot latest/beta channel.

Ok, I think I figured it out. Iv ended up adding a few more packages to the stagePackages list I now have

  stagePackages:
    - default
    - libglu1-mesa
    - libtinfo5

The error is now gone (I have some more errors about Vulkan drivers vkCreateInstance failed with VK_ERROR_INCOMPATIBLE_DRIVER) but I think the app is running better in general now and Chromium is reporting hardware acceleration with most items on the list now.

Thanks for the help guys

1 Like