Can't mix ports.ubuntu.com and archive.ubuntu.com (building multi-arch snaps)
Metadata
Current evaluation
⚠️ This summary may be outdated — the issue content or evaluation prompts have changed since this evaluation was made.
Closed without resolution. Multi-arch snap builds remain unsupported due to apt repository mixing failures and stale package caches before architecture additions. No fix was implemented.
Suggested action: —
No scores available.
Issue body
The use case is building snaps containing both 32- and 64-bit packages (i.e. to support older software in the graphics-core22 stack [1]).
I've not found a way to build a amd64 + i386 (or arm64 + armhf) snap, because either repository refresh fails (case A), or snapcraft holds on to an archive cache from before `dpkg --add-architecture` (case B).
## Case A
Given this YAML:
(using the ARM example as this stops working when building a snap for an architecture that doesn't exist in the added repository - this way you can reproduce on amd64)
```yaml
name: arch-test
base: core22
version: '0.1'
summary: Architecture test
description: |
Multi-architecture test.
grade: devel
confinement: devmode
package-repositories:
- type: apt
url: http://ports.ubuntu.com/ubuntu-ports/
suites: [jammy]
components: [main, universe]
architectures: [armhf]
key-id: F6ECB3762474EDA9D21B7022871920D1991BC93C
key-server: keyserver.ubuntu.com
parts:
part:
plugin: nil
stage-packages:
- libc6:armhf
```
```plain
$ snapcraft
Launching instance...
Add repository architecture: armhf
Failed to refresh package list: failed to run apt update.
Failed to execute pack in instance.
Full execution log: '/home/michal/.cache/snapcraft/log/snapcraft-20230304-212001.588931.log'
```
Because:
```plain
2023-03-04 21:20:35.447 :: 2023-03-04 20:20:35.054 :: E: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/jammy/main/binary-armhf/Packages 404 Not Found [IP: 185.125.190.36 80]
2023-03-04 21:20:35.447 :: 2023-03-04 20:20:35.054 :: E: Failed to fetch http://security.ubuntu.com/ubuntu/dists/jammy-security/main/binary-armhf/Packages 404 Not Found [IP: 185.125.190.39 80]
2023-03-04 21:20:35.447 :: 2023-03-04 20:20:35.054 :: E: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/jammy-updates/main/binary-armhf/Packages 404 Not Found [IP: 185.125.190.39 80]
2023-03-04 21:20:35.447 :: 2023-03-04 20:20:35.054 :: E: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/jammy-backports/main/binary-armhf/Packages 404 Not Found [IP: 185.125.190.39 80]
2023-03-04 21:20:35.447 :: 2023-03-04 20:20:35.054 :: E: Some index files failed to download. They have been ignored, or old ones used instead.
```
The apt repository definitions in the build base are not architecture-specific, so adding an architecture outside of that repository results in above errors.
## Case B
Another approach:
```yaml
# ... (no package-repositories)
parts:
aaa:
plugin: nil
stage-packages:
- libc6
arch-add:
plugin: nil
override-pull: |
if [ "${CRAFT_TARGET_ARCH}" == "amd64" ]; then
dpkg --add-architecture i386
apt-get update
fi
pack-i386:
after: [arch-add]
plugin: nil
stage-packages:
- libc6:i386
```
This will fail to find `libc6:i386`, because Snapcraft seems to hold to an apt cache from before processing parts:
```plain
Launching instance...
Executed: pull arch-add
Stage package not found in part 'pack': libc6:i386.
Failed to execute pack in instance.
Full execution log: '/home/michal/.cache/snapcraft/log/snapcraft-20230304-213302.303889.log'
```
Re-running the build will complete, because Snapcraft will have reloaded the now-multiarch cache.
[1] https://github.com/MirServer/glvnd-core22/
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| qwen/qwen3.6-35b-a3b | — | — | Closed without resolution. Multi-arch snap builds remain unsupported due to apt repository mixing failures and stale package caches before architecture additions. No fix was implemented. | |
| qwen/qwen3.6-35b-a3b | — | — | Closed without resolution. The reported multi-arch snap build failure caused by apt repository mixing and stale package caches remains unfixed. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Closed without comments or resolution. Likely abandoned. Multi-arch repository mixing remains unaddressed. |
Update history
No update history recorded yet.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #2018609 Can't update repositories when building for different arch from host | snapcraft (launchpad) | closed | Cross-architecture repository update bug in snapcraft was closed without discussion or a fix. The report appears abandoned, with no resolution or pull request provided. |