From 0f100de5ac9188e601027bbff1db72cdff333a58 Mon Sep 17 00:00:00 2001 From: Daniel Hilst <392820+dhilst@users.noreply.github.com> Date: Mon, 29 Jun 2026 07:37:23 -0300 Subject: [PATCH] fix(xCAT-genesis-base): collapse usr-merged dirs in the netboot image Building the genesis netboot image on a usr-merged host (openSUSE Leap 15, and increasingly EL) leaves the extracted root with /bin, /sbin, /lib and /lib64 as real directories holding the same files that already live under /usr/*. rpm then sees each binary twice (e.g. fs/bin/bash and fs/usr/bin/bash) and aborts the install of xCAT-genesis-base with dozens of file conflicts, so the package cannot be installed. After unpacking the dracut image, fold those top-level directories into /usr and replace them with relative symlinks, matching a normal usr-merged layout. The loop is a no-op when the image already ships them as symlinks, so EL builds are unaffected. Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com> --- xCAT-genesis-builder/xCAT-genesis-base.spec | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/xCAT-genesis-builder/xCAT-genesis-base.spec b/xCAT-genesis-builder/xCAT-genesis-base.spec index 768c368a8..fe544f319 100644 --- a/xCAT-genesis-builder/xCAT-genesis-base.spec +++ b/xCAT-genesis-builder/xCAT-genesis-base.spec @@ -131,6 +131,19 @@ dracut --compress gzip -m "xcat base" --no-early-microcode -N -f "$DRACUT_IMAGE" zcat "$DRACUT_IMAGE" | cpio -dumi ) +# usrmerge collapse: on a usr-merged build host the extracted genesis fs can +# contain /bin,/sbin,/lib,/lib64 as real directories that duplicate the files +# already under /usr/*, which makes rpm reject the package with file conflicts. +# Fold the top-level dirs into /usr and replace them with symlinks (a no-op on +# hosts where the image already ships them as symlinks). +for _d in bin sbin lib lib64; do + if [ -d "$GENESIS_FS/$_d" ] && [ ! -L "$GENESIS_FS/$_d" ] && [ -d "$GENESIS_FS/usr/$_d" ]; then + cp -a "$GENESIS_FS/$_d/." "$GENESIS_FS/usr/$_d/" 2>/dev/null || true + rm -rf "$GENESIS_FS/$_d" + ln -s "usr/$_d" "$GENESIS_FS/$_d" + fi +done + # xCAT 2.14.5 genesis payloads shipped usr/lib/dracut/hooks as a real directory. # Newer dracut (EL8+) makes it a symlink to ../../../var/lib/dracut/hooks. RPM # cannot replace a directory with a symlink across an upgrade, so a 2.17 -> 2.18