diff --git a/.gitignore b/.gitignore index 3182a5b..cd41c79 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,3 @@ SOURCES/eppic-e8844d3.tar.gz -SOURCES/kexec-tools-2.0.27.tar.xz -SOURCES/makedumpfile-1.7.4.tar.gz +SOURCES/kexec-tools-2.0.29.tar.xz +SOURCES/makedumpfile-1.7.6.tar.gz diff --git a/.kexec-tools.metadata b/.kexec-tools.metadata index c417c38..f7944d6 100644 --- a/.kexec-tools.metadata +++ b/.kexec-tools.metadata @@ -1,3 +1,3 @@ 80ac3f5e77d3c79883edadf14428734db4720009 SOURCES/eppic-e8844d3.tar.gz -ed15f191adee22ab0721ba62af1cae67eb981670 SOURCES/kexec-tools-2.0.27.tar.xz -98cae2b1062871905795918c32b6d46ccd115074 SOURCES/makedumpfile-1.7.4.tar.gz +b05e53b8f63ca039a06b0f8cb8a175b0f447449e SOURCES/kexec-tools-2.0.29.tar.xz +0182de2145780593639b4e0b4a573af0595b8988 SOURCES/makedumpfile-1.7.6.tar.gz diff --git a/SOURCES/99-kdump.conf b/SOURCES/99-kdump.conf new file mode 100644 index 0000000..230ca31 --- /dev/null +++ b/SOURCES/99-kdump.conf @@ -0,0 +1,4 @@ +dracutmodules='' +add_dracutmodules=' kdumpbase ' +omit_dracutmodules=' plymouth resume ifcfg earlykdump ' +omit_drivers+=' nouveau amdgpu ' diff --git a/SOURCES/dracut-kdump.sh b/SOURCES/dracut-kdump.sh index 80acc93..f0619c0 100755 --- a/SOURCES/dracut-kdump.sh +++ b/SOURCES/dracut-kdump.sh @@ -15,6 +15,8 @@ fi KDUMP_PATH="/var/crash" KDUMP_LOG_FILE="/run/initramfs/kexec-dmesg.log" +KDUMP_TEST_ID="" +KDUMP_TEST_STATUS="" CORE_COLLECTOR="" DEFAULT_CORE_COLLECTOR="makedumpfile -l --message-level 7 -d 31" DMESG_COLLECTOR="/sbin/vmcore-dmesg" @@ -141,7 +143,12 @@ dump_fs() ;; esac - _dump_fs_path=$(echo "$1/$KDUMP_PATH/$HOST_IP-$DATEDIR/" | tr -s /) + if [ -z "$KDUMP_TEST_ID" ]; then + _dump_fs_path=$(echo "$1/$KDUMP_PATH/$HOST_IP-$DATEDIR/" | tr -s /) + else + _dump_fs_path=$(echo "$1/$KDUMP_PATH/" | tr -s /) + fi + dinfo "saving to $_dump_fs_path" # Only remount to read-write mode if the dump target is mounted read-only. @@ -388,7 +395,12 @@ dump_ssh() { _ret=0 _ssh_opt="-i $1 -o BatchMode=yes -o StrictHostKeyChecking=yes" - _ssh_dir="$KDUMP_PATH/$HOST_IP-$DATEDIR" + if [ -z "$KDUMP_TEST_ID" ]; then + _ssh_dir="$KDUMP_PATH/$HOST_IP-$DATEDIR" + else + _ssh_dir="$KDUMP_PATH" + fi + if is_ipv6_address "$2"; then _scp_address=${2%@*}@"[${2#*@}]" else @@ -572,6 +584,48 @@ fence_kdump_notify() fi } +kdump_test_set_status() { + _status="$1" + + [ -n "$KDUMP_TEST_STATUS" ] || return + + case "$_status" in + success|fail) ;; + *) + derror "Unknown test status $_status" + return 1 + ;; + esac + + if is_ssh_dump_target; then + _ssh_opts="-i $SSH_KEY_LOCATION -o BatchMode=yes -o StrictHostKeyChecking=yes" + _ssh_host=$(echo "$DUMP_INSTRUCTION" | awk '{print $3}') + + ssh -q $_ssh_opts "$_ssh_host" "mkdir -p ${KDUMP_TEST_STATUS%/*}" \ + || return 1 + ssh -q $_ssh_opts "$_ssh_host" "echo $_status kdump_test_id=$KDUMP_TEST_ID > $KDUMP_TEST_STATUS" \ + || return 1 + else + _target=$(echo "$DUMP_INSTRUCTION" | awk '{print $2}') + + mkdir -p "$_target/$KDUMP_PATH" || return 1 + echo "$_status kdump_test_id=$KDUMP_TEST_ID" > "$_target/$KDUMP_TEST_STATUS" + sync -f "$_target/$KDUMP_TEST_STATUS" + fi +} + +kdump_test_init() { + is_raw_dump_target && return + + KDUMP_TEST_ID=$(getarg kdump_test_id=) + [ -z "$KDUMP_TEST_ID" ] && return + + KDUMP_PATH="$KDUMP_PATH/kdump-test-$KDUMP_TEST_ID" + KDUMP_TEST_STATUS="$KDUMP_PATH/vmcore-creation.status" + + kdump_test_set_status 'fail' +} + if [ "$1" = "--error-handler" ]; then get_kdump_confs do_failure_action @@ -597,6 +651,7 @@ if [ -z "$DUMP_INSTRUCTION" ]; then DUMP_INSTRUCTION="dump_fs $NEWROOT" fi +kdump_test_init if ! do_kdump_pre; then derror "kdump_pre script exited with non-zero status!" do_final_action @@ -615,4 +670,5 @@ if [ $DUMP_RETVAL -ne 0 ]; then exit 1 fi +kdump_test_set_status "success" do_final_action diff --git a/SOURCES/fadump-howto.txt b/SOURCES/fadump-howto.txt index 2fe76cf..aec251b 100644 --- a/SOURCES/fadump-howto.txt +++ b/SOURCES/fadump-howto.txt @@ -319,7 +319,27 @@ Advanced Setups & Failure action: Kdump and fadump exhibit similar behavior in terms of setup & failure action. For fadump advanced setup related information see section "Advanced Setups" in "kexec-kdump-howto.txt" document. Refer to "Failure action" section in "kexec- -kdump-howto.txt" document for fadump failure action related information. +kdump-howto.txt" document for fadump failure action related information. Note +that the below options from /etc/sysconfig/kdump have no relevance to fadump +owing to the way it operates: + +-KDUMP_BOOTDIR +-KDUMP_IMG +-KDUMP_IMG_EXT +-KEXEC_ARGS +-KDUMP_KERNELVER +-KDUMP_COMMANDLINE +-KDUMP_COMMANDLINE_REMOVE +-KDUMP_COMMANDLINE_APPEND + +Passing additional parameters to fadump capture kerenl + +-FADUMP_COMMANDLINE_APPEND + +If a powerpc system supports passing additional parameters, it would have the +sysfs node '/sys/kernel/fadump/bootargs_append'. FADUMP_COMMANDLINE_APPEND +allows us to append arguments to fadump capture kernel, further to parameters +passed via the bootloader. Compression and filtering @@ -331,11 +351,7 @@ Notes on rootfs mount: Dracut is designed to mount rootfs by default. If rootfs mounting fails it will refuse to go on. So fadump leaves rootfs mounting to dracut currently. We make the assumtion that proper root= cmdline is being passed to dracut -initramfs for the time being. If you need modify "KDUMP_COMMANDLINE=" in -/etc/sysconfig/kdump, you will need to make sure that appropriate root= -options are copied from /proc/cmdline. In general it is best to append -command line options using "KDUMP_COMMANDLINE_APPEND=" instead of replacing -the original command line completely. +initramfs for the time being. How to disable FADump: diff --git a/SOURCES/kdump-lib-initramfs.sh b/SOURCES/kdump-lib-initramfs.sh index 6eaec93..e1b5d53 100755 --- a/SOURCES/kdump-lib-initramfs.sh +++ b/SOURCES/kdump-lib-initramfs.sh @@ -101,15 +101,14 @@ get_fs_type_from_target() get_mntpoint_from_target() { - local SOURCE TARGET - findmnt -k --pairs -o SOURCE,TARGET "$1" | while read line; do - eval "$line" - # omit sources that are bind mounts i.e. they contain a [/path/to/subpath]. - if [[ ! "$SOURCE" =~ \[ ]]; then - echo $TARGET - break - fi - done + local _mntpoint + # get the first TARGET when SOURCE doesn't end with ]. + # In most cases, a SOURCE ends with ] when fsroot or subvol exists. + _mntpoint=$(get_mount_info TARGET,SOURCE source "$1" | grep -v "\]$" | awk 'NR==1 { print $1 }') + + # fallback to the old way when _mntpoint is empty. + [[ -n "$_mntpoint" ]] || _mntpoint=$(get_mount_info TARGET source "$1" -f ) + echo $_mntpoint } is_ssh_dump_target() @@ -156,9 +155,14 @@ is_nfs_dump_target() return 1 } +fs_dump_target() +{ + kdump_get_conf_val "ext[234]\|xfs\|btrfs\|minix\|virtiofs" +} + is_fs_dump_target() { - [ -n "$(kdump_get_conf_val "ext[234]\|xfs\|btrfs\|minix\|virtiofs")" ] + [ -n "$(fs_dump_target)" ] } is_lvm2_thinp_device() diff --git a/SOURCES/kdump-lib.sh b/SOURCES/kdump-lib.sh index 28ee6c0..5ba7a07 100755 --- a/SOURCES/kdump-lib.sh +++ b/SOURCES/kdump-lib.sh @@ -7,6 +7,7 @@ FADUMP_ENABLED_SYS_NODE="/sys/kernel/fadump/enabled" FADUMP_REGISTER_SYS_NODE="/sys/kernel/fadump/registered" +FADUMP_APPEND_ARGS_SYS_NODE="/sys/kernel/fadump/bootargs_append" is_uki() { diff --git a/SOURCES/kdump.service b/SOURCES/kdump.service index 15405dc..406a790 100644 --- a/SOURCES/kdump.service +++ b/SOURCES/kdump.service @@ -2,10 +2,10 @@ Description=Crash recovery kernel arming After=network.target network-online.target remote-fs.target basic.target DefaultDependencies=no -ConditionKernelCommandLine=crashkernel [Service] Type=oneshot +ExecCondition=/bin/sh -c 'grep -q -e "crashkernel" -e "fadump" /proc/cmdline' ExecStart=/usr/bin/kdumpctl start ExecStop=/usr/bin/kdumpctl stop ExecReload=/usr/bin/kdumpctl reload diff --git a/SOURCES/kdump.sysconfig.i386 b/SOURCES/kdump.sysconfig.i386 index d8bf5f6..70860ea 100644 --- a/SOURCES/kdump.sysconfig.i386 +++ b/SOURCES/kdump.sysconfig.i386 @@ -39,6 +39,10 @@ KDUMP_IMG="vmlinuz" #What is the images extension. Relocatable kernels don't have one KDUMP_IMG_EXT="" +# Enable vmcore creation notification by default, disable by setting +# VMCORE_CREATION_NOTIFICATION="" +VMCORE_CREATION_NOTIFICATION="yes" + # Logging is controlled by following variables in the first kernel: # - @var KDUMP_STDLOGLVL - logging level to standard error (console output) # - @var KDUMP_SYSLOGLVL - logging level to syslog (by logger command) diff --git a/SOURCES/kdump.sysconfig.ppc64 b/SOURCES/kdump.sysconfig.ppc64 index b7c4e79..445ab1f 100644 --- a/SOURCES/kdump.sysconfig.ppc64 +++ b/SOURCES/kdump.sysconfig.ppc64 @@ -39,6 +39,10 @@ KDUMP_IMG="vmlinuz" #What is the images extension. Relocatable kernels don't have one KDUMP_IMG_EXT="" +# Enable vmcore creation notification by default, disable by setting +# VMCORE_CREATION_NOTIFICATION="" +VMCORE_CREATION_NOTIFICATION="yes" + #Specify the action after failure # Logging is controlled by following variables in the first kernel: diff --git a/SOURCES/kdump.sysconfig.ppc64le b/SOURCES/kdump.sysconfig.ppc64le index c1cee45..405eeef 100644 --- a/SOURCES/kdump.sysconfig.ppc64le +++ b/SOURCES/kdump.sysconfig.ppc64le @@ -23,6 +23,10 @@ KDUMP_COMMANDLINE_REMOVE="hugepages hugepagesz slub_debug quiet log_buf_len swio # after processed by KDUMP_COMMANDLINE_REMOVE KDUMP_COMMANDLINE_APPEND="irqpoll nr_cpus=1 noirqdistrib reset_devices cgroup_disable=memory numa=off udev.children-max=2 ehea.use_mcs=0 panic=10 kvm_cma_resv_ratio=0 transparent_hugepage=never novmcoredd hugetlb_cma=0" +# This variable lets us append arguments to fadump (powerpc) capture kernel, +# further to the parameters passed via the bootloader. +FADUMP_COMMANDLINE_APPEND="nr_cpus=16 numa=off cgroup_disable=memory cma=0 kvm_cma_resv_ratio=0 hugetlb_cma=0 transparent_hugepage=never novmcoredd udev.children-max=2" + # Any additional kexec arguments required. In most situations, this should # be left empty # @@ -39,6 +43,10 @@ KDUMP_IMG="vmlinuz" #What is the images extension. Relocatable kernels don't have one KDUMP_IMG_EXT="" +# Enable vmcore creation notification by default, disable by setting +# VMCORE_CREATION_NOTIFICATION="" +VMCORE_CREATION_NOTIFICATION="yes" + #Specify the action after failure # Logging is controlled by following variables in the first kernel: diff --git a/SOURCES/kdump.sysconfig.s390x b/SOURCES/kdump.sysconfig.s390x index b823093..a7a79a9 100644 --- a/SOURCES/kdump.sysconfig.s390x +++ b/SOURCES/kdump.sysconfig.s390x @@ -42,6 +42,10 @@ KDUMP_IMG="vmlinuz" #What is the images extension. Relocatable kernels don't have one KDUMP_IMG_EXT="" +# Enable vmcore creation notification by default, disable by setting +# VMCORE_CREATION_NOTIFICATION="" +VMCORE_CREATION_NOTIFICATION="yes" + # Logging is controlled by following variables in the first kernel: # - @var KDUMP_STDLOGLVL - logging level to standard error (console output) # - @var KDUMP_SYSLOGLVL - logging level to syslog (by logger command) diff --git a/SOURCES/kdump.sysconfig.x86_64 b/SOURCES/kdump.sysconfig.x86_64 index 09d7350..d3a5ce4 100644 --- a/SOURCES/kdump.sysconfig.x86_64 +++ b/SOURCES/kdump.sysconfig.x86_64 @@ -39,6 +39,10 @@ KDUMP_IMG="vmlinuz" #What is the images extension. Relocatable kernels don't have one KDUMP_IMG_EXT="" +# Enable vmcore creation notification by default, disable by setting +# VMCORE_CREATION_NOTIFICATION="" +VMCORE_CREATION_NOTIFICATION="yes" + # Logging is controlled by following variables in the first kernel: # - @var KDUMP_STDLOGLVL - logging level to standard error (console output) # - @var KDUMP_SYSLOGLVL - logging level to syslog (by logger command) diff --git a/SOURCES/kdumpctl b/SOURCES/kdumpctl index cb20708..b52dea5 100755 --- a/SOURCES/kdumpctl +++ b/SOURCES/kdumpctl @@ -18,6 +18,7 @@ KDUMP_INITRD="" TARGET_INITRD="" #kdump shall be the default dump mode DEFAULT_DUMP_MODE="kdump" +VMCORE_CREATION_STATUS="/var/lib/kdump/vmcore-creation.status" image_time=0 standard_kexec_args="-p" @@ -41,8 +42,10 @@ if ! dlog_init; then fi KDUMP_TMPDIR=$(mktemp --tmpdir -d kdump.XXXX) +TMPMNT="$KDUMP_TMPDIR/target" trap ' ret=$?; + is_mounted $TMPMNT && umount -f $TMPMNT; rm -rf "$KDUMP_TMPDIR" exit $ret; ' EXIT @@ -142,6 +145,8 @@ rebuild_kdump_initrd() rebuild_initrd() { + local _ret + if [[ ! -w $(dirname "$TARGET_INITRD") ]]; then derror "$(dirname "$TARGET_INITRD") does not have write permission. Cannot rebuild $TARGET_INITRD" return 1 @@ -152,6 +157,11 @@ rebuild_initrd() else rebuild_kdump_initrd fi + + _ret=$? + + set_vmcore_creation_status 'clear' + return $_ret } #$1: the files to be checked with IFS=' ' @@ -932,8 +942,24 @@ check_dump_feasibility() check_kdump_feasibility } +fadump_bootargs_append() +{ + if [[ -f "$FADUMP_APPEND_ARGS_SYS_NODE" ]]; then + output=$( { echo "${FADUMP_COMMANDLINE_APPEND}" > "$FADUMP_APPEND_ARGS_SYS_NODE" ; } 2>&1) + if [ $? -eq 0 ]; then + output=$(cat "$FADUMP_APPEND_ARGS_SYS_NODE") + dinfo "fadump: additional parameters for capture kernel: '$output'" + else + dwarn "WARNING: failed to setup additional parameters for fadump capture kernel: '$output'" + fi + else + dwarn "WARNING: this kernel does not support passing additional parameters to fadump capture kernel." + fi +} + start_fadump() { + fadump_bootargs_append echo 1 > "$FADUMP_REGISTER_SYS_NODE" if ! is_kernel_loaded "fadump"; then derror "fadump: failed to register" @@ -1120,6 +1146,7 @@ stop_kdump() reload_fadump() { + fadump_bootargs_append if echo 1 > "$FADUMP_REGISTER_SYS_NODE"; then dinfo "fadump: re-registered successfully" return 0 @@ -1756,6 +1783,179 @@ if [[ ! -f $KDUMP_CONFIG_FILE ]]; then exit 1 fi +set_kdump_test_id() +{ + local _id=$1 + + KDUMP_COMMANDLINE_APPEND+=" $_id " + + if ! reload >& /dev/null; then + derror "Set kdump test id fail." + exit 1 + fi +} + +# $1: success/fail/pending/manual/clear +# $2: test id +set_vmcore_creation_status() +{ + local _status=$1 + local _kdump_test_id + _dir=$(dirname "$VMCORE_CREATION_STATUS") + + [[ -d "$_dir" ]] || mkdir -p "$_dir" + [[ -w "$_dir" ]] || chmod +w "$_dir" + + case "$_status" in + pending) + _kdump_test_id="kdump_test_id=$(date +%s-%N)" + set_kdump_test_id "$_kdump_test_id" + echo "$_status $_kdump_test_id" > "$VMCORE_CREATION_STATUS" + ;; + success | fail | manual) + sed -E -i "s/^\w+/$_status/" "$VMCORE_CREATION_STATUS" + ;; + clear) + rm -f "$VMCORE_CREATION_STATUS" + ;; + *) + return + esac + sync -f "$_dir" +} + +fetch_status() +{ + local _test_id="$1" _mnt + local _status _target + + is_raw_dump_target && return 2 + + _status="$(get_save_path)/kdump-test-$_test_id/vmcore-creation.status" + + if is_nfs_dump_target || is_fs_dump_target; then + if is_fs_dump_target; then + _target=$(fs_dump_target) + else + _target=$(kdump_get_conf_val nfs) + fi + _mnt=$(get_mntpoint_from_target "$_target") + if [[ -z "$_mnt" ]] || ! is_mounted "$_mnt"; then + mkdir -p "$TMPMNT" + mount "$_target" "$TMPMNT" -o defaults || \ + { dwarn "Failed to mount $_target" && return 2; } + _mnt="$TMPMNT" + fi + _status="$_mnt/$_status" + elif is_ssh_dump_target; then + local _scp_address + + if is_ipv6_address "${OPT[_target]}"; then + _scp_address="${OPT[_target]%@*}@[${OPT[_target]#*@}]" + else + _scp_address="${OPT[_target]}" + fi + + scp -q -i "${OPT[sshkey]}" -o BatchMode=yes \ + "$_scp_address:$_status" \ + "$KDUMP_TMPDIR" + case "$?" in + 0) + # success + ;; + 1) + # file not found + return 1 + ;; + 255) + # no connection to host + return 2 + esac + _status="$KDUMP_TMPDIR/vmcore-creation.status" + fi + [[ -f "$_status" ]] || return 1 + grep -q "success" "$_status" && return 0 || return 1 +} + +check_vmcore_creation_status() +{ + local _status _test_id _timestamp _status_date + + [[ ${VMCORE_CREATION_NOTIFICATION,,} == "yes" ]] || return + + [[ "$DEFAULT_DUMP_MODE" == "kdump" ]] || return + + if [[ ! -s "$VMCORE_CREATION_STATUS" ]]; then + dwarn "Notice: No vmcore creation test performed!" + return + fi + + read -r _status _test_id < "$VMCORE_CREATION_STATUS" + _test_id=${_test_id#*=} + _timestamp=${_test_id%-*} + _status_date=$(date -d "@$_timestamp") + + if [[ "$_status" == "pending" ]]; then + fetch_status "$_test_id" + case "$?" in + 0) + _status="success" + ;; + 1) + _status="fail" + ;; + *) + _status="manual" + ;; + esac + set_vmcore_creation_status "$_status" + fi + + case "$_status" in + success) + dinfo "Notice: Last successful vmcore creation on $_status_date" + ;; + fail) + dwarn "Notice: Last NOT successful vmcore creation on $_status_date" + ;; + manual) + dwarn "Notice: Require manual check for kdump test of $_status_date" + ;; + *) + derror "Unknown test status: $_status" + ;; + esac +} + +kdump_test() +{ + if ! is_kernel_loaded "$DEFAULT_DUMP_MODE"; then + derror "Kdump needs be operational before test." + exit 1 + fi + + if [[ ! "$DEFAULT_DUMP_MODE" == "kdump" ]]; then + derror "Only kdump is supported for test." + exit 1 + fi + + if [[ ! "$1" == "--force" ]]; then + read -r -p "DANGER!!! Will perform a kdump test by crashing the system, proceed? (y/N): " input + case $input in + [Yy] ) + dinfo "Start kdump test..." + ;; + * ) + dinfo "Operation cancelled." + exit 0 + ;; + esac + fi + + set_vmcore_creation_status 'pending' + echo c > /proc/sysrq-trigger +} + main() { # Determine if the dump mode is kdump or fadump @@ -1786,6 +1986,7 @@ main() EXIT_CODE=3 ;; esac + check_vmcore_creation_status exit $EXIT_CODE ;; reload) @@ -1816,6 +2017,10 @@ main() shift reset_crashkernel "$@" ;; + test) + shift + kdump_test "$@" + ;; _reset-crashkernel-after-update) if [[ $(kdump_get_conf_val auto_reset_crashkernel) != no ]]; then reset_crashkernel_after_update @@ -1827,7 +2032,7 @@ main() fi ;; *) - dinfo $"Usage: $0 {estimate|start|stop|status|restart|reload|rebuild|reset-crashkernel|propagate|showmem}" + dinfo $"Usage: $0 {estimate|start|stop|status|restart|reload|rebuild|reset-crashkernel|propagate|showmem|test}" exit 1 ;; esac diff --git a/SOURCES/kdumpctl.8 b/SOURCES/kdumpctl.8 index 29a6119..06a78e7 100644 --- a/SOURCES/kdumpctl.8 +++ b/SOURCES/kdumpctl.8 @@ -70,7 +70,16 @@ Note: The memory requirements for kdump varies heavily depending on the used hardware and system configuration. Thus the recommended crashkernel might not work for your specific setup. Please test if kdump works after resetting the crashkernel value. - +.TP +.I test [--force] +Test the kdump by actually trigger the system crash & dump, and check if a +vmcore can really be generated successfully based on current config and +environment. After system reboot back to normal, check the test result +by "kdumpctl status". Note, fadump is not supported. + +If the optional parameter [--force] is provided, there will be no confirmation +before triggering the system crash. Dangerous though, this option is meant +for automation testing. .SH "SEE ALSO" .BR kdump.conf (5), .BR mkdumprd (8) diff --git a/SOURCES/kexec-update-manpage-with-explicit-mention-of-clean-.patch b/SOURCES/kexec-update-manpage-with-explicit-mention-of-clean-.patch deleted file mode 100644 index d7b674a..0000000 --- a/SOURCES/kexec-update-manpage-with-explicit-mention-of-clean-.patch +++ /dev/null @@ -1,39 +0,0 @@ -From bd0200c47c45dd420244b39ddabcecdab1fb9a8e Mon Sep 17 00:00:00 2001 -From: Hari Bathini -Date: Wed, 20 Sep 2023 17:29:27 +0530 -Subject: [PATCH] kexec: update manpage with explicit mention of clean kexec - -While the manpage does mention about kexec boot with a clean shutdown, -it is not explicit about it. Make it explicit. - -Signed-off-by: Hari Bathini -Signed-off-by: Simon Horman ---- - kexec/kexec.8 | 11 +++++++++-- - 1 file changed, 9 insertions(+), 2 deletions(-) - -diff --git a/kexec/kexec.8 b/kexec/kexec.8 -index 3a344c5..179dcf2 100644 ---- a/kexec/kexec.8 -+++ b/kexec/kexec.8 -@@ -95,8 +95,15 @@ then you would use the following command to load the kernel: - .RB "\-\-append=" "root=/dev/hda1" "\ \-\-initrd=" /boot/initrd - .RE - .PP --After this kernel is loaded, it can be booted to at any time using the --command: -+After this kernel is loaded, assuming the user-space supports kexec-based -+rebooting, it can be booted to, with a clean shutdown, using the command: -+ -+.RS -+.BR reboot -+.RE -+.PP -+Alternatively, it can also be booted to, without calling shutdown(8), with -+the command: - - .RS - .BR kexec \ \-e --- -2.41.0 - diff --git a/SOURCES/kexec_file-add-kexec_file-flag-to-support-debug-prin.patch b/SOURCES/kexec_file-add-kexec_file-flag-to-support-debug-prin.patch deleted file mode 100644 index 7ded28a..0000000 --- a/SOURCES/kexec_file-add-kexec_file-flag-to-support-debug-prin.patch +++ /dev/null @@ -1,44 +0,0 @@ -From 9d9cf8de8b2ad8273861a30476a46f34cd34871a Mon Sep 17 00:00:00 2001 -From: Baoquan He -Date: Tue, 14 Nov 2023 23:20:30 +0800 -Subject: [PATCH] kexec_file: add kexec_file flag to support debug printing -Content-type: text/plain - -This add KEXEC_FILE_DEBUG to kexec_file_flags so that it can be passed -to kernel when '-d' is added with kexec_file_load interface. With that -flag enabled, kernel can enable the debugging message printing. - -Signed-off-by: Baoquan He -Signed-off-by: Simon Horman ---- - kexec/kexec-syscall.h | 1 + - kexec/kexec.c | 1 + - 2 files changed, 2 insertions(+) - -diff --git a/kexec/kexec-syscall.h b/kexec/kexec-syscall.h -index 2559bffb93da..73e52543e1b0 100644 ---- a/kexec/kexec-syscall.h -+++ b/kexec/kexec-syscall.h -@@ -119,6 +119,7 @@ static inline long kexec_file_load(int kernel_fd, int initrd_fd, - #define KEXEC_FILE_UNLOAD 0x00000001 - #define KEXEC_FILE_ON_CRASH 0x00000002 - #define KEXEC_FILE_NO_INITRAMFS 0x00000004 -+#define KEXEC_FILE_DEBUG 0x00000008 - - /* These values match the ELF architecture values. - * Unless there is a good reason that should continue to be the case. -diff --git a/kexec/kexec.c b/kexec/kexec.c -index 9d0ec46e5657..222f79e3112e 100644 ---- a/kexec/kexec.c -+++ b/kexec/kexec.c -@@ -1477,6 +1477,7 @@ int main(int argc, char *argv[]) - return 0; - case OPT_DEBUG: - kexec_debug = 1; -+ kexec_file_flags |= KEXEC_FILE_DEBUG; - break; - case OPT_NOIFDOWN: - skip_ifdown = 1; --- -2.41.0 - diff --git a/SOURCES/mkdumprd b/SOURCES/mkdumprd index af0006d..77c3538 100644 --- a/SOURCES/mkdumprd +++ b/SOURCES/mkdumprd @@ -27,7 +27,7 @@ SAVE_PATH=$(get_save_path) OVERRIDE_RESETTABLE=0 extra_modules="" -dracut_args=(--add kdumpbase --quiet --hostonly --hostonly-cmdline --hostonly-i18n --hostonly-mode strict --hostonly-nics '' -o "plymouth resume ifcfg earlykdump") +dracut_args=(--quiet --hostonly --hostonly-cmdline --hostonly-i18n --hostonly-mode strict --hostonly-nics '') MKDUMPRD_TMPDIR="$(mktemp -d -t mkdumprd.XXXXXX)" [ -d "$MKDUMPRD_TMPDIR" ] || perror_exit "dracut: mktemp -p -d -t dracut.XXXXXX failed." @@ -474,6 +474,15 @@ if [[ -d /sys/module/nvme ]]; then add_dracut_arg "--add-drivers" "nvme" fi +# Use kdump managed dracut profile. +[[ $kdump_dracut_confdir ]] || kdump_dracut_confdir=/lib/kdump/dracut.conf.d +if [[ "$(dracut --help)" == *--add-confdir* ]] && [[ -d "$kdump_dracut_confdir" ]]; then + dracut_args+=("--add-confdir" "$kdump_dracut_confdir") +else + dracut_args+=(--add kdumpbase) + dracut_args+=(--omit "plymouth resume ifcfg earlykdump") +fi + dracut "${dracut_args[@]}" "$@" _rc=$? diff --git a/SPECS/kexec-tools.spec b/SPECS/kexec-tools.spec index 97c59c9..903f312 100644 --- a/SPECS/kexec-tools.spec +++ b/SPECS/kexec-tools.spec @@ -1,11 +1,11 @@ %global eppic_ver e8844d3793471163ae4a56d8f95897be9e5bd554 %global eppic_shortver %(c=%{eppic_ver}; echo ${c:0:7}) -%global mkdf_ver 1.7.4 +%global mkdf_ver 1.7.6 %global mkdf_shortver %(c=%{mkdf_ver}; echo ${c:0:7}) Name: kexec-tools -Version: 2.0.27 -Release: 15%{?dist} +Version: 2.0.29 +Release: 5%{?dist} License: GPLv2 Summary: The kexec/kdump userspace component @@ -46,6 +46,7 @@ Source35: kdump-migrate-action.sh Source36: kdump-restart.sh Source37: 60-fadump.install Source38: supported-kdump-targets.txt +Source39: 99-kdump.conf ####################################### # These are sources for mkdumpramfs @@ -113,8 +114,6 @@ Requires: systemd-udev%{?_isa} # # Patches 601 onward are generic patches # -Patch601: kexec-update-manpage-with-explicit-mention-of-clean-.patch -Patch602: kexec_file-add-kexec_file-flag-to-support-debug-prin.patch %description kexec-tools provides /sbin/kexec binary that facilitates a new @@ -130,9 +129,6 @@ mkdir -p -m755 kcp tar -z -x -v -f %{SOURCE9} tar -z -x -v -f %{SOURCE19} -%patch601 -p1 -%patch602 -p1 - %ifarch ppc %define archdef ARCH=ppc %endif @@ -184,7 +180,7 @@ mkdir -p -m755 $RPM_BUILD_ROOT%{_udevrulesdir} mkdir -p $RPM_BUILD_ROOT%{_unitdir} mkdir -p -m755 $RPM_BUILD_ROOT%{_bindir} mkdir -p -m755 $RPM_BUILD_ROOT%{_libdir} -mkdir -p -m755 $RPM_BUILD_ROOT%{_prefix}/lib/kdump +mkdir -p -m755 $RPM_BUILD_ROOT%{_prefix}/lib/kdump/dracut.conf.d mkdir -p -m755 $RPM_BUILD_ROOT%{_sharedstatedir}/kdump install -m 755 %{SOURCE1} $RPM_BUILD_ROOT%{_bindir}/kdumpctl @@ -206,6 +202,7 @@ install -m 644 %{SOURCE25} $RPM_BUILD_ROOT%{_mandir}/man8/kdumpctl.8 install -m 755 %{SOURCE20} $RPM_BUILD_ROOT%{_prefix}/lib/kdump/kdump-lib.sh install -m 755 %{SOURCE23} $RPM_BUILD_ROOT%{_prefix}/lib/kdump/kdump-lib-initramfs.sh install -m 755 %{SOURCE31} $RPM_BUILD_ROOT%{_prefix}/lib/kdump/kdump-logger.sh +install -m 644 %{SOURCE39} $RPM_BUILD_ROOT%{_prefix}/lib/kdump/dracut.conf.d/99-kdump.conf %ifarch ppc64 ppc64le install -m 755 %{SOURCE32} $RPM_BUILD_ROOT/usr/sbin/mkfadumprd install -m 755 %{SOURCE35} $RPM_BUILD_ROOT%{_prefix}/lib/kdump/kdump-migrate-action.sh @@ -410,6 +407,35 @@ fi %endif %changelog +* Fri Jan 17 2025 Tao Liu - 2.0.29-5 +- 99-kdump.conf: Omit nouveau and amdgpu module + +* Fri Jan 10 2025 Tao Liu - 2.0.29-4 +- kdump.service: Replace ConditionKernelCommandLine with ExecCondition + +* Fri Dec 13 2024 Tao Liu - 2.0.29-3 +- fadump: fix passing additional parameters for capture kernel +- fadump: pass additional parameters for capture kernel + +* Fri Dec 6 2024 Tao Liu - 2.0.29-2 +- Re-introduce vmcore creation notification to kdump +- Revert "Introduce vmcore creation notification to kdump" +- Add kdump dracut config +- kdump-lib-initramfs: Improve mount point retrieval logic + +* Wed Nov 6 2024 Tao Liu - 2.0.29-1 +- Release 2.0.29-1 +- Rebase makedumpfile to v1.7.6 + +* Mon Oct 21 2024 Tao Liu - 2.0.27-18 +- Return the correct exit code of rebuild initrd + +* Tue Oct 8 2024 Tao Liu - 2.0.27-17 +- Introduce vmcore creation notification to kdump + +* Tue Sep 10 2024 Tao Liu - 2.0.27-16 +- Revert "lib: Ensure we don't find bind mounts for device target" + * Wed Aug 7 2024 Tao Liu - 2.0.27-15 - Support setting up Open vSwitch (Ovs) Bridge network