From 9b4f6070ece8baa586d7a138b400447dc5003f9b Mon Sep 17 00:00:00 2001 From: Coiby Xu Date: Mon, 14 Feb 2022 11:03:17 +0800 Subject: [PATCH] fix incorrect usage of _get_all_kernels_from_grubby Related: bz1895258 Upstream: Fedora Conflict: None commit 41b8f9528c8ed89c68ad59750c18f032b5675a06 Author: Coiby Xu Date: Wed Feb 9 08:04:39 2022 +0800 fix incorrect usage of _get_all_kernels_from_grubby It's found that the kernel cmdline crashkernel=auto doesn't get updated when upgrading kexec-tools. This happens because _get_all_kernels_from_grubby is called with no argument by reset_crashkernel_after_update. When retrieving all kernel paths on the system, "grubby --info ALL" should be used. Fix this error by passing "ALL" argument. Fixes: 0adb0f4 ("try to reset kernel crashkernel when kexec-tools updates the default crashkernel value") Reported-by: Jie Li Signed-off-by: Coiby Xu Reviewed-by: Tao Liu Signed-off-by: Coiby Xu --- kdumpctl | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/kdumpctl b/kdumpctl index e670295..860a27a 100755 --- a/kdumpctl +++ b/kdumpctl @@ -1408,6 +1408,11 @@ _valid_grubby_kernel_path() [[ -n "$1" ]] && grubby --info="$1" > /dev/null 2>&1 } +# return all the kernel paths given a grubby kernel-path +# +# $1: kernel path accepted by grubby, e.g. DEFAULT, ALL, +# /boot/vmlinuz-`uname -r` +# return: kernel paths separated by space _get_all_kernels_from_grubby() { local _kernels _line _kernel_path _grubby_kernel_path=$1 @@ -1583,7 +1588,7 @@ reset_crashkernel_after_update() _crashkernel_vals[new_kdump]=$(get_default_crashkernel kdump) _crashkernel_vals[new_fadump]=$(get_default_crashkernel fadump) - for _kernel in $(_get_all_kernels_from_grubby); do + for _kernel in $(_get_all_kernels_from_grubby ALL); do _crashkernel=$(get_grub_kernel_boot_parameter "$_kernel" crashkernel) if [[ $_crashkernel == auto ]]; then reset_crashkernel "--kernel=$_kernel"