Snapcraft 7.1.0 fails to find stage package when cross-compiling
Metadata
Current evaluation
Fixed by canonical/snapcraft#3416 (commit 8f418e3d9), restoring core20 behavior so stage packages come from build-on repositories during cross-compilation.
Resolution: closed resolved
Reason: The regression was fixed by merged PR canonical/snapcraft#3416, commit 8f418e3d9, which corrected stage-package architecture selection to match the build-on repository behavior.
Evaluated by: mr-cal-bot
No scores available.
Issue body
I tried the architectures support to cross-compile a snap for arm64 and armhf. So I added the following lines to my snapcraft.yaml:
```yaml
architectures:
- build-on: amd64
build-for: amd64
- build-on: [amd64, arm64]
build-for: arm64
- build-on: [amd64, armhf]
build-for: armhf
```
After running `snapcraft` on my amd64 machine, the amd64 snap is built correctly, but the arm64 and armhf builds fail with the error **Stage package not found in part 'theengs-gateway': bluez.**
Previously (with Snapcraft 7.0) I built the arm64 snap on a jammy LXC container on an arm64 machine, and the armhf snap on an a jammy LXC container on an armhf machine, and this just worked: the stage package bluez was found and the resulting snaps installed and ran fine locally. Building the arm64 snap on arm64 with Snapcraft 7.1 also works. So it seems something is going wrong with stage packages when cross-compiling.
Here's the project:
https://github.com/theengs/gateway-snap
Here's the pull request where I try to use the architectures support:
https://github.com/theengs/gateway-snap/pull/7
Relevant part of the logs:
```
2022-07-27 20:05:43.822 :: 2022-07-27 20:05:42.596 Requested stage-packages: ['bluez']
2022-07-27 20:05:43.822 :: 2022-07-27 20:05:43.491 Marking bluez (and its dependencies) to be fetched
2022-07-27 20:05:43.822 :: 2022-07-27 20:05:43.492 Stage package not found in part 'theengs-gateway': bluez.
2022-07-27 20:05:43.822 :: 2022-07-27 20:05:43.496 Traceback (most recent call last):
2022-07-27 20:05:43.822 :: 2022-07-27 20:05:43.496 File "/snap/snapcraft/x1/lib/python3.8/site-packages/craft_parts/executor/part_handler.py", line 846, in _fetch_stage_packages
2022-07-27 20:05:43.822 :: 2022-07-27 20:05:43.496 fetched_packages = packages.Repository.fetch_stage_packages(
2022-07-27 20:05:43.822 :: 2022-07-27 20:05:43.496 File "/snap/snapcraft/x1/lib/python3.8/site-packages/craft_parts/packages/deb.py", line 261, in wrapped
2022-07-27 20:05:43.822 :: 2022-07-27 20:05:43.496 return method(*args, **kwargs)
2022-07-27 20:05:43.822 :: 2022-07-27 20:05:43.496 File "/snap/snapcraft/x1/lib/python3.8/site-packages/craft_parts/packages/deb.py", line 588, in fetch_stage_packages
2022-07-27 20:05:43.822 :: 2022-07-27 20:05:43.496 apt_cache.mark_packages(set(package_names))
2022-07-27 20:05:43.822 :: 2022-07-27 20:05:43.496 File "/snap/snapcraft/x1/lib/python3.8/site-packages/craft_parts/packages/apt_cache.py", line 302, in mark_packages
2022-07-27 20:05:43.822 :: 2022-07-27 20:05:43.496 raise errors.PackageNotFound(name_arch)
2022-07-27 20:05:43.822 :: 2022-07-27 20:05:43.496 craft_parts.packages.errors.PackageNotFound: Package not found: bluez.
2022-07-27 20:05:43.822 :: 2022-07-27 20:05:43.496
2022-07-27 20:05:43.822 :: 2022-07-27 20:05:43.496 During handling of the above exception, another exception occurred:
2022-07-27 20:05:43.822 :: 2022-07-27 20:05:43.496 Traceback (most recent call last):
2022-07-27 20:05:43.822 :: 2022-07-27 20:05:43.496 File "/snap/snapcraft/x1/lib/python3.8/site-packages/snapcraft/parts/parts.py", line 170, in run
2022-07-27 20:05:43.822 :: 2022-07-27 20:05:43.496 aex.execute(action, stdout=stream, stderr=stream)
2022-07-27 20:05:43.822 :: 2022-07-27 20:05:43.496 File "/snap/snapcraft/x1/lib/python3.8/site-packages/craft_parts/executor/executor.py", line 301, in execute
2022-07-27 20:05:43.822 :: 2022-07-27 20:05:43.496 self._executor.execute(actions, stdout=stdout, stderr=stderr)
2022-07-27 20:05:43.822 :: 2022-07-27 20:05:43.496 File "/snap/snapcraft/x1/lib/python3.8/site-packages/craft_parts/executor/executor.py", line 126, in execute
2022-07-27 20:05:43.822 :: 2022-07-27 20:05:43.496 self._run_action(act, stdout=stdout, stderr=stderr)
2022-07-27 20:05:43.822 :: 2022-07-27 20:05:43.496 File "/snap/snapcraft/x1/lib/python3.8/site-packages/craft_parts/executor/executor.py", line 189, in _run_action
2022-07-27 20:05:43.822 :: 2022-07-27 20:05:43.496 handler.run_action(action, stdout=stdout, stderr=stderr)
2022-07-27 20:05:43.822 :: 2022-07-27 20:05:43.496 File "/snap/snapcraft/x1/lib/python3.8/site-packages/craft_parts/executor/part_handler.py", line 161, in run_action
2022-07-27 20:05:43.822 :: 2022-07-27 20:05:43.496 state = handler(step_info, stdout=stdout, stderr=stderr)
2022-07-27 20:05:43.822 :: 2022-07-27 20:05:43.496 File "/snap/snapcraft/x1/lib/python3.8/site-packages/craft_parts/executor/part_handler.py", line 182, in _run_pull
2022-07-27 20:05:43.822 :: 2022-07-27 20:05:43.497 fetched_packages = self._fetch_stage_packages(step_info=step_info)
2022-07-27 20:05:43.822 :: 2022-07-27 20:05:43.497 File "/snap/snapcraft/x1/lib/python3.8/site-packages/craft_parts/executor/part_handler.py", line 854, in _fetch_stage_packages
2022-07-27 20:05:43.822 :: 2022-07-27 20:05:43.497 raise errors.StagePackageNotFound(
2022-07-27 20:05:43.822 :: 2022-07-27 20:05:43.497 craft_parts.errors.StagePackageNotFound: Stage package not found in part 'theengs-gateway': bluez.
2022-07-27 20:05:43.822 :: 2022-07-27 20:05:43.497 Full execution log: '/tmp/snapcraft.log'
2022-07-27 20:05:45.095 Failed to execute pack in instance.
2022-07-27 20:05:45.099 Traceback (most recent call last):
2022-07-27 20:05:45.099 File "/snap/snapcraft/7986/lib/python3.8/site-packages/snapcraft/parts/lifecycle.py", line 452, in _run_in_provider
2022-07-27 20:05:45.099 instance.execute_run(cmd, check=True, cwd=output_dir)
2022-07-27 20:05:45.099 File "/snap/snapcraft/7986/lib/python3.8/site-packages/craft_providers/lxd/lxd_instance.py", line 221, in execute_run
2022-07-27 20:05:45.099 return self.lxc.exec(
2022-07-27 20:05:45.099 File "/snap/snapcraft/7986/lib/python3.8/site-packages/craft_providers/lxd/lxc.py", line 326, in exec
2022-07-27 20:05:45.099 return runner(final_cmd, **kwargs) # pylint: disable=subprocess-run-check
2022-07-27 20:05:45.099 File "/snap/snapcraft/7986/usr/lib/python3.8/subprocess.py", line 516, in run
2022-07-27 20:05:45.099 raise CalledProcessError(retcode, process.args,
2022-07-27 20:05:45.099 subprocess.CalledProcessError: Command '['lxc', '--project', 'snapcraft', 'exec', 'local:snapcraft-theengs-gateway-on-amd64-for-arm64-519419', '--cwd', '/root/project', '--', 'env', 'PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin', 'SNAPCRAFT_MANAGED_MODE=1', 'SNAPCRAFT_BUILD_INFO=1', 'SNAPCRAFT_IMAGE_INFO={"build_url":"https://github.com/theengs/gateway-snap/actions/runs/2749306160"}', 'snapcraft', 'pack', '--enable-manifest', '--build-for', 'arm64']' returned non-zero exit status 1.
```
I have attached the full logs.
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| stealth/space-bunny-alpha | — | closed resolved | Fixed by canonical/snapcraft#3416 (commit 8f418e3d9), restoring core20 behavior so stage packages come from build-on repositories during cross-compilation. | |
| stealth/space-bunny-alpha | — | closed resolved | Fixed by restoring core22 cross-compilation to fetch stage packages from the build-on architecture; snapcraft PR #3461 updated package filtering by architecture and version. | |
| stealth/space-bunny-alpha | — | closed stale | Closed without a documented fix after a confirmed Snapcraft 7.1 core22 cross-compilation regression; no resolving PR, commit, or release was linked. | |
| stealth/space-bunny-alpha | — | closed stale | Closed without a documented fix or linked pull request. Snapcraft 7.1.0’s cross-compiled arm64/armhf builds failed to resolve the bluez stage package. | |
| qwen/qwen3.6-35b-a3b | — | — | Closed without documented resolution. Reported Snapcraft 7.1.0 failing to locate stage packages during cross-compilation, causing arm64/armhf build failures. | |
| qwen/qwen3.6-35b-a3b | — | — | Closed. Snapcraft 7.1.0 fails to find stage packages like bluez when cross-compiling from amd64 to arm64/armhf, breaking builds. Issue closed without a provided resolution or fix. | |
| qwen/qwen3.6-35b-a3b | — | — | Closed without resolution. Snapcraft 7.1.0 failed to locate the bluez stage package during amd64 to arm64/armhf cross-compilation. The report was abandoned due to inactivity. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Closed without comments or explicit resolution. Snapcraft 7.1.0 failed to locate the bluez stage package during amd64 to arm64/armhf cross-compilation, breaking builds that worked in version 7.0. |
Update history
| Date | Change |
|---|---|
| created |
Related work
-
Likely Fixed By:
canonical/snapcraft#3416
(confidence 98%)
The commit is titled "repo: default to target arch for stage package cache" and directly addresses stage-package architecture handling.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #1570414 Snapcraft doesn't check if cross-compiling before trying to install necessary tools | snapcraft (launchpad) | closed | Fixed: cross-build packages are now only installed when actually cross-compiling. Resolved by merged PR canonical/snapcraft#451 (commit 96b811df1), released in Snapcraft 2.8.1 via #465; LP bug closed. | |
| #1768908 Snapcraft stages dependencies for alternates that aren't staged | snapcraft (launchpad) | closed | Fixed by merged snapcore/snapcraft PR #2119, which automatically prunes unneeded stage-packages (commit b9faf80bd). | |
| #1873349 snapcraft sometimes generates invalid stage-packages entries in manifest.yaml | snapcraft (launchpad) | closed | Fixed by snapcraft#3047 (commit 2e6549953), correcting install_stage_packages() output so manifest stage-packages entries are valid. The fix landed on edge; no release was affected. | |
| #1568131 Terse error message when package cannot be found | snapcraft (launchpad) | closed | Missing stage-packages now produce a clear error. Fixed by merged PR canonical/snapcraft#524 (0c05bd66f), released in Snapcraft 2.10 and verified in 2.10.1. | |
| #1981979 snapcraft 7.0.8+ stopped working on non debian systems | snapcraft (launchpad) | closed | Fixed in snapcore/snapcraft#3843 (commit ed49405fb, merged as 57ecab3bc) by deferring the Debian package import so Snapcraft starts on non-Debian hosts. | |
| #2099923 Snapcraft builds are failing: install of snap "snapcraft" failed | snapcraft (launchpad) | open | Reported Launchpad Bionic non-i386 builds cannot install Snapcraft 7.x/stable because core20 needs snapd 2.61; the issue remains open, untriaged, and unanswered. | |
| #1157 repo: support versioned stage-packages | snapcraft | merged | Merged support for versioned stage-packages in canonical/snapcraft#1157 via commit ef4076821, resolving Launchpad bug #1666656. | |
| #1973197 snapcraft 7.x not running override-build | snapcraft (launchpad) | closed | Closed as a snap config issue, not a Snapcraft bug: override-build runs after stage packages are pulled, so Steam's i386 enable came too late. Maintainer @cmatsuoka advised moving enable-i386 to override-pull. | |
| #1538688 Support referencing the stage dir from snapcraft.yaml | snapcraft (launchpad) | closed | Implemented SNAPCRAFT_STAGE substitution for part properties and merged the fix in canonical/snapcraft#270 via eb033b40c. | |
| #1833408 core20: fails to create snap with merged-usr | snapcraft (launchpad) | closed | Fixed by merged snapcraft#2628 (commit 3f5799a72), making filesets preserve symlink directory paths during staging. |