fix: attempt to fix snap once more 2 #5252

This commit is contained in:
Johannes Millan 2025-10-12 11:34:30 +02:00
parent ac8ebf93cf
commit 53eaaddea9
2 changed files with 19 additions and 5 deletions

View file

@ -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

View file

@ -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