Created
December 13, 2025 22:57
-
-
Save danielrosehill/7e0386c10b35f02909e7c37f94ece499 to your computer and use it in GitHub Desktop.
Fix Electron app sandbox crashes on Linux (Ubuntu/KDE) - No comments
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Fix Electron App Sandbox Crashes on Linux | |
| Electron apps on Linux often fail to launch with errors like: | |
| - `signal=TRAP` | |
| - Sandbox-related crashes | |
| - Apps that work with `--no-sandbox` but fail otherwise | |
| ## The Problem | |
| Electron's sandbox requires either: | |
| 1. SUID permissions on `chrome-sandbox` binary | |
| 2. User namespaces enabled in kernel | |
| 3. Sandbox disabled entirely | |
| On many Linux distributions (especially with Wayland/KDE), the default setup doesn't satisfy these requirements. | |
| ## System-Wide Fix | |
| Instead of adding `--no-sandbox` to every Electron app's desktop entry, set a global environment variable. | |
| ### Step 1: Add to `~/.pam_environment` (GUI sessions) | |
| ```bash | |
| echo 'ELECTRON_DISABLE_SANDBOX DEFAULT=1' >> ~/.pam_environment | |
| ``` | |
| ### Step 2: Add to `~/.bashrc` (terminal sessions) | |
| ```bash | |
| echo '# Disable Electron sandbox (fixes launch issues on Linux)' >> ~/.bashrc | |
| echo 'export ELECTRON_DISABLE_SANDBOX=1' >> ~/.bashrc | |
| ``` | |
| ### Step 3: Apply to current session (without logout) | |
| ```bash | |
| export ELECTRON_DISABLE_SANDBOX=1 | |
| systemctl --user set-environment ELECTRON_DISABLE_SANDBOX=1 | |
| dbus-update-activation-environment ELECTRON_DISABLE_SANDBOX=1 | |
| ``` | |
| ## Verification | |
| After applying, all Electron apps should launch without the `--no-sandbox` flag. | |
| ## Notes | |
| - This applies to all Electron-based apps (VS Code, Slack, Discord, etc.) | |
| - The `.pam_environment` syntax uses tabs, not spaces | |
| - Full effect after next login, but Step 3 applies immediately | |
| ## Tested On | |
| - Ubuntu 25.04/25.10 | |
| - KDE Plasma on Wayland | |
| - Electron apps installed to `/opt/` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment