← Back to issue list

Packing with CRAFT_BUILD_ON can fail when installing registered snaps

View original Github issue

Metadata

Project
craft-application
Number
#1059
Type
issue
State
open
Author
tigarmo
Labels
Status: Triaged
Created
Updated
Closed
—

Current evaluation

Cross-architecture packing with registered snaps could inject incompatible host snaps; commit 16bd7ac3 now skips host snap injection when architectures differ.

Suggested action: close resolved

Reason: Repository history contains resolving commit 16bd7ac3 from PR craft-application#1037, titled "don't inject snaps if the host and guest architectures differ." This directly addresses the reported core24 architecture mismatch.

Evaluated by: mr-cal-bot

Impact: 48 Quick Win: 31 Complexity: 35 Confidence: 97 Actionability: 98

Issue body

### Bug Description An example is this: an `amd64` host, `CRAFT_BUILD_ON=armhf` to pack an armhf package, and an application plugin that registers `astral-uv` as a snap to be installed in the instance. What happens then is that the application tries to inject at least `core24` (astral-uv's base) from the host, which fails because of the different architecture. I say "at least" because possibly the application would also try to inject the host astral-uv snap too, but it fails before that. ### To Reproduce . ### part yaml ```shell ``` ### Relevant log output ```shell 2026-04-09 16:51:15.765 2026-04-09 16:51:15.764 * Command standard error output: b'error: cannot install snap file: snap "core24" supported architectures (arm64)\n are incompatible with this system (armhf)\n' 2026-04-09 16:51:15.771 2026-04-09 16:51:15.771 Traceback (most recent call last): 2026-04-09 16:51:15.771 2026-04-09 16:51:15.771 File "/snap/mysnap/967/lib/python3.12/site-packages/craft_providers/actions/snap_installer.py", line 401, in inject_from_host 2026-04-09 16:51:15.771 2026-04-09 16:51:15.771 executor.execute_run( 2026-04-09 16:51:15.771 2026-04-09 16:51:15.771 File "/snap/mysnap/967/lib/python3.12/site-packages/craft_providers/lxd/lxd_instance.py", line 279, in execute_run 2026-04-09 16:51:15.771 2026-04-09 16:51:15.771 return self.lxc.exec( 2026-04-09 16:51:15.772 2026-04-09 16:51:15.771 ^^^^^^^^^^^^^^ 2026-04-09 16:51:15.772 2026-04-09 16:51:15.772 File "/snap/mysnap/967/lib/python3.12/site-packages/craft_providers/lxd/lxc.py", line 536, in exec 2026-04-09 16:51:15.772 2026-04-09 16:51:15.772 return runner(final_cmd, timeout=timeout, check=check, **kwargs) 2026-04-09 16:51:15.772 2026-04-09 16:51:15.772 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2026-04-09 16:51:15.772 2026-04-09 16:51:15.772 File "/snap/mysnap/current/usr/lib/python3.12/subprocess.py", line 571, in run 2026-04-09 16:51:15.772 2026-04-09 16:51:15.772 raise CalledProcessError(retcode, process.args, 2026-04-09 16:51:15.772 2026-04-09 16:51:15.772 subprocess.CalledProcessError: Command '['lxc', '--project', 'mysnap', 'exec', 'local:mysnap-myproject-arm64-262639', '--', 'env', 'CRAFT_MANAGED_MODE=1', 'mysnap_DEBUG=False', 'mysnap_BUILD_ON=armhf', 'mysnap_LXD_REMOTE=local', 'mysnap_LAUNCHPAD_INSTANCE=production', 'https_proxy=http://10.145.198.242:8888', 'HTTPS_PROXY=http://10.145.198.242:8888', 'http_proxy=http://10.145.198.242:8888', 'HTTP_PROXY=http://10.145.198.242:8888', 'DEBIAN_FRONTEND=noninteractive', 'DEBCONF_NONINTERACTIVE_SEEN=true', 'DEBIAN_PRIORITY=critical', 'snap', 'install', '/tmp/core24.snap']' returned non-zero exit status 1. 2026-04-09 16:51:15.772 2026-04-09 16:51:15.772 2026-04-09 16:51:15.772 2026-04-09 16:51:15.772 The above exception was the direct cause of the following exception: 2026-04-09 16:51:15.772 2026-04-09 16:51:15.772 Traceback (most recent call last): 2026-04-09 16:51:15.772 2026-04-09 16:51:15.772 File "/snap/mysnapt/967/lib/python3.12/site-packages/craft_providers/base.py", line 696, in _install_snaps 2026-04-09 16:51:15.772 2026-04-09 16:51:15.772 snap_installer.inject_from_host( 2026-04-09 16:51:15.772 2026-04-09 16:51:15.772 File "/snap/mysnapt/967/lib/python3.12/site-packages/craft_providers/actions/snap_installer.py", line 365, in inject_from_host 2026-04-09 16:51:15.772 2026-04-09 16:51:15.772 inject_from_host(executor=executor, snap_name=host_snap_base, classic=False) 2026-04-09 16:51:15.772 2026-04-09 16:51:15.772 File "/snap/mysnapt/967/lib/python3.12/site-packages/craft_providers/actions/snap_installer.py", line 410, in inject_from_host 2026-04-09 16:51:15.772 2026-04-09 16:51:15.772 raise SnapInstallationError( 2026-04-09 16:51:15.773 2026-04-09 16:51:15.772 craft_providers.actions.snap_installer.SnapInstallationError: failed to install snap 'core24' ```

