From 1a733872aeab1d1dcc0b063cd05afe61bbeb1c33 Mon Sep 17 00:00:00 2001 From: Lichen Liu Date: Tue, 14 Oct 2025 11:30:29 +0800 Subject: [PATCH 1/2] Strip surrounding quotes from configuration values The documentation for kdump.conf suggests values can be enclosed in double quotes, as in 'core_collector "makedumpfile -l --message-level 7 -d 31"'. However, the parsing logic did not strip these quotes, causing the system to treat them as part of the value. This led to errors, such as attempting to execute the command '"makedumpfile', which would fail with a "command not found" error. ``` kdump.sh[599]: /lib/kdump-lib-initramfs.sh: line 145: "makedumpfile: command not found kdump[601]: saving vmcore failed, _exitcode:127 kdump[603]: saving the /run/initramfs/kexec-dmesg.log to /sysroot//var/crash/127.0.0.1-2025-09-17-19:25:10/ kdump[609]: saving vmcore failed [FAILED] Failed to start Kdump Vmcore Save Service. ``` This patch fixes the issue by removing surrounding double quotes from configuration values when they are read. This ensures that quoted values are handled correctly and behave as documented. Signed-off-by: Lichen Liu --- dracut/99kdumpbase/module-setup.sh | 2 +- kdump-lib-initramfs.sh | 5 +++-- kdumpctl | 1 + 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/dracut/99kdumpbase/module-setup.sh b/dracut/99kdumpbase/module-setup.sh index 1c223ed..4dc11ac 100755 --- a/dracut/99kdumpbase/module-setup.sh +++ b/dracut/99kdumpbase/module-setup.sh @@ -719,7 +719,7 @@ kdump_install_conf() { kdump_read_conf > "${initdir}/tmp/$$-kdump.conf" while read -r _opt _val; do - # remove inline comments after the end of a directive. + [[ $_val == \"*\" ]] && _val=${_val:1:-1} case "$_opt" in raw) _pdev=$(persistent_policy="by-id" kdump_get_persistent_dev "$_val") diff --git a/kdump-lib-initramfs.sh b/kdump-lib-initramfs.sh index 558295a..c4bc6d2 100755 --- a/kdump-lib-initramfs.sh +++ b/kdump-lib-initramfs.sh @@ -29,9 +29,10 @@ kdump_read_conf() kdump_get_conf_val() { # For lines matching "^\s*$1\s+", remove matched part (config name including space), - # remove tailing comment, space, then store in hold space. Print out the hold buffer on last line. + # remove tailing comment, space and the surrounding quotes, then store in hold space. + # Print out the hold buffer on last line. [ -f "$KDUMP_CONFIG_FILE" ] && - sed -n -e "/^\s*\($1\)\s\+/{s/^\s*\($1\)\s\+//;s/#.*//;s/\s*$//;h};\${x;p}" $KDUMP_CONFIG_FILE + sed -n -e "/^\s*\($1\)\s\+/{s/^\s*\($1\)\s\+//;s/#.*//;s/\s*$//;s/^\"\(.*\)\"$/\1/;h};\${x;p}" $KDUMP_CONFIG_FILE } is_mounted() diff --git a/kdumpctl b/kdumpctl index dd69318..6375efa 100755 --- a/kdumpctl +++ b/kdumpctl @@ -324,6 +324,7 @@ _set_config() fi return 1 fi + [[ $_val == \"*\" ]] && _val=${_val:1:-1} OPT[$opt]="$val" } -- 2.51.1