From 4163c87731579030154436760d362499d37fceba Mon Sep 17 00:00:00 2001 From: Frantisek Sumsal Date: Wed, 5 Oct 2022 15:26:16 +0200 Subject: [PATCH] test: configure ldconfig's cache in the minimal verity images The glibc stuff on ppc64le C8S is a little bit wild, as there are two versions: ``` $ ldconfig -p | grep libc.so libc.so.6 (libc6,64bit, hwcap: "power9", OS ABI: Linux 3.10.0) => /lib64/glibc-hwcaps/power9/libc-2.28.so libc.so.6 (libc6,64bit, OS ABI: Linux 3.10.0) => /lib64/libc.so.6 ``` and with `/etc/ld.so.cache` present all binaries use the first one: ``` $ ldd /bin/cat linux-vdso64.so.1 (0x00007fffa8070000) libc.so.6 => /lib64/glibc-hwcaps/power9/libc-2.28.so (0x00007fffa7e20000) /lib64/ld64.so.2 (0x00007fffa8090000) ``` However, without the cache the binaries will fall back to `/lib64/libc.so.6` which breaks tests that use the minimal verity images (like TEST-29), because we install only the first version (that's shown by `ldd` at the time the images are created): ``` [ 91.595343] testsuite-29.sh[747]: + portablectl --profile=trusted attach --now --runtime /usr/share/minimal_0.raw minimal-app0 Starting systemd-portabled.service... [ OK ] Started systemd-portabled.service. Starting minimal-app0-foo.service... Starting minimal-app0.service... [ 104.432217] cat[858]: cat: error while loading shared libraries: libc.so.6: cannot open shared object file: No such file or directory [ 104.435080] cat[857]: cat: error while loading shared libraries: libc.so.6: cannot open shared object file: No such file or directory [FAILED] Failed to start minimal-app0.service. See 'systemctl status minimal-app0.service' for details. ``` ``` $ chroot /var/tmp/systemd-test.nMHPfc/minimal/ /bin/bash: error while loading shared libraries: libc.so.6: cannot open shared object file: No such file or directory ``` With the ldconfig's cache it seems to work as expected: ``` $ chroot /var/tmp/systemd-test.gVtYLg/minimal bash-4.4# cat --version cat (GNU coreutils) 8.30 ... ``` --- test/test-functions | 1 + 1 file changed, 1 insertion(+) diff --git a/test/test-functions b/test/test-functions index d1e3e993f9c..30a6014a73f 100644 --- a/test/test-functions +++ b/test/test-functions @@ -630,6 +630,7 @@ install_verity_minimal() { mkdir -p "$initdir/usr/lib/systemd/system" "$initdir/usr/lib/extension-release.d" "$initdir/etc" "$initdir/var/tmp" "$initdir/opt" "$initdir/var/lib/app1" setup_basic_dirs install_basic_tools + install_ld_so_conf # Shellcheck treats [[ -v VAR ]] as an assignment to avoid a different # issue, thus falsely triggering SC2030 in this case # See: koalaman/shellcheck#1409