[PATCH] unit tests: fix test failures "The param /boot/boot/vmlinuz-xxx is incorrect"
by Coiby Xu
Currently, some tests failed with "The param /boot/boot/vmlinuz-xxx is
incorrect", for example,
[root@fedora kexec-tools]# shellspec spec/kdumpctl_manage_reset_spec.sh
Examples:
1) kdumpctl reset-crashkernel [--kernel] [--fadump] Test the kdump dump mode --kernel=ALL kdumpctl should warn the user that crashkernel has been udpated
When call reset_crashkernel --kernel=ALL
1.1) The error should include Updated crashkernel=1G-4G:192M,4G-64G:256M,64G-:512M for kernel=/boot/vmlinuz-5.15.6-100.fc34.x86_64
expected "The param /boot/boot/vmlinuz-5.15.6-100.fc34.x86_64 is incorrect
The param /boot/boot/vmlinuz-5.15.6-100.fc34.x86_64 is incorrect
kdump: Updated crashkernel=1G-4G:192M,4G-64G:256M,64G-:512M for kernel=/boot/boot/vmlinuz-5.15.6-100.fc34.x86_64. Please reboot the system for the change to take effect.
The param /boot/boot/vmlinuz-5.14.14-200.fc34.x86_64 is incorrect
The param /boot/boot/vmlinuz-5.14.14-200.fc34.x86_64 is incorrect
kdump: Updated crashkernel=1G-4G:192M,4G-64G:256M,64G-:512M for kernel=/boot/boot/vmlinuz-5.14.14-200.fc34.x86_64. Please reboot the system for the change to take effect.
The param /boot/boot/vmlinuz-0-rescue-e986846f63134c7295458cf36300ba5b is incorrect
The param /boot/boot/vmlinuz-0-rescue-e986846f63134c7295458cf36300ba5b is incorrect
kdump: Updated crashkernel=1G-4G:192M,4G-64G:256M,64G-:512M for kernel=/boot/boot/vmlinuz-0-rescue-e986846f63134c7295458cf36300ba5b. Please reboot the system for the change to take effect." to include "Updated crashkernel=1G-4G:192M,4G-64G:256M,64G-:512M for kernel=/boot/vmlinuz-5.15.6-100.fc34.x86_64"
# spec/kdumpctl_reset_crashkernel_spec.sh:69
This happens because when a system has a boot partition, grubby
automatically prefixes a path with "/boot". The current boot loader
entries used for tests already has the prefix "/boot" in the path and
prefixing a path again will cause the above problem.
grubby uses "mountpoint -q /boot" to tell if there is a boot partition.
This patch mocks mountpoint so grubby knows the boot loader entries
are for a system without a boot partition.
Note this patch also avoids another error seen in the setup phase of the
test "The param /boot/vmlinuz-xxx is incorrect". I believe this error is
a bug of "grubby --update-kernel" in testing mode because running the
grubby in normal mode actually works and "grubby --info=/boot/vmlinuz-*"
also works in testing mode,
[root@fedora support]# grubby --no-etc-grub-update --grub2 --bad-image-okay --env=grub_env -b boot_load_entries --args crashkernel=333M --update-kernel=/boot/vmlinuz-5.15.6-100.fc34.x86_64
The param /boot/vmlinuz-5.15.6-100.fc34.x86_64 is incorrect
[root@fedora support]# grubby --no-etc-grub-update --grub2 --bad-image-okay --env=grub_env -b boot_load_entries --info=/boot/vmlinuz-5.15.6-100.fc34.x86_64
index=0
kernel="/boot/boot/vmlinuz-5.15.6-100.fc34.x86_64"
[root@fedora support]]# grubby --args crashkernel=333M --update-kernel=/boot/vmlinuz-6.0.7-301.fc37.x86_64 && echo "succeed"
succeed
Signed-off-by: Coiby Xu <coxu(a)redhat.com>
---
spec/kdumpctl_manage_crashkernel_spec.sh | 8 +++++++-
spec/kdumpctl_reset_crashkernel_spec.sh | 8 +++++++-
spec/support/bin/@grubby | 3 ---
3 files changed, 14 insertions(+), 5 deletions(-)
delete mode 100755 spec/support/bin/@grubby
diff --git a/spec/kdumpctl_manage_crashkernel_spec.sh b/spec/kdumpctl_manage_crashkernel_spec.sh
index bae3f314..3255d9aa 100644
--- a/spec/kdumpctl_manage_crashkernel_spec.sh
+++ b/spec/kdumpctl_manage_crashkernel_spec.sh
@@ -42,6 +42,12 @@ Describe 'Management of the kernel crashkernel parameter.'
rm -rf "$KDUMP_SPEC_TEST_RUN_DIR"
}
+ # the boot loader entries are for a system without a boot partition, mock
+ # mountpoint to let grubby know it
+ Mock mountpoint
+ exit 1
+ End
+
grubby() {
# - --no-etc-grub-update, not update /etc/default/grub
# - --bad-image-okay, don't check the validity of the image
@@ -49,7 +55,7 @@ Describe 'Management of the kernel crashkernel parameter.'
# the default /boot/grub2/grubenv
# - --bls-directory, specify custom BootLoaderSpec config files to avoid
# modifying the default /boot/loader/entries
- @grubby --no-etc-grub-update --grub2 --config-file="$GRUB_CFG" --bad-image-okay --env="$KDUMP_SPEC_TEST_RUN_DIR"/env_temp -b "$KDUMP_SPEC_TEST_RUN_DIR"/boot_load_entries "$@"
+ /usr/sbin/grubby --no-etc-grub-update --grub2 --config-file="$GRUB_CFG" --bad-image-okay --env="$KDUMP_SPEC_TEST_RUN_DIR"/env_temp -b "$KDUMP_SPEC_TEST_RUN_DIR"/boot_load_entries "$@"
}
# The mocking breaks has_command. Mock it as well to fix the tests.
diff --git a/spec/kdumpctl_reset_crashkernel_spec.sh b/spec/kdumpctl_reset_crashkernel_spec.sh
index 2e3b2ba7..88ff5a90 100644
--- a/spec/kdumpctl_reset_crashkernel_spec.sh
+++ b/spec/kdumpctl_reset_crashkernel_spec.sh
@@ -19,6 +19,12 @@ Describe 'kdumpctl reset-crashkernel [--kernel] [--fadump]'
BeforeAll 'setup'
AfterAll 'cleanup'
+ # the boot loader entries are for a system without a boot partition, mock
+ # mountpoint to let grubby know it
+ Mock mountpoint
+ exit 1
+ End
+
grubby() {
# - --no-etc-grub-update, not update /etc/default/grub
# - --bad-image-okay, don't check the validity of the image
@@ -26,7 +32,7 @@ Describe 'kdumpctl reset-crashkernel [--kernel] [--fadump]'
# the default /boot/grub2/grubenv
# - --bls-directory, specify custom BootLoaderSpec config files to avoid
# modifying the default /boot/loader/entries
- @grubby --no-etc-grub-update --grub2 --bad-image-okay --env="$KDUMP_SPEC_TEST_RUN_DIR"/env_temp -b "$KDUMP_SPEC_TEST_RUN_DIR"/boot_load_entries "$@"
+ /usr/sbin/grubby --no-etc-grub-update --grub2 --bad-image-okay --env="$KDUMP_SPEC_TEST_RUN_DIR"/env_temp -b "$KDUMP_SPEC_TEST_RUN_DIR"/boot_load_entries "$@"
}
# The mocking breaks has_command. Mock it as well to fix the tests.
diff --git a/spec/support/bin/@grubby b/spec/support/bin/@grubby
deleted file mode 100755
index 2a9b33ff..00000000
--- a/spec/support/bin/@grubby
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/bin/sh -e
-. "$SHELLSPEC_SUPPORT_BIN"
-invoke grubby "$@"
--
2.41.0
7 months, 3 weeks
[PATCH v3 00/15] Various small cleanups and improvements
by Philipp Rudo
Hi everybody,
this series got spit from the CLI rework series as they are independent and can
be merged earlier to reduce the overall series size. While most of the patches
were part of the rfc v1 of the CLI rework series patches 9-15 are new.
Thanks
Philipp
v2 -> v3:
- Rebased to latest rawhide.
- Adjusted unit test to changes made in patch 6 & 8.
@Pingfan: I've left your Reviewed-by as the changes only touch the tests but
not the code. Hope that is ok with you.
- Added new patches 14 & 15 to fix problems in the unit tests.
v1 -> v2:
- Added new patch 13, which I've noticed during reviewing the patch Coiby
posted to split up the package.
- Improved the commit message of patch 10 with comments from Pingfan.
- Added Pingfan's Reviewed-by to all patches contained in v1.
rfc -> v1:
- Rebased to latest rawhide
- Patch 1 added two more fixes.
- Patch 2,4&8 improved the commit message
- Patch 3 dropped definition of _is_valid_kver as it was already present on
latest rawhide
- Added new patches 9-12
Philipp Rudo (15):
Fix various shellcheck findings
kdump-lib: make is_zstd_command_available more generic
kdump-lib: simplify _get_kdump_kernel_version
kdumpctl: drop _get_current_running_kernel_path
kdumpctl: drop condrestart subcommand
kdumpctl: simplify _update_kernel_cmdline
kdumpctl: Prevent option --fadump on non-PPC in reset_crashkernel
kdumpctl: Stop updating grub config in reset_crashkernel
kdump.conf: Remove option override_resettable
spec: Clean up handling of dracut files
spec: Silence unversioned Obsolete warning
kdump-lib: Harden _crashkernel_add
spec: Drop special handling for IA64 machines
unit tests: Fix parse_config test case
unit tests: Fix paths in fake bls configs
gen-kdump-conf.sh | 6 -
kdump-lib.sh | 179 ++++++++-----
kdump.conf.5 | 8 -
kdumpctl | 236 ++++++------------
kexec-tools.spec | 72 ++----
mkdumprd | 57 +----
mkfadumprd | 2 +-
spec/kdump-lib_spec.sh | 38 ++-
spec/kdumpctl_general_spec.sh | 80 +-----
spec/kdumpctl_manage_crashkernel_spec.sh | 5 +
spec/kdumpctl_reset_crashkernel_spec.sh | 15 +-
...846f63134c7295458cf36300ba5b-0-rescue.conf | 4 +-
...58cf36300ba5b-5.14.14-200.fc34.x86_64.conf | 4 +-
...458cf36300ba5b-5.15.6-100.fc34.x86_64.conf | 4 +-
14 files changed, 257 insertions(+), 453 deletions(-)
--
2.41.0
7 months, 4 weeks
[PATCH] update 98-kexec rules for crash hotplug
by Eric DeVolder
The Linux kernel series "crash: Kernel handling of CPU and memory hot
un/plug" recently landed in mainline. To take advantage of the
performance benefits of that series, 98-kexec.rules needs an update to
optimize the handling of CPU and memory hotplug changes.
It is safe to deploy these rule updates now, ahead of distros/kernels
enabling the feature, since the crash_hotplug sysfs nodes would not be
present and thus the newly introduced rules in 98-kexec would act as a
nop-op and fall thru for legacy behavior. But when distros/kernels
enable the feature, then 98-kexec rules is ready and can properly take
advantage.
Link: https://lore.kernel.org/lkml/20230814214446.6659-1-eric.devolder@oracle.com/
Link:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit...
Signed-off-by: Eric DeVolder <eric.devolder(a)oracle.com>
---
98-kexec.rules | 4 ++++
98-kexec.rules.ppc64 | 4 ++++
2 files changed, 8 insertions(+)
diff --git a/98-kexec.rules b/98-kexec.rules
index b73b701..52b2ee8 100644
--- a/98-kexec.rules
+++ b/98-kexec.rules
@@ -1,3 +1,7 @@
+# The kernel updates the crash elfcorehdr for CPU and memory changes
+SUBSYSTEM=="cpu", ATTRS{crash_hotplug}=="1", GOTO="kdump_reload_end"
+SUBSYSTEM=="memory", ATTRS{crash_hotplug}=="1", GOTO="kdump_reload_end"
+
SUBSYSTEM=="cpu", ACTION=="add", GOTO="kdump_reload"
SUBSYSTEM=="cpu", ACTION=="remove", GOTO="kdump_reload"
SUBSYSTEM=="memory", ACTION=="online", GOTO="kdump_reload"
diff --git a/98-kexec.rules.ppc64 b/98-kexec.rules.ppc64
index a1c00a9..94c8b5d 100644
--- a/98-kexec.rules.ppc64
+++ b/98-kexec.rules.ppc64
@@ -1,3 +1,7 @@
+# The kernel updates the crash elfcorehdr for CPU and memory changes
+SUBSYSTEM=="cpu", ATTRS{crash_hotplug}=="1", GOTO="kdump_reload_end"
+SUBSYSTEM=="memory", ATTRS{crash_hotplug}=="1", GOTO="kdump_reload_end"
+
SUBSYSTEM=="cpu", ACTION=="online", GOTO="kdump_reload_cpu"
SUBSYSTEM=="memory", ACTION=="online", GOTO="kdump_reload_mem"
SUBSYSTEM=="memory", ACTION=="offline", GOTO="kdump_reload_mem"
--
2.39.3
8 months
[PATCH v2 00/13] Various small cleanups and improvements
by Philipp Rudo
Hi everybody,
this series got spit from the CLI rework series as they are independent and can
be merged earlier to reduce the overall series size. While most of the patches
were part of the rfc v1 of the CLI rework series patches 9-13 are new.
Thanks
Philipp
v1 -> v2
- Added new patch 13, which I've noticed during reviewing the patch Coiby
posted to split up the package.
- Improved the commit message of patch 10 with comments from Pingfan.
- Added Pingfan's Reviewed-by to all patches contained in v1.
rfc -> v1:
- Rebased to latest rawhide
- Patch 1 added two more fixes.
- Patch 2,4&8 improved the commit message
- Patch 3 dropped definition of _is_valid_kver as it was already present on
latest rawhide
- Added new patches 9-12
Philipp Rudo (13):
Fix various shellcheck findings
kdump-lib: make is_zstd_command_available more generic
kdump-lib: simplify _get_kdump_kernel_version
kdumpctl: drop _get_current_running_kernel_path
kdumpctl: drop condrestart subcommand
kdumpctl: simplify _update_kernel_cmdline
kdumpctl: Prevent option --fadump on non-PPC in reset_crashkernel
kdumpctl: Stop updating grub config in reset_crashkernel
kdump.conf: Remove option override_resettable
spec: Clean up handling of dracut files
spec: Silence unversioned Obsolete warning
kdump-lib: Harden _crashkernel_add
spec: Drop special handling for IA64 machines
gen-kdump-conf.sh | 6 --
kdump-lib.sh | 179 +++++++++++++++++++++----------
kdump.conf.5 | 8 --
kdumpctl | 236 +++++++++++++----------------------------
kexec-tools.spec | 72 ++++---------
mkdumprd | 57 +---------
mkfadumprd | 2 +-
spec/kdump-lib_spec.sh | 38 ++++---
8 files changed, 237 insertions(+), 361 deletions(-)
--
2.41.0
8 months, 1 week
[PATCH] powerpc: update fadump sysfs node path
by Sourabh Jain
The fadump sysfs nodes /sys/kernel/fadump_[enabled|registered], have
been relocated to /sys/kernel/fadump/[enabled|registered] by kernel
commits d418b19f34ed ("powerpc/fadump: Reorganize /sys/kernel/fadump_*
sysfs files").
To ensure compatibility, symbolic links were added for each relocated
sysfs entry. Nonetheless, note that these symbolic links might be
removed later, as they have been deprecated by kernel commit
3f5f1f22ef10 ("Documentation/ABI: Mark /sys/kernel/fadump_* sysfs files
deprecated")
This patch updates the scripts to use the updated fadump sysfs files.
Signed-off-by: Sourabh Jain <sourabhjain(a)linux.ibm.com>
---
98-kexec.rules.ppc64 | 2 +-
fadump-howto.txt | 2 +-
kdump-lib.sh | 4 ++--
3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/98-kexec.rules.ppc64 b/98-kexec.rules.ppc64
index a1c00a9..e9db276 100644
--- a/98-kexec.rules.ppc64
+++ b/98-kexec.rules.ppc64
@@ -17,6 +17,6 @@ GOTO="kdump_reload_end"
LABEL="kdump_reload_cpu"
-RUN+="/bin/sh -c '/usr/bin/systemctl is-active kdump.service || exit 0; ! test -f /sys/kernel/fadump_enabled || cat /sys/kernel/fadump_enabled | grep 0 || exit 0; /usr/bin/systemd-run --quiet --no-block /usr/lib/udev/kdump-udev-throttler'"
+RUN+="/bin/sh -c '/usr/bin/systemctl is-active kdump.service || exit 0; ! test -f /sys/kernel/fadump/enabled || cat /sys/kernel/fadump/enabled | grep 0 || exit 0; /usr/bin/systemd-run --quiet --no-block /usr/lib/udev/kdump-udev-throttler'"
LABEL="kdump_reload_end"
diff --git a/fadump-howto.txt b/fadump-howto.txt
index 9773f78..2fe76cf 100644
--- a/fadump-howto.txt
+++ b/fadump-howto.txt
@@ -137,7 +137,7 @@ Then, start up kdump as well:
# systemctl start kdump.service
This should turn on the firmware assisted functionality in kernel by
-echo'ing 1 to /sys/kernel/fadump_registered, leaving the system ready
+echo'ing 1 to /sys/kernel/fadump/registered, leaving the system ready
to capture a vmcore upon crashing. For journaling filesystems like XFS an
additional step is required to ensure bootloader does not pick the
older initrd (without vmcore capture scripts):
diff --git a/kdump-lib.sh b/kdump-lib.sh
index 16238c5..99c726b 100755
--- a/kdump-lib.sh
+++ b/kdump-lib.sh
@@ -8,8 +8,8 @@ else
. /lib/kdump/kdump-lib-initramfs.sh
fi
-FADUMP_ENABLED_SYS_NODE="/sys/kernel/fadump_enabled"
-FADUMP_REGISTER_SYS_NODE="/sys/kernel/fadump_registered"
+FADUMP_ENABLED_SYS_NODE="/sys/kernel/fadump/enabled"
+FADUMP_REGISTER_SYS_NODE="/sys/kernel/fadump/registered"
is_uki()
{
--
2.41.0
8 months, 1 week