osmith submitted this change.
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.