Evaluation history

Date Model Scores Action Summary
stealth/space-bunny-alpha
Impact: 48
Quick Win: 31
Complexity: 35
Confidence: 97
Actionability: 98
close resolved Cross-architecture packing with registered snaps could inject incompatible host snaps; commit 16bd7ac3 now skips host snap injection when architectures differ.
qwen/qwen3.6-35b-a3b
Impact: 70
Quick Win: 22
Complexity: 60
Confidence: 80
Actionability: 80
keep open Cross-architecture build with CRAFT_BUILD_ON fails when injecting registered snaps due to architecture mismatch (e.g., amd64 host building armhf tries to inject arm64 core24)
qwen/qwen3.8-27b
Impact: 60
Quick Win: 33
Staleness: 20
Complexity: 45
Confidence: 80
Support Request: 5
keep open Cross-architecture packing with CRAFT_BUILD_ON fails when a plugin registers a snap: the provider injects the host's base snap (e.g. core24) into the guest, which fails on arch mismatch. Triaged; fixed in craft-application PR #1037.
qwen/qwen3.6-35b-a3b
Staleness: 55
Complexity: 60
Confidence: 90
Support Request: 5
keep open Packing with CRAFT_BUILD_ON fails when injecting host snaps into a target instance due to architecture mismatch. Issue is triaged but has been inactive for 102 days.
qwen3.6-35b-a3b-mtp-q6
Staleness: 70
Complexity: 50
Confidence: 85
Support Request: 5
keep open Bug where CRAFT_BUILD_ON causes snap packing to fail due to host/target architecture mismatch when injecting base snaps like core24. Currently triaged and awaiting development.

Update history

No update history recorded yet.

Related work

  • Likely Fixed By: craft-application#1037 (confidence 98%)

    PR #1037 was merged as commit 16bd7ac3 and changes ProviderService to avoid injecting host snaps during cross-architecture builds.

Related issues

Issue Project State Summary Similarity
#1064 fix: skip injecting snaps from host when cross-building craft-application closed Closed as redundant after the same cross-build snap-injection fix merged in canonical/craft-application#1037 via commit 16bd7ac3.
73%
#1037 feat(ProviderService): don't inject snaps if the host and guest architectures differ craft-application merged Merged PR #1037 as commit 16bd7ac3, preventing host application-snap injection for cross-architecture guests and using Snap Store installation instead.
72%