Bug 16405

Summary: meta-virtualization: skopeo copy command in container-bundle use host arch
Product: [Build System, Metadata & Runtime] Other YP Layers Reporter: Martin Frétigné <martin.fretigne>
Component: layersAssignee: Bruce Ashfield <bruce.ashfield>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: Medium+ CC: bruce.ashfield, poky.bs.watcher, poky.watcher, randy.macleod
Version: 6.0   
Target Milestone: 6.0.4   
Hardware: ARM   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: No (bug/feature does not impact docs)
Attachments:
Description Flags
container-bundle: override arch in skopeo copy command to support multiarch containers none

Description Martin Frétigné 2026-08-20 16:13:35 UTC
Created attachment 5243 [details]
container-bundle: override arch in skopeo copy command to support multiarch containers

Hello,

when bundling a multiarch container (e.g. docker.io/library/hello-world) using container-bundle.bbclass on wrynose, on my x86_64 dev machine for my ARM target, the amd64 version is bundled instead of the arm64 version.

I added the --override-arch option to the skopeo command to make the sure the version for the target is used. See attached patch.

Does it seem correct to you ?
Comment 1 Bruce Ashfield 2026-08-20 18:20:33 UTC
This path is exercised heavily here and on the autobuilder, but our multiarch
coverage takes a different route: we build the arches natively via oci-multiarch
(each in its own multiconfig), and where we do bundle, host and target arch line
up. So neither flow crosses an external multiarch image against a different
target arch, which is exactly where you happened to hit.

It is true that the skopeo copy in container-bundle passes no
architecture, so for a multiarch source it falls back to
skopeo-native's host arch (amd64 on an x86_64 builder).  On a native
build that happens to match the target; cross-building from x86_64 to
arm, it grabs the wrong image.

Rather than have you carry the patch, I've committed a slightly more
general version. Instead of a fixed --override-arch, it derives the
target arch from TARGET_ARCH via oe.go.map_arch -- the same mapping
image-oci already uses for OCI builds -- and adds --override-variant
for 32-bit arm (arm/v7 vs arm/v6). So it covers arm64, armv7, 386 and
the rest without anyone hardcoding an arch.  --override-os linux is
set explicitly alongside it.

One thing worth knowing: this assumes the pinned CONTAINER_DIGESTS
digest is the manifest-list (index) digest -- then --override-arch
selects the right entry from the list. For hello-world that's the
case. If a digest ever pins a single-arch manifest, the override can't
reselect, and shouldn't need to.

This is on master-next; I'll get it onto wrynose too since that's what
you're on.  After that the bundle should pick the target arch without
your local patch.
Comment 2 Martin Frétigné 2026-08-20 23:28:59 UTC
Ok, thanks. What's the time frame for the backport to wrynose ?
Comment 3 Martin Frétigné 2026-08-24 10:54:56 UTC
I pulled the wrynose branch, everything is working as expected (including fixes for #16402).
Comment 4 Bruce Ashfield 2026-10-27 22:16:35 UTC
The more general fix (deriving the target arch for the skopeo copy from TARGET_ARCH via oe.go.map_arch) is in master and was backported to wrynose; the reporter confirmed it works. Closing.