All of lore.kernel.org
 help / color / mirror / Atom feed
* [meta-virtualization][PATCH 0/3] OCI multi-layer fixes for dnf5 and nginx
@ 2026-11-22 18:29 Tim Orling
  2026-11-22 18:29 ` [meta-virtualization][PATCH 1/3] image-oci: track multi-layer rootfs directories with pseudo Tim Orling
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Tim Orling @ 2026-11-22 18:29 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]

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         |  9 ++++++++-
 classes/image-oci.bbclass                        |  8 ++++++++
 recipes-containers/images/app-container-nginx.bb | 11 +++++++++++
 3 files changed, 27 insertions(+), 1 deletion(-)


base-commit: 89b00d096a432000766729cd721ae647af500112
-- 
2.56.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [meta-virtualization][PATCH 1/3] image-oci: track multi-layer rootfs directories with pseudo
  2026-11-22 18:29 [meta-virtualization][PATCH 0/3] OCI multi-layer fixes for dnf5 and nginx Tim Orling
@ 2026-11-22 18:29 ` Tim Orling
  2026-11-22 23:29   ` Bruce Ashfield
  2026-11-22 18:29 ` [meta-virtualization][PATCH 2/3] container-volatile-fixup: run after empty_var_volatile Tim Orling
  2026-11-22 18:29 ` [meta-virtualization][PATCH 3/3] app-container-nginx: create /run/nginx and /var/log/nginx in rootfs Tim Orling
  2 siblings, 1 reply; 5+ messages in thread
From: Tim Orling @ 2026-11-22 18:29 UTC (permalink / raw)
  To: meta-virtualization; +Cc: Tim Orling

oci_multilayer_install_packages() installs each packages: layer into
${WORKDIR}/oci-layer-rootfs/layer-N-<name> from the do_image_oci
prefunc, which runs under pseudo. That directory is not in
PSEUDO_INCLUDE_PATHS, whereas ${WORKDIR}/rootfs used by do_rootfs is.

Since oe-core moved to dnf 5.4.7.0, every 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

dnf creates var/lib/rpm in the layer rootfs but the rpmdb is never
created, while do_rootfs of the same recipe installs the same packages
successfully. The rpm macros (%_dbpath=/var/lib/rpm) and the
RPM_CONFIGDIR/RPM_ETCCONFIGDIR environment are identical in both tasks;
the only difference found is pseudo coverage of the install root.

Add the layer rootfs base to PSEUDO_INCLUDE_PATHS, the same way
image.bbclass does for MULTILIB_TEMP_ROOTFS.

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 | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/classes/image-oci.bbclass b/classes/image-oci.bbclass
index 141cd2a8..5c9ef0e6 100644
--- a/classes/image-oci.bbclass
+++ b/classes/image-oci.bbclass
@@ -69,6 +69,14 @@ 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}"
+# AI-generated (Claude Code, Claude Opus 5.5).
+# Multi-layer package layers are installed by RpmPM/OpkgPM into
+# ${WORKDIR}/oci-layer-rootfs/layer-N-<name> from do_image_oci, which runs
+# under pseudo. Like ${WORKDIR}/rootfs for do_rootfs, the layer rootfs must
+# be tracked by pseudo or dnf5/rpm6 cannot open the rpmdb in the installroot
+# ("rpmtsOpenDB failed: Invalid argument"). Same approach as image.bbclass
+# uses for MULTILIB_TEMP_ROOTFS.
+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] 5+ messages in thread

* [meta-virtualization][PATCH 2/3] container-volatile-fixup: run after empty_var_volatile
  2026-11-22 18:29 [meta-virtualization][PATCH 0/3] OCI multi-layer fixes for dnf5 and nginx Tim Orling
  2026-11-22 18:29 ` [meta-virtualization][PATCH 1/3] image-oci: track multi-layer rootfs directories with pseudo Tim Orling
@ 2026-11-22 18:29 ` Tim Orling
  2026-11-22 18:29 ` [meta-virtualization][PATCH 3/3] app-container-nginx: create /run/nginx and /var/log/nginx in rootfs Tim Orling
  2 siblings, 0 replies; 5+ messages in thread
From: Tim Orling @ 2026-11-22 18:29 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.

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 | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/classes/container-volatile-fixup.bbclass b/classes/container-volatile-fixup.bbclass
index 98c86b97..be3dbdd4 100644
--- a/classes/container-volatile-fixup.bbclass
+++ b/classes/container-volatile-fixup.bbclass
@@ -1,5 +1,12 @@
 # Workaround /var/volatile for now
-ROOTFS_POSTPROCESS_COMMAND += "rootfs_fixup_var_volatile"
+#
+# AI-generated (Claude Code, Claude Opus 5.5).
+# Use :append, not +=: image.bbclass pulls in rootfs-postcommands via
+# inherit_defer, so its "+= empty_var_volatile" lands after anything a
+# recipe adds with +=. empty_var_volatile then deletes everything under
+# /var/volatile (base-files' fstab mounts tmpfs there), undoing this fixup.
+# :append is applied after all += operations, so this runs afterwards.
+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] 5+ messages in thread

* [meta-virtualization][PATCH 3/3] app-container-nginx: create /run/nginx and /var/log/nginx in rootfs
  2026-11-22 18:29 [meta-virtualization][PATCH 0/3] OCI multi-layer fixes for dnf5 and nginx Tim Orling
  2026-11-22 18:29 ` [meta-virtualization][PATCH 1/3] image-oci: track multi-layer rootfs directories with pseudo Tim Orling
  2026-11-22 18:29 ` [meta-virtualization][PATCH 2/3] container-volatile-fixup: run after empty_var_volatile Tim Orling
