* [meta-virtualization][PATCH v2 0/3] OCI multi-layer fixes for dnf5 and nginx
@ 2026-11-26 0:47 Tim Orling
2026-11-26 0:47 ` [meta-virtualization][PATCH v2 1/3] image-oci: track multi-layer rootfs directories with pseudo Tim Orling
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Tim Orling @ 2026-11-26 0:47 UTC (permalink / raw)
To: meta-virtualization; +Cc: Tim Orling
Since oe-core moved to dnf 5.4.7.0, every OCI_LAYER_MODE = "multi"
image fails to install its packages: layers, because the layer rootfs
under ${WORKDIR}/oci-layer-rootfs is not tracked by pseudo. Patch 1
fixes that.
Patches 2 and 3 fix the long-standing "OCI: Directory not found in
IMAGE_ROOTFS" warnings from app-container-nginx: empty_var_volatile
was wiping the container-volatile-fixup directories, and nginx's /run
and /var/log directories are never created outside of boot-time
tmpfiles.d.
Tested with the containers-library autobuilder target (aarch64 and
x86-64): all containers build with no warnings.
[YOCTO #16531]
Changes in v2:
- Patch 1: the commit message now explains the root cause. Under
pseudo, rpm sees uid 0 and chowns the rpmdb directory it creates to
0:0. The layer rootfs is not tracked, so that chown is real, and
bitbake's network-isolation user namespace has no mapping for uid 0,
so it fails with EINVAL. dnf4 ignored that failure; dnf5 does not.
- Patch 1: also explains why the layer install cannot run with pseudo
disabled instead: rpm still chroots into the install root for every
transaction. That was tried on the autobuilder, and every package
layer came out empty with "Rpm transaction failed".
- All patches: no AI attribution in the code, comments cut to one line,
steps to reproduce added to the commit messages.
- Sent with the konsulko.com address in the From: header, so the
author survives the list.
Tim Orling (3):
image-oci: track multi-layer rootfs directories with pseudo
container-volatile-fixup: run after empty_var_volatile
app-container-nginx: create /run/nginx and /var/log/nginx in rootfs
classes/container-volatile-fixup.bbclass | 3 ++-
classes/image-oci.bbclass | 2 ++
recipes-containers/images/app-container-nginx.bb | 6 ++++++
3 files changed, 10 insertions(+), 1 deletion(-)
base-commit: 89b00d096a432000766729cd721ae647af500112
--
2.56.1
^ permalink raw reply [flat|nested] 7+ messages in thread* [meta-virtualization][PATCH v2 1/3] image-oci: track multi-layer rootfs directories with pseudo 2026-11-26 0:47 [meta-virtualization][PATCH v2 0/3] OCI multi-layer fixes for dnf5 and nginx Tim Orling @ 2026-11-26 0:47 ` Tim Orling 2026-11-30 3:48 ` Bruce Ashfield 2026-11-26 0:47 ` [meta-virtualization][PATCH v2 2/3] container-volatile-fixup: run after empty_var_volatile Tim Orling 2026-11-26 0:47 ` [meta-virtualization][PATCH v2 3/3] app-container-nginx: create /run/nginx and /var/log/nginx in rootfs Tim Orling 2 siblings, 1 reply; 7+ messages in thread From: Tim Orling @ 2026-11-26 0:47 UTC (permalink / raw) To: meta-virtualization; +Cc: Tim Orling oci_install_layer_packages() installs each packages: layer into ${WORKDIR}/oci-layer-rootfs/layer-N-<name> from do_image_oci. Since oe-core moved to dnf 5.4.7.0, every rpm layer install fails: error: cannot open Packages database in Failed to load system repo from root ".../oci-layer-rootfs/layer-1-base": rpmtsOpenDB failed: Invalid argument do_image_oci runs under pseudo, so getuid() returns 0 in dnf and rpm, but the layer rootfs is not in PSEUDO_INCLUDE_PATHS, so pseudo passes their syscalls through unchanged. When dnf5 loads the system repo, libsolv calls rpmtsOpenDB(), and rpm's openDatabase() runs rpmioMkpath(dbhome, 0755, getuid(), getgid()). That creates var/lib/rpm and then chowns it to 0:0 for real. bitbake runs the task in a user namespace that maps only the build user's uid (bb.utils.disable_network), so the kernel rejects a chown to the unmapped uid 0 with EINVAL. rpm returns before the sqlite rpmdb is created. dnf4 never showed this: its CLI loads the system repo with load_system_repo='auto' and ignores the failure, and the next open finds the directories already present and skips the chown. dnf5 makes the failure fatal. Opening the rpmdb is only the first place rpm needs root. With getuid() == 0 it chowns every file it installs (fsmChown() in lib/fsm.cc), and every transaction chroots into the install root (rpmChrootIn() in lib/transaction.cc), as do scriptlets. Both fail outside pseudo. Running dnf with PSEUDO_DISABLED=1 instead avoids the chowns, but the chroot then fails with EPERM and every transaction aborts with "Rpm transaction failed", leaving all package layers empty (tried on the containers-library autobuilder target). So the layer rootfs needs pseudo for the same reason ${WORKDIR}/rootfs does for do_rootfs. Add it to PSEUDO_INCLUDE_PATHS, as image.bbclass does for MULTILIB_TEMP_ROOTFS. The ownership pseudo records there does not reach the image: the layer is copied into the bundle with --no-owner --no-group, and umoci records ownership itself. To reproduce, build a multi-layer rpm image, for example: inherit image image-oci IMAGE_INSTALL = "base-files" IMAGE_PKGTYPE = "rpm" OCI_LAYER_MODE = "multi" OCI_LAYERS = "base:packages:base-files+coreutils" Without this change, log.do_image_oci shows the error above, demoted to "OCI: Package installation had issues", and the layer is empty. The EINVAL can be shown on its own with: unshare --user --net --map-current-user sh -c 'touch f && chown 0:0 f' Tested with the containers-library autobuilder target (aarch64 and x86-64). [YOCTO #16531] AI-Generated: Uses Claude Code (Claude Opus 5.5) Signed-off-by: Tim Orling <tim.orling@konsulko.com> --- classes/image-oci.bbclass | 2 ++ 1 file changed, 2 insertions(+) diff --git a/classes/image-oci.bbclass b/classes/image-oci.bbclass index 141cd2a8..d4c3096a 100644 --- a/classes/image-oci.bbclass +++ b/classes/image-oci.bbclass @@ -69,6 +69,8 @@ do_image_oci[depends] += "jq-native:do_populate_sysroot" # Package manager native tools for multi-layer mode with package installation OCI_PM_DEPENDS = "${@oci_get_pm_depends(d)}" do_image_oci[depends] += "${OCI_PM_DEPENDS}" +# rpm installs layers as fake root (chown, chroot), so pseudo must track them +PSEUDO_INCLUDE_PATHS .= ",${WORKDIR}/oci-layer-rootfs" def oci_pkg_type(d): """Resolve IMAGE_PKGTYPE with a single, documented default. -- 2.56.1 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [meta-virtualization][PATCH v2 1/3] image-oci: track multi-layer rootfs directories with pseudo 2026-11-26 0:47 ` [meta-virtualization][PATCH v2 1/3] image-oci: track multi-layer rootfs directories with pseudo Tim Orling @ 2026-11-30 3:48 ` Bruce Ashfield 0 siblings, 0 replies; 7+ messages in thread From: Bruce Ashfield @ 2026-11-30 3:48 UTC (permalink / raw) To: Tim Orling; +Cc: meta-virtualization merged, with some edits on my side. Thanks for tracking down the root cause. I trimmed the commit message and moved the part about why rpm needs pseudo in the layer rootfs into a comment above PSEUDO_INCLUDE_PATHS, so it's there when someone reads the class. The rpm function level detail and the unshare example are dropped from the commit. The author still came through the list as tim.orling=konsulko.com@lists.yoctoproject.org, so I fixed that as well .. no need to resend. Bruce > oci_install_layer_packages() installs each packages: layer into > ${WORKDIR}/oci-layer-rootfs/layer-N-<name> from do_image_oci. Since > oe-core moved to dnf 5.4.7.0, every rpm layer install fails: > > error: cannot open Packages database in > Failed to load system repo from root ".../oci-layer-rootfs/layer-1-base": > rpmtsOpenDB failed: Invalid argument > > do_image_oci runs under pseudo, so getuid() returns 0 in dnf and rpm, > but the layer rootfs is not in PSEUDO_INCLUDE_PATHS, so pseudo passes > their syscalls through unchanged. When dnf5 loads the system repo, > libsolv calls rpmtsOpenDB(), and rpm's openDatabase() runs > rpmioMkpath(dbhome, 0755, getuid(), getgid()). That creates var/lib/rpm > and then chowns it to 0:0 for real. bitbake runs the task in a user > namespace that maps only the build user's uid (bb.utils.disable_network), > so the kernel rejects a chown to the unmapped uid 0 with EINVAL. rpm > returns before the sqlite rpmdb is created. > > dnf4 never showed this: its CLI loads the system repo with > load_system_repo='auto' and ignores the failure, and the next open finds > the directories already present and skips the chown. dnf5 makes the > failure fatal. > > Opening the rpmdb is only the first place rpm needs root. With > getuid() == 0 it chowns every file it installs (fsmChown() in > lib/fsm.cc), and every transaction chroots into the install root > (rpmChrootIn() in lib/transaction.cc), as do scriptlets. Both fail > outside pseudo. > > Running dnf with PSEUDO_DISABLED=1 instead avoids the chowns, but the > chroot then fails with EPERM and every transaction aborts with "Rpm > transaction failed", leaving all package layers empty (tried on the > containers-library autobuilder target). > > So the layer rootfs needs pseudo for the same reason ${WORKDIR}/rootfs > does for do_rootfs. Add it to PSEUDO_INCLUDE_PATHS, as image.bbclass > does for MULTILIB_TEMP_ROOTFS. The ownership pseudo records there does > not reach the image: the layer is copied into the bundle with > --no-owner --no-group, and umoci records ownership itself. > > To reproduce, build a multi-layer rpm image, for example: > > inherit image image-oci > IMAGE_INSTALL = "base-files" > IMAGE_PKGTYPE = "rpm" > OCI_LAYER_MODE = "multi" > OCI_LAYERS = "base:packages:base-files+coreutils" > > Without this change, log.do_image_oci shows the error above, demoted to > "OCI: Package installation had issues", and the layer is empty. > > The EINVAL can be shown on its own with: > > unshare --user --net --map-current-user sh -c 'touch f && chown 0:0 f' > > Tested with the containers-library autobuilder target (aarch64 and > x86-64). > > [YOCTO #16531] > > AI-Generated: Uses Claude Code (Claude Opus 5.5) > Signed-off-by: Tim Orling <tim.orling@konsulko.com> > --- > classes/image-oci.bbclass | 2 ++ > 1 file changed, 2 insertions(+) > ^ permalink raw reply [flat|nested] 7+ messages in thread
* [meta-virtualization][PATCH v2 2/3] container-volatile-fixup: run after empty_var_volatile 2026-11-26 0:47 [meta-virtualization][PATCH v2 0/3] OCI multi-layer fixes for dnf5 and nginx Tim Orling 2026-11-26 0:47 ` [meta-virtualization][PATCH v2 1/3] image-oci: track multi-layer rootfs directories with pseudo Tim Orling @ 2026-11-26 0:47 ` Tim Orling 2026-11-30 3:48 ` Bruce Ashfield 2026-11-26 0:47 ` [meta-virtualization][PATCH v2 3/3] app-container-nginx: create /run/nginx and /var/log/nginx in rootfs Tim Orling 2 siblings, 1 reply; 7+ messages in thread From: Tim Orling @ 2026-11-26 0:47 UTC (permalink / raw) To: meta-virtualization; +Cc: Tim Orling image.bbclass inherits rootfs-postcommands with inherit_defer, so its "ROOTFS_POSTPROCESS_COMMAND += 'empty_var_volatile'" is added after the recipe's own "+= rootfs_fixup_var_volatile". base-files' fstab mounts tmpfs on /var/volatile, so empty_var_volatile then deletes the volatile/tmp and volatile/log directories the fixup just created, leaving /var/log and /var/tmp as dangling symlinks. Multi-layer directories: layers then warn: OCI: Directory not found in IMAGE_ROOTFS: /var/volatile/log OCI: Directory not found in IMAGE_ROOTFS: /var/volatile/tmp Use :append so the fixup runs after empty_var_volatile. To reproduce, build app-container-nginx (OCI_LAYER_MODE = "multi", inherits container-volatile-fixup) and check log.do_image_oci for the warnings above; ${IMAGE_ROOTFS}/var/volatile is empty. Tested with the containers-library autobuilder target (aarch64 and x86-64). AI-Generated: Uses Claude Code (Claude Opus 5.5) Signed-off-by: Tim Orling <tim.orling@konsulko.com> --- classes/container-volatile-fixup.bbclass | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/classes/container-volatile-fixup.bbclass b/classes/container-volatile-fixup.bbclass index 98c86b97..cd186b97 100644 --- a/classes/container-volatile-fixup.bbclass +++ b/classes/container-volatile-fixup.bbclass @@ -1,5 +1,6 @@ # Workaround /var/volatile for now -ROOTFS_POSTPROCESS_COMMAND += "rootfs_fixup_var_volatile" +# :append: run after empty_var_volatile (rootfs-postcommands, inherit_defer) +ROOTFS_POSTPROCESS_COMMAND:append = " rootfs_fixup_var_volatile" rootfs_fixup_var_volatile () { install -m 1777 -d ${IMAGE_ROOTFS}/${localstatedir}/volatile/tmp install -m 755 -d ${IMAGE_ROOTFS}/${localstatedir}/volatile/log -- 2.56.1 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [meta-virtualization][PATCH v2 2/3] container-volatile-fixup: run after empty_var_volatile 2026-11-26 0:47 ` [meta-virtualization][PATCH v2 2/3] container-volatile-fixup: run after empty_var_volatile Tim Orling @ 2026-11-30 3:48 ` Bruce Ashfield 0 siblings, 0 replies; 7+ messages in thread From: Bruce Ashfield @ 2026-11-30 3:48 UTC (permalink / raw) To: Tim Orling; +Cc: meta-virtualization merged Bruce > image.bbclass inherits rootfs-postcommands with inherit_defer, so its > "ROOTFS_POSTPROCESS_COMMAND += 'empty_var_volatile'" is added after the > recipe's own "+= rootfs_fixup_var_volatile". base-files' fstab mounts > tmpfs on /var/volatile, so empty_var_volatile then deletes the > volatile/tmp and volatile/log directories the fixup just created, > leaving /var/log and /var/tmp as dangling symlinks. Multi-layer > directories: layers then warn: > > OCI: Directory not found in IMAGE_ROOTFS: /var/volatile/log > OCI: Directory not found in IMAGE_ROOTFS: /var/volatile/tmp > > Use :append so the fixup runs after empty_var_volatile. > > To reproduce, build app-container-nginx (OCI_LAYER_MODE = "multi", > inherits container-volatile-fixup) and check log.do_image_oci for the > warnings above; ${IMAGE_ROOTFS}/var/volatile is empty. > > Tested with the containers-library autobuilder target (aarch64 and > x86-64). > > AI-Generated: Uses Claude Code (Claude Opus 5.5) > Signed-off-by: Tim Orling <tim.orling@konsulko.com> > --- > classes/container-volatile-fixup.bbclass | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > ^ permalink raw reply [flat|nested] 7+ messages in thread
* [meta-virtualization][PATCH v2 3/3] app-container-nginx: create /run/nginx and /var/log/nginx in rootfs 2026-11-26 0:47 [meta-virtualization][PATCH v2 0/3] OCI multi-layer fixes for dnf5 and nginx Tim Orling 2026-11-26 0:47 ` [meta-virtualization][PATCH v2 1/3] image-oci: track multi-layer rootfs directories with pseudo Tim Orling 2026-11-26 0:47 ` [meta-virtualization][PATCH v2 2/3] container-volatile-fixup: run after empty_var_volatile Tim Orling @ 2026-11-26 0:47 ` Tim Orling 2026-11-30 3:48 ` Bruce Ashfield 2 siblings, 1 reply; 7+ messages in thread From: Tim Orling @ 2026-11-26 0:47 UTC (permalink / raw) To: meta-virtualization; +Cc: Tim Orling nginx removes /run and ${localstatedir}/log from its package and creates them at boot via tmpfiles.d or populate-volatile, which never runs in a container. The nginx-dirs layer and NONROOT_OWNED_DIRS therefore find nothing to copy or chown: OCI: Directory not found in IMAGE_ROOTFS: /run/nginx OCI: Directory not found in IMAGE_ROOTFS: /var/log/nginx Create both directories in a ROOTFS_POSTPROCESS_COMMAND, appended after rootfs_fixup_var_volatile so the /var/log -> volatile/log target exists. To reproduce, build app-container-nginx with the previous patch applied and check log.do_image_oci for the warnings above. Tested with the containers-library autobuilder target (aarch64 and x86-64). AI-Generated: Uses Claude Code (Claude Opus 5.5) Signed-off-by: Tim Orling <tim.orling@konsulko.com> --- recipes-containers/images/app-container-nginx.bb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/recipes-containers/images/app-container-nginx.bb b/recipes-containers/images/app-container-nginx.bb index f57c7887..9401b10b 100644 --- a/recipes-containers/images/app-container-nginx.bb +++ b/recipes-containers/images/app-container-nginx.bb @@ -47,6 +47,12 @@ inherit image-oci inherit container-nonroot-user inherit container-volatile-fixup +# nginx creates these at boot via tmpfiles.d, which never runs in a container +ROOTFS_POSTPROCESS_COMMAND:append = " nginx_container_dirs" +nginx_container_dirs () { + install -d -m 0755 ${IMAGE_ROOTFS}/run/nginx ${IMAGE_ROOTFS}${localstatedir}/log/nginx +} + IMAGE_FEATURES = "" IMAGE_LINGUAS = "" NO_RECOMMENDATIONS = "1" -- 2.56.1 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [meta-virtualization][PATCH v2 3/3] app-container-nginx: create /run/nginx and /var/log/nginx in rootfs 2026-11-26 0:47 ` [meta-virtualization][PATCH v2 3/3] app-container-nginx: create /run/nginx and /var/log/nginx in rootfs Tim Orling @ 2026-11-30 3:48 ` Bruce Ashfield 0 siblings, 0 replies; 7+ messages in thread From: Bruce Ashfield @ 2026-11-30 3:48 UTC (permalink / raw) To: Tim Orling; +Cc: meta-virtualization merged Bruce > nginx removes /run and ${localstatedir}/log from its package and creates > them at boot via tmpfiles.d or populate-volatile, which never runs in a > container. The nginx-dirs layer and NONROOT_OWNED_DIRS therefore find > nothing to copy or chown: > > OCI: Directory not found in IMAGE_ROOTFS: /run/nginx > OCI: Directory not found in IMAGE_ROOTFS: /var/log/nginx > > Create both directories in a ROOTFS_POSTPROCESS_COMMAND, appended after > rootfs_fixup_var_volatile so the /var/log -> volatile/log target exists. > > To reproduce, build app-container-nginx with the previous patch applied > and check log.do_image_oci for the warnings above. > > Tested with the containers-library autobuilder target (aarch64 and > x86-64). > > AI-Generated: Uses Claude Code (Claude Opus 5.5) > Signed-off-by: Tim Orling <tim.orling@konsulko.com> > --- > recipes-containers/images/app-container-nginx.bb | 6 ++++++ > 1 file changed, 6 insertions(+) > ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2026-11-30 3:48 UTC | newest] Thread overview: 7+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2026-11-26 0:47 [meta-virtualization][PATCH v2 0/3] OCI multi-layer fixes for dnf5 and nginx Tim Orling 2026-11-26 0:47 ` [meta-virtualization][PATCH v2 1/3] image-oci: track multi-layer rootfs directories with pseudo Tim Orling 2026-11-30 3:48 ` Bruce Ashfield 2026-11-26 0:47 ` [meta-virtualization][PATCH v2 2/3] container-volatile-fixup: run after empty_var_volatile Tim Orling 2026-11-30 3:48 ` Bruce Ashfield 2026-11-26 0:47 ` [meta-virtualization][PATCH v2 3/3] app-container-nginx: create /run/nginx and /var/log/nginx in rootfs Tim Orling 2026-11-30 3:48 ` Bruce Ashfield
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.