[RFC] rootfs: fix source package downloads on merged-usr hosts

Message ID 20261125140831.1428212-1-srinuvasan.a@siemens.com
State New
Headers show
Series [RFC] rootfs: fix source package downloads on merged-usr hosts | expand

Commit Message

srinuvasan.a Nov. 25, 2026, 2:08 p.m. UTC
From: Srinuvasan <srinuvasan.a@siemens.com>

When cache-deb-src is enabled, rootfs_cmd runs apt-get without an
explicit rootfs. On merged-usr hosts, it skips symlinked paths such as
/lib64, which can prevent native apt-get from starting and leave source
packages missing from base-apt.

Bind host directory paths even when they are symlinks. Continue to skip
symlinks in an explicit rootfs, where the root bind provides them.

Err Logs:

bwrap --unshare-user --unshare-pid --bind /work/build/base-apt/tmp/deploy/isar-apt/lx1-trixie/apt/lx1-trixie /isar-apt --chdir /deb-src/debian-trixie/adcli --ro-bind /etc /etc --ro-bind /sys /sys --ro-bind /usr /usr --ro-bind /var /var --dev-bind /dev /dev --proc /proc --tmpfs /tmp --bind /work/build/base-apt/tmp/deploy/isar-apt/lx1-trixie/apt/lx1-trixie /isar-apt --bind /work/build/base-apt/tmp/deb-src /deb-src --bind /work/build/base-apt/tmp/work/lx1-trixie-amd64/base-apt-pseudo-rootfs-base-qemu-amd64/1.0-r0/rootfs /work/build/base-apt/tmp/work/lx1-trixie-amd64/base-apt-pseudo-rootfs-base-qemu-amd64/1.0-r0/rootfs -- apt-get -o APT::Architecture=amd64 -o Debug::NoLocking=1 -o Dir=/work/build/base-apt/tmp/work/lx1-trixie-amd64/base-apt-pseudo-rootfs-base-qemu-amd64/1.0-r0/rootfs -y --download-only --only-source source adcli=0.9.2-1
bwrap: execvp apt-get: No such file or directory

Signed-off-by: Srinuvasan <srinuvasan.a@siemens.com>
---
 meta/classes-recipe/rootfs.bbclass | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Patch

diff --git a/meta/classes-recipe/rootfs.bbclass b/meta/classes-recipe/rootfs.bbclass
index d0c93abf..9c582c85 100644
--- a/meta/classes-recipe/rootfs.bbclass
+++ b/meta/classes-recipe/rootfs.bbclass
@@ -160,8 +160,10 @@  rootfs_cmd() {
     shift  # remove "--", command and its arguments follows
 
     # bin, lib and lib64 are only real directories on unmerged-usr rootfs
+    # Bind host directories on both merged and unmerged-usr systems.
     for ro_d in bin etc lib lib64 sys usr var; do
-        [ -d ${bwrap_rootfs}/${ro_d} ] && [ ! -L ${bwrap_rootfs}/${ro_d} ] || continue
+        [ -d ${bwrap_rootfs}/${ro_d} ] || continue
+        [ -z "${bwrap_rootfs}" ] || [ ! -L ${bwrap_rootfs}/${ro_d} ] || continue
         bwrap_args="${bwrap_args} --ro-bind ${bwrap_rootfs}/${ro_d} /${ro_d}"
     done