Legacy (pre core24) classic snap launcher still broken on Ubuntu 26.04 (head/uutils, follow up to #9704)

Author: ryankupkCreated Jul 1, 2026Updated Sep 27, 2026
LabelsStale

This is a follow up to #9704, which was closed alongside the core24 migration work in #9517. That PR explicitly does not touch the legacy embedded snap launcher script (the one shipped via app-builder-bin for core18/20/22 snaps), so this specific failure is still unfixed for any existing published classic snap that has not migrated to core24. Filing separately so it stays visible and tracked on its own, since closed issues do not show up in default triage.

Problem: on Ubuntu 26.04, classic confinement snaps built with the legacy electron-builder snap launcher fail to start at all, with no error output and exit code 1.

Root cause:

The bundled desktop-common.sh launcher script (from app-builder-bin, sourced from the upstream snapcraft desktop helpers) contains logic that tries to replace a user's real XDG directories (Documents, Desktop, Downloads, etc.) with symlinks into the snap's data dir. It decides whether to do this via:

function can_open_file() {
  head -c0 "$1" &> /dev/null
}

used both on real files and on real directories. Ubuntu 26.04 changed the default /usr/bin/head from GNU coreutils to rust-coreutils (uutils). GNU's head -c0 short circuits on a zero byte count and returns success even when given a directory. uutils' head -c0 actually opens the path and fails with Is a directory. That flips can_open_file() to report directories as unreadable, which flips needs_xdg_links to true, which sends the script down the "replace XDG dirs with symlinks" path.

For a classic confinement snap, $HOME is the user's real home, not a sandboxed path. So the script ends up trying to rmdir the user's real, non-empty ~/Documents (and similar for other XDG dirs). That fails, and because the script runs under set -e, the whole launcher exits immediately with no output at all.

Reproduced in detail (full bash -x trace showing the exact rmdir /home/<user>/Documents call) in the earlier comment here: https://github.com/electron-userland/electron-builder/issues/9704#issuecomment-4860011632

Impact: any existing published classic snap built with the legacy (pre core24) electron-builder snap launcher will fail to start on Ubuntu 26.04 with no indication of why, until either the user works around it locally or the app is rebuilt against a launcher that does not do this XDG dir replacement for classic snaps.

Workaround for end users right now: point head back at GNU coreutils, which Ubuntu 26.04 still ships side by side as gnu-coreutils:

bash
sudo ln -sf /usr/bin/gnuhead /usr/bin/head
sudo ln -sf /usr/bin/gnuhead /bin/head

This is a blunt, system wide workaround, not something app authors or users should have to rely on long term.

Suggested real fix: for classic confinement snaps specifically, the launcher should not attempt to replace XDG directories with symlinks at all, since $HOME already points at the real directories and there is nothing to redirect. This would remove the dependency on can_open_file()/head for classic snaps entirely, independent of whatever coreutils implementation happens to be first in PATH. Canonical's own snapcraft desktop-exports script already avoids the head-based check ([ -f "$1" ] && [ -r "$1" ], noted by @seb128 in #9704), which would also reduce exposure to this specific trigger even if the broader classic-snap XDG replacement logic is kept.

Source: electron-userland/electron-builder