electronelectron-buildersnapcraft

Electron snap app packaged with snapcraft GPU disabled on Raspberry Pi


I’ve been going around in circles for hours trying to figure out why my electron app build with electron-builder and packaged as a snap does not have any GPU acceleration enabled. Iv googled and searched forums for ages 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 as a result.

enter image description here

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

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

Also tried adding the libglu1-mesa package to stage packages, which I picked up from this article: Adding OpenGL/GPU support to a snap (https://forum.snapcraft.io/t/adding-opengl-gpu-support-to-a-snap/6273)

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)

If I run standard chromium that is installed on the Raspberry Pi, and check the GPU status there, all GPU hardware acceleration is enabled and looks normal. So this seems to be snapcraft related. I have asked on the snapcraft forums and got no reply.

I feel like this should be a pretty common issue with anyone building electron apps with snaps, what am I missing here? can anyone assist before i pull all my hair out?

Thanks in advance

More info

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. message (Critical) eglInitialize: Could not create a backing OpenGL context.


Solution

  • Iv managed to solve this after days of searching and with some assistance from GitHub Copilot

    For anyone else experiencing this same issue, I was able to solve it by adding some missing packages to my electron-builder.yaml under stagePackages.

    Here's my stagePackages block from my config file

      stagePackages:
        - default
        - libglu1-mesa
        - libtinfo5
        - libvulkan1