osmith submitted this change.

View Change

Approvals: Jenkins Builder: Verified pespin: Looks good to me, but someone else must approve laforge: Looks good to me, approved fixeria: Looks good to me, but someone else must approve
testenv: qemu: fix adding kernel modules

Without this patch qemu_initrd_add_file fails to add kernel modules
with "No such file or directory" when running in podman, even though the
files exist:

./testenv.py run ggsn -Dp -c osmo_ggsn_v4_only

+ cp -a --parents /lib/modules/6.1.0-34-amd64/kernel/drivers/net/net_failover.ko /tmp/testenv-ggsn_tests-osmo_ggsn_v4_only-20250509-1146-cd82caba-wegi5i98/ggsn/_initrd/usr
cp: 'lib/modules/6.1.0-34-amd64/kernel/drivers/net': No such file or directory


When looking at it with strace it became clear that this comes from a
getxattr that fails in the podman filesystem and returns a misleading
error:

getxattr("lib/modules/6.1.0-34-amd64/kernel/drivers/net", "system.posix_acl_access", 0x7ffc012054e0, 132) = -1 ENOENT (No such file or directory)

Fix it by modifying the cp command to not try to preserve any attributes
(they don't matter in the initramfs).

Change-Id: Ic32318da169ee8ebf867937782be5cf8a15f9f2f
---
M _testenv/data/scripts/qemu/qemu_functions.sh
1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/_testenv/data/scripts/qemu/qemu_functions.sh b/_testenv/data/scripts/qemu/qemu_functions.sh
index e2014a1..9c92a37 100755
--- a/_testenv/data/scripts/qemu/qemu_functions.sh
+++ b/_testenv/data/scripts/qemu/qemu_functions.sh
@@ -8,14 +8,15 @@
# $@: path to files
qemu_initrd_add_file() {
local i
+ local cp="cp --no-dereference --recursive --parents"

for i in "$@"; do
case "$i" in
/bin/*|/sbin/*|/lib/*|/lib64/*)
- cp -a --parents "$i" "$INITRD_DIR"/usr
+ $cp "$i" "$INITRD_DIR"/usr
;;
*)
- cp -a --parents "$i" "$INITRD_DIR"
+ $cp "$i" "$INITRD_DIR"
;;
esac
done

To view, visit change 40313. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-MessageType: merged
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: Ic32318da169ee8ebf867937782be5cf8a15f9f2f
Gerrit-Change-Number: 40313
Gerrit-PatchSet: 1
Gerrit-Owner: osmith <osmith@sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy@sysmocom.de>
Gerrit-Reviewer: laforge <laforge@osmocom.org>
Gerrit-Reviewer: osmith <osmith@sysmocom.de>
Gerrit-Reviewer: pespin <pespin@sysmocom.de>