Skip to content

Packing with CRAFT_BUILD_ON can fail when installing registered snaps #1059

Open

Description

@tigarmo

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

Relevant log output

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'

Activity

  1. changed the title [-]Packing with CRAFT_BUILD_ON can fail when installing registered[/-] [+]Packing with CRAFT_BUILD_ON can fail when installing registered snaps[/+] on Apr 10, 2026
  2. syncronize-issues-to-jira commented on Apr 10, 2026

    @syncronize-issues-to-jira

    Thank you for reporting your feedback to us!

    The internal ticket has been created: https://warthogs.atlassian.net/browse/CRAFT-5118.

    This message was autogenerated

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions