Skip to content

Commit 450981a

Browse files
valkirilovclaude
andcommitted
fix(snap): migrate snap to core24 to fix launch on modern Linux
The Linux snap failed to launch on modern systems: native modules built on the ubuntu-24.04 CI runner (glibc 2.39) couldn't load on the core20 base (glibc 2.31) -> "libm.so.6: version GLIBC_2.38 not found" loading better_sqlite3.node. The old gnome-3-28-1804 platform also lacked a working GPU driver for current hardware. Migrate the snap to base core24 via electron-builder's `snapcraft.core24`: - base core24 -> glibc 2.39, matching the build toolchain (fixes the fatal load) - GNOME extension (default) -> gnome-46-2404 + mesa-2404/gpu-2404 (modern GPU) - XDG_SESSION_TYPE=x11 -> forces XWayland, restoring the old allowNativeWayland:false behavior (Electron 40 removed ELECTRON_OZONE_PLATFORM_HINT and snapcraft core24 rejects '=' in an app command, so this env var is the supported mechanism) - plain browser-support plug -> auto-connects on install (snapd only blocks auto-connect for allow-sandbox:true); electron-builder adds --no-sandbox itself - network / home / password-manager-service plugs preserved CI: core24 builds via the snapcraft CLI in an LXD container, so the x64 Linux job installs snapcraft + lxd, grants the LXD socket, and allows iptables FORWARD (the runner's Docker sets it to DROP, blocking the build container's network). Gated to runs where the snap target is actually built. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 89c43a8 commit 450981a

2 files changed

Lines changed: 41 additions & 5 deletions

File tree

.github/workflows/pipeline-build-linux.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,31 @@ jobs:
119119
sudo apt-get install -qy ruby ruby-dev build-essential
120120
sudo gem install --no-document fpm
121121
122+
# The snap target builds on core24 via snapcraft + the GNOME extension,
123+
# which requires an isolated build environment (LXD). x64 only — snap is x64.
124+
- name: Install snapcraft + LXD (for core24 snap build)
125+
if: >-
126+
matrix.arch == 'x64'
127+
&& steps.resolve-targets.outputs.should_build == 'true'
128+
&& (steps.resolve-targets.outputs.mode == 'default'
129+
|| contains(steps.resolve-targets.outputs.custom_targets, 'snap'))
130+
run: |
131+
sudo snap install snapcraft --classic
132+
sudo snap install lxd
133+
sudo lxd waitready --timeout=60
134+
sudo lxd init --auto
135+
sudo usermod -aG lxd "$USER"
136+
# The build step runs in a shell started before the group change, so the
137+
# new 'lxd' group isn't active there and snapcraft's pylxd can't reach the
138+
# socket ("LXD requires additional permissions"). Grant the socket directly
139+
# so snapcraft can connect without a re-login.
140+
sudo chmod 0666 /var/snap/lxd/common/lxd/unix.socket
141+
# GitHub runners run Docker, which sets the iptables FORWARD policy to DROP.
142+
# That blocks the LXD bridge's NAT traffic, so the snapcraft build container
143+
# has no internet ("A network related operation failed..."). Allow forwarding
144+
# so the container can fetch the base, GNOME extension, and stage-packages.
145+
sudo iptables -P FORWARD ACCEPT
146+
122147
- name: Build linux packages (production)
123148
if: vars.ENV == 'production' && steps.resolve-targets.outputs.mode == 'default'
124149
run: yarn package:prod --linux ${{ matrix.defaultTargets }}

electron-builder.json

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -136,11 +136,22 @@
136136
"rpm": {
137137
"fpm": ["--rpm-digest", "sha256"]
138138
},
139-
"snap": {
140-
"plugs": ["default", "password-manager-service"],
141-
"confinement": "strict",
142-
"stagePackages": ["default"],
143-
"allowNativeWayland": false
139+
"snapcraft": {
140+
"base": "core24",
141+
"core24": {
142+
"confinement": "strict",
143+
"useLXD": true,
144+
"stagePackages": ["default"],
145+
"environment": {
146+
"XDG_SESSION_TYPE": "x11"
147+
},
148+
"plugs": [
149+
"network",
150+
"home",
151+
"password-manager-service",
152+
"browser-support"
153+
]
154+
}
144155
},
145156
"flatpak": {
146157
"runtimeVersion": "20.08",

0 commit comments

Comments
 (0)