Can't mix ports.ubuntu.com and archive.ubuntu.com (building multi-arch snaps)
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Launchpad itself |
New
|
Undecided
|
Unassigned | ||
Snapcraft |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
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-
grade: devel
confinement: devmode
package-
- type: apt
url: http://
suites: [jammy]
components: [main, universe]
architectures: [armhf]
key-id: F6ECB3762474EDA
key-server: keyserver.
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/
```
Because:
```plain
2023-03-04 21:20:35.447 :: 2023-03-04 20:20:35.054 :: E: Failed to fetch http://
2023-03-04 21:20:35.447 :: 2023-03-04 20:20:35.054 :: E: Failed to fetch http://
2023-03-04 21:20:35.447 :: 2023-03-04 20:20:35.054 :: E: Failed to fetch http://
2023-03-04 21:20:35.447 :: 2023-03-04 20:20:35.054 :: E: Failed to fetch http://
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-
## Case B
Another approach:
```yaml
# ... (no package-
parts:
aaa:
plugin: nil
stage-packages:
- libc6
arch-add:
plugin: nil
override-pull: |
if [ "${CRAFT_
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/
```
Re-running the build will complete, because Snapcraft will have reloaded the now-multiarch cache.
description: | updated |
description: | updated |
description: | updated |
description: | updated |
description: | updated |
description: | updated |
Changed in snapcraft: | |
status: | Confirmed → Fix Released |
There may be two bugs here in reality: e-specific repositories on the build bases repositories`
1) non-architectur
- Snapcraft could mangle them to avoid the problem
- the build bases could have [arch=<>] bits added to the default repos
- Snapcraft could allow advanced grammar for `package-
2) Snapcraft holding on to apt caches across parts
- this may be found to be by design
- but re-reading the cache in `pull` steps could also help