From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-qt1-f173.google.com (mail-qt1-f173.google.com [209.85.160.173]) by mx.groups.io with SMTP id smtpd.msgproc02-g2.25673.1796010483366191202 for ; Sun, 29 Nov 2026 19:48:03 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20260707 header.b=Aftmb7cS; spf=pass (domain: gmail.com, ip: 209.85.160.173, mailfrom: bruce.ashfield@gmail.com) Received: by mail-qt1-f173.google.com with SMTP id d75a77b69052e-5364d86f7f0so108155771cf.1 for ; Sun, 29 Nov 2026 19:48:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1796010482; x=1796615282; darn=lists.yoctoproject.org; h=mime-version:content-transfer-encoding:content-type:references :in-reply-to:subject:cc:to:from:date:message-id:from:to:cc:subject :date:message-id:reply-to:content-type; bh=GDbi9y2YYV+KVNL3CYEDbWqKtl3rN+ZyZpVQRalMWG4=; b=Aftmb7cS6CkaYFVb02zvyE04KKR2jV4IDuv2CWTJ1n76IxjL3wME/HnlURUBtUy6Dd XVLFwVOyuSesO3yPNmmVKsF1HQBbjVD/0gqsggirVL13UxFNpjn9vaSsEcb8is2JNnvu Pq7BNQoK0Dn9ALxzGylxAgVnAN6OImJYIfBo4HIkspudtzB5WIevoMzRAsuTtov6hCIg KkIwAGlEKglgSyPhV1NF/e6ESV/pRNZmyYluoElGhj/OXPoPoWFQuImU2i9UXdtWn2ZF 9GzKLotrgfZ5fedRDvWQmGlsdo7Gura9MaW6AsTCK7o85f4s408SyAqfV13l+u02rzff 6p5Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796010482; x=1796615282; h=mime-version:content-transfer-encoding:content-type:references :in-reply-to:subject:cc:to:from:date:message-id:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=GDbi9y2YYV+KVNL3CYEDbWqKtl3rN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LAB6Ir9yvMMwlj7Cr CJN/CJSFrlVB/CPxpkCJebiy8Z46t2tLt90ZFkfb7F9Ny99k3jfhImUohq8+EmgIxgbWD0kOU0E OvoyfNkNi+nD8gm+bfGu2XaORSBnaPDJH8bV3yHeatt4n9o6MCHeiYqsDe8lCZLiokH8wHCY= X-Received: by 2002:ac8:5d8f:0:b0:537:83ea:2fc6 with SMTP id d75a77b69052e-55d76a5e019mr660998971cf.58.1796010482157; Sun, 29 Nov 2026 19:48:02 -0800 (PST) Return-Path: Received: from [127.0.1.1] (pool-174-112-34-35.cpe.net.cable.rogers.com. [174.112.34.35]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-921349b3a0csm283427306d6.14.2026.11.29.19.48.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 29 Nov 2026 19:48:01 -0800 (PST) Message-ID: <6b0cf1f1.e869fc0f.21328c.78cf@mx.google.com> Date: Sun, 29 Nov 2026 19:48:01 -0800 (PST) From: Bruce Ashfield To: Tim Orling Cc: meta-virtualization@lists.yoctoproject.org Subject: Re: [meta-virtualization][PATCH v2 1/3] image-oci: track multi-layer rootfs directories with pseudo In-Reply-To: <20261126004756.89781-2-tim.orling@konsulko.com> References: <20261126004756.89781-1-tim.orling@konsulko.com> <20261126004756.89781-2-tim.orling@konsulko.com> Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit MIME-Version: 1.0 List-Id: X-Webhook-Received: from 45-33-107-173.ip.linodeusercontent.com [45.33.107.173] by lin-tor-korg-lkml-alma10-1 with HTTPS for ; Mon, 30 Nov 2026 03:48:04 -0000 X-Groupsio-URL: https://lists.yoctoproject.org/g/meta-virtualization/message/10206 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- 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 > --- > classes/image-oci.bbclass | 2 ++ > 1 file changed, 2 insertions(+) >