← All needs

Snap: no GPU acceleration on Ubuntu 26.04 - bundled Mesa 21.2.6 can't load any driver ("\$${ORIGIN}" search path)

**Does this issue occur when all extensions are disabled?** Yes (tested with `--disable-extensions`). - **VS Code:** 1.141.2, snap revision 270 (`latest/stable`, base `core20`, classic) - **OS:** Ubuntu 26.04, kernel 7.0, KDE Plasma 6.6 (Wayland, VS Code running through XWayland as the snap forces `--ozone-platform=x11`) - **GPU:** NVIDIA GeForce GT 710 (Kepler), open-source nouveau driver, system Mesa 26.0.8 ### What happens With hardware acceleration enabled (fresh portable profile, no `disable-hardware-acceleration`), the snap starts with the GPU disabled. `SystemInfo.getInfo` over the DevTools protocol reports `GL renderer: Disabled` and `gpu_compositing: disabled_software`. This is the same whether started with `snap run code` or through the snap's own `electron-launch`. Running the snap's Electron binary directly, so that stderr is visible, shows why: ``` libGL error: MESA-LOADER: failed to open nouveau: /usr/lib/dri/nouveau_dri.so: cannot open shared object file: No such file or directory (search paths /usr/lib/x86_64-linux-gnu/dri:\$${ORIGIN}/dri:/usr/lib/dri, suffix _dri) libGL error: failed to load driver: nouveau ERROR:ui/gl/gl_display.cc:673] Initialization of all (2) EGL display types failed. ``` ### Cause The snap bundles Mesa 21.2.6 (`usr/lib/x86_64-linux-gnu/libGLX_mesa.so.0`, `libEGL_mesa.so.0` and `dri/*_dri.so`). The compiled-in driver search path in both libraries is the literal string ``` /usr/lib/x86_64-linux-gnu/dri:\$${ORIGIN}/dri:/usr/lib/dri ``` - **`/usr/lib/x86_64-linux-gnu/dri`** is the host's directory. With current Mesa (here 26.0.8), the host's `*_dri.so` files there are stubs (symlinks to `libdril_dri.so`) that a Mesa 21 loader cannot use. - **`\$${ORIGIN}/dri`** should point at the snap's own bundled drivers, but the escaping is wrong, so `${ORIGIN}` is never expanded. - **`/usr/lib/dri`** does not exist. So no driver can be loaded, and the GPU process falls back to software. Forcing the bundled drivers with `LIBGL_DRIVERS_PATH=/snap/code/current/usr/lib/x86_64-linux-gnu/dri` doesn't help on this GPU: the GPU process segfaults in the bundled `nouveau_dri.so` (Mesa 21.2.6) three times and Chromium disables the GPU. ### For comparison The official tarball of the **same version** (`code-stable-x64`, 1.141.2), which uses the system's Mesa 26, gets GPU acceleration on this machine: `ANGLE (Mesa, NV106, OpenGL 4.3 (Core Profile) Mesa 26.0.8)`, all GPU features enabled. ### Notes - I only tested an NVIDIA/nouveau GPU. The host stubs and the broken `${ORIGIN}` path don't depend on the GPU, so Intel and AMD users of the snap on distributions with current Mesa are probably affected too. #325800 looks like the same problem on Intel: UHD 620, Ubuntu 24.04, host Mesa 25.2.8, snap, `Initialization of all (2) EGL display types failed`. I haven't verified that it has the same cause. - Possible fixes: stop bundling Mesa and use the host's, or move to a newer base and use the `gpu-2404` content interface. Alternatively, build the bundled Mesa with a working `${ORIGIN}` search path, but its Mesa 21 drivers may not support newer GPUs or kernels anyway.