From 53eaaddea981f45497d24b6839a8d71431712ba2 Mon Sep 17 00:00:00 2001 From: Johannes Millan Date: Sun, 12 Oct 2025 11:34:30 +0200 Subject: [PATCH] fix: attempt to fix snap once more 2 #5252 --- electron-builder.yaml | 9 +++++++-- electron/start-app.ts | 15 ++++++++++++--- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/electron-builder.yaml b/electron-builder.yaml index e06e7d8c8..991cb105e 100644 --- a/electron-builder.yaml +++ b/electron-builder.yaml @@ -64,18 +64,23 @@ snap: # Force software rendering to avoid GPU/Mesa driver issues in snap confinement # See: https://github.com/johannesjo/super-productivity/issues/5252 environment: - LIBGL_ALWAYS_SOFTWARE: '1' + # Primary: Force llvmpipe software renderer (most explicit) MESA_LOADER_DRIVER_OVERRIDE: llvmpipe + # Secondary: Ensure software rendering fallback (defense-in-depth) + LIBGL_ALWAYS_SOFTWARE: '1' + # Configure driver search paths for snap confinement LIBGL_DRIVERS_PATH: !!str '$SNAP/usr/lib/$SNAPCRAFT_ARCH_TRIPLET/dri:$SNAP/gnome-platform/usr/lib/$SNAPCRAFT_ARCH_TRIPLET/dri' + # Force Mesa on NVIDIA systems __GLX_VENDOR_LIBRARY_NAME: mesa - DISABLE_WAYLAND: '1' stagePackages: - default - libglu1-mesa - libosmesa6 - libgl1-mesa-dri + - libtinfo5 plugs: - default + - browser-support - password-manager-service - system-observe - login-session-observe diff --git a/electron/start-app.ts b/electron/start-app.ts index 4b8408530..cec64e345 100644 --- a/electron/start-app.ts +++ b/electron/start-app.ts @@ -61,14 +61,23 @@ export const startApp = (): void => { const isSnap = process.platform === 'linux' && !!process.env.SNAP; if (isSnap && !isForceGpu) { log( - 'Snap: Disabling hardware acceleration to avoid Mesa driver lookup crashes (issue #5252)', + 'Snap: Disabling hardware acceleration to avoid Mesa driver access issues (issue #5252)', + ); + log( + 'Snap: Using software rendering (llvmpipe) with snap strict confinement security', ); log('Snap: Launch with --enable-gpu to attempt hardware rendering (may crash)'); + + // Disable hardware acceleration in Electron app.disableHardwareAcceleration(); - // Additional command-line switches to ensure snap compatibility + // Disable GPU completely to prevent GPU process spawn attempts app.commandLine.appendSwitch('disable-gpu'); - app.commandLine.appendSwitch('disable-gpu-sandbox'); + + // Disable Chromium's internal sandbox - rely on snap's strict confinement instead + // This is the recommended approach per Snapcraft documentation for strict confinement + // Chromium's sandbox conflicts with snap confinement causing launch failures + app.commandLine.appendSwitch('no-sandbox'); } // Initialize protocol handling