@ 2026-11-22 18:29 ` Tim Orling
  2 siblings, 0 replies; 5+ messages in thread
From: Tim Orling @ 2026-11-22 18:29 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.

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 | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/recipes-containers/images/app-container-nginx.bb b/recipes-containers/images/app-container-nginx.bb
index f57c7887..c4e84bd3 100644
--- a/recipes-containers/images/app-container-nginx.bb
+++ b/recipes-containers/images/app-container-nginx.bb
@@ -47,6 +47,17 @@ inherit image-oci
 inherit container-nonroot-user
 inherit container-volatile-fixup
 
+# AI-generated (Claude Code, Claude Opus 5.5).
+# nginx deletes /run and /var/log from its package and relies on
+# tmpfiles.d/populate-volatile at boot to create them, which never runs in
+# a container. Create them at rootfs time so the nginx-dirs layer and
+# NONROOT_OWNED_DIRS find them. :append keeps this after
+# rootfs_fixup_var_volatile, which provides the /var/log symlink target.
+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] 5+ messages in thread

* Re: [meta-virtualization][PATCH 1/3] image-oci: track multi-layer rootfs directories with pseudo
  2026-11-22 18:29 ` [meta-virtualization][PATCH 1/3] image-oci: track multi-layer rootfs directories with pseudo Tim Orling
@ 2026-11-22 23:29   ` Bruce Ashfield
  0 siblings, 0 replies; 5+ messages in thread
From: Bruce Ashfield @ 2026-11-22 23:29 UTC (permalink / raw)
  To: Tim Orling; +Cc: meta-virtualization

> Since oe-core moved to dnf 5.4.7.0, every 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
>
> dnf creates var/lib/rpm in the layer rootfs but the rpmdb is never
> created, while do_rootfs of the same recipe installs the same packages
> successfully. The rpm macros (%_dbpath=/var/lib/rpm) and the
> RPM_CONFIGDIR/RPM_ETCCONFIGDIR environment are identical in both tasks;
> the only difference found is pseudo coverage of the install root.

Thanks for chasing this, I hadn't hit it yet since my oe-core is still
on dnf 4 and I haven't started my M2 update cycle.

This change tells me that tracking the layer rootfs with pseudo makes
the error go away, but not why rpm can't open its database without it.

Before going this way, I need to be sure. The OCI classes have been
moving ownership and special permissions out of pseudo, not into it
.. umoci runs rootless and records owners in its own xattrs, the
setuid/setgid bits are restored with pseudo disabled before each
repack, and the runtime bundles on master-next are archived by a
script that runs with pseudo disabled. The layer rootfs is copied into
the bundle with --no-owner --no-group anyway, so whatever pseudo
tracks there never makes it into the image. Adding pseudo coverage
only to get rpm to open its database goes against all of that.

What is dnf5/rpm doing in the installroot that fails with EINVAL when
the path isn't tracked? If we can find that, then there's a shot at
fixing that root cause. If not, it all needs to be captured in the
commit message.

> +# AI-generated (Claude Code, Claude Opus 5.5).
> +# Multi-layer package layers are installed by RpmPM/OpkgPM into
> +# ${WORKDIR}/oci-layer-rootfs/layer-N-<name> from do_image_oci, which runs
> +# under pseudo. Like ${WORKDIR}/rootfs for do_rootfs, the layer rootfs must
> +# be tracked by pseudo or dnf5/rpm6 cannot open the rpmdb in the installroot
> +# ("rpmtsOpenDB failed: Invalid argument"). Same approach as image.bbclass
> +# uses for MULTILIB_TEMP_ROOTFS.
> +PSEUDO_INCLUDE_PATHS .= ",${WORKDIR}/oci-layer-rootfs"

Two things here, and they apply to 2/3 and 3/3 as well.

The AI-Generated trailer in the commit message is fine, but I don't
want the attribution line in the code itself. It stays in the layer
long after anyone cares how the patch was written.

The comments are also too long, and mostly repeat the commit message.
A line or two on what the code is for is enough, the rest belongs in
the commit.

Finally, the patches came through the list as "Tim Orling via
meta-virtualization <ticotimo=gmail.com@lists.yoctoproject.org>" with
no From: in the body, so git am picks that up as the author and the
push gets rejected. If you send a v2 with --from (or format.from set)
the konsulko address will survive the list.

2/3 and 3/3 look right to me otherwise .. the inherit_defer ordering
for empty_var_volatile seem right. But putting some reproducing
instructions in the commits (or a test) would be better.

Bruce

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-11-22 23:29 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-22 18:29 [meta-virtualization][PATCH 0/3] OCI multi-layer fixes for dnf5 and nginx Tim Orling
2026-11-22 18:29 ` [meta-virtualization][PATCH 1/3] image-oci: track multi-layer rootfs directories with pseudo Tim Orling
2026-11-22 23:29   ` Bruce Ashfield
2026-11-22 18:29 ` [meta-virtualization][PATCH 2/3] container-volatile-fixup: run after empty_var_volatile Tim Orling
2026-11-22 18:29 ` [meta-virtualization][PATCH 3/3] app-container-nginx: create /run/nginx and /var/log/nginx in rootfs Tim Orling

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.