Snapcraft fails to run on 32bit userspace container on 64bit ARM kernel.
Bug Description
On compatible hardware, where the vendor has not saved silicon to exclude 32bit support, one can use the personality system call to set the personality of a process to the 32bit sub-architecture of the 64bit architecture. Notably, 64bit kernels set such personality on 32bit programs automatically.
This is perfect for running snapcraft on fast 64bit arm hardware, while using a lightweight 32bit container, so that one can build arm 32bit snaps natively, without having to add explicit support for full cross compilation.
This fails, because snapcraft and the numerous craft_ libraries don't universally understand this architecture mode, all while trying to understand architecture modes.
On aarch64 kernel running 32bit userspace profile, or running with the 32bit personality flag set (see the setarch program for details) uname -m returns armv8l.
$ uname -m
aarch64
$ setarch armv7l uname -m
armv8l
Snapcraft should treat armv8l as an alias of armv7l across the board.
I found
To Reproduce
On an arm64 system spawn an 32bit userspace container with lxd:
$ lxc launch ubuntu-daily:n/armhf
Then lxc shell into the container and install snapcraft:
# snap install --classic snapcraft
Finally run --help:
# snapcraft --help
root@classic-sawfly:~# uname -a
Linux classic-sawfly 6.14.0-1009-raspi #9-Ubuntu SMP PREEMPT_DYNAMIC Mon Jun 23 16:47:03 UTC 2025 armv8l armv8l armv8l GNU/Linux
root@classic-sawfly:~# snapcraft --help
[traceback]
Environment
Ubuntu daily armhf on Ubuntu LTS aarch64
snapcraft.yaml
N/A
Relevant log output
Traceback (most recent call last):
File "/snap/snapcraft/15372/bin/snapcraft", line 5, in <module>
from snapcraft.application import main
File "/snap/snapcraft/15372/lib/python3.12/site-packages/snapcraft/application.py", line 39, in <module>
from snapcraft import cli, commands, errors, models, services, store
File "/snap/snapcraft/15372/lib/python3.12/site-packages/snapcraft/cli.py", line 33, in <module>
from snapcraft import errors, store, utils
File "/snap/snapcraft/15372/lib/python3.12/site-packages/snapcraft/store/__init__.py", line 22, in <module>
from .client import StoreClientCLI
File "/snap/snapcraft/15372/lib/python3.12/site-packages/snapcraft/store/client.py", line 35, in <module>
from snapcraft import __version__, errors, models, utils
File "/snap/snapcraft/15372/lib/python3.12/site-packages/snapcraft/models/__init__.py", line 26, in <module>
from .project import (
File "/snap/snapcraft/15372/lib/python3.12/site-packages/snapcraft/models/project.py", line 2236, in <module>
class ArchitectureProject(models.CraftBaseModel, extra="ignore"):
File "/snap/snapcraft/15372/lib/python3.12/site-packages/snapcraft/models/project.py", line 2240, in ArchitectureProject
default=[str(DebianArchitecture.from_host())],
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/snap/snapcraft/15372/lib/python3.12/site-packages/craft_platforms/_architectures.py", line 64, in from_host
return cls.from_machine(platform.machine())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/snap/snapcraft/15372/lib/python3.12/site-packages/craft_platforms/_architectures.py", line 59, in from_machine
return cls(_ARCH_TRANSLATIONS_PLATFORM_TO_DEB.get(arch.lower(), arch.lower()))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/snap/snapcraft/current/usr/lib/python3.12/enum.py", line 757, in __call__
return cls.__new__(cls, value)
^^^^^^^^^^^^^^^^^^^^^^^
File "/snap/snapcraft/current/usr/lib/python3.12/enum.py", line 1171, in __new__
raise ve_exc
ValueError: 'armv8l' is not a valid DebianArchitecture
Additional context
No response
There are a dozen or more mappings of supported architectures in Snapcraft and the craft libraries. Some map armv8l and others don't.
I think we should consistently map armv8l to armv7l and am interested in @lengau's opinion.
Thank you for reporting your feedback to us!
The internal ticket has been created: https://warthogs.atlassian.net/browse/SNAPCRAFT-1190.
This message was autogenerated