Previously, the kernel parameter crashkernel will be set up when kexec-tools is installed. But now it will happen only when kdump.service is enabled first. When kexec-tools is installed, the kdump.service will be enabled according to the systemd policy file and later the kernel parameter crashkernel will be added only if kdump.service is enabled. Fedora disables kdump.service in the systemd policy. So enable kdump.service in the systemd preset policy manually in the test script.
Fixes: 0ffce0ef ("Only try to reset crashkernel when kdump.service is enabled") Signed-off-by: Coiby Xu coxu@redhat.com --- tests/scripts/build-scripts/test-base-image.sh | 3 +++ 1 file changed, 3 insertions(+)
diff --git a/tests/scripts/build-scripts/test-base-image.sh b/tests/scripts/build-scripts/test-base-image.sh index afe1a974..866e5646 100755 --- a/tests/scripts/build-scripts/test-base-image.sh +++ b/tests/scripts/build-scripts/test-base-image.sh @@ -16,6 +16,9 @@ img_inst $TESTDIR/scripts/kexec-kdump-test/test.sh /kexec-kdump-test/test.sh img_inst $TESTDIR/scripts/kexec-kdump-test/kexec-kdump-test.service /etc/systemd/system/kexec-kdump-test.service img_run_cmd "systemctl enable kexec-kdump-test.service"
+# enable kdump.service in the systemd preset policy so the kernel parameter crashkernel +# will be added automatically when kexec-tools is installed +img_run_cmd "echo 'enable kdump.service' > /usr/lib/systemd/system-preset/95-kdump.preset" img_inst_pkg $TEST_RPMS # Test script should start kdump manually to save time img_run_cmd "systemctl disable kdump.service"
The crashkernel kernel parameter failed to be configured with the error,
/lib/kdump/kdump-lib.sh: line 976: /dev/fd/63: No such file or directory
_crashkernel_add uses process substitution (<(command)) which won't work when /dev and /proc are not mounted. This patch bind-mounts /proc/ and /dev so _crashkernel_add won't return empty value.
Signed-off-by: Coiby Xu coxu@redhat.com Fixes: 64f2827a ("kdump-lib: Harden _crashkernel_add") --- tests/scripts/image-init-lib.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/tests/scripts/image-init-lib.sh b/tests/scripts/image-init-lib.sh index b0af7f8c..5082ae59 100644 --- a/tests/scripts/image-init-lib.sh +++ b/tests/scripts/image-init-lib.sh @@ -178,11 +178,17 @@ mount_image() { $SUDO mount $mnt_dev $mnt [ $? -ne 0 ] && perror_exit "failed to mount device '$mnt_dev'" boot=$(get_mount_boot "$dev") + root=$(get_image_mount_root $image) if [[ -n "$boot" ]]; then - root=$(get_image_mount_root $image) $SUDO mount $boot $root/boot [ $? -ne 0 ] && perror_exit "failed to mount the bootable partition for device '$mnt_dev'" fi + + # bind-mount /proc/ and /dev to support process substitution <(command) + # Currently needed for setting up the crashkernel kernel parameter + for target in proc dev; do + $SUDO mount -o bind /$target $root/$target + done }
get_image_mount_root() {