← Back to issue list

snapcraft does not properly detect the architecture when kernel is 64 bits but userspace is 32

View original Launchpad issue

Metadata

Project
snapcraft (launchpad)
Number
#1641123
Type
issue
State
closed
Author
~alfonsosanchezbeato
Labels
—
Created
Updated
Closed

Current evaluation

Fixed in snapcore/snapcraft#1089 by deriving the build architecture from the compiler target, preventing 32-bit ARM artifacts from being mislabeled arm64.

Resolution: closed resolved

Reason: The closing update linked PR snapcore/snapcraft#1089, which implemented the proposed gcc -dumpmachine-based architecture detection. This correctly identifies armhf builds running in 32-bit user space on a 64-bit kernel.

Evaluated by: mr-cal-bot

No scores available.

Issue body

Building a snap in a chroot in a phone that has 64 bits kernel but 32 bits user space produces a snap that is supposed to be 64 bits, with name *_arm64.snap and snap.yaml containing: << architectures: - arm64 >> However, the compiled files are 32 bits, because: $ gcc -v |& grep Target Target: arm-linux-gnueabihf

Evaluation history

Date Model Scores Action Summary
stealth/space-bunny-alpha — closed resolved Fixed in snapcore/snapcraft#1089 by deriving the build architecture from the compiler target, preventing 32-bit ARM artifacts from being mislabeled arm64.
stealth/space-bunny-alpha — closed resolved Fixed userspace-aware ARM architecture detection in merged Snapcraft PRs #1060 (31c45dd51) and #1089 (9a66ec843), preventing 32-bit armhf artifacts from being labeled arm64.
stealth/space-bunny-alpha — closed resolved Fixed by merged PR #1060 (commit 31c45dd51), which detects the actual userspace architecture instead of relying on the kernel architecture.
qwen/qwen3.6-35b-a3b — — Closed without resolution. Snapcraft incorrectly identified arm64 architecture in 64-bit kernel/32-bit userspace chroots, generating mismatched snaps. The report was abandoned due to inactivity.
qwen/qwen3.6-35b-a3b — — Abandoned. Snapcraft misdetected arm64 architecture on 64-bit kernel/32-bit userspace chroots, packaging 32-bit binaries with arm64 metadata. Closed without resolution or follow-up.

Update history

Date Change
created

Related work

  • Likely Fixed By: snapcore/snapcraft#1089 (confidence 97%)

    Final linked PR implementing compiler-target-based architecture detection.

  • Related To: snapcore/snapcraft#1060 (confidence 90%)

    Earlier architecture-detection PR linked from the issue.

Related issues

Issue Project State Summary Similarity
#5638 Snapcraft fails to run on 32bit userspace container on 64bit ARM kernel. snapcraft closed Fixed by merged PR #6394 (commit e51640488): Snapcraft now maps armv8l to armv7l, supporting ARMHF builds in 32-bit ARM userspace on 64-bit ARM kernels.
79%
#4214 snapcraft 7.4.3 doesn't adequately complain about non-existent architectures snapcraft closed Fixed in Snapcraft 8: invalid build-on architectures now produce a clear validation error listing all supported architectures.
76%
#1862256 snapcraft should complain loudly when building base: core20 snap on i386 snapcraft (launchpad) closed Closed as superseded: improved architecture parsing rejects unsupported core20/i386 builds, making a dedicated check unnecessary; snapcraft#4392 improved this handling.
76%
#2012074 snapcraft cannot build snap by default on aarch64 snapcraft (launchpad) open ARM64 default builds failed on Snapcraft 7.3.1 because core20 selected amd64-only Multipass images; later defaults use core22/LXD on Linux, addressing the reported path.
75%
#1943603 snapcraft --target-arch=i386 does not build i386 images, because core20 does not support i386 and yet the build starts and wastes time snapcraft (launchpad) open Legacy Snapcraft accepted an unsupported core20/i386 target, wasted build time, and produced an amd64 snap; current validation excludes i386 and drops core20.
75%
#1691569 snapcraft fails when specifying 'any' architecture in build packages snapcraft (launchpad) closed Fixed by snapcore/snapcraft PR #1322, which restored support for architecture-qualified build packages such as python:any.
74%
#1987627 Cannot build snaps in a 32-bit armhf container when running an arm64 kernel snapcraft (launchpad) closed Fixed in Snapcraft 9.1 by PR #6394 (commit e5164048), adding armv8l support so a 32-bit ARM userspace on an ARM64 kernel maps to armhf.
74%
#1813634 not reliable way to detect target architecture snapcraft (launchpad) open Snapcraft 8.0.0 added explicit build-for architecture variables, superseding the ambiguous 3.0.1-era target_arch and SNAPCRAFT_ARCH_TRIPLET behavior.
73%
#1817288 snapcraft cleanbuild produces incorrect architecture snap snapcraft (launchpad) closed Bug (legacy cleanbuild naming a snap _multi.snap despite correct advanced architectures) was never fixed; closed in Aug 2023 by ~sergiusens noting cleanbuild is no longer supported and all builds are now transparently clean.
73%
#1760857 SNAPCRAFT_IMAGE_INFO contains wrong architecture snapcraft (launchpad) closed Wrong architecture in recorded LXD image info was fixed by merged snapcore/snapcraft PR #2046 (commit 828ea5120), which filtered image lookup by target architecture.
73%