← 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 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.

Suggested action: keep open

Reason: The issue is triaged (Status: Triaged label, internal ticket CRAFT-5118) and the root cause is addressed by craft-application PR #1037 ('don't inject snaps if the host and guest architectures differ'), which skips host snap injection when build_on differs from the host arch. The issue should be closed once the fix is verified, but it is not stale or invalid.

Impact: 60 Quick Win: 33.0 Staleness: 20 Complexity: 45 Confidence: 80 Support Request: 5

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
qwen/qwen3.8-27b
Impact: 60
Quick Win: 33.0
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.
qwen3.6-35b-a3b-mtp-q6
Staleness: 65
Complexity: 55
Confidence: 85
Support Request: 10
keep open CRAFT_BUILD_ON packing fails when injecting registered snaps due to host and target architecture mismatches. Status is triaged and tracked as internal ticket CRAFT-5118, awaiting development.

Update history

No update history recorded yet.

Related work

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

    PR #1037 'feat(ProviderService): don't inject snaps if the host and guest architectures differ' directly addresses the reported failure where core24 is injected from the host into an armhf guest.

Related issues

No related issues found above the similarity threshold.