Re: [meta-virtualization][PATCH 0/2] image-oci: two do_image_oci bugfixes (missing pm.update(), libgcc/libgcc-initial sysroot collision)
Koen Kooi <[email protected]> Tue, 28 Jul 2026 19:30:55 +0200
| Newsgroups | org.yoctoproject.lists.meta-virtualization |
|---|---|
| Message-ID | <[email protected]> |
--Apple-Mail=_7CA04D86-0F02-4C0A-AF5B-12023013CF55 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > Op 28 jul 2026, om 14:45 heeft Bruce Ashfield = <[email protected]> het volgende geschreven: >=20 > On Tue, Jul 28, 2026 at 7:56=E2=80=AFAM Koen Kooi via = lists.yoctoproject.org > <[email protected]> wrote: >>=20 >> I've been working on a prototype for building a rootfs with multiple = multi-layer OCI images images, all built from scratch, in one bitbake = command. I ran into some issues along the way: >>=20 >> * image-oci never runs "opkg update" or its rpm equivalents, so = nothing gets installed >> * both libgcc-initial and libgcc want to be in the sysroot >>=20 >> The first issue is straightforward, for the second I leaned heavily = on Claude to write a proper python version and explain it better. I'm = not fond of the wall of text that ends up with, but this is already the = 3rd iteration of trimming it down. >>=20 >> Anyway, This is the first wave, I'm working on other fixes, like = mtime influencing base-layer sharing, but that needs more testing and = review. I do need to mention how surprisingly small the resulting image = recipes are, a big thanks to everyone who has been working on this! >>=20 >> Below is what Claude suggested as coverletter, it is still verbose, = but doesn't suffer from the "Is Koen being sarcastic or not?" issue :) >>=20 >> 1/2 - image-oci: call pm.update() before pm.install() for multi-layer >> package layers >>=20 >> Multi-layer OCI images (OCI_LAYER_MODE =3D "multi") with a = "packages:" >> layer silently produce an empty layer: do_image_oci reports success, >> but the layer's opkg/rpm install never actually installs anything, >> because the per-layer package manager's local index/cache was never >> refreshed after write_index() (do_rootfs itself always calls >> pm.update() between the two; image-oci's per-layer installer >> skipped it). The failure is only visible as a bb.warn(), so the >> build looks green while shipping an empty (or partial) layer. >=20 > Aha. Since I've obviously tested the package installs and they work, > but multi layer is something that I don't recall testing in that = combination. It's a first for me as well :) >=20 >>=20 >> Reproduced with a minimal recipe (base-files+coreutils in a >> "packages:" layer): before the fix, the resulting OCI layer blob >> contains 0 regular files; after the fix, the same layer contains >> 272 files and the compressed blob grows from 299 bytes to 7.5 MB. >> Full before/after evidence in the patch commit message and in >> TEST-CASES.md if you'd like to reproduce it independently. >>=20 >=20 > I'd definitely want to see a reproducer, both so I can confirm how > I didn't see this before, and so I can get it into the layer tests. >=20 > Does this same image reproduce the second issue as well ? It does not, I've attached a tarball with what I think is the minimal = reproducer from scratch. Tried it on a different, clean build machine = and after suffering through llvm/clang/boost builds, it does reproduce! = My robot buddy summed it up as: Both real builds ran to completion, first-hand: =E2=80=A2 Bug 1 (pm.update): reproduced live =E2=80=94 0-file layer = unpatched, confirmed by extracting the actual OCI tar myself. =E2=80=A2 Bug 2 (libgcc-initial): the raw abort didn't fire in two = attempts (plain build + cleansstate-forced rebuild), matching the = earlier investigation. But I got independent proof of the mechanism that = doesn't need Koen's patch at all =E2=80=94 a bitbake -g + = task-depends.dot BFS showing libgcc-initial.do_populate_sysroot is = genuinely reachable from do_image_oci via the rootfs/SPDX chain. Bonus: = the boost recipe also hits bug 1, so it's not coreutils-specific. > I'd also like to reproduce that, to hunt around and see if there's > any other options to resolve the problem. The blacklisting of -initial feels a bit too specific and narrow to me. = But I've never really looked into this part of OE, so I don't trust my = feelings on that. regards, Koen Robot generated text: Reproducer attached (image-oci-repro.tar.gz): standalone kas tree, = oe-core + meta-openembedded + meta-virtualization, all master, = qemux86-64, package_ipk. README has the exact commands; short version = below. kas checkout kas-bugtest.yml . openembedded-core/oe-init-build-env build rm -rf oci-layer-cache && bitbake test-oci-pmupdate do_image_oci warns "Unable to install packages... Couldn't find anything = to satisfy 'base-files'" but reports Succeeded. Pulled the shipped OCI = tar apart: layer blob is 299B compressed/7680B uncompressed, 0 regular = files, just the bin/lib/sbin/usr/var skeleton. With 1/2 applied + cache = cleared + cleansstate: 272 files, 7.5MB, all the expected = coreutils/base-files content. Same image doesn't reach bug 2 - coreutils never pulls libgcc into = do_image_oci's walk. Swapped it for boost (test-oci-initial-collision, = also attached): same multi+packages shape, so it hits bug 1 too (opkg = install of base-files+boost fails the same way - not just a coreutils = quirk). For bug 2 specifically: `bitbake -g` + a BFS over = task-depends.dot from do_image_oci finds do_image_oci -> do_image -> = do_create_rootfs_spdx -> libgcc-initial.do_create_spdx -> = libgcc-initial.do_populate_sysroot - so libgcc-initial is reachable, via = do_rootfs's own SPDX chain, not via do_image_oci's declared [depends] = (umoci/jq/opkg/rsync-native, none of which reach it). That's the = mechanism confirmed live, no patch needed to see it. Couldn't force the raw crtbegin.o abort itself, unpatched, in two tries = - plain build, and cleansstate on = libgcc+libgcc-initial+umoci-native+jq-native+recipe. Both built clean. = Consistent with what we saw downstream: depends on whether = extend_recipe_sysroot actually has to populate both libgcc variants vs. = setscene-shortcut them, which cleansstate on a handful of recipes = doesn't control. Downstream hit it deterministically over 6+ = clean-sstate attempts on a wider DEPENDS set; not reproduced here. Options I looked at for 2/2 besides the BB_TASKDEPDATA strip: fixing = SSTATE_EXCLUDEDEPS_SYSROOT in oe-core to key off the dependency instead = of the consuming task being do_populate_sysroot (root cause, wide blast = radius), keeping do_image_oci off staging_taskhandler's generic prefunc = path, giving do_image_oci its own sysroot. Happy to take a run at any of = those if you'd rather not carry the strip as a meta-virtualization-local = workaround. --Apple-Mail=_7CA04D86-0F02-4C0A-AF5B-12023013CF55 Content-Disposition: attachment; filename=imageocirepro.tar.gz Content-Type: application/x-gzip; x-unix-mode=0644; name="imageocirepro.tar.gz" Content-Transfer-Encoding: base64 H4sIAAAAAAAAA+1be3PbuBHP3/wUGCVXSWeJetiWe3Kd1g9dTnN+ZCylbZpxNRQJSYxIgkeQltX0 vnt/C5B6245zia+dCpmJKQJY7HsXC9D1rSEvC9stRzyMROXFN2hVtIODffpbO9ivLv7N2ovafn23 XmvUG7W9F9Vafb+2+4LtfwtkVlsiYyti7MVY8OChcY/1/482d0X+163js4vW112DBNzY27tH/rV6 DcJelv/ubuPgB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JjRVeEp8ntEFxVzad1sSOfn9tveRat73Ptr+7rb6xxf UgQ6/al1+nO2l4hpC6BQKW/45u33Nuht27Zt27Zt27Zt27Zt27Zt27Z72n8AUihMpwBQAAA= --Apple-Mail=_7CA04D86-0F02-4C0A-AF5B-12023013CF55 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii >=20 > Bruce >=20 >> 2/2 - image-oci: drop *-initial sysroot deps in do_image_oci to avoid >> libgcc collision >>=20 >> do_image_oci can abort with: >> ERROR: <recipe> do_image_oci: The file .../crtbegin.o is installed >> by both libgcc and libgcc-initial, aborting >>=20 >> Root cause is in extend_recipe_sysroot's dependency walk: the >> SSTATE_EXCLUDEDEPS_SYSROOT exclusion that normally keeps libgcc and >> libgcc-initial from landing in the same sysroot only applies when >> the *consuming* task is itself do_populate_sysroot. do_image_oci >> reaches extend_recipe_sysroot through the generic "any task whose >> [depends] contains populate_sysroot gets this prefunc" path >> (staging_taskhandler), so that exclusion never fires for it. >>=20 >> This one is sstate-state-dependent -- whether it fires depends on >> whether extend_recipe_sysroot's walk actually needs to populate (vs. >> skip via sstate/setscene shortcuts) both libgcc and libgcc-initial >> for a given recipe/build. A minimal single-package OCI recipe did >> not reach libgcc in our testing, but a multi-layer "packages:" = recipe >> installing a from-source-compiled library with a moderately large >> DEPENDS (boost) did: instrumenting the fix confirms it stripping two >> "*-initial" do_populate_sysroot nodes out of BB_TASKDEPDATA for that >> recipe, i.e. libgcc-initial is a real, reachable node in >> do_image_oci's dependency walk for realistic recipes. We were not >> able to force the raw abort deterministically within our test >> window (a downstream build did hit it deterministically across 6+ >> clean-sstate attempts on a wider dependency set) -- see the patch >> commit message and TEST-CASES.md for exactly what was and wasn't >> reproduced, and why the fix is justified regardless. >>=20 >>=20 >> Signed-off-by: Koen Kooi <[email protected]> >>=20 >> -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- >> Links: You receive all messages sent to this group. >> View/Reply Online (#9990): = https://lists.yoctoproject.org/g/meta-virtualization/message/9990 >> Mute This Topic: https://lists.yoctoproject.org/mt/120482430/1050810 >> Group Owner: [email protected] >> Unsubscribe: = https://lists.yoctoproject.org/g/meta-virtualization/unsub = [[email protected]] >> -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- >>=20 >=20 >=20 > -- > - Thou shalt not follow the NULL pointer, for chaos and madness await > thee at its end > - "Use the force Harry" - Gandalf, Star Trek II --Apple-Mail=_7CA04D86-0F02-4C0A-AF5B-12023013CF55--