diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..13a7635 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +SOURCES/eppic-e8844d3.tar.gz +SOURCES/kexec-tools-2.0.23.tar.xz +SOURCES/makedumpfile-1.7.0.tar.gz diff --git a/.kexec-tools.metadata b/.kexec-tools.metadata new file mode 100644 index 0000000..d05e81c --- /dev/null +++ b/.kexec-tools.metadata @@ -0,0 +1,3 @@ +80ac3f5e77d3c79883edadf14428734db4720009 SOURCES/eppic-e8844d3.tar.gz +c9213672bbc9d08d25f6b1ea0cd9056d2e1c5e73 SOURCES/kexec-tools-2.0.23.tar.xz +a931a40b80df204be1b02bfb502921cc618810fd SOURCES/makedumpfile-1.7.0.tar.gz diff --git a/SOURCES/60-kdump.install b/SOURCES/60-kdump.install new file mode 100755 index 0000000..5b0e021 --- /dev/null +++ b/SOURCES/60-kdump.install @@ -0,0 +1,36 @@ +#!/usr/bin/bash + +COMMAND="$1" +KERNEL_VERSION="$2" +KDUMP_INITRD_DIR_ABS="$3" +KERNEL_IMAGE="$4" + +if ! [[ ${KERNEL_INSTALL_MACHINE_ID-x} ]]; then + exit 0 +fi + +if [[ -d "$KDUMP_INITRD_DIR_ABS" ]]; then + KDUMP_INITRD="initrdkdump" +else + # If `KDUMP_BOOTDIR` is not writable, then the kdump + # initrd must have been placed at `/var/lib/kdump` + if [[ ! -w "/boot" ]]; then + KDUMP_INITRD_DIR_ABS="/var/lib/kdump" + else + KDUMP_INITRD_DIR_ABS="/boot" + fi + KDUMP_INITRD="initramfs-${KERNEL_VERSION}kdump.img" +fi + +ret=0 +case "$COMMAND" in + add) + # Do nothing, kdump initramfs is strictly host only + # and managed by kdump service + ;; + remove) + rm -f -- "$KDUMP_INITRD_DIR_ABS/$KDUMP_INITRD" + ret=$? + ;; +esac +exit $ret diff --git a/SOURCES/92-crashkernel.install b/SOURCES/92-crashkernel.install new file mode 100755 index 0000000..1d67a13 --- /dev/null +++ b/SOURCES/92-crashkernel.install @@ -0,0 +1,13 @@ +#!/usr/bin/bash + +COMMAND="$1" +KERNEL_VERSION="$2" +KDUMP_INITRD_DIR_ABS="$3" +KERNEL_IMAGE="$4" + +case "$COMMAND" in +add) + kdumpctl reset-crashkernel-for-installed_kernel "$KERNEL_VERSION" + exit 0 + ;; +esac diff --git a/SOURCES/98-kexec.rules b/SOURCES/98-kexec.rules new file mode 100644 index 0000000..b73b701 --- /dev/null +++ b/SOURCES/98-kexec.rules @@ -0,0 +1,16 @@ +SUBSYSTEM=="cpu", ACTION=="add", GOTO="kdump_reload" +SUBSYSTEM=="cpu", ACTION=="remove", GOTO="kdump_reload" +SUBSYSTEM=="memory", ACTION=="online", GOTO="kdump_reload" +SUBSYSTEM=="memory", ACTION=="offline", GOTO="kdump_reload" + +GOTO="kdump_reload_end" + +LABEL="kdump_reload" + +# If kdump is not loaded, calling kdump-udev-throttle will end up +# doing nothing, but systemd-run will always generate extra logs for +# each call, so trigger the kdump-udev-throttler only if kdump +# service is active to avoid unnecessary logs +RUN+="/bin/sh -c '/usr/bin/systemctl is-active kdump.service || exit 0; /usr/bin/systemd-run --quiet --no-block /usr/lib/udev/kdump-udev-throttler'" + +LABEL="kdump_reload_end" diff --git a/SOURCES/98-kexec.rules.ppc64 b/SOURCES/98-kexec.rules.ppc64 new file mode 100644 index 0000000..a1c00a9 --- /dev/null +++ b/SOURCES/98-kexec.rules.ppc64 @@ -0,0 +1,22 @@ +SUBSYSTEM=="cpu", ACTION=="online", GOTO="kdump_reload_cpu" +SUBSYSTEM=="memory", ACTION=="online", GOTO="kdump_reload_mem" +SUBSYSTEM=="memory", ACTION=="offline", GOTO="kdump_reload_mem" + +GOTO="kdump_reload_end" + +# If kdump is not loaded, calling kdump-udev-throttle will end up +# doing nothing, but systemd-run will always generate extra logs for +# each call, so trigger the kdump-udev-throttler only if kdump +# service is active to avoid unnecessary logs + +LABEL="kdump_reload_mem" + +RUN+="/bin/sh -c '/usr/bin/systemctl is-active kdump.service || exit 0; /usr/bin/systemd-run --quiet --no-block /usr/lib/udev/kdump-udev-throttler'" + +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'" + +LABEL="kdump_reload_end" diff --git a/SOURCES/crashkernel-howto.txt b/SOURCES/crashkernel-howto.txt new file mode 100644 index 0000000..1ba79ab --- /dev/null +++ b/SOURCES/crashkernel-howto.txt @@ -0,0 +1,119 @@ +Introduction +============ + +This document describes features the kexec-tools package provides for setting +and estimating the crashkernel value. + +Kdump lives in a pre-reserved chunk of memory, and the size of the reserved +memory is specified by the `crashkernel=` kernel parameter. It's hard to +estimate an accurate `crashkernel=` value, so it's always recommended to test +kdump after you updated the `crashkernel=` value or changed the dump target. + + +Default crashkernel value +========================= + +Latest kexec-tools provides "kdumpctl get-default-crashkernel" to retrieve +the default crashkernel value, + + $ echo $(kdumpctl get-default-crashkernel) + 1G-4G:192M,4G-64G:256M,64G-102400T:512M + +It will be taken as the default value of 'crashkernel=', you can use +this value as a reference for setting crashkernel value manually. + + +New installed system +==================== + +Anaconda is the OS installer which sets all the kernel boot cmdline on a newly +installed system. If kdump is enabled during Anaconda installation, Anaconda +will use the default crashkernel value as the default `crashkernel=` value on +the newly installed system. + +Users can override the value during Anaconda installation manually. + + +Auto update of crashkernel boot parameter +========================================= + +A new release of kexec-tools could update the default crashkernel value. +By default, kexec-tools would reset crashkernel to the new default value if it +detects old default crashkernel value is used by installed kernels. If you don't +want kexec-tools to update the old default crashkernel to the new default +crashkernel, you can change auto_reset_crashkernel to no in kdump.conf. + +Supported Bootloaders +--------------------- + +This auto update only works with GRUB2 and ZIPL, as kexec-tools heavily depends +on `grubby`. If other boot loaders are used, the user will have to update the +`crashkernel=` value manually. + + +Reset crashkernel to default value +================================== + +kexec-tools only perform the auto update of crashkernel value when it can +confirm the boot kernel's crashkernel value is using its corresponding default +value and auto_reset_crashkernel=yes in kdump.conf. In other cases, the user +can reset the crashkernel value by themselves. + +Reset using kdumpctl +-------------------- + +To make it easier to reset the `crashkernel=` kernel cmdline to this default +value properly, `kdumpctl` also provides a sub-command: + + `kdumpctl reset-crashkernel [--kernel=path_to_kernel] [--reboot]` + +This command will read from the `crashkernel.default` file and reset +bootloader's kernel cmdline to the default value. It will also update bootloader +config if the bootloader has a standalone config file. User will have to reboot +the machine after this command to make it take effect if --reboot is not specified. +For ppc64le, an optional "[--fadump=[on|off|nocma]]" can also be specified to toggle +FADump on/off. + +Reset manually +-------------- + +To reset the crashkernel value manually, it's recommended to use utils like +`grubby`. A one liner script for resetting `crashkernel=` value of all installed +kernels to current boot kernel's crashkernel.default` is: + + grubby --update-kernel ALL --args "crashkernel=$(kdumpctl get-default-crashkernel)" + +Estimate crashkernel +==================== + +The best way to estimate a usable crashkernel value is by testing kdump +manually. And you can set crashkernel to a large value, then adjust the +crashkernel value to an acceptable value gradually. + +`kdumpctl` also provides a sub-command for doing rough estimating without +triggering kdump: + + `kdumpctl estimate` + +The output will be like this: + +``` + Encrypted kdump target requires extra memory, assuming using the keyslot with minimun memory requirement + + Reserved crashkernel: 256M + Recommended crashkernel: 655M + + Kernel image size: 47M + Kernel modules size: 12M + Initramfs size: 19M + Runtime reservation: 64M + LUKS required size: 512M + Large modules: + xfs: 1892352 + nouveau: 2318336 + WARNING: Current crashkernel size is lower than recommended size 655M. +``` + +It will generate a summary report about the estimated memory consumption +of each component of kdump. The value may not be accurate enough, but +would be a good start for finding a suitable crashkernel value. diff --git a/SOURCES/dracut-early-kdump-module-setup.sh b/SOURCES/dracut-early-kdump-module-setup.sh new file mode 100755 index 0000000..0451118 --- /dev/null +++ b/SOURCES/dracut-early-kdump-module-setup.sh @@ -0,0 +1,65 @@ +#!/bin/bash + +. /etc/sysconfig/kdump + +KDUMP_KERNEL="" +KDUMP_INITRD="" + +check() { + if [[ ! -f /etc/sysconfig/kdump ]] || [[ ! -f /lib/kdump/kdump-lib.sh ]] \ + || [[ -n ${IN_KDUMP} ]]; then + return 1 + fi + return 255 +} + +depends() { + echo "base shutdown" + return 0 +} + +prepare_kernel_initrd() { + . /lib/kdump/kdump-lib.sh + + prepare_kdump_bootinfo + + # $kernel is a variable from dracut + if [[ $KDUMP_KERNELVER != "$kernel" ]]; then + dwarn "Using kernel version '$KDUMP_KERNELVER' for early kdump," \ + "but the initramfs is generated for kernel version '$kernel'" + fi +} + +install() { + prepare_kernel_initrd + if [[ ! -f $KDUMP_KERNEL ]]; then + derror "Could not find required kernel for earlykdump," \ + "earlykdump will not work!" + return 1 + fi + if [[ ! -f $KDUMP_INITRD ]]; then + derror "Could not find required kdump initramfs for earlykdump," \ + "please ensure kdump initramfs is generated first," \ + "earlykdump will not work!" + return 1 + fi + + inst_multiple tail find cut dirname hexdump + inst_simple "/etc/sysconfig/kdump" + inst_binary "/usr/sbin/kexec" + inst_binary "/usr/bin/gawk" "/usr/bin/awk" + inst_binary "/usr/bin/logger" "/usr/bin/logger" + inst_binary "/usr/bin/printf" "/usr/bin/printf" + inst_binary "/usr/bin/xargs" "/usr/bin/xargs" + inst_script "/lib/kdump/kdump-lib.sh" "/lib/kdump-lib.sh" + inst_script "/lib/kdump/kdump-lib-initramfs.sh" "/lib/kdump/kdump-lib-initramfs.sh" + inst_script "/lib/kdump/kdump-logger.sh" "/lib/kdump-logger.sh" + inst_hook cmdline 00 "$moddir/early-kdump.sh" + inst_binary "$KDUMP_KERNEL" + inst_binary "$KDUMP_INITRD" + + ln_r "$KDUMP_KERNEL" "/boot/kernel-earlykdump" + ln_r "$KDUMP_INITRD" "/boot/initramfs-earlykdump" + + chmod -x "${initdir}/$KDUMP_KERNEL" +} diff --git a/SOURCES/dracut-early-kdump.sh b/SOURCES/dracut-early-kdump.sh new file mode 100755 index 0000000..45ee6dc --- /dev/null +++ b/SOURCES/dracut-early-kdump.sh @@ -0,0 +1,84 @@ +#! /bin/sh + +KEXEC=/sbin/kexec +standard_kexec_args="-p" + +EARLY_KDUMP_INITRD="" +EARLY_KDUMP_KERNEL="" +EARLY_KDUMP_CMDLINE="" +EARLY_KDUMP_KERNELVER="" +EARLY_KEXEC_ARGS="" + +. /etc/sysconfig/kdump +. /lib/dracut-lib.sh +. /lib/kdump-lib.sh +. /lib/kdump-logger.sh + +# initiate the kdump logger +if ! dlog_init; then + echo "failed to initiate the kdump logger." + exit 1 +fi + +prepare_parameters() +{ + EARLY_KDUMP_CMDLINE=$(prepare_cmdline "${KDUMP_COMMANDLINE}" "${KDUMP_COMMANDLINE_REMOVE}" "${KDUMP_COMMANDLINE_APPEND}") + EARLY_KDUMP_KERNEL="/boot/kernel-earlykdump" + EARLY_KDUMP_INITRD="/boot/initramfs-earlykdump" +} + +early_kdump_load() +{ + if ! check_kdump_feasibility; then + return 1 + fi + + if is_fadump_capable; then + dwarn "WARNING: early kdump doesn't support fadump." + return 1 + fi + + if check_current_kdump_status; then + return 1 + fi + + prepare_parameters + + EARLY_KEXEC_ARGS=$(prepare_kexec_args "${KEXEC_ARGS}") + + if is_secure_boot_enforced; then + dinfo "Secure Boot is enabled. Using kexec file based syscall." + EARLY_KEXEC_ARGS="$EARLY_KEXEC_ARGS -s" + fi + + # Here, only output the messages, but do not save these messages + # to a file because the target disk may not be mounted yet, the + # earlykdump is too early. + ddebug "earlykdump: $KEXEC ${EARLY_KEXEC_ARGS} $standard_kexec_args \ + --command-line=$EARLY_KDUMP_CMDLINE --initrd=$EARLY_KDUMP_INITRD \ + $EARLY_KDUMP_KERNEL" + + if $KEXEC $EARLY_KEXEC_ARGS $standard_kexec_args \ + --command-line="$EARLY_KDUMP_CMDLINE" \ + --initrd=$EARLY_KDUMP_INITRD $EARLY_KDUMP_KERNEL; then + dinfo "kexec: loaded early-kdump kernel" + return 0 + else + derror "kexec: failed to load early-kdump kernel" + return 1 + fi +} + +set_early_kdump() +{ + if getargbool 0 rd.earlykdump; then + dinfo "early-kdump is enabled." + early_kdump_load + else + dinfo "early-kdump is disabled." + fi + + return 0 +} + +set_early_kdump diff --git a/SOURCES/dracut-fadump-init-fadump.sh b/SOURCES/dracut-fadump-init-fadump.sh new file mode 100755 index 0000000..94a3751 --- /dev/null +++ b/SOURCES/dracut-fadump-init-fadump.sh @@ -0,0 +1,48 @@ +#!/bin/sh +export PATH=/usr/bin:/usr/sbin +export SYSTEMD_IN_INITRD=lenient + +[ -e /proc/mounts ] || + (mkdir -p /proc && mount -t proc -o nosuid,noexec,nodev proc /proc) + +grep -q '^sysfs /sys sysfs' /proc/mounts || + (mkdir -p /sys && mount -t sysfs -o nosuid,noexec,nodev sysfs /sys) + +grep -q '^none / ' /proc/mounts || grep -q '^rootfs / ' /proc/mounts && ROOTFS_IS_RAMFS=1 + +if [ -f /proc/device-tree/rtas/ibm,kernel-dump ] || [ -f /proc/device-tree/ibm,opal/dump/mpipl-boot ]; then + mkdir /newroot + mount -t ramfs ramfs /newroot + + if [ $ROOTFS_IS_RAMFS ]; then + for FILE in $(ls -A /fadumproot/); do + mv /fadumproot/$FILE /newroot/ + done + exec switch_root /newroot /init + else + mkdir /newroot/sys /newroot/proc /newroot/dev /newroot/run /newroot/oldroot + + grep -q '^devtmpfs /dev devtmpfs' /proc/mounts && mount --move /dev /newroot/dev + grep -q '^tmpfs /run tmpfs' /proc/mounts && mount --move /run /newroot/run + mount --move /sys /newroot/sys + mount --move /proc /newroot/proc + + cp --reflink=auto --sparse=auto --preserve=mode,timestamps,links -dfr /fadumproot/. /newroot/ + cd /newroot && pivot_root . oldroot + + loop=1 + while [ $loop ]; do + unset loop + while read -r _ mp _; do + case $mp in + /oldroot/*) umount -d "$mp" && loop=1 ;; + esac + done </proc/mounts + done + umount -d -l oldroot + + exec /init + fi +else + exec /init.dracut +fi diff --git a/SOURCES/dracut-fadump-module-setup.sh b/SOURCES/dracut-fadump-module-setup.sh new file mode 100644 index 0000000..f062486 --- /dev/null +++ b/SOURCES/dracut-fadump-module-setup.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +check() { + return 255 +} + +depends() { + return 0 +} + +install() { + mv -f "$initdir/init" "$initdir/init.dracut" + inst_script "$moddir/init-fadump.sh" /init + chmod a+x "$initdir/init" + + # Install required binaries for the init script (init-fadump.sh) + inst_multiple sh modprobe grep mkdir mount + if dracut_module_included "squash"; then + inst_multiple cp pivot_root umount + else + inst_multiple ls mv switch_root + fi +} diff --git a/SOURCES/dracut-kdump-capture.service b/SOURCES/dracut-kdump-capture.service new file mode 100644 index 0000000..3f20aba --- /dev/null +++ b/SOURCES/dracut-kdump-capture.service @@ -0,0 +1,30 @@ +# This file is part of systemd. +# +# systemd is free software; you can redistribute it and/or modify it +# under the terms of the GNU Lesser General Public License as published by +# the Free Software Foundation; either version 2.1 of the License, or +# (at your option) any later version. + +[Unit] +Description=Kdump Vmcore Save Service +After=initrd.target initrd-parse-etc.service sysroot.mount +After=dracut-initqueue.service dracut-pre-mount.service dracut-mount.service dracut-pre-pivot.service +Before=initrd-cleanup.service +ConditionPathExists=/etc/initrd-release +OnFailure=emergency.target +OnFailureJobMode=isolate + +[Service] +Environment=DRACUT_SYSTEMD=1 +Environment=NEWROOT=/sysroot +Type=oneshot +ExecStart=/bin/kdump.sh +StandardInput=null +StandardOutput=syslog +StandardError=syslog+console +KillMode=process +RemainAfterExit=yes + +# Bash ignores SIGTERM, so we send SIGHUP instead, to ensure that bash +# terminates cleanly. +KillSignal=SIGHUP diff --git a/SOURCES/dracut-kdump-emergency.service b/SOURCES/dracut-kdump-emergency.service new file mode 100644 index 0000000..0cf7051 --- /dev/null +++ b/SOURCES/dracut-kdump-emergency.service @@ -0,0 +1,27 @@ +# This service will run the real kdump error handler code. Executing the +# failure action configured in kdump.conf + +[Unit] +Description=Kdump Error Handler +DefaultDependencies=no +After=systemd-vconsole-setup.service +Wants=systemd-vconsole-setup.service + +[Service] +Environment=HOME=/ +Environment=DRACUT_SYSTEMD=1 +Environment=NEWROOT=/sysroot +WorkingDirectory=/ +ExecStart=/bin/kdump.sh --error-handler +ExecStopPost=-/bin/rm -f -- /.console_lock +Type=oneshot +StandardInput=tty-force +StandardOutput=inherit +StandardError=inherit +KillMode=process +IgnoreSIGPIPE=no +TasksMax=infinity + +# Bash ignores SIGTERM, so we send SIGHUP instead, to ensure that bash +# terminates cleanly. +KillSignal=SIGHUP diff --git a/SOURCES/dracut-kdump-emergency.target b/SOURCES/dracut-kdump-emergency.target new file mode 100644 index 0000000..a1bb493 --- /dev/null +++ b/SOURCES/dracut-kdump-emergency.target @@ -0,0 +1,14 @@ +# This file is part of systemd. +# +# systemd is free software; you can redistribute it and/or modify it +# under the terms of the GNU Lesser General Public License as published by +# the Free Software Foundation; either version 2.1 of the License, or +# (at your option) any later version. + +[Unit] +Description=Emergency Mode +Documentation=man:systemd.special(7) +Requires=emergency.service +After=emergency.service +AllowIsolate=yes +IgnoreOnIsolate=yes diff --git a/SOURCES/dracut-kdump.sh b/SOURCES/dracut-kdump.sh new file mode 100755 index 0000000..b69bc98 --- /dev/null +++ b/SOURCES/dracut-kdump.sh @@ -0,0 +1,583 @@ +#!/bin/sh +# +# The main kdump routine in capture kernel, bash may not be the +# default shell. Any code added must be POSIX compliant. + +. /lib/dracut-lib.sh +. /lib/kdump-logger.sh +. /lib/kdump-lib-initramfs.sh + +#initiate the kdump logger +if ! dlog_init; then + echo "failed to initiate the kdump logger." + exit 1 +fi + +KDUMP_PATH="/var/crash" +KDUMP_LOG_FILE="/run/initramfs/kexec-dmesg.log" +CORE_COLLECTOR="" +DEFAULT_CORE_COLLECTOR="makedumpfile -l --message-level 7 -d 31" +DMESG_COLLECTOR="/sbin/vmcore-dmesg" +FAILURE_ACTION="systemctl reboot -f" +DATEDIR=$(date +%Y-%m-%d-%T) +HOST_IP='127.0.0.1' +DUMP_INSTRUCTION="" +SSH_KEY_LOCATION="/root/.ssh/kdump_id_rsa" +DD_BLKSIZE=512 +FINAL_ACTION="systemctl reboot -f" +KDUMP_PRE="" +KDUMP_POST="" +NEWROOT="/sysroot" +OPALCORE="/sys/firmware/opal/mpipl/core" +KDUMP_CONF_PARSED="/tmp/kdump.conf.$$" + +# POSIX doesn't have pipefail, only apply when using bash +# shellcheck disable=SC3040 +[ -n "$BASH" ] && set -o pipefail + +DUMP_RETVAL=0 + +kdump_read_conf > $KDUMP_CONF_PARSED + +get_kdump_confs() +{ + while read -r config_opt config_val; do + # remove inline comments after the end of a directive. + case "$config_opt" in + path) + KDUMP_PATH="$config_val" + ;; + core_collector) + [ -n "$config_val" ] && CORE_COLLECTOR="$config_val" + ;; + sshkey) + if [ -f "$config_val" ]; then + SSH_KEY_LOCATION=$config_val + fi + ;; + kdump_pre) + KDUMP_PRE="$config_val" + ;; + kdump_post) + KDUMP_POST="$config_val" + ;; + fence_kdump_args) + FENCE_KDUMP_ARGS="$config_val" + ;; + fence_kdump_nodes) + FENCE_KDUMP_NODES="$config_val" + ;; + failure_action | default) + case $config_val in + shell) + FAILURE_ACTION="kdump_emergency_shell" + ;; + reboot) + FAILURE_ACTION="systemctl reboot -f && exit" + ;; + halt) + FAILURE_ACTION="halt && exit" + ;; + poweroff) + FAILURE_ACTION="systemctl poweroff -f && exit" + ;; + dump_to_rootfs) + FAILURE_ACTION="dump_to_rootfs" + ;; + esac + ;; + final_action) + case $config_val in + reboot) + FINAL_ACTION="systemctl reboot -f" + ;; + halt) + FINAL_ACTION="halt" + ;; + poweroff) + FINAL_ACTION="systemctl poweroff -f" + ;; + esac + ;; + esac + done < "$KDUMP_CONF_PARSED" + + if [ -z "$CORE_COLLECTOR" ]; then + CORE_COLLECTOR="$DEFAULT_CORE_COLLECTOR" + if is_ssh_dump_target || is_raw_dump_target; then + CORE_COLLECTOR="$CORE_COLLECTOR -F" + fi + fi +} + +# store the kexec kernel log to a file. +save_log() +{ + dmesg -T > $KDUMP_LOG_FILE + + if command -v journalctl > /dev/null; then + journalctl -ab >> $KDUMP_LOG_FILE + fi + chmod 600 $KDUMP_LOG_FILE +} + +# $1: dump path, must be a mount point +dump_fs() +{ + ddebug "dump_fs _mp=$1" + + if ! is_mounted "$1"; then + dinfo "dump path '$1' is not mounted, trying to mount..." + if ! mount --target "$1"; then + derror "failed to dump to '$1', it's not a mount point!" + return 1 + fi + fi + + # Remove -F in makedumpfile case. We don't want a flat format dump here. + case $CORE_COLLECTOR in + *makedumpfile*) + CORE_COLLECTOR=$(echo "$CORE_COLLECTOR" | sed -e "s/-F//g") + ;; + esac + + _dump_fs_path=$(echo "$1/$KDUMP_PATH/$HOST_IP-$DATEDIR/" | tr -s /) + dinfo "saving to $_dump_fs_path" + + # Only remount to read-write mode if the dump target is mounted read-only. + _dump_mnt_op=$(get_mount_info OPTIONS target "$1" -f) + case $_dump_mnt_op in + ro*) + dinfo "Remounting the dump target in rw mode." + mount -o remount,rw "$1" || return 1 + ;; + esac + + mkdir -p "$_dump_fs_path" || return 1 + + save_vmcore_dmesg_fs ${DMESG_COLLECTOR} "$_dump_fs_path" + save_opalcore_fs "$_dump_fs_path" + + dinfo "saving vmcore" + $CORE_COLLECTOR /proc/vmcore "$_dump_fs_path/vmcore-incomplete" + _dump_exitcode=$? + if [ $_dump_exitcode -eq 0 ]; then + mv "$_dump_fs_path/vmcore-incomplete" "$_dump_fs_path/vmcore" + sync + dinfo "saving vmcore complete" + else + derror "saving vmcore failed, exitcode:$_dump_exitcode" + fi + + dinfo "saving the $KDUMP_LOG_FILE to $_dump_fs_path/" + save_log + mv "$KDUMP_LOG_FILE" "$_dump_fs_path/" + if [ $_dump_exitcode -ne 0 ]; then + return 1 + fi + + # improper kernel cmdline can cause the failure of echo, we can ignore this kind of failure + return 0 +} + +# $1: dmesg collector +# $2: dump path +save_vmcore_dmesg_fs() +{ + dinfo "saving vmcore-dmesg.txt to $2" + if $1 /proc/vmcore > "$2/vmcore-dmesg-incomplete.txt"; then + mv "$2/vmcore-dmesg-incomplete.txt" "$2/vmcore-dmesg.txt" + chmod 600 "$2/vmcore-dmesg.txt" + + # Make sure file is on disk. There have been instances where later + # saving vmcore failed and system rebooted without sync and there + # was no vmcore-dmesg.txt available. + sync + dinfo "saving vmcore-dmesg.txt complete" + else + if [ -f "$2/vmcore-dmesg-incomplete.txt" ]; then + chmod 600 "$2/vmcore-dmesg-incomplete.txt" + fi + derror "saving vmcore-dmesg.txt failed" + fi +} + +# $1: dump path +save_opalcore_fs() +{ + if [ ! -f $OPALCORE ]; then + # Check if we are on an old kernel that uses a different path + if [ -f /sys/firmware/opal/core ]; then + OPALCORE="/sys/firmware/opal/core" + else + return 0 + fi + fi + + dinfo "saving opalcore:$OPALCORE to $1/opalcore" + if ! cp $OPALCORE "$1/opalcore"; then + derror "saving opalcore failed" + return 1 + fi + + sync + dinfo "saving opalcore complete" + return 0 +} + +dump_to_rootfs() +{ + + if [ "$(systemctl status dracut-initqueue | sed -n "s/^\s*Active: \(\S*\)\s.*$/\1/p")" = "inactive" ]; then + dinfo "Trying to bring up initqueue for rootfs mount" + systemctl start dracut-initqueue + fi + + dinfo "Clean up dead systemd services" + systemctl cancel + dinfo "Waiting for rootfs mount, will timeout after 90 seconds" + systemctl start --no-block sysroot.mount + + _loop=0 + while [ $_loop -lt 90 ] && ! is_mounted /sysroot; do + sleep 1 + _loop=$((_loop + 1)) + done + + if ! is_mounted /sysroot; then + derror "Failed to mount rootfs" + return + fi + + ddebug "NEWROOT=$NEWROOT" + dump_fs $NEWROOT +} + +kdump_emergency_shell() +{ + ddebug "Switching to kdump emergency shell..." + + [ -f /etc/profile ] && . /etc/profile + export PS1='kdump:${PWD}# ' + + . /lib/dracut-lib.sh + if [ -f /dracut-state.sh ]; then + . /dracut-state.sh 2> /dev/null + fi + + source_conf /etc/conf.d + + type plymouth > /dev/null 2>&1 && plymouth quit + + source_hook "emergency" + while read -r _tty rest; do + ( + echo + echo + echo 'Entering kdump emergency mode.' + echo 'Type "journalctl" to view system logs.' + echo 'Type "rdsosreport" to generate a sosreport, you can then' + echo 'save it elsewhere and attach it to a bug report.' + echo + echo + ) > "/dev/$_tty" + done < /proc/consoles + sh -i -l + /bin/rm -f -- /.console_lock +} + +do_failure_action() +{ + dinfo "Executing failure action $FAILURE_ACTION" + eval $FAILURE_ACTION +} + +do_final_action() +{ + dinfo "Executing final action $FINAL_ACTION" + eval $FINAL_ACTION +} + +do_dump() +{ + eval $DUMP_INSTRUCTION + _ret=$? + + if [ $_ret -ne 0 ]; then + derror "saving vmcore failed" + fi + + return $_ret +} + +do_kdump_pre() +{ + if [ -n "$KDUMP_PRE" ]; then + "$KDUMP_PRE" + _ret=$? + if [ $_ret -ne 0 ]; then + derror "$KDUMP_PRE exited with $_ret status" + return $_ret + fi + fi + + # if any script fails, it just raises warning and continues + if [ -d /etc/kdump/pre.d ]; then + for file in /etc/kdump/pre.d/*; do + "$file" + _ret=$? + if [ $_ret -ne 0 ]; then + derror "$file exited with $_ret status" + fi + done + fi + return 0 +} + +do_kdump_post() +{ + if [ -d /etc/kdump/post.d ]; then + for file in /etc/kdump/post.d/*; do + "$file" "$1" + _ret=$? + if [ $_ret -ne 0 ]; then + derror "$file exited with $_ret status" + fi + done + fi + + if [ -n "$KDUMP_POST" ]; then + "$KDUMP_POST" "$1" + _ret=$? + if [ $_ret -ne 0 ]; then + derror "$KDUMP_POST exited with $_ret status" + fi + fi +} + +# $1: block target, eg. /dev/sda +dump_raw() +{ + [ -b "$1" ] || return 1 + + dinfo "saving to raw disk $1" + + if ! echo "$CORE_COLLECTOR" | grep -q makedumpfile; then + _src_size=$(stat --format %s /proc/vmcore) + _src_size_mb=$((_src_size / 1048576)) + /kdumpscripts/monitor_dd_progress $_src_size_mb & + fi + + dinfo "saving vmcore" + $CORE_COLLECTOR /proc/vmcore | dd of="$1" bs=$DD_BLKSIZE >> /tmp/dd_progress_file 2>&1 || return 1 + sync + + dinfo "saving vmcore complete" + return 0 +} + +# $1: ssh key file +# $2: ssh address in <user>@<host> format +dump_ssh() +{ + _ret=0 + _ssh_opt="-i $1 -o BatchMode=yes -o StrictHostKeyChecking=yes" + _ssh_dir="$KDUMP_PATH/$HOST_IP-$DATEDIR" + if is_ipv6_address "$2"; then + _scp_address=${2%@*}@"[${2#*@}]" + else + _scp_address=$2 + fi + + dinfo "saving to $2:$_ssh_dir" + + cat /var/lib/random-seed > /dev/urandom + ssh -q $_ssh_opt "$2" mkdir -p "$_ssh_dir" || return 1 + + save_vmcore_dmesg_ssh "$DMESG_COLLECTOR" "$_ssh_dir" "$_ssh_opt" "$2" + dinfo "saving vmcore" + + save_opalcore_ssh "$_ssh_dir" "$_ssh_opt" "$2" "$_scp_address" + + if [ "${CORE_COLLECTOR%%[[:blank:]]*}" = "scp" ]; then + scp -q $_ssh_opt /proc/vmcore "$_scp_address:$_ssh_dir/vmcore-incomplete" + _ret=$? + _vmcore="vmcore" + else + $CORE_COLLECTOR /proc/vmcore | ssh $_ssh_opt "$2" "umask 0077 && dd bs=512 of='$_ssh_dir/vmcore-incomplete'" + _ret=$? + _vmcore="vmcore.flat" + fi + + if [ $_ret -eq 0 ]; then + ssh $_ssh_opt "$2" "mv '$_ssh_dir/vmcore-incomplete' '$_ssh_dir/$_vmcore'" + _ret=$? + if [ $_ret -ne 0 ]; then + derror "moving vmcore failed, exitcode:$_ret" + else + dinfo "saving vmcore complete" + fi + else + derror "saving vmcore failed, exitcode:$_ret" + fi + + dinfo "saving the $KDUMP_LOG_FILE to $2:$_ssh_dir/" + save_log + if ! scp -q $_ssh_opt $KDUMP_LOG_FILE "$_scp_address:$_ssh_dir/"; then + derror "saving log file failed, _exitcode:$_ret" + fi + + return $_ret +} + +# $1: dump path +# $2: ssh opts +# $3: ssh address in <user>@<host> format +# $4: scp address, similar with ssh address but IPv6 addresses are quoted +save_opalcore_ssh() +{ + if [ ! -f $OPALCORE ]; then + # Check if we are on an old kernel that uses a different path + if [ -f /sys/firmware/opal/core ]; then + OPALCORE="/sys/firmware/opal/core" + else + return 0 + fi + fi + + dinfo "saving opalcore:$OPALCORE to $3:$1" + + if ! scp $2 $OPALCORE "$4:$1/opalcore-incomplete"; then + derror "saving opalcore failed" + return 1 + fi + + ssh $2 "$3" mv "$1/opalcore-incomplete" "$1/opalcore" + dinfo "saving opalcore complete" + return 0 +} + +# $1: dmesg collector +# $2: dump path +# $3: ssh opts +# $4: ssh address in <user>@<host> format +save_vmcore_dmesg_ssh() +{ + dinfo "saving vmcore-dmesg.txt to $4:$2" + if $1 /proc/vmcore | ssh $3 "$4" "umask 0077 && dd of='$2/vmcore-dmesg-incomplete.txt'"; then + ssh -q $3 "$4" mv "$2/vmcore-dmesg-incomplete.txt" "$2/vmcore-dmesg.txt" + dinfo "saving vmcore-dmesg.txt complete" + else + derror "saving vmcore-dmesg.txt failed" + fi +} + +get_host_ip() +{ + if is_nfs_dump_target || is_ssh_dump_target; then + kdumpnic=$(getarg kdumpnic=) + if [ -z "$kdumpnic" ]; then + derror "failed to get kdumpnic!" + return 1 + fi + if ! kdumphost=$(ip addr show dev "$kdumpnic" | grep '[ ]*inet'); then + derror "wrong kdumpnic: $kdumpnic" + return 1 + fi + kdumphost=$(echo "$kdumphost" | head -n 1 | awk '{print $2}') + kdumphost="${kdumphost%%/*}" + if [ -z "$kdumphost" ]; then + derror "wrong kdumpnic: $kdumpnic" + return 1 + fi + HOST_IP=$kdumphost + fi + return 0 +} + +read_kdump_confs() +{ + if [ ! -f "$KDUMP_CONFIG_FILE" ]; then + derror "$KDUMP_CONFIG_FILE not found" + return + fi + + get_kdump_confs + + # rescan for add code for dump target + while read -r config_opt config_val; do + # remove inline comments after the end of a directive. + case "$config_opt" in + dracut_args) + config_val=$(get_dracut_args_target "$config_val") + if [ -n "$config_val" ]; then + config_val=$(get_mntpoint_from_target "$config_val") + DUMP_INSTRUCTION="dump_fs $config_val" + fi + ;; + ext[234] | xfs | btrfs | minix | nfs) + config_val=$(get_mntpoint_from_target "$config_val") + DUMP_INSTRUCTION="dump_fs $config_val" + ;; + raw) + DUMP_INSTRUCTION="dump_raw $config_val" + ;; + ssh) + DUMP_INSTRUCTION="dump_ssh $SSH_KEY_LOCATION $config_val" + ;; + esac + done < "$KDUMP_CONF_PARSED" +} + +fence_kdump_notify() +{ + if [ -n "$FENCE_KDUMP_NODES" ]; then + # shellcheck disable=SC2086 + $FENCE_KDUMP_SEND $FENCE_KDUMP_ARGS $FENCE_KDUMP_NODES & + fi +} + +if [ "$1" = "--error-handler" ]; then + get_kdump_confs + do_failure_action + do_final_action + + exit $? +fi + +# continue here only if we have to save dump. +if [ -f /etc/fadump.initramfs ] && [ ! -f /proc/device-tree/rtas/ibm,kernel-dump ] && [ ! -f /proc/device-tree/ibm,opal/dump/mpipl-boot ]; then + exit 0 +fi + +read_kdump_confs +fence_kdump_notify + +if ! get_host_ip; then + derror "get_host_ip exited with non-zero status!" + exit 1 +fi + +if [ -z "$DUMP_INSTRUCTION" ]; then + DUMP_INSTRUCTION="dump_fs $NEWROOT" +fi + +if ! do_kdump_pre; then + derror "kdump_pre script exited with non-zero status!" + do_final_action + # During systemd service to reboot the machine, stop this shell script running + exit 1 +fi +make_trace_mem "kdump saving vmcore" '1:shortmem' '2+:mem' '3+:slab' +do_dump +DUMP_RETVAL=$? + +if ! do_kdump_post $DUMP_RETVAL; then + derror "kdump_post script exited with non-zero status!" +fi + +if [ $DUMP_RETVAL -ne 0 ]; then + exit 1 +fi + +do_final_action diff --git a/SOURCES/dracut-module-setup.sh b/SOURCES/dracut-module-setup.sh new file mode 100755 index 0000000..c319fc2 --- /dev/null +++ b/SOURCES/dracut-module-setup.sh @@ -0,0 +1,1090 @@ +#!/bin/bash + +kdump_module_init() { + if ! [[ -d "${initdir}/tmp" ]]; then + mkdir -p "${initdir}/tmp" + fi + + . /lib/kdump/kdump-lib.sh +} + +check() { + [[ $debug ]] && set -x + #kdumpctl sets this explicitly + if [[ -z $IN_KDUMP ]] || [[ ! -f /etc/kdump.conf ]]; then + return 1 + fi + return 0 +} + +depends() { + local _dep="base shutdown" + + kdump_module_init + + add_opt_module() { + [[ " $omit_dracutmodules " != *\ $1\ * ]] && _dep="$_dep $1" + } + + if is_squash_available; then + add_opt_module squash + else + dwarning "Required modules to build a squashed kdump image is missing!" + fi + + if is_wdt_active; then + add_opt_module watchdog + fi + + if is_ssh_dump_target; then + _dep="$_dep ssh-client" + fi + + if [[ "$(uname -m)" == "s390x" ]]; then + _dep="$_dep znet" + fi + + if [[ -n "$(ls -A /sys/class/drm 2> /dev/null)" ]] || [[ -d /sys/module/hyperv_fb ]]; then + add_opt_module drm + fi + + if is_generic_fence_kdump || is_pcs_fence_kdump; then + _dep="$_dep network" + fi + + echo "$_dep" +} + +kdump_is_bridge() { + [[ -d /sys/class/net/"$1"/bridge ]] +} + +kdump_is_bond() { + [[ -d /sys/class/net/"$1"/bonding ]] +} + +kdump_is_team() { + [[ -f /usr/bin/teamnl ]] && teamnl "$1" ports &> /dev/null +} + +kdump_is_vlan() { + [[ -f /proc/net/vlan/"$1" ]] +} + +# $1: netdev name +source_ifcfg_file() { + local ifcfg_file + + dwarning "Network Scripts are deprecated. You are encouraged to set up network by NetworkManager." + ifcfg_file=$(get_ifcfg_filename "$1") + if [[ -f ${ifcfg_file} ]]; then + . "${ifcfg_file}" + else + dwarning "The ifcfg file of $1 is not found!" + fi +} + +kdump_setup_dns() { + local _netdev="$1" + local _conpath="$2" + local _nameserver _dns _tmp array + local _dnsfile=${initdir}/etc/cmdline.d/42dns.conf + + _tmp=$(get_nmcli_field_by_conpath "IP4.DNS" "$_conpath") + # shellcheck disable=SC2206 + array=(${_tmp//|/ }) + if [[ ${array[*]} ]]; then + for _dns in "${array[@]}"; do + echo "nameserver=$_dns" >> "$_dnsfile" + done + else + dwarning "Failed to get DNS info via nmcli output. Now try sourcing ifcfg script" + source_ifcfg_file "$_netdev" + [[ -n $DNS1 ]] && echo "nameserver=$DNS1" > "$_dnsfile" + [[ -n $DNS2 ]] && echo "nameserver=$DNS2" >> "$_dnsfile" + fi + + while read -r content; do + _nameserver=$(echo "$content" | grep ^nameserver) + [[ -z $_nameserver ]] && continue + + _dns=$(echo "$_nameserver" | awk '{print $2}') + [[ -z $_dns ]] && continue + + if [[ ! -f $_dnsfile ]] || ! grep -q "$_dns" "$_dnsfile"; then + echo "nameserver=$_dns" >> "$_dnsfile" + fi + done < "/etc/resolv.conf" +} + +# $1: repeat times +# $2: string to be repeated +# $3: separator +repeatedly_join_str() { + local _count="$1" + local _str="$2" + local _separator="$3" + local i _res + + if [[ $_count -le 0 ]]; then + echo -n "" + return + fi + + i=0 + _res="$_str" + ((_count--)) + + while [[ $i -lt $_count ]]; do + ((i++)) + _res="${_res}${_separator}${_str}" + done + echo -n "$_res" +} + +# $1: prefix +# $2: ipv6_flag="-6" indicates it's IPv6 +# Given a prefix, calculate the netmask (equivalent of "ipcalc -m") +# by concatenating three parts, +# 1) the groups with all bits set 1 +# 2) a group with partial bits set to 0 +# 3) the groups with all bits set to 0 +cal_netmask_by_prefix() { + local _prefix="$1" + local _ipv6_flag="$2" _ipv6 + local _bits_per_octet=8 + local _count _res _octets_per_group _octets_total _seperator _total_groups + local _max_group_value _max_group_value_repr _bits_per_group _tmp _zero_bits + + if [[ $_ipv6_flag == "-6" ]]; then + _ipv6=1 + else + _ipv6=0 + fi + + if [[ $_prefix -lt 0 || $_prefix -gt 128 ]] \ + || ( ((!_ipv6)) && [[ $_prefix -gt 32 ]]); then + derror "Bad prefix:$_prefix for calculating netmask" + exit 1 + fi + + if ((_ipv6)); then + _octets_per_group=2 + _octets_total=16 + _seperator=":" + else + _octets_per_group=1 + _octets_total=4 + _seperator="." + fi + + _total_groups=$((_octets_total / _octets_per_group)) + _bits_per_group=$((_octets_per_group * _bits_per_octet)) + _max_group_value=$(((1 << _bits_per_group) - 1)) + + if ((_ipv6)); then + _max_group_value_repr=$(printf "%x" $_max_group_value) + else + _max_group_value_repr="$_max_group_value" + fi + + _count=$((_prefix / _octets_per_group / _bits_per_octet)) + _first_part=$(repeatedly_join_str "$_count" "$_max_group_value_repr" "$_seperator") + _res="$_first_part" + + _tmp=$((_octets_total * _bits_per_octet - _prefix)) + _zero_bits=$((_tmp % _bits_per_group)) + if [[ $_zero_bits -ne 0 ]]; then + _second_part=$((_max_group_value >> _zero_bits << _zero_bits)) + if ((_ipv6)); then + _second_part=$(printf "%x" $_second_part) + fi + ((_count++)) + if [[ -z $_first_part ]]; then + _res="$_second_part" + else + _res="${_first_part}${_seperator}${_second_part}" + fi + fi + + _count=$((_total_groups - _count)) + if [[ $_count -eq 0 ]]; then + echo -n "$_res" + return + fi + + if ((_ipv6)) && [[ $_count -gt 1 ]]; then + # use condensed notion for IPv6 + _third_part=":" + else + _third_part=$(repeatedly_join_str "$_count" "0" "$_seperator") + fi + + if [[ -z $_res ]] && ((!_ipv6)); then + echo -n "${_third_part}" + else + echo -n "${_res}${_seperator}${_third_part}" + fi +} + +#$1: netdev name +#$2: srcaddr +#if it use static ip echo it, or echo null +kdump_static_ip() { + local _netdev="$1" _srcaddr="$2" kdumpnic="$3" _ipv6_flag + local _netmask _gateway _ipaddr _target _nexthop _prefix + + _ipaddr=$(ip addr show dev "$_netdev" permanent | awk "/ $_srcaddr\/.* /{print \$2}") + + if is_ipv6_address "$_srcaddr"; then + _ipv6_flag="-6" + fi + + if [[ -n $_ipaddr ]]; then + _gateway=$(ip $_ipv6_flag route list dev "$_netdev" \ + | awk '/^default /{print $3}' | head -n 1) + + if [[ "x" != "x"$_ipv6_flag ]]; then + # _ipaddr="2002::56ff:feb6:56d5/64", _netmask is the number after "/" + _netmask=${_ipaddr#*\/} + _srcaddr="[$_srcaddr]" + _gateway="[$_gateway]" + else + _prefix=$(cut -d'/' -f2 <<< "$_ipaddr") + if ! _netmask=$(cal_netmask_by_prefix "$_prefix" "$_ipv6_flag"); then + derror "Failed to calculate netmask for $_ipaddr" + exit 1 + fi + fi + echo -n "${_srcaddr}::${_gateway}:${_netmask}::" + fi + + /sbin/ip $_ipv6_flag route show | grep -v default \ + | grep ".*via.* $_netdev " | grep -v "^[[:space:]]*nexthop" \ + | while read -r _route; do + _target=$(echo "$_route" | awk '{print $1}') + _nexthop=$(echo "$_route" | awk '{print $3}') + if [[ "x" != "x"$_ipv6_flag ]]; then + _target="[$_target]" + _nexthop="[$_nexthop]" + fi + echo "rd.route=$_target:$_nexthop:$kdumpnic" + done >> "${initdir}/etc/cmdline.d/45route-static.conf" + + kdump_handle_mulitpath_route "$_netdev" "$_srcaddr" "$kdumpnic" +} + +kdump_handle_mulitpath_route() { + local _netdev="$1" _srcaddr="$2" kdumpnic="$3" _ipv6_flag + local _target _nexthop _route _weight _max_weight _rule + + if is_ipv6_address "$_srcaddr"; then + _ipv6_flag="-6" + fi + + while IFS="" read -r _route; do + if [[ $_route =~ [[:space:]]+nexthop ]]; then + _route=${_route##[[:space:]]} + # Parse multipath route, using previous _target + [[ $_target == 'default' ]] && continue + [[ $_route =~ .*via.*\ $_netdev ]] || continue + + _weight=$(echo "$_route" | cut -d ' ' -f7) + if [[ $_weight -gt $_max_weight ]]; then + _nexthop=$(echo "$_route" | cut -d ' ' -f3) + _max_weight=$_weight + if [[ "x" != "x"$_ipv6_flag ]]; then + _rule="rd.route=[$_target]:[$_nexthop]:$kdumpnic" + else + _rule="rd.route=$_target:$_nexthop:$kdumpnic" + fi + fi + else + [[ -n $_rule ]] && echo "$_rule" + _target=$(echo "$_route" | cut -d ' ' -f1) + _rule="" _max_weight=0 _weight=0 + fi + done >> "${initdir}/etc/cmdline.d/45route-static.conf" \ + <<< "$(/sbin/ip $_ipv6_flag route show)" + + [[ -n $_rule ]] && echo "$_rule" >> "${initdir}/etc/cmdline.d/45route-static.conf" +} + +kdump_get_mac_addr() { + cat "/sys/class/net/$1/address" +} + +#Bonding or team master modifies the mac address +#of its slaves, we should use perm address +kdump_get_perm_addr() { + local addr + addr=$(ethtool -P "$1" | sed -e 's/Permanent address: //') + if [[ -z $addr ]] || [[ $addr == "00:00:00:00:00:00" ]]; then + derror "Can't get the permanent address of $1" + else + echo "$addr" + fi +} + +# Prefix kernel assigned names with "kdump-". EX: eth0 -> kdump-eth0 +# Because kernel assigned names are not persistent between 1st and 2nd +# kernel. We could probably end up with eth0 being eth1, eth0 being +# eth1, and naming conflict happens. +kdump_setup_ifname() { + local _ifname + + # If ifname already has 'kdump-' prefix, we must be switching from + # fadump to kdump. Skip prefixing 'kdump-' in this case as adding + # another prefix may truncate the ifname. Since an ifname with + # 'kdump-' is already persistent, this should be fine. + if [[ $1 =~ eth* ]] && [[ ! $1 =~ ^kdump-* ]]; then + _ifname="kdump-$1" + else + _ifname="$1" + fi + + echo "$_ifname" +} + +kdump_setup_bridge() { + local _netdev=$1 + local _brif _dev _mac _kdumpdev + for _dev in "/sys/class/net/$_netdev/brif/"*; do + [[ -e $_dev ]] || continue + _dev=${_dev##*/} + _kdumpdev=$_dev + if kdump_is_bond "$_dev"; then + (kdump_setup_bond "$_dev" "$(get_nmcli_connection_apath_by_ifname "$_dev")") || exit 1 + elif kdump_is_team "$_dev"; then + kdump_setup_team "$_dev" + elif kdump_is_vlan "$_dev"; then + kdump_setup_vlan "$_dev" + else + _mac=$(kdump_get_mac_addr "$_dev") + _kdumpdev=$(kdump_setup_ifname "$_dev") + echo -n " ifname=$_kdumpdev:$_mac" >> "${initdir}/etc/cmdline.d/41bridge.conf" + fi + _brif+="$_kdumpdev," + done + echo " bridge=$_netdev:${_brif%,}" >> "${initdir}/etc/cmdline.d/41bridge.conf" +} + +# drauct takes bond=<bondname>[:<bondslaves>:[:<options>]] syntax to parse +# bond. For example: +# bond=bond0:eth0,eth1:mode=balance-rr +kdump_setup_bond() { + local _netdev="$1" + local _conpath="$2" + local _dev _mac _slaves _kdumpdev _bondoptions + for _dev in $(cat "/sys/class/net/$_netdev/bonding/slaves"); do + _mac=$(kdump_get_perm_addr "$_dev") + _kdumpdev=$(kdump_setup_ifname "$_dev") + echo -n " ifname=$_kdumpdev:$_mac" >> "${initdir}/etc/cmdline.d/42bond.conf" + _slaves+="$_kdumpdev," + done + echo -n " bond=$_netdev:${_slaves%,}" >> "${initdir}/etc/cmdline.d/42bond.conf" + + _bondoptions=$(get_nmcli_field_by_conpath "bond.options" "$_conpath") + + if [[ -z $_bondoptions ]]; then + dwarning "Failed to get bond configuration via nmlci output. Now try sourcing ifcfg script." + source_ifcfg_file "$_netdev" + _bondoptions="$(echo "$BONDING_OPTS" | xargs echo | tr " " ",")" + fi + + if [[ -z $_bondoptions ]]; then + derror "Get empty bond options" + exit 1 + fi + + echo ":$_bondoptions" >> "${initdir}/etc/cmdline.d/42bond.conf" +} + +kdump_setup_team() { + local _netdev=$1 + local _dev _mac _slaves _kdumpdev + for _dev in $(teamnl "$_netdev" ports | awk -F':' '{print $2}'); do + _mac=$(kdump_get_perm_addr "$_dev") + _kdumpdev=$(kdump_setup_ifname "$_dev") + echo -n " ifname=$_kdumpdev:$_mac" >> "${initdir}/etc/cmdline.d/44team.conf" + _slaves+="$_kdumpdev," + done + echo " team=$_netdev:${_slaves%,}" >> "${initdir}/etc/cmdline.d/44team.conf" + #Buggy version teamdctl outputs to stderr! + #Try to use the latest version of teamd. + if ! teamdctl "$_netdev" config dump > "${initdir}/tmp/$$-$_netdev.conf"; then + derror "teamdctl failed." + exit 1 + fi + inst_dir /etc/teamd + inst_simple "${initdir}/tmp/$$-$_netdev.conf" "/etc/teamd/$_netdev.conf" + rm -f "${initdir}/tmp/$$-$_netdev.conf" +} + +kdump_setup_vlan() { + local _netdev=$1 + local _phydev + local _netmac + local _kdumpdev + + _phydev="$(awk '/^Device:/{print $2}' /proc/net/vlan/"$_netdev")" + _netmac="$(kdump_get_mac_addr "$_phydev")" + + #Just support vlan over bond and team + if kdump_is_bridge "$_phydev"; then + derror "Vlan over bridge is not supported!" + exit 1 + elif kdump_is_bond "$_phydev"; then + (kdump_setup_bond "$_phydev" "$(get_nmcli_connection_apath_by_ifname "$_phydev")") || exit 1 + echo " vlan=$(kdump_setup_ifname "$_netdev"):$_phydev" > "${initdir}/etc/cmdline.d/43vlan.conf" + else + _kdumpdev="$(kdump_setup_ifname "$_phydev")" + echo " vlan=$(kdump_setup_ifname "$_netdev"):$_kdumpdev ifname=$_kdumpdev:$_netmac" > "${initdir}/etc/cmdline.d/43vlan.conf" + fi +} + +# find online znet device +# return ifname (_netdev) +# code reaped from the list_configured function of +# https://github.com/hreinecke/s390-tools/blob/master/zconf/znetconf +find_online_znet_device() { + local CCWGROUPBUS_DEVICEDIR="/sys/bus/ccwgroup/devices" + local NETWORK_DEVICES d ifname ONLINE + + [[ ! -d $CCWGROUPBUS_DEVICEDIR ]] && return + NETWORK_DEVICES=$(find $CCWGROUPBUS_DEVICEDIR) + for d in $NETWORK_DEVICES; do + [[ ! -f "$d/online" ]] && continue + read -r ONLINE < "$d/online" + if [[ $ONLINE -ne 1 ]]; then + continue + fi + # determine interface name, if there (only for qeth and if + # device is online) + if [[ -f $d/if_name ]]; then + read -r ifname < "$d/if_name" + elif [[ -d $d/net ]]; then + ifname=$(ls "$d/net/") + fi + [[ -n $ifname ]] && break + done + echo -n "$ifname" +} + +# setup s390 znet cmdline +# $1: netdev (ifname) +# $2: nmcli connection path +kdump_setup_znet() { + local _netdev="$1" + local _conpath="$2" + local s390_prefix="802-3-ethernet.s390-" + local _options="" + local NETTYPE + local SUBCHANNELS + + NETTYPE=$(get_nmcli_field_by_conpath "${s390_prefix}nettype" "$_conpath") + SUBCHANNELS=$(get_nmcli_field_by_conpath "${s390_prefix}subchannels" "$_conpath") + _options=$(get_nmcli_field_by_conpath "${s390_prefix}options" "$_conpath") + + if [[ -z $NETTYPE || -z $SUBCHANNELS || -z $_options ]]; then + dwarning "Failed to get znet configuration via nmlci output. Now try sourcing ifcfg script." + source_ifcfg_file "$_netdev" + for i in $OPTIONS; do + _options=${_options},$i + done + fi + + if [[ -z $NETTYPE || -z $SUBCHANNELS || -z $_options ]]; then + exit 1 + fi + + echo "rd.znet=${NETTYPE},${SUBCHANNELS},${_options} rd.znet_ifname=$_netdev:${SUBCHANNELS}" > "${initdir}/etc/cmdline.d/30znet.conf" +} + +kdump_get_ip_route() { + local _route + if ! _route=$(/sbin/ip -o route get to "$1" 2>&1); then + derror "Bad kdump network destination: $1" + exit 1 + fi + echo "$_route" +} + +kdump_get_ip_route_field() { + echo "$1" | sed -n -e "s/^.*\<$2\>\s\+\(\S\+\).*$/\1/p" +} + +kdump_get_remote_ip() { + local _remote _remote_temp + _remote=$(get_remote_host "$1") + if is_hostname "$_remote"; then + _remote_temp=$(getent ahosts "$_remote" | grep -v : | head -n 1) + if [[ -z $_remote_temp ]]; then + _remote_temp=$(getent ahosts "$_remote" | head -n 1) + fi + _remote=$(echo "$_remote_temp" | awk '{print $1}') + fi + echo "$_remote" +} + +# Setup dracut to bring up network interface that enable +# initramfs accessing giving destination +# $1: destination host +kdump_install_net() { + local _destaddr _srcaddr _route _netdev _conpath kdumpnic + local _static _proto _ip_conf _ip_opts _ifname_opts + local _znet_netdev _znet_conpath + + _destaddr=$(kdump_get_remote_ip "$1") + _route=$(kdump_get_ip_route "$_destaddr") + _srcaddr=$(kdump_get_ip_route_field "$_route" "src") + _netdev=$(kdump_get_ip_route_field "$_route" "dev") + _conpath=$(get_nmcli_connection_apath_by_ifname "$_netdev") + _netmac=$(kdump_get_mac_addr "$_netdev") + kdumpnic=$(kdump_setup_ifname "$_netdev") + + _znet_netdev=$(find_online_znet_device) + if [[ -n $_znet_netdev ]]; then + _znet_conpath=$(get_nmcli_connection_apath_by_ifname "$_znet_netdev") + if ! (kdump_setup_znet "$_znet_netdev" "$_znet_conpath"); then + derror "Failed to set up znet" + exit 1 + fi + fi + + _static=$(kdump_static_ip "$_netdev" "$_srcaddr" "$kdumpnic") + if [[ -n $_static ]]; then + _proto=none + elif is_ipv6_address "$_srcaddr"; then + _proto=auto6 + else + _proto=dhcp + fi + + _ip_conf="${initdir}/etc/cmdline.d/40ip.conf" + _ip_opts=" ip=${_static}$kdumpnic:${_proto}" + + # dracut doesn't allow duplicated configuration for same NIC, even they're exactly the same. + # so we have to avoid adding duplicates + # We should also check /proc/cmdline for existing ip=xx arg. + # For example, iscsi boot will specify ip=xxx arg in cmdline. + if [[ ! -f $_ip_conf ]] || ! grep -q "$_ip_opts" "$_ip_conf" \ + && ! grep -q "ip=[^[:space:]]*$_netdev" /proc/cmdline; then + echo "$_ip_opts" >> "$_ip_conf" + fi + + if kdump_is_bridge "$_netdev"; then + kdump_setup_bridge "$_netdev" + elif kdump_is_bond "$_netdev"; then + (kdump_setup_bond "$_netdev" "$_conpath") || exit 1 + elif kdump_is_team "$_netdev"; then + kdump_setup_team "$_netdev" + elif kdump_is_vlan "$_netdev"; then + kdump_setup_vlan "$_netdev" + else + _ifname_opts=" ifname=$kdumpnic:$_netmac" + echo "$_ifname_opts" >> "$_ip_conf" + fi + + kdump_setup_dns "$_netdev" "$_conpath" + + if [[ ! -f ${initdir}/etc/cmdline.d/50neednet.conf ]]; then + # network-manager module needs this parameter + echo "rd.neednet" >> "${initdir}/etc/cmdline.d/50neednet.conf" + fi + + # Save netdev used for kdump as cmdline + # Whoever calling kdump_install_net() is setting up the default gateway, + # ie. bootdev/kdumpnic. So don't override the setting if calling + # kdump_install_net() for another time. For example, after setting eth0 as + # the default gate way for network dump, eth1 in the fence kdump path will + # call kdump_install_net again and we don't want eth1 to be the default + # gateway. + if [[ ! -f ${initdir}/etc/cmdline.d/60kdumpnic.conf ]] \ + && [[ ! -f ${initdir}/etc/cmdline.d/70bootdev.conf ]]; then + echo "kdumpnic=$kdumpnic" > "${initdir}/etc/cmdline.d/60kdumpnic.conf" + echo "bootdev=$kdumpnic" > "${initdir}/etc/cmdline.d/70bootdev.conf" + fi +} + +# install etc/kdump/pre.d and /etc/kdump/post.d +kdump_install_pre_post_conf() { + if [[ -d /etc/kdump/pre.d ]]; then + for file in /etc/kdump/pre.d/*; do + if [[ -x $file ]]; then + dracut_install "$file" + elif [[ $file != "/etc/kdump/pre.d/*" ]]; then + echo "$file is not executable" + fi + done + fi + + if [[ -d /etc/kdump/post.d ]]; then + for file in /etc/kdump/post.d/*; do + if [[ -x $file ]]; then + dracut_install "$file" + elif [[ $file != "/etc/kdump/post.d/*" ]]; then + echo "$file is not executable" + fi + done + fi +} + +default_dump_target_install_conf() { + local _target _fstype + local _mntpoint _save_path + + is_user_configured_dump_target && return + + _save_path=$(get_bind_mount_source "$(get_save_path)") + _target=$(get_target_from_path "$_save_path") + _mntpoint=$(get_mntpoint_from_target "$_target") + + _fstype=$(get_fs_type_from_target "$_target") + if is_fs_type_nfs "$_fstype"; then + kdump_install_net "$_target" + _fstype="nfs" + else + _target=$(kdump_get_persistent_dev "$_target") + fi + + echo "$_fstype $_target" >> "${initdir}/tmp/$$-kdump.conf" + + # don't touch the path under root mount + if [[ $_mntpoint != "/" ]]; then + _save_path=${_save_path##"$_mntpoint"} + fi + + #erase the old path line, then insert the parsed path + sed -i "/^path/d" "${initdir}/tmp/$$-kdump.conf" + echo "path $_save_path" >> "${initdir}/tmp/$$-kdump.conf" +} + +#install kdump.conf and what user specifies in kdump.conf +kdump_install_conf() { + local _opt _val _pdev + + kdump_read_conf > "${initdir}/tmp/$$-kdump.conf" + + while read -r _opt _val; do + # remove inline comments after the end of a directive. + case "$_opt" in + raw) + _pdev=$(persistent_policy="by-id" kdump_get_persistent_dev "$_val") + sed -i -e "s#^${_opt}[[:space:]]\+$_val#$_opt $_pdev#" "${initdir}/tmp/$$-kdump.conf" + ;; + ext[234] | xfs | btrfs | minix) + _pdev=$(kdump_get_persistent_dev "$_val") + sed -i -e "s#^${_opt}[[:space:]]\+$_val#$_opt $_pdev#" "${initdir}/tmp/$$-kdump.conf" + ;; + ssh | nfs) + kdump_install_net "$_val" + ;; + dracut_args) + if [[ $(get_dracut_args_fstype "$_val") == nfs* ]]; then + kdump_install_net "$(get_dracut_args_target "$_val")" + fi + ;; + kdump_pre | kdump_post | extra_bins) + # shellcheck disable=SC2086 + dracut_install $_val + ;; + core_collector) + dracut_install "${_val%%[[:blank:]]*}" + ;; + esac + done <<< "$(kdump_read_conf)" + + kdump_install_pre_post_conf + + default_dump_target_install_conf + + kdump_configure_fence_kdump "${initdir}/tmp/$$-kdump.conf" + inst "${initdir}/tmp/$$-kdump.conf" "/etc/kdump.conf" + rm -f "${initdir}/tmp/$$-kdump.conf" +} + +# Default sysctl parameters should suffice for kdump kernel. +# Remove custom configurations sysctl.conf & sysctl.d/* +remove_sysctl_conf() { + + # As custom configurations like vm.min_free_kbytes can lead + # to OOM issues in kdump kernel, avoid them + rm -f "${initdir}/etc/sysctl.conf" + rm -rf "${initdir}/etc/sysctl.d" + rm -rf "${initdir}/run/sysctl.d" + rm -rf "${initdir}/usr/lib/sysctl.d" +} + +kdump_iscsi_get_rec_val() { + + local result + + # The open-iscsi 742 release changed to using flat files in + # /var/lib/iscsi. + + result=$(/sbin/iscsiadm --show -m session -r "$1" | grep "^${2} = ") + result=${result##* = } + echo "$result" +} + +kdump_get_iscsi_initiator() { + local _initiator + local initiator_conf="/etc/iscsi/initiatorname.iscsi" + + [[ -f $initiator_conf ]] || return 1 + + while read -r _initiator; do + [[ -z ${_initiator%%#*} ]] && continue # Skip comment lines + + case $_initiator in + InitiatorName=*) + initiator=${_initiator#InitiatorName=} + echo "rd.iscsi.initiator=${initiator}" + return 0 + ;; + *) ;; + esac + done < ${initiator_conf} + + return 1 +} + +# Figure out iBFT session according to session type +is_ibft() { + [[ "$(kdump_iscsi_get_rec_val "$1" "node.discovery_type")" == fw ]] +} + +kdump_setup_iscsi_device() { + local path=$1 + local tgt_name + local tgt_ipaddr + local username + local password + local userpwd_str + local username_in + local password_in + local userpwd_in_str + local netroot_str + local initiator_str + local netroot_conf="${initdir}/etc/cmdline.d/50iscsi.conf" + local initiator_conf="/etc/iscsi/initiatorname.iscsi" + + dinfo "Found iscsi component $1" + + # Check once before getting explicit values, so we can bail out early, + # e.g. in case of pure-hardware(all-offload) iscsi. + if ! /sbin/iscsiadm -m session -r "$path" &> /dev/null; then + return 1 + fi + + if is_ibft "$path"; then + return + fi + + # Remove software iscsi cmdline generated by 95iscsi, + # and let kdump regenerate here. + rm -f "${initdir}/etc/cmdline.d/95iscsi.conf" + + tgt_name=$(kdump_iscsi_get_rec_val "$path" "node.name") + tgt_ipaddr=$(kdump_iscsi_get_rec_val "$path" "node.conn\[0\].address") + + # get and set username and password details + username=$(kdump_iscsi_get_rec_val "$path" "node.session.auth.username") + [[ $username == "<empty>" ]] && username="" + password=$(kdump_iscsi_get_rec_val "$path" "node.session.auth.password") + [[ $password == "<empty>" ]] && password="" + username_in=$(kdump_iscsi_get_rec_val "$path" "node.session.auth.username_in") + [[ -n $username ]] && userpwd_str="$username:$password" + + # get and set incoming username and password details + [[ $username_in == "<empty>" ]] && username_in="" + password_in=$(kdump_iscsi_get_rec_val "$path" "node.session.auth.password_in") + [[ $password_in == "<empty>" ]] && password_in="" + + [[ -n $username_in ]] && userpwd_in_str=":$username_in:$password_in" + + kdump_install_net "$tgt_ipaddr" + + # prepare netroot= command line + # FIXME: Do we need to parse and set other parameters like protocol, port + # iscsi_iface_name, netdev_name, LUN etc. + + if is_ipv6_address "$tgt_ipaddr"; then + tgt_ipaddr="[$tgt_ipaddr]" + fi + netroot_str="netroot=iscsi:${userpwd_str}${userpwd_in_str}@$tgt_ipaddr::::$tgt_name" + + [[ -f $netroot_conf ]] || touch "$netroot_conf" + + # If netroot target does not exist already, append. + if ! grep -q "$netroot_str" "$netroot_conf"; then + echo "$netroot_str" >> "$netroot_conf" + dinfo "Appended $netroot_str to $netroot_conf" + fi + + # Setup initator + if ! initiator_str=$(kdump_get_iscsi_initiator); then + derror "Failed to get initiator name" + return 1 + fi + + # If initiator details do not exist already, append. + if ! grep -q "$initiator_str" "$netroot_conf"; then + echo "$initiator_str" >> "$netroot_conf" + dinfo "Appended $initiator_str to $netroot_conf" + fi +} + +kdump_check_iscsi_targets() { + # If our prerequisites are not met, fail anyways. + type -P iscsistart > /dev/null || return 1 + + kdump_check_setup_iscsi() ( + local _dev + _dev=$1 + + [[ -L /sys/dev/block/$_dev ]] || return + cd "$(readlink -f "/sys/dev/block/$_dev")" || return 1 + until [[ -d sys || -d iscsi_session ]]; do + cd .. + done + [[ -d iscsi_session ]] && kdump_setup_iscsi_device "$PWD" + ) + + [[ $hostonly ]] || [[ $mount_needs ]] && { + for_each_host_dev_and_slaves_all kdump_check_setup_iscsi + } +} + +# hostname -a is deprecated, do it by ourself +get_alias() { + local ips + local entries + local alias_set + + ips=$(hostname -I) + for ip in $ips; do + # in /etc/hosts, alias can come at the 2nd column + if entries=$(grep "$ip" /etc/hosts | awk '{ $1=""; print $0 }'); then + alias_set="$alias_set $entries" + fi + done + + echo "$alias_set" +} + +is_localhost() { + local hostnames + local shortnames + local aliasname + local nodename=$1 + + hostnames=$(hostname -A) + shortnames=$(hostname -A -s) + aliasname=$(get_alias) + hostnames="$hostnames $shortnames $aliasname" + + for name in ${hostnames}; do + if [[ $name == "$nodename" ]]; then + return 0 + fi + done + return 1 +} + +# retrieves fence_kdump nodes from Pacemaker cluster configuration +get_pcs_fence_kdump_nodes() { + local nodes + + pcs cluster sync > /dev/null 2>&1 && pcs cluster cib-upgrade > /dev/null 2>&1 + # get cluster nodes from cluster cib, get interface and ip address + nodelist=$(pcs cluster cib | xmllint --xpath "/cib/status/node_state/@uname" -) + + # nodelist is formed as 'uname="node1" uname="node2" ... uname="nodeX"' + # we need to convert each to node1, node2 ... nodeX in each iteration + for node in ${nodelist}; do + # convert $node from 'uname="nodeX"' to 'nodeX' + eval "$node" + nodename="$uname" + # Skip its own node name + if is_localhost "$nodename"; then + continue + fi + nodes="$nodes $nodename" + done + + echo "$nodes" +} + +# retrieves fence_kdump args from config file +get_pcs_fence_kdump_args() { + if [[ -f $FENCE_KDUMP_CONFIG_FILE ]]; then + . "$FENCE_KDUMP_CONFIG_FILE" + echo "$FENCE_KDUMP_OPTS" + fi +} + +get_generic_fence_kdump_nodes() { + local filtered + local nodes + + nodes=$(kdump_get_conf_val "fence_kdump_nodes") + for node in ${nodes}; do + # Skip its own node name + if is_localhost "$node"; then + continue + fi + filtered="$filtered $node" + done + echo "$filtered" +} + +# setup fence_kdump in cluster +# setup proper network and install needed files +kdump_configure_fence_kdump() { + local kdump_cfg_file=$1 + local nodes + local args + + if is_generic_fence_kdump; then + nodes=$(get_generic_fence_kdump_nodes) + + elif is_pcs_fence_kdump; then + nodes=$(get_pcs_fence_kdump_nodes) + + # set appropriate options in kdump.conf + echo "fence_kdump_nodes $nodes" >> "${kdump_cfg_file}" + + args=$(get_pcs_fence_kdump_args) + if [[ -n $args ]]; then + echo "fence_kdump_args $args" >> "${kdump_cfg_file}" + fi + + else + # fence_kdump not configured + return 1 + fi + + # setup network for each node + for node in ${nodes}; do + kdump_install_net "$node" + done + + dracut_install /etc/hosts + dracut_install /etc/nsswitch.conf + dracut_install "$FENCE_KDUMP_SEND" +} + +# Install a random seed used to feed /dev/urandom +# By the time kdump service starts, /dev/uramdom is already fed by systemd +kdump_install_random_seed() { + local poolsize + + poolsize=$(< /proc/sys/kernel/random/poolsize) + + if [[ ! -d "${initdir}/var/lib/" ]]; then + mkdir -p "${initdir}/var/lib/" + fi + + dd if=/dev/urandom of="${initdir}/var/lib/random-seed" \ + bs="$poolsize" count=1 2> /dev/null +} + +kdump_install_systemd_conf() { + # Kdump turns out to require longer default systemd mount timeout + # than 1st kernel(90s by default), we use default 300s for kdump. + if ! grep -q -r "^[[:space:]]*DefaultTimeoutStartSec=" "${initdir}/etc/systemd/system.conf"*; then + mkdir -p "${initdir}/etc/systemd/system.conf.d" + echo "[Manager]" > "${initdir}/etc/systemd/system.conf.d/kdump.conf" + echo "DefaultTimeoutStartSec=300s" >> "${initdir}/etc/systemd/system.conf.d/kdump.conf" + fi + + # Forward logs to console directly, and don't read Kmsg, this avoids + # unneccessary memory consumption and make console output more useful. + # Only do so for non fadump image. + mkdir -p "${initdir}/etc/systemd/journald.conf.d" + echo "[Journal]" > "${initdir}/etc/systemd/journald.conf.d/kdump.conf" + echo "Storage=volatile" >> "${initdir}/etc/systemd/journald.conf.d/kdump.conf" + echo "ReadKMsg=no" >> "${initdir}/etc/systemd/journald.conf.d/kdump.conf" + echo "ForwardToConsole=yes" >> "${initdir}/etc/systemd/journald.conf.d/kdump.conf" +} + +remove_cpu_online_rule() { + local file=${initdir}/usr/lib/udev/rules.d/40-redhat.rules + + sed -i '/SUBSYSTEM=="cpu"/d' "$file" +} + +install() { + local arch + + kdump_module_init + kdump_install_conf + remove_sysctl_conf + + # Onlining secondary cpus breaks kdump completely on KVM on Power hosts + # Though we use maxcpus=1 by default but 40-redhat.rules will bring up all + # possible cpus by default. (rhbz1270174 rhbz1266322) + # Thus before we get the kernel fix and the systemd rule fix let's remove + # the cpu online rule in kdump initramfs. + arch=$(uname -m) + if [[ "$arch" = "ppc64le" ]] || [[ "$arch" = "ppc64" ]]; then + remove_cpu_online_rule + fi + + if is_ssh_dump_target; then + kdump_install_random_seed + fi + dracut_install -o /etc/adjtime /etc/localtime + inst "$moddir/monitor_dd_progress" "/kdumpscripts/monitor_dd_progress" + chmod +x "${initdir}/kdumpscripts/monitor_dd_progress" + inst "/bin/dd" "/bin/dd" + inst "/bin/tail" "/bin/tail" + inst "/bin/date" "/bin/date" + inst "/bin/sync" "/bin/sync" + inst "/bin/cut" "/bin/cut" + inst "/bin/head" "/bin/head" + inst "/bin/awk" "/bin/awk" + inst "/bin/sed" "/bin/sed" + inst "/bin/stat" "/bin/stat" + inst "/sbin/makedumpfile" "/sbin/makedumpfile" + inst "/sbin/vmcore-dmesg" "/sbin/vmcore-dmesg" + inst "/usr/bin/printf" "/sbin/printf" + inst "/usr/bin/logger" "/sbin/logger" + inst "/usr/bin/chmod" "/sbin/chmod" + inst "/lib/kdump/kdump-lib-initramfs.sh" "/lib/kdump-lib-initramfs.sh" + inst "/lib/kdump/kdump-logger.sh" "/lib/kdump-logger.sh" + inst "$moddir/kdump.sh" "/usr/bin/kdump.sh" + inst "$moddir/kdump-capture.service" "$systemdsystemunitdir/kdump-capture.service" + systemctl -q --root "$initdir" add-wants initrd.target kdump-capture.service + # Replace existing emergency service and emergency target + cp "$moddir/kdump-emergency.service" "$initdir/$systemdsystemunitdir/emergency.service" + cp "$moddir/kdump-emergency.target" "$initdir/$systemdsystemunitdir/emergency.target" + # Also redirect dracut-emergency to kdump error handler + ln_r "$systemdsystemunitdir/emergency.service" "$systemdsystemunitdir/dracut-emergency.service" + + # Check for all the devices and if any device is iscsi, bring up iscsi + # target. Ideally all this should be pushed into dracut iscsi module + # at some point of time. + kdump_check_iscsi_targets + + kdump_install_systemd_conf + + # nfs/ssh dump will need to get host ip in second kernel and need to call 'ip' tool, see get_host_ip for more detail + if is_nfs_dump_target || is_ssh_dump_target; then + inst "ip" + fi + + # For the lvm type target under kdump, in /etc/lvm/lvm.conf we can + # safely replace "reserved_memory=XXXX"(default value is 8192) with + # "reserved_memory=1024" to lower memory pressure under kdump. We do + # it unconditionally here, if "/etc/lvm/lvm.conf" doesn't exist, it + # actually does nothing. + sed -i -e \ + 's/\(^[[:space:]]*reserved_memory[[:space:]]*=\)[[:space:]]*[[:digit:]]*/\1 1024/' \ + "${initdir}/etc/lvm/lvm.conf" &> /dev/null + + # Save more memory by dropping switch root capability + dracut_no_switch_root +} diff --git a/SOURCES/dracut-monitor_dd_progress b/SOURCES/dracut-monitor_dd_progress new file mode 100644 index 0000000..e139d33 --- /dev/null +++ b/SOURCES/dracut-monitor_dd_progress @@ -0,0 +1,28 @@ +#!/bin/sh + +SRC_FILE_MB=$1 + +while true +do + DD_PID=`pidof dd` + if [ -n "$DD_PID" ]; then + break + fi +done + +while true +do + sleep 5 + if [ ! -d /proc/$DD_PID ]; then + break + fi + + kill -s USR1 $DD_PID + CURRENT_SIZE=`tail -n 1 /tmp/dd_progress_file | sed "s/[^0-9].*//g"` + [ -n "$CURRENT_SIZE" ] && { + CURRENT_MB=$(($CURRENT_SIZE / 1048576)) + echo -e "Copied $CURRENT_MB MB / $SRC_FILE_MB MB\r" + } +done + +rm -f /tmp/dd_progress_file diff --git a/SOURCES/early-kdump-howto.txt b/SOURCES/early-kdump-howto.txt new file mode 100644 index 0000000..68b23c7 --- /dev/null +++ b/SOURCES/early-kdump-howto.txt @@ -0,0 +1,95 @@ +Early Kdump HOWTO + +Introduction +------------ + +Early kdump is a mechanism to make kdump operational earlier than normal kdump +service. The kdump service starts early enough for general crash cases, but +there are some cases where it has no chance to make kdump operational in boot +sequence, such as detecting devices and starting early services. If you hit +such a case, early kdump may allow you to get more information of it. + +Early kdump is implemented as a dracut module. It adds a kernel (vmlinuz) and +initramfs for kdump to your system's initramfs in order to load them as early +as possible. After that, if you provide "rd.earlykdump" in kernel command line, +then in the initramfs, early kdump will load those files like the normal kdump +service. This is disabled by default. + +For the normal kdump service, it can check whether the early kdump has loaded +the crash kernel and initramfs. It has no conflict with the early kdump. + +How to configure early kdump +---------------------------- + +We assume if you're reading this document, you should already have kexec-tools +installed. + +You can rebuild the initramfs with earlykdump support with below steps: + +1. start kdump service to make sure kdump initramfs is created. + + # systemctl start kdump + + NOTE: If a crash occurs during boot process, early kdump captures a vmcore + and reboot the system by default, so the system might go into crash loop. + You can avoid such a crash loop by adding the following settings, which + power off the system after dump capturing, to kdump.conf in advance: + + final_action poweroff + failure_action poweroff + + For the failure_action, you can choose anything other than "reboot". + +2. rebuild system initramfs with earlykdump support. + + # dracut --force --add earlykdump + + NOTE: Recommend to backup the original system initramfs before performing + this step to put it back if something happens during boot-up. + +3. add rd.earlykdump in grub kernel command line. + +After making said changes, reboot your system to take effect. Of course, if you +want to disable early kdump, you can simply remove "rd.earlykdump" from kernel +boot parameters in grub, and reboot system like above. + +Once the boot is completed, you can check the status of the early kdump support +on the command prompt: + + # journalctl -b | grep early-kdump + +Then, you will see some useful logs, for example: + +- if early kdump is successful. + +Mar 09 09:57:56 localhost dracut-cmdline[190]: early-kdump is enabled. +Mar 09 09:57:56 localhost dracut-cmdline[190]: kexec: loaded early-kdump kernel + +- if early kdump is disabled. + +Mar 09 10:02:47 localhost dracut-cmdline[189]: early-kdump is disabled. + +Notes +----- + +- The size of early kdump initramfs will be large because it includes vmlinuz + and kdump initramfs. + +- Early kdump inherits the settings of normal kdump, so any changes that + caused normal kdump rebuilding also require rebuilding the system initramfs + to make sure that the changes take effect for early kdump. Therefore, after + the rebuilding of kdump initramfs is completed, provide a prompt message to + tell the fact. + +- If you install an updated kernel and reboot the system with it, the early + kdump will be disabled by default. To enable it with the new kernel, you + need to take the above steps again. + +Limitation +---------- + +- At present, early kdump doesn't support fadump. + +- Early kdump loads a crash kernel and initramfs at the beginning of the + process in system's initramfs, so a crash at earlier than that (e.g. in + kernel initialization) cannot be captured even with the early kdump. diff --git a/SOURCES/fadump-howto.txt b/SOURCES/fadump-howto.txt new file mode 100644 index 0000000..bc87644 --- /dev/null +++ b/SOURCES/fadump-howto.txt @@ -0,0 +1,355 @@ +Firmware assisted dump (fadump) HOWTO + +Introduction + +Firmware assisted dump is a new feature in the 3.4 mainline kernel supported +only on powerpc architecture. The goal of firmware-assisted dump is to enable +the dump of a crashed system, and to do so from a fully-reset system, and to +minimize the total elapsed time until the system is back in production use. A +complete documentation on implementation can be found at +Documentation/powerpc/firmware-assisted-dump.txt in upstream linux kernel tree +from 3.4 version and above. + +Please note that the firmware-assisted dump feature is only available on Power6 +and above systems with recent firmware versions. + +Overview + +Fadump + +Fadump is a robust kernel crash dumping mechanism to get reliable kernel crash +dump with assistance from firmware. This approach does not use kexec, instead +firmware assists in booting the kdump kernel while preserving memory contents. +Unlike kdump, the system is fully reset, and loaded with a fresh copy of the +kernel. In particular, PCI and I/O devices are reinitialized and are in a +clean, consistent state. This second kernel, often called a capture kernel, +boots with very little memory and captures the dump image. + +The first kernel registers the sections of memory with the Power firmware for +dump preservation during OS initialization. These registered sections of memory +are reserved by the first kernel during early boot. When a system crashes, the +Power firmware fully resets the system, preserves all the system memory +contents, save the low memory (boot memory of size larger of 5% of system +RAM or 256MB) of RAM to the previous registered region. It will also save +system registers, and hardware PTE's. + +Fadump is supported only on ppc64 platform. The standard kernel and capture +kernel are one and the same on ppc64. + +If you're reading this document, you should already have kexec-tools +installed. If not, you install it via the following command: + + # yum install kexec-tools + +Fadump Operational Flow: + +Like kdump, fadump also exports the ELF formatted kernel crash dump through +/proc/vmcore. Hence existing kdump infrastructure can be used to capture fadump +vmcore. The idea is to keep the functionality transparent to end user. From +user perspective there is no change in the way kdump init script works. + +However, unlike kdump, fadump does not pre-load kdump kernel and initrd into +reserved memory, instead it always uses default OS initrd during second boot +after crash. Hence, for fadump, we rebuild the new kdump initrd and replace it +with default initrd. Before replacing existing default initrd we take a backup +of original default initrd for user's reference. The dracut package has been +enhanced to rebuild the default initrd with vmcore capture steps. The initrd +image is rebuilt as per the configuration in /etc/kdump.conf file. + +The control flow of fadump works as follows: +01. System panics. +02. At the crash, kernel informs power firmware that kernel has crashed. +03. Firmware takes the control and reboots the entire system preserving + only the memory (resets all other devices). +04. The reboot follows the normal booting process (non-kexec). +05. The boot loader loads the default kernel and initrd from /boot +06. The default initrd loads and runs /init +07. dracut-kdump.sh script present in fadump aware default initrd checks if + '/proc/device-tree/rtas/ibm,kernel-dump' file exists before executing + steps to capture vmcore. + (This check will help to bypass the vmcore capture steps during normal boot + process.) +09. Captures dump according to /etc/kdump.conf +10. Is dump capture successful (yes goto 12, no goto 11) +11. Perform the failure action specified in /etc/kdump.conf + (The default failure action is reboot, if unspecified) +12. Perform the final action specified in /etc/kdump.conf + (The default final action is reboot, if unspecified) + + +How to configure fadump: + +Again, we assume if you're reading this document, you should already have +kexec-tools installed. If not, you install it via the following command: + + # yum install kexec-tools + +Make the kernel to be configured with FADump as the default boot entry, if +it isn't already: + + # grubby --set-default=/boot/vmlinuz-<kver> + +Boot into the kernel to be configured for FADump. To be able to do much of +anything interesting in the way of debug analysis, you'll also need to install +the kernel-debuginfo package, of the same arch as your running kernel, and the +crash utility: + + # yum --enablerepo=\*debuginfo install kernel-debuginfo.$(uname -m) crash + +Next up, we need to modify some boot parameters to enable firmware assisted +dump. With the help of grubby, it's very easy to append "fadump=on" to the end +of your kernel boot parameters. To reserve the appropriate amount of memory +for boot memory preservation, pass 'crashkernel=X' kernel cmdline parameter. +For the recommended value of X, see 'FADump Memory Requirements' section. + + # grubby --args="fadump=on crashkernel=6G" --update-kernel=/boot/vmlinuz-`uname -r` + +By default, FADump reserved memory will be initialized as CMA area to make the +memory available through CMA allocator on the production kernel. We can opt out +of this, making reserved memory unavailable to production kernel, by booting the +linux kernel with 'fadump=nocma' instead of 'fadump=on'. + +The term 'boot memory' means size of the low memory chunk that is required for +a kernel to boot successfully when booted with restricted memory. By default, +the boot memory size will be the larger of 5% of system RAM or 256MB. +Alternatively, user can also specify boot memory size through boot parameter +'fadump_reserve_mem=' which will override the default calculated size. Use this +option if default boot memory size is not sufficient for second kernel to boot +successfully. + +After making said changes, reboot your system, so that the specified memory is +reserved and left untouched by the normal system. Take note that the output of +'free -m' will show X MB less memory than without this parameter, which is +expected. If you see OOM (Out Of Memory) error messages while loading capture +kernel, then you should bump up the memory reservation size. + +Now that you've got that reserved memory region set up, you want to turn on +the kdump init script: + + # systemctl enable kdump.service + +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 +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): + + * If /boot is a separate partition, run the below commands as the root user, + or as a user with CAP_SYS_ADMIN rights: + + # fsfreeze -f + # fsfreeze -u + + * If /boot is not a separate partition, reboot the system. + +After reboot check if the kdump service is up and running with: + + # systemctl status kdump.service + +To test out whether FADump is configured properly, you can force-crash your +system by echo'ing a 'c' into /proc/sysrq-trigger: + + # echo c > /proc/sysrq-trigger + +You should see some panic output, followed by the system reset and booting into +fresh copy of kernel. When default initrd loads and runs /init, vmcore should +be copied out to disk (by default, in /var/crash/<YYYY.MM.DD-HH:MM:SS>/vmcore), +then the system rebooted back into your normal kernel. + +Once back to your normal kernel, you can use the previously installed crash +kernel in conjunction with the previously installed kernel-debuginfo to +perform postmortem analysis: + + # crash /usr/lib/debug/lib/modules/2.6.17-1.2621.el5/vmlinux + /var/crash/2006-08-23-15:34/vmcore + + crash> bt + +and so on... + +Saving vmcore-dmesg.txt +----------------------- +Kernel log bufferes are one of the most important information available +in vmcore. Now before saving vmcore, kernel log bufferes are extracted +from /proc/vmcore and saved into a file vmcore-dmesg.txt. After +vmcore-dmesg.txt, vmcore is saved. Destination disk and directory for +vmcore-dmesg.txt is same as vmcore. Note that kernel log buffers will +not be available if dump target is raw device. + +FADump Memory Requirements: + + System Memory Recommended memory +--------------------- ---------------------- + 4 GB - 16 GB : 768 MB + 16 GB - 64 GB : 1024 MB + 64 GB - 128 GB : 2 GB + 128 GB - 1 TB : 4 GB + 1 TB - 2 TB : 6 GB + 2 TB - 4 TB : 12 GB + 4 TB - 8 TB : 20 GB + 8 TB - 16 TB : 36 GB + 16 TB - 32 TB : 64 GB + 32 TB - 64 TB : 128 GB + 64 TB & above : 180 GB + +Things to remember: + +1) The memory required to boot capture Kernel is a moving target that depends + on many factors like hardware attached to the system, kernel and modules in + use, packages installed and services enabled, there is no one-size-fits-all. + But the above recommendations are based on system memory. So, the above + recommendations for FADump come with a few assumptions, based on available + system memory, about the resources the system could have. So, please take + the recommendations with a pinch of salt and remember to try capturing dump + a few times to confirm that the system is configured successfully with dump + capturing support. + +2) Though the memory requirements for FADump seem high, this memory is not + completely set aside but made available for userspace applications to use, + through the CMA allocator. + +3) As the same initrd is used for booting production kernel as well as capture + kernel and with dump being captured in a restricted memory environment, few + optimizations (like not inclding network dracut module, disabling multipath + and such) are applied while building the initrd. In case, the production + environment needs these optimizations to be avoided, dracut_args option in + /etc/kdump.conf file could be leveraged. For example, if a user wishes for + network module to be included in the initrd, adding the below entry in + /etc/kdump.conf file and restarting kdump service would take care of it. + + dracut_args --add "network" + +4) If FADump is configured to capture vmcore to a remote dump target using SSH + or NFS protocol, the corresponding network interface '<interface-name>' is + renamed to 'kdump-<interface-name>', if it is generic (like *eth# or net#). + It happens because vmcore capture scripts in the initial RAM disk (initrd) + add the 'kdump-' prefix to the network interface name to secure persistent + naming. And as capture kernel and production kernel use the same initrd in + case of FADump, the interface name is changed for the production kernel too. + This is likely to impact network configuration setup for production kernel. + So, it is recommended to use a non-generic name for a network interface, + before setting up FADump to capture vmcore to a remote dump target based on + that network interface, to avoid running into network configuration issues. + +Dump Triggering methods: + +This section talks about the various ways, other than a Kernel Panic, in which +fadump can be triggered. The following methods assume that fadump is configured +on your system, with the scripts enabled as described in the section above. + +1) AltSysRq C + +FAdump can be triggered with the combination of the 'Alt','SysRq' and 'C' +keyboard keys. Please refer to the following link for more details: + +https://fedoraproject.org/wiki/QA/Sysrq + +In addition, on PowerPC boxes, fadump can also be triggered via Hardware +Management Console(HMC) using 'Ctrl', 'O' and 'C' keyboard keys. + +2) Kernel OOPs + +If we want to generate a dump everytime the Kernel OOPses, we can achieve this +by setting the 'Panic On OOPs' option as follows: + + # echo 1 > /proc/sys/kernel/panic_on_oops + +3) PowerPC specific methods: + +On IBM PowerPC machines, issuing a soft reset invokes the XMON debugger(if +XMON is configured). To configure XMON one needs to compile the kernel with +the CONFIG_XMON and CONFIG_XMON_DEFAULT options, or by compiling with +CONFIG_XMON and booting the kernel with xmon=on option. + +Following are the ways to remotely issue a soft reset on PowerPC boxes, which +would drop you to XMON. Pressing a 'X' (capital alphabet X) followed by an +'Enter' here will trigger the dump. + +3.1) HMC + +Hardware Management Console(HMC) available on Power4 and Power5 machines allow +partitions to be reset remotely. This is specially useful in hang situations +where the system is not accepting any keyboard inputs. + +Once you have HMC configured, the following steps will enable you to trigger +fadump via a soft reset: + +On Power4 + Using GUI + + * In the right pane, right click on the partition you wish to dump. + * Select "Operating System->Reset". + * Select "Soft Reset". + * Select "Yes". + + Using HMC Commandline + + # reset_partition -m <machine> -p <partition> -t soft + +On Power5 + Using GUI + + * In the right pane, right click on the partition you wish to dump. + * Select "Restart Partition". + * Select "Dump". + * Select "OK". + + Using HMC Commandline + + # chsysstate -m <managed system name> -n <lpar name> -o dumprestart -r lpar + +3.2) Blade Management Console for Blade Center + +To initiate a dump operation, go to Power/Restart option under "Blade Tasks" in +the Blade Management Console. Select the corresponding blade for which you want +to initate the dump and then click "Restart blade with NMI". This issues a +system reset and invokes xmon debugger. + + +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. + +Compression and filtering + +Refer "Compression and filtering" section in "kexec-kdump-howto.txt" document. +Compression and filtering are same for kdump & fadump. + + +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. + +How to disable FADump: + +Remove "fadump=on"/"fadump=nocma" from kernel cmdline parameters OR replace +it with "fadump=off" kernel cmdline parameter: + + # grubby --update-kernel=/boot/vmlinuz-`uname -r` --remove-args="fadump=on" +or + # grubby --update-kernel=/boot/vmlinuz-`uname -r` --remove-args="fadump=nocma" +OR + # grubby --update-kernel=/boot/vmlinuz-`uname -r` --args="fadump=off" + +Remove "crashkernel=" from kernel cmdline parameters: + + # grubby --update-kernel=/boot/vmlinuz-`uname -r` --remove-args="crashkernel" + +If KDump is to be used as the dump capturing mechanism, reset the crashkernel parameter: + + # kdumpctl reset-crashkernel `uname -r` + +Reboot the system for the settings to take effect. diff --git a/SOURCES/kdump-dep-generator.sh b/SOURCES/kdump-dep-generator.sh new file mode 100644 index 0000000..f48c8f6 --- /dev/null +++ b/SOURCES/kdump-dep-generator.sh @@ -0,0 +1,23 @@ +#!/bin/sh + +# More details about systemd generator: +# http://www.freedesktop.org/wiki/Software/systemd/Generators/ + +. /usr/lib/kdump/kdump-lib.sh +. /usr/lib/kdump/kdump-logger.sh + +# If invokded with no arguments for testing purpose, output to /tmp to +# avoid overriding the existing. +dest_dir="/tmp" + +if [ -n "$1" ]; then + dest_dir=$1 +fi + +systemd_dir=/usr/lib/systemd/system +kdump_wants=$dest_dir/kdump.service.wants + +if is_ssh_dump_target; then + mkdir -p $kdump_wants + ln -sf $systemd_dir/network-online.target $kdump_wants/ +fi diff --git a/SOURCES/kdump-in-cluster-environment.txt b/SOURCES/kdump-in-cluster-environment.txt new file mode 100644 index 0000000..de1eb5e --- /dev/null +++ b/SOURCES/kdump-in-cluster-environment.txt @@ -0,0 +1,91 @@ +Kdump-in-cluster-environment HOWTO + +Introduction + +Kdump is a kexec based crash dumping mechansim for Linux. This docuement +illustrate how to configure kdump in cluster environment to allow the kdump +crash recovery service complete without being preempted by traditional power +fencing methods. + +Overview + +Kexec/Kdump + +Details about Kexec/Kdump are available in Kexec-Kdump-howto file and will not +be described here. + +fence_kdump + +fence_kdump is an I/O fencing agent to be used with the kdump crash recovery +service. When the fence_kdump agent is invoked, it will listen for a message +from the failed node that acknowledges that the failed node is executing the +kdump crash kernel. Note that fence_kdump is not a replacement for traditional +fencing methods. The fence_kdump agent can only detect that a node has entered +the kdump crash recovery service. This allows the kdump crash recovery service +complete without being preempted by traditional power fencing methods. + +fence_kdump_send + +fence_kdump_send is a utility used to send messages that acknowledge that the +node itself has entered the kdump crash recovery service. The fence_kdump_send +utility is typically run in the kdump kernel after a cluster node has +encountered a kernel panic. Once the cluster node has entered the kdump crash +recovery service, fence_kdump_send will periodically send messages to all +cluster nodes. When the fence_kdump agent receives a valid message from the +failed nodes, fencing is complete. + +How to configure Pacemaker cluster environment: + +If we want to use kdump in Pacemaker cluster environment, fence-agents-kdump +should be installed in every nodes in the cluster. You can achieve this via +the following command: + + # yum install -y fence-agents-kdump + +Next is to add kdump_fence to the cluster. Assuming that the cluster consists +of three nodes, they are node1, node2 and node3, and use Pacemaker to perform +resource management and pcs as cli configuration tool. + +With pcs it is easy to add a stonith resource to the cluster. For example, add +a stonith resource named mykdumpfence with fence type of fence_kdump via the +following commands: + + # pcs stonith create mykdumpfence fence_kdump \ + pcmk_host_check=static-list pcmk_host_list="node1 node2 node3" + # pcs stonith update mykdumpfence pcmk_monitor_action=metadata --force + # pcs stonith update mykdumpfence pcmk_status_action=metadata --force + # pcs stonith update mykdumpfence pcmk_reboot_action=off --force + +Then enable stonith + # pcs property set stonith-enabled=true + +How to configure kdump: + +Actually there are two ways how to configure fence_kdump support: + +1) Pacemaker based clusters + If you have successfully configured fence_kdump in Pacemaker, there is + no need to add some special configuration in kdump. So please refer to + Kexec-Kdump-howto file for more information. + +2) Generic clusters + For other types of clusters there are two configuration options in + kdump.conf which enables fence_kdump support: + + fence_kdump_nodes <node(s)> + Contains list of cluster node(s) separated by space to send + fence_kdump notification to (this option is mandatory to enable + fence_kdump) + + fence_kdump_args <arg(s)> + Command line arguments for fence_kdump_send (it can contain + all valid arguments except hosts to send notification to) + + These options will most probably be configured by your cluster software, + so please refer to your cluster documentation how to enable fence_kdump + support. + +Please be aware that these two ways cannot be combined and 2) has precedence +over 1). It means that if fence_kdump is configured using fence_kdump_nodes +and fence_kdump_args options in kdump.conf, Pacemaker configuration is not +used even if it exists. diff --git a/SOURCES/kdump-lib-initramfs.sh b/SOURCES/kdump-lib-initramfs.sh new file mode 100755 index 0000000..9be0fe9 --- /dev/null +++ b/SOURCES/kdump-lib-initramfs.sh @@ -0,0 +1,132 @@ +#!/bin/sh +# +# The code in this file will be used in initramfs environment, bash may +# not be the default shell. Any code added must be POSIX compliant. + +DEFAULT_PATH="/var/crash/" +KDUMP_CONFIG_FILE="/etc/kdump.conf" +FENCE_KDUMP_CONFIG_FILE="/etc/sysconfig/fence_kdump" +FENCE_KDUMP_SEND="/usr/libexec/fence_kdump_send" + +# Read kdump config in well formated style +kdump_read_conf() +{ + # Following steps are applied in order: strip trailing comment, strip trailing space, + # strip heading space, match non-empty line, remove duplicated spaces between conf name and value + [ -f "$KDUMP_CONFIG_FILE" ] && sed -n -e "s/#.*//;s/\s*$//;s/^\s*//;s/\(\S\+\)\s*\(.*\)/\1 \2/p" $KDUMP_CONFIG_FILE +} + +# Retrieves config value defined in kdump.conf +# $1: config name, sed regexp compatible +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. + [ -f "$KDUMP_CONFIG_FILE" ] && + sed -n -e "/^\s*\($1\)\s\+/{s/^\s*\($1\)\s\+//;s/#.*//;s/\s*$//;h};\${x;p}" $KDUMP_CONFIG_FILE +} + +is_mounted() +{ + findmnt -k -n "$1" > /dev/null 2>&1 +} + +# $1: info type +# $2: mount source type +# $3: mount source +# $4: extra args +get_mount_info() +{ + __kdump_mnt=$(findmnt -k -n -r -o "$1" "--$2" "$3" $4) + + [ -z "$__kdump_mnt" ] && [ -e "/etc/fstab" ] && __kdump_mnt=$(findmnt -s -n -r -o "$1" "--$2" "$3" $4) + + echo "$__kdump_mnt" +} + +is_ipv6_address() +{ + echo "$1" | grep -q ":" +} + +is_fs_type_nfs() +{ + [ "$1" = "nfs" ] || [ "$1" = "nfs4" ] +} + +# If $1 contains dracut_args "--mount", return <filesystem type> +get_dracut_args_fstype() +{ + echo $1 | grep "\-\-mount" | sed "s/.*--mount .\(.*\)/\1/" | cut -d' ' -f3 +} + +# If $1 contains dracut_args "--mount", return <device> +get_dracut_args_target() +{ + echo $1 | grep "\-\-mount" | sed "s/.*--mount .\(.*\)/\1/" | cut -d' ' -f1 +} + +get_save_path() +{ + __kdump_path=$(kdump_get_conf_val path) + [ -z "$__kdump_path" ] && __kdump_path=$DEFAULT_PATH + + # strip the duplicated "/" + echo "$__kdump_path" | tr -s / +} + +get_root_fs_device() +{ + findmnt -k -f -n -o SOURCE / +} + +# Return the current underlying device of a path, ignore bind mounts +get_target_from_path() +{ + __kdump_target=$(df "$1" 2> /dev/null | tail -1 | awk '{print $1}') + [ "$__kdump_target" = "/dev/root" ] && [ ! -e /dev/root ] && __kdump_target=$(get_root_fs_device) + echo "$__kdump_target" +} + +get_fs_type_from_target() +{ + get_mount_info FSTYPE source "$1" -f +} + +get_mntpoint_from_target() +{ + # --source is applied to ensure non-bind mount is returned + get_mount_info TARGET source "$1" -f +} + +is_ssh_dump_target() +{ + kdump_get_conf_val ssh | grep -q @ +} + +is_raw_dump_target() +{ + [ -n "$(kdump_get_conf_val raw)" ] +} + +is_nfs_dump_target() +{ + if [ -n "$(kdump_get_conf_val nfs)" ]; then + return 0 + fi + + if is_fs_type_nfs "$(get_dracut_args_fstype "$(kdump_get_conf_val dracut_args)")"; then + return 0 + fi + + if is_fs_type_nfs "$(get_fs_type_from_target "$(get_target_from_path "$(get_save_path)")")"; then + return 0 + fi + + return 1 +} + +is_fs_dump_target() +{ + [ -n "$(kdump_get_conf_val "ext[234]\|xfs\|btrfs\|minix")" ] +} diff --git a/SOURCES/kdump-lib.sh b/SOURCES/kdump-lib.sh new file mode 100755 index 0000000..4d9fed7 --- /dev/null +++ b/SOURCES/kdump-lib.sh @@ -0,0 +1,989 @@ +#!/bin/bash +# +# Kdump common variables and functions +# + +. /usr/lib/kdump/kdump-lib-initramfs.sh + +FADUMP_ENABLED_SYS_NODE="/sys/kernel/fadump_enabled" + +is_fadump_capable() +{ + # Check if firmware-assisted dump is enabled + # if no, fallback to kdump check + if [[ -f $FADUMP_ENABLED_SYS_NODE ]]; then + rc=$(< $FADUMP_ENABLED_SYS_NODE) + [[ $rc -eq 1 ]] && return 0 + fi + return 1 +} + +is_squash_available() +{ + for kmodule in squashfs overlay loop; do + if [[ -z $KDUMP_KERNELVER ]]; then + modprobe --dry-run $kmodule &> /dev/null || return 1 + else + modprobe -S "$KDUMP_KERNELVER" --dry-run $kmodule &> /dev/null || return 1 + fi + done +} + +is_zstd_command_available() +{ + [[ -x "$(command -v zstd)" ]] +} + +perror_exit() +{ + derror "$@" + exit 1 +} + +# Check if fence kdump is configured in Pacemaker cluster +is_pcs_fence_kdump() +{ + # no pcs or fence_kdump_send executables installed? + type -P pcs > /dev/null || return 1 + [[ -x $FENCE_KDUMP_SEND ]] || return 1 + + # fence kdump not configured? + (pcs cluster cib | grep 'type="fence_kdump"') &> /dev/null || return 1 +} + +# Check if fence_kdump is configured using kdump options +is_generic_fence_kdump() +{ + [[ -x $FENCE_KDUMP_SEND ]] || return 1 + + [[ $(kdump_get_conf_val fence_kdump_nodes) ]] +} + +to_dev_name() +{ + local dev="${1//\"/}" + + case "$dev" in + UUID=*) + blkid -U "${dev#UUID=}" + ;; + LABEL=*) + blkid -L "${dev#LABEL=}" + ;; + *) + echo "$dev" + ;; + esac +} + +is_user_configured_dump_target() +{ + [[ $(kdump_get_conf_val "ext[234]\|xfs\|btrfs\|minix\|raw\|nfs\|ssh") ]] || is_mount_in_dracut_args +} + +get_user_configured_dump_disk() +{ + local _target + + _target=$(kdump_get_conf_val "ext[234]\|xfs\|btrfs\|minix\|raw") + [[ -n $_target ]] && echo "$_target" && return + + _target=$(get_dracut_args_target "$(kdump_get_conf_val "dracut_args")") + [[ -b $_target ]] && echo "$_target" +} + +get_block_dump_target() +{ + local _target _path + + if is_ssh_dump_target || is_nfs_dump_target; then + return + fi + + _target=$(get_user_configured_dump_disk) + [[ -n $_target ]] && to_dev_name "$_target" && return + + # Get block device name from local save path + _path=$(get_save_path) + _target=$(get_target_from_path "$_path") + [[ -b $_target ]] && to_dev_name "$_target" +} + +is_dump_to_rootfs() +{ + [[ $(kdump_get_conf_val 'failure_action\|default') == dump_to_rootfs ]] +} + +get_failure_action_target() +{ + local _target + + if is_dump_to_rootfs; then + # Get rootfs device name + _target=$(get_root_fs_device) + [[ -b $_target ]] && to_dev_name "$_target" && return + # Then, must be nfs root + echo "nfs" + fi +} + +# Get kdump targets(including root in case of dump_to_rootfs). +get_kdump_targets() +{ + local _target _root + local kdump_targets + + _target=$(get_block_dump_target) + if [[ -n $_target ]]; then + kdump_targets=$_target + elif is_ssh_dump_target; then + kdump_targets="ssh" + else + kdump_targets="nfs" + fi + + # Add the root device if dump_to_rootfs is specified. + _root=$(get_failure_action_target) + if [[ -n $_root ]] && [[ $kdump_targets != "$_root" ]]; then + kdump_targets="$kdump_targets $_root" + fi + + echo "$kdump_targets" +} + +# Return the bind mount source path, return the path itself if it's not bind mounted +# Eg. if /path/to/src is bind mounted to /mnt/bind, then: +# /mnt/bind -> /path/to/src, /mnt/bind/dump -> /path/to/src/dump +# +# findmnt uses the option "-v, --nofsroot" to exclusive the [/dir] +# in the SOURCE column for bind-mounts, then if $_src equals to +# $_src_nofsroot, the mountpoint is not bind mounted directory. +# +# Below is just an example for mount info +# /dev/mapper/atomicos-root[/ostree/deploy/rhel-atomic-host/var], if the +# directory is bind mounted. The former part represents the device path, rest +# part is the bind mounted directory which quotes by bracket "[]". +get_bind_mount_source() +{ + local _mnt _path _src _opt _fstype + local _fsroot _src_nofsroot + + _mnt=$(df "$1" | tail -1 | awk '{print $NF}') + _path=${1#$_mnt} + + _src=$(get_mount_info SOURCE target "$_mnt" -f) + _opt=$(get_mount_info OPTIONS target "$_mnt" -f) + _fstype=$(get_mount_info FSTYPE target "$_mnt" -f) + + # bind mount in fstab + if [[ -d $_src ]] && [[ $_fstype == none ]] && (echo "$_opt" | grep -q "\bbind\b"); then + echo "$_src$_path" && return + fi + + # direct mount + _src_nofsroot=$(get_mount_info SOURCE target "$_mnt" -v -f) + if [[ $_src_nofsroot == "$_src" ]]; then + echo "$_mnt$_path" && return + fi + + _fsroot=${_src#${_src_nofsroot}[} + _fsroot=${_fsroot%]} + _mnt=$(get_mount_info TARGET source "$_src_nofsroot" -f) + + # for btrfs, _fsroot will also contain the subvol value as well, strip it + if [[ $_fstype == btrfs ]]; then + local _subvol + _subvol=${_opt#*subvol=} + _subvol=${_subvol%,*} + _fsroot=${_fsroot#$_subvol} + fi + echo "$_mnt$_fsroot$_path" +} + +get_mntopt_from_target() +{ + get_mount_info OPTIONS source "$1" -f +} + +# Get the path where the target will be mounted in kdump kernel +# $1: kdump target device +get_kdump_mntpoint_from_target() +{ + local _mntpoint + + _mntpoint=$(get_mntpoint_from_target "$1") + # mount under /sysroot if dump to root disk or mount under + # mount under /kdumproot if dump target is not mounted in first kernel + # mount under /kdumproot/$_mntpoint in other cases in 2nd kernel. + # systemd will be in charge to umount it. + if [[ -z $_mntpoint ]]; then + _mntpoint="/kdumproot" + else + if [[ $_mntpoint == "/" ]]; then + _mntpoint="/sysroot" + else + _mntpoint="/kdumproot/$_mntpoint" + fi + fi + + # strip duplicated "/" + echo $_mntpoint | tr -s "/" +} + +kdump_get_persistent_dev() +{ + local dev="${1//\"/}" + + case "$dev" in + UUID=*) + dev=$(blkid -U "${dev#UUID=}") + ;; + LABEL=*) + dev=$(blkid -L "${dev#LABEL=}") + ;; + esac + echo $(get_persistent_dev "$dev") +} + +is_atomic() +{ + grep -q "ostree" /proc/cmdline +} + +# get ip address or hostname from nfs/ssh config value +get_remote_host() +{ + local _config_val=$1 + + # ipv6 address in kdump.conf is around with "[]", + # factor out the ipv6 address + _config_val=${_config_val#*@} + _config_val=${_config_val%:/*} + _config_val=${_config_val#[} + _config_val=${_config_val%]} + echo "$_config_val" +} + +is_hostname() +{ + local _hostname + + _hostname=$(echo "$1" | grep ":") + if [[ -n $_hostname ]]; then + return 1 + fi + echo "$1" | grep -q "[a-zA-Z]" +} + +# Copied from "/etc/sysconfig/network-scripts/network-functions" +get_hwaddr() +{ + if [[ -f "/sys/class/net/$1/address" ]]; then + awk '{ print toupper($0) }' < "/sys/class/net/$1/address" + elif [[ -d "/sys/class/net/$1" ]]; then + LC_ALL="" LANG="" ip -o link show "$1" 2> /dev/null | + awk '{ print toupper(gensub(/.*link\/[^ ]* ([[:alnum:]:]*).*/, + "\\1", 1)); }' + fi +} + +# Get value by a field using "nmcli -g" +# Usage: get_nmcli_value_by_field <field> <nmcli command> +# +# "nmcli --get-values" allows us to retrive value(s) by field, for example, +# nmcli --get-values <field> connection show /org/freedesktop/NetworkManager/ActiveConnection/1 +# returns the following value for the corresponding field respectively, +# Field Value +# IP4.DNS "10.19.42.41 | 10.11.5.19 | 10.5.30.160" +# 802-3-ethernet.s390-subchannels "" +# bond.options "mode=balance-rr" +get_nmcli_value_by_field() +{ + LANG=C nmcli --get-values "$@" +} + +# Get nmcli field value of an connection apath (a D-Bus active connection path) +# Usage: get_nmcli_field_by_apath <field> <apath> +get_nmcli_field_by_conpath() +{ + local _field=$1 _apath=$2 + + get_nmcli_value_by_field "$_field" connection show "$_apath" +} + +# Get nmcli connection apath (a D-Bus active connection path ) by ifname +# +# apath is used for nmcli connection operations, e.g. +# $ nmcli connection show $apath +get_nmcli_connection_apath_by_ifname() +{ + local _ifname=$1 + + get_nmcli_value_by_field "GENERAL.CON-PATH" device show "$_ifname" +} + +get_ifcfg_by_device() +{ + grep -E -i -l "^[[:space:]]*DEVICE=\"*${1}\"*[[:space:]]*$" \ + /etc/sysconfig/network-scripts/ifcfg-* 2> /dev/null | head -1 +} + +get_ifcfg_by_hwaddr() +{ + grep -E -i -l "^[[:space:]]*HWADDR=\"*${1}\"*[[:space:]]*$" \ + /etc/sysconfig/network-scripts/ifcfg-* 2> /dev/null | head -1 +} + +get_ifcfg_by_uuid() +{ + grep -E -i -l "^[[:space:]]*UUID=\"*${1}\"*[[:space:]]*$" \ + /etc/sysconfig/network-scripts/ifcfg-* 2> /dev/null | head -1 +} + +get_ifcfg_by_name() +{ + grep -E -i -l "^[[:space:]]*NAME=\"*${1}\"*[[:space:]]*$" \ + /etc/sysconfig/network-scripts/ifcfg-* 2> /dev/null | head -1 +} + +is_nm_running() +{ + [[ "$(LANG=C nmcli -t --fields running general status 2> /dev/null)" == "running" ]] +} + +is_nm_handling() +{ + LANG=C nmcli -t --fields device,state dev status 2> /dev/null | + grep -q "^\(${1}:connected\)\|\(${1}:connecting.*\)$" +} + +# $1: netdev name +get_ifcfg_nmcli() +{ + local nm_uuid nm_name + local ifcfg_file + + # Get the active nmcli config name of $1 + if is_nm_running && is_nm_handling "${1}"; then + # The configuration "uuid" and "name" generated by nm is wrote to + # the ifcfg file as "UUID=<nm_uuid>" and "NAME=<nm_name>". + nm_uuid=$(LANG=C nmcli -t --fields uuid,device c show --active 2> /dev/null | + grep "${1}" | head -1 | cut -d':' -f1) + nm_name=$(LANG=C nmcli -t --fields name,device c show --active 2> /dev/null | + grep "${1}" | head -1 | cut -d':' -f1) + ifcfg_file=$(get_ifcfg_by_uuid "${nm_uuid}") + [[ -z ${ifcfg_file} ]] && ifcfg_file=$(get_ifcfg_by_name "${nm_name}") + fi + + echo -n "${ifcfg_file}" +} + +# $1: netdev name +get_ifcfg_legacy() +{ + local ifcfg_file hwaddr + + ifcfg_file="/etc/sysconfig/network-scripts/ifcfg-${1}" + [[ -f ${ifcfg_file} ]] && echo -n "${ifcfg_file}" && return + + ifcfg_file=$(get_ifcfg_by_name "${1}") + [[ -f ${ifcfg_file} ]] && echo -n "${ifcfg_file}" && return + + hwaddr=$(get_hwaddr "${1}") + if [[ -n $hwaddr ]]; then + ifcfg_file=$(get_ifcfg_by_hwaddr "${hwaddr}") + [[ -f ${ifcfg_file} ]] && echo -n "${ifcfg_file}" && return + fi + + ifcfg_file=$(get_ifcfg_by_device "${1}") + + echo -n "${ifcfg_file}" +} + +# $1: netdev name +# Return the ifcfg file whole name(including the path) of $1 if any. +get_ifcfg_filename() +{ + local ifcfg_file + + ifcfg_file=$(get_ifcfg_nmcli "${1}") + if [[ -z ${ifcfg_file} ]]; then + ifcfg_file=$(get_ifcfg_legacy "${1}") + fi + + echo -n "${ifcfg_file}" +} + +# returns 0 when omission of a module is desired in dracut_args +# returns 1 otherwise +is_dracut_mod_omitted() +{ + local dracut_args dracut_mod=$1 + + set -- $(kdump_get_conf_val dracut_args) + while [ $# -gt 0 ]; do + case $1 in + -o | --omit) + [[ " ${2//[^[:alnum:]]/ } " == *" $dracut_mod "* ]] && return 0 + ;; + esac + shift + done + + return 1 +} + +is_wdt_active() +{ + local active + + [[ -d /sys/class/watchdog ]] || return 1 + for dir in /sys/class/watchdog/*; do + [[ -f "$dir/state" ]] || continue + active=$(< "$dir/state") + [[ $active == "active" ]] && return 0 + done + return 1 +} + +have_compression_in_dracut_args() +{ + [[ "$(kdump_get_conf_val dracut_args)" =~ \ + (^|[[:space:]])--(gzip|bzip2|lzma|xz|lzo|lz4|zstd|no-compress|compress)([[:space:]]|$) ]] +} + +# If "dracut_args" contains "--mount" information, use it +# directly without any check(users are expected to ensure +# its correctness). +is_mount_in_dracut_args() +{ + [[ " $(kdump_get_conf_val dracut_args)" =~ .*[[:space:]]--mount[=[:space:]].* ]] +} + +check_crash_mem_reserved() +{ + local mem_reserved + + mem_reserved=$(< /sys/kernel/kexec_crash_size) + if [[ $mem_reserved -eq 0 ]]; then + derror "No memory reserved for crash kernel" + return 1 + fi + + return 0 +} + +check_kdump_feasibility() +{ + if [[ ! -e /sys/kernel/kexec_crash_loaded ]]; then + derror "Kdump is not supported on this kernel" + return 1 + fi + check_crash_mem_reserved + return $? +} + +check_current_kdump_status() +{ + if [[ ! -f /sys/kernel/kexec_crash_loaded ]]; then + derror "Perhaps CONFIG_CRASH_DUMP is not enabled in kernel" + return 1 + fi + + rc=$(< /sys/kernel/kexec_crash_loaded) + if [[ $rc == 1 ]]; then + return 0 + else + return 1 + fi +} + +# remove_cmdline_param <kernel cmdline> <param1> [<param2>] ... [<paramN>] +# Remove a list of kernel parameters from a given kernel cmdline and print the result. +# For each "arg" in the removing params list, "arg" and "arg=xxx" will be removed if exists. +remove_cmdline_param() +{ + local cmdline=$1 + shift + + for arg in "$@"; do + cmdline=$(echo "$cmdline" | + sed -e "s/\b$arg=[^ ]*//g" \ + -e "s/^$arg\b//g" \ + -e "s/[[:space:]]$arg\b//g" \ + -e "s/\s\+/ /g") + done + echo "$cmdline" +} + +# +# This function returns the "apicid" of the boot +# cpu (cpu 0) if present. +# +get_bootcpu_apicid() +{ + awk ' \ + BEGIN { CPU = "-1"; } \ + $1=="processor" && $2==":" { CPU = $NF; } \ + CPU=="0" && /^apicid/ { print $NF; } \ + ' \ + /proc/cpuinfo +} + +# +# append_cmdline <kernel cmdline> <parameter name> <parameter value> +# This function appends argument "$2=$3" to string ($1) if not already present. +# +append_cmdline() +{ + local cmdline=$1 + local newstr=${cmdline/$2/""} + + # unchanged str implies argument wasn't there + if [[ $cmdline == "$newstr" ]]; then + cmdline="${cmdline} ${2}=${3}" + fi + + echo "$cmdline" +} + +# This function check iomem and determines if we have more than +# 4GB of ram available. Returns 1 if we do, 0 if we dont +need_64bit_headers() +{ + return "$(tail -n 1 /proc/iomem | awk '{ split ($1, r, "-"); + print (strtonum("0x" r[2]) > strtonum("0xffffffff")); }')" +} + +# Check if secure boot is being enforced. +# +# Per Peter Jones, we need check efivar SecureBoot-$(the UUID) and +# SetupMode-$(the UUID), they are both 5 bytes binary data. The first four +# bytes are the attributes associated with the variable and can safely be +# ignored, the last bytes are one-byte true-or-false variables. If SecureBoot +# is 1 and SetupMode is 0, then secure boot is being enforced. +# +# Assume efivars is mounted at /sys/firmware/efi/efivars. +is_secure_boot_enforced() +{ + local secure_boot_file setup_mode_file + local secure_boot_byte setup_mode_byte + + # On powerpc, secure boot is enforced if: + # host secure boot: /ibm,secure-boot/os-secureboot-enforcing DT property exists + # guest secure boot: /ibm,secure-boot >= 2 + if [[ -f /proc/device-tree/ibm,secureboot/os-secureboot-enforcing ]]; then + return 0 + fi + if [[ -f /proc/device-tree/ibm,secure-boot ]] && + [[ $(lsprop /proc/device-tree/ibm,secure-boot | tail -1) -ge 2 ]]; then + return 0 + fi + + # Detect secure boot on x86 and arm64 + secure_boot_file=$(find /sys/firmware/efi/efivars -name "SecureBoot-*" 2> /dev/null) + setup_mode_file=$(find /sys/firmware/efi/efivars -name "SetupMode-*" 2> /dev/null) + + if [[ -f $secure_boot_file ]] && [[ -f $setup_mode_file ]]; then + secure_boot_byte=$(hexdump -v -e '/1 "%d\ "' "$secure_boot_file" | cut -d' ' -f 5) + setup_mode_byte=$(hexdump -v -e '/1 "%d\ "' "$setup_mode_file" | cut -d' ' -f 5) + + if [[ $secure_boot_byte == "1" ]] && [[ $setup_mode_byte == "0" ]]; then + return 0 + fi + fi + + # Detect secure boot on s390x + if [[ -e "/sys/firmware/ipl/secure" && "$(< /sys/firmware/ipl/secure)" == "1" ]]; then + return 0 + fi + + return 1 +} + +# +# prepare_kexec_args <kexec args> +# This function prepares kexec argument. +# +prepare_kexec_args() +{ + local kexec_args=$1 + local found_elf_args + + ARCH=$(uname -m) + if [[ $ARCH == "i686" ]] || [[ $ARCH == "i386" ]]; then + need_64bit_headers + if [[ $? == 1 ]]; then + found_elf_args=$(echo "$kexec_args" | grep elf32-core-headers) + if [[ -n $found_elf_args ]]; then + dwarn "Warning: elf32-core-headers overrides correct elf64 setting" + else + kexec_args="$kexec_args --elf64-core-headers" + fi + else + found_elf_args=$(echo "$kexec_args" | grep elf64-core-headers) + if [[ -z $found_elf_args ]]; then + kexec_args="$kexec_args --elf32-core-headers" + fi + fi + fi + echo "$kexec_args" +} + +# +# Detect initrd and kernel location, results are stored in global enviromental variables: +# KDUMP_BOOTDIR, KDUMP_KERNELVER, KDUMP_KERNEL, DEFAULT_INITRD, and KDUMP_INITRD +# +# Expectes KDUMP_BOOTDIR, KDUMP_IMG, KDUMP_IMG_EXT, KDUMP_KERNELVER to be loaded from config already +# and will prefer already set values so user can specify custom kernel/initramfs location +# +prepare_kdump_bootinfo() +{ + local boot_img boot_imglist boot_dirlist boot_initrdlist + local machine_id + + if [[ -z $KDUMP_KERNELVER ]]; then + KDUMP_KERNELVER="$(uname -r)" + fi + + read -r machine_id < /etc/machine-id + boot_dirlist=${KDUMP_BOOTDIR:-"/boot /boot/efi /efi /"} + boot_imglist="$KDUMP_IMG-$KDUMP_KERNELVER$KDUMP_IMG_EXT $machine_id/$KDUMP_KERNELVER/$KDUMP_IMG" + + # Use BOOT_IMAGE as reference if possible, strip the GRUB root device prefix in (hd0,gpt1) format + boot_img="$(sed "s/^BOOT_IMAGE=\((\S*)\)\?\(\S*\) .*/\2/" /proc/cmdline)" + if [[ -n $boot_img ]]; then + boot_imglist="$boot_img $boot_imglist" + fi + + for dir in $boot_dirlist; do + for img in $boot_imglist; do + if [[ -f "$dir/$img" ]]; then + KDUMP_KERNEL=$(echo "$dir/$img" | tr -s '/') + break 2 + fi + done + done + + if ! [[ -e $KDUMP_KERNEL ]]; then + derror "Failed to detect kdump kernel location" + return 1 + fi + + # Set KDUMP_BOOTDIR to where kernel image is stored + KDUMP_BOOTDIR=$(dirname "$KDUMP_KERNEL") + + # Default initrd should just stay aside of kernel image, try to find it in KDUMP_BOOTDIR + boot_initrdlist="initramfs-$KDUMP_KERNELVER.img initrd" + for initrd in $boot_initrdlist; do + if [[ -f "$KDUMP_BOOTDIR/$initrd" ]]; then + defaut_initrd_base="$initrd" + DEFAULT_INITRD="$KDUMP_BOOTDIR/$defaut_initrd_base" + break + fi + done + + # Create kdump initrd basename from default initrd basename + # initramfs-5.7.9-200.fc32.x86_64.img => initramfs-5.7.9-200.fc32.x86_64kdump.img + # initrd => initrdkdump + if [[ -z $defaut_initrd_base ]]; then + kdump_initrd_base=initramfs-${KDUMP_KERNELVER}kdump.img + elif [[ $defaut_initrd_base == *.* ]]; then + kdump_initrd_base=${defaut_initrd_base%.*}kdump.${DEFAULT_INITRD##*.} + else + kdump_initrd_base=${defaut_initrd_base}kdump + fi + + # Place kdump initrd in $(/var/lib/kdump) if $(KDUMP_BOOTDIR) not writable + if [[ ! -w $KDUMP_BOOTDIR ]]; then + var_target_initrd_dir="/var/lib/kdump" + mkdir -p "$var_target_initrd_dir" + KDUMP_INITRD="$var_target_initrd_dir/$kdump_initrd_base" + else + KDUMP_INITRD="$KDUMP_BOOTDIR/$kdump_initrd_base" + fi +} + +get_watchdog_drvs() +{ + local _wdtdrvs _drv _dir + + for _dir in /sys/class/watchdog/*; do + # device/modalias will return driver of this device + [[ -f "$_dir/device/modalias" ]] || continue + _drv=$(< "$_dir/device/modalias") + _drv=$(modprobe --set-version "$KDUMP_KERNELVER" -R "$_drv" 2> /dev/null) + for i in $_drv; do + if ! [[ " $_wdtdrvs " == *" $i "* ]]; then + _wdtdrvs="$_wdtdrvs $i" + fi + done + done + + echo "$_wdtdrvs" +} + +# +# prepare_cmdline <commandline> <commandline remove> <commandline append> +# This function performs a series of edits on the command line. +# Store the final result in global $KDUMP_COMMANDLINE. +prepare_cmdline() +{ + local cmdline id arg + + if [[ -z $1 ]]; then + cmdline=$(< /proc/cmdline) + else + cmdline="$1" + fi + + # These params should always be removed + cmdline=$(remove_cmdline_param "$cmdline" crashkernel panic_on_warn) + # These params can be removed configurably + while read -r arg; do + cmdline=$(remove_cmdline_param "$cmdline" "$arg") + done <<< "$(echo "$2" | xargs -n 1 echo)" + + # Always remove "root=X", as we now explicitly generate all kinds + # of dump target mount information including root fs. + # + # We do this before KDUMP_COMMANDLINE_APPEND, if one really cares + # about it(e.g. for debug purpose), then can pass "root=X" using + # KDUMP_COMMANDLINE_APPEND. + cmdline=$(remove_cmdline_param "$cmdline" root) + + # With the help of "--hostonly-cmdline", we can avoid some interitage. + cmdline=$(remove_cmdline_param "$cmdline" rd.lvm.lv rd.luks.uuid rd.dm.uuid rd.md.uuid fcoe) + + # Remove netroot, rd.iscsi.initiator and iscsi_initiator since + # we get duplicate entries for the same in case iscsi code adds + # it as well. + cmdline=$(remove_cmdline_param "$cmdline" netroot rd.iscsi.initiator iscsi_initiator) + + cmdline="${cmdline} $3" + + id=$(get_bootcpu_apicid) + if [[ -n ${id} ]]; then + cmdline=$(append_cmdline "$cmdline" disable_cpu_apicid "$id") + fi + + # If any watchdog is used, set it's pretimeout to 0. pretimeout let + # watchdog panic the kernel first, and reset the system after the + # panic. If the system is already in kdump, panic is not helpful + # and only increase the chance of watchdog failure. + for i in $(get_watchdog_drvs); do + cmdline+=" $i.pretimeout=0" + + if [[ $i == hpwdt ]]; then + # hpwdt have a special parameter kdumptimeout, is's only suppose + # to be set to non-zero in first kernel. In kdump, non-zero + # value could prevent the watchdog from resetting the system. + cmdline+=" $i.kdumptimeout=0" + fi + done + + echo "$cmdline" +} + +#get system memory size in the unit of GB +get_system_size() +{ + result=$(grep "System RAM" /proc/iomem | awk -F ":" '{ print $1 }' | tr "[:lower:]" "[:upper:]" | paste -sd+) + result="+$result" + # replace '-' with '+0x' and '+' with '-0x' + sum=$(echo "$result" | sed -e 's/-/K0x/g' -e 's/+/-0x/g' -e 's/K/+/g') + size=$(printf "%d\n" $((sum))) + size=$((size / 1024 / 1024 / 1024)) + + echo "$size" +} + +get_recommend_size() +{ + local mem_size=$1 + local _ck_cmdline=$2 + local OLDIFS="$IFS" + + start=${_ck_cmdline::1} + if [[ $mem_size -lt $start ]]; then + echo "0M" + return + fi + IFS=',' + for i in $_ck_cmdline; do + end=$(echo "$i" | awk -F "-" '{ print $2 }' | awk -F ":" '{ print $1 }') + recommend=$(echo "$i" | awk -F "-" '{ print $2 }' | awk -F ":" '{ print $2 }') + size=${end::-1} + unit=${end: -1} + if [[ $unit == 'T' ]]; then + size=$((size * 1024)) + fi + if [[ $mem_size -lt $size ]]; then + echo "$recommend" + IFS="$OLDIFS" + return + fi + done + IFS="$OLDIFS" +} + +# get default crashkernel +# $1 dump mode, if not specified, dump_mode will be judged by is_fadump_capable +kdump_get_arch_recommend_crashkernel() +{ + local _arch _ck_cmdline _dump_mode + + if [[ -z "$1" ]]; then + if is_fadump_capable; then + _dump_mode=fadump + else + _dump_mode=kdump + fi + else + _dump_mode=$1 + fi + + _arch=$(uname -m) + + if [[ $_arch == "x86_64" ]] || [[ $_arch == "s390x" ]]; then + _ck_cmdline="1G-4G:192M,4G-64G:256M,64G-:512M" + elif [[ $_arch == "aarch64" ]]; then + _ck_cmdline="2G-:448M" + elif [[ $_arch == "ppc64le" ]]; then + if [[ $_dump_mode == "fadump" ]]; then + _ck_cmdline="4G-16G:768M,16G-64G:1G,64G-128G:2G,128G-1T:4G,1T-2T:6G,2T-4T:12G,4T-8T:20G,8T-16T:36G,16T-32T:64G,32T-64T:128G,64T-:180G" + else + _ck_cmdline="2G-4G:384M,4G-16G:512M,16G-64G:1G,64G-128G:2G,128G-:4G" + fi + fi + + echo -n "$_ck_cmdline" +} + +# return recommended size based on current system RAM size +# $1: kernel version, if not set, will defaults to $(uname -r) +kdump_get_arch_recommend_size() +{ + local _ck_cmdline _sys_mem + + if ! [[ -r "/proc/iomem" ]]; then + echo "Error, can not access /proc/iomem." + return 1 + fi + _sys_mem=$(get_system_size) + _ck_cmdline=$(kdump_get_arch_recommend_crashkernel) + _ck_cmdline=${_ck_cmdline//-:/-102400T:} + get_recommend_size "$_sys_mem" "$_ck_cmdline" +} + +# Print all underlying crypt devices of a block device +# print nothing if device is not on top of a crypt device +# $1: the block device to be checked in maj:min format +get_luks_crypt_dev() +{ + local _type + + [[ -b /dev/block/$1 ]] || return 1 + + _type=$(eval "$(blkid -u filesystem,crypto -o export -- "/dev/block/$1"); echo \$TYPE") + [[ $_type == "crypto_LUKS" ]] && echo "$1" + + for _x in "/sys/dev/block/$1/slaves/"*; do + [[ -f $_x/dev ]] || continue + [[ $_x/subsystem -ef /sys/class/block ]] || continue + get_luks_crypt_dev "$(< "$_x/dev")" + done +} + +# kdump_get_maj_min <device> +# Prints the major and minor of a device node. +# Example: +# $ get_maj_min /dev/sda2 +# 8:2 +kdump_get_maj_min() +{ + local _majmin + _majmin="$(stat -L -c '%t:%T' "$1" 2> /dev/null)" + printf "%s" "$((0x${_majmin%:*})):$((0x${_majmin#*:}))" +} + +get_all_kdump_crypt_dev() +{ + local _dev + + for _dev in $(get_block_dump_target); do + get_luks_crypt_dev "$(kdump_get_maj_min "$_dev")" + done +} + +check_vmlinux() +{ + # Use readelf to check if it's a valid ELF + readelf -h "$1" &> /dev/null || return 1 +} + +get_vmlinux_size() +{ + local size=0 _msize + + while read -r _msize; do + size=$((size + _msize)) + done <<< "$(readelf -l -W "$1" | awk '/^ LOAD/{print $6}' 2> /dev/stderr)" + + echo $size +} + +try_decompress() +{ + # The obscure use of the "tr" filter is to work around older versions of + # "grep" that report the byte offset of the line instead of the pattern. + + # Try to find the header ($1) and decompress from here + for pos in $(tr "$1\n$2" "\n$2=" < "$4" | grep -abo "^$2"); do + if ! type -P "$3" > /dev/null; then + ddebug "Signiature detected but '$3' is missing, skip this decompressor" + break + fi + + pos=${pos%%:*} + tail "-c+$pos" "$img" | $3 > "$5" 2> /dev/null + if check_vmlinux "$5"; then + ddebug "Kernel is extracted with '$3'" + return 0 + fi + done + + return 1 +} + +# Borrowed from linux/scripts/extract-vmlinux +get_kernel_size() +{ + # Prepare temp files: + local tmp img=$1 + + tmp=$(mktemp /tmp/vmlinux-XXX) + trap 'rm -f "$tmp"' 0 + + # Try to check if it's a vmlinux already + check_vmlinux "$img" && get_vmlinux_size "$img" && return 0 + + # That didn't work, so retry after decompression. + try_decompress '\037\213\010' xy gunzip "$img" "$tmp" || + try_decompress '\3757zXZ\000' abcde unxz "$img" "$tmp" || + try_decompress 'BZh' xy bunzip2 "$img" "$tmp" || + try_decompress '\135\0\0\0' xxx unlzma "$img" "$tmp" || + try_decompress '\211\114\132' xy 'lzop -d' "$img" "$tmp" || + try_decompress '\002!L\030' xxx 'lz4 -d' "$img" "$tmp" || + try_decompress '(\265/\375' xxx unzstd "$img" "$tmp" + + # Finally check for uncompressed images or objects: + [[ $? -eq 0 ]] && get_vmlinux_size "$tmp" && return 0 + + # Fallback to use iomem + local _size=0 _seg + while read -r _seg; do + _size=$((_size + 0x${_seg#*-} - 0x${_seg%-*})) + done <<< "$(grep -E "Kernel (code|rodata|data|bss)" /proc/iomem | cut -d ":" -f 1)" + echo $_size +} diff --git a/SOURCES/kdump-logger.sh b/SOURCES/kdump-logger.sh new file mode 100755 index 0000000..3fd433d --- /dev/null +++ b/SOURCES/kdump-logger.sh @@ -0,0 +1,355 @@ +#!/bin/sh +# +# This comes from the dracut-logger.sh +# +# The logger defined 4 logging levels: +# - ddebug (4) +# The DEBUG Level designates fine-grained informational events that are most +# useful to debug an application. +# - dinfo (3) +# The INFO level designates informational messages that highlight the +# progress of the application at coarse-grained level. +# - dwarn (2) +# The WARN level designates potentially harmful situations. +# - derror (1) +# The ERROR level designates error events that might still allow the +# application to continue running. +# +# Logging is controlled by following global variables: +# - @var kdump_stdloglvl - logging level to standard error (console output) +# - @var kdump_sysloglvl - logging level to syslog (by logger command) +# - @var kdump_kmsgloglvl - logging level to /dev/kmsg (only for boot-time) +# +# If any of the variables is not set, the function dlog_init() sets it to default: +# - In the first kernel: +# - @var kdump_stdloglvl = 3 (info) +# - @var kdump_sysloglvl = 0 (no logging) +# - @var kdump_kmsgloglvl = 0 (no logging) +# +# -In the second kernel: +# - @var kdump_stdloglvl = 0 (no logging) +# - @var kdump_sysloglvl = 3 (info) +# - @var kdump_kmsgloglvl = 0 (no logging) +# +# First of all you have to start with dlog_init() function which initializes +# required variables. Don't call any other logging function before that one! +# +# The code in this file might be run in an environment without bash. +# Any code added must be POSIX compliant. + +# Define vairables for the log levels in this module. +kdump_stdloglvl="" +kdump_sysloglvl="" +kdump_kmsgloglvl="" + +# The dracut-lib.sh is only available in the second kernel, and it won't +# be used in the first kernel because the dracut-lib.sh is invisible in +# the first kernel. +if [ -f /lib/dracut-lib.sh ]; then + . /lib/dracut-lib.sh +fi + +# @brief Get the log level from kernel command line. +# @retval 1 if something has gone wrong +# @retval 0 on success. +# +get_kdump_loglvl() +{ + [ -f /lib/dracut-lib.sh ] && kdump_sysloglvl=$(getarg rd.kdumploglvl) + [ -z "$kdump_sysloglvl" ] && return 1; + + if [ -f /lib/dracut-lib.sh ] && ! isdigit "$kdump_sysloglvl"; then + return 1 + fi + + return 0 +} + +# @brief Check the log level. +# @retval 1 if something has gone wrong +# @retval 0 on success. +# +check_loglvl() +{ + case "$1" in + 0|1|2|3|4) + return 0 + ;; + *) + return 1 + ;; + esac +} + +# @brief Initializes Logger. +# @retval 1 if something has gone wrong +# @retval 0 on success. +# +dlog_init() { + ret=0 + + if [ -s /proc/vmcore ];then + if ! get_kdump_loglvl; then + logger -t "kdump[$$]" -p warn -- "Kdump is using the default log level(3)." + kdump_sysloglvl=3 + fi + kdump_stdloglvl=0 + kdump_kmsgloglvl=0 + else + kdump_stdloglvl=$KDUMP_STDLOGLVL + kdump_sysloglvl=$KDUMP_SYSLOGLVL + kdump_kmsgloglvl=$KDUMP_KMSGLOGLVL + fi + + [ -z "$kdump_stdloglvl" ] && kdump_stdloglvl=3 + [ -z "$kdump_sysloglvl" ] && kdump_sysloglvl=0 + [ -z "$kdump_kmsgloglvl" ] && kdump_kmsgloglvl=0 + + for loglvl in "$kdump_stdloglvl" "$kdump_kmsgloglvl" "$kdump_sysloglvl"; do + if ! check_loglvl "$loglvl"; then + echo "Illegal log level: $kdump_stdloglvl $kdump_kmsgloglvl $kdump_sysloglvl" + return 1 + fi + done + + # Skip initialization if it's already done. + [ -n "$kdump_maxloglvl" ] && return 0 + + if [ "$UID" -ne 0 ]; then + kdump_kmsgloglvl=0 + kdump_sysloglvl=0 + fi + + if [ "$kdump_sysloglvl" -gt 0 ]; then + if [ -d /run/systemd/journal ] \ + && systemd-cat --version 1>/dev/null 2>&1 \ + && systemctl --quiet is-active systemd-journald.socket 1>/dev/null 2>&1; then + readonly _systemdcatfile="/var/tmp/systemd-cat" + mkfifo "$_systemdcatfile" 1>/dev/null 2>&1 + readonly _dlogfd=15 + systemd-cat -t 'kdump' --level-prefix=true <"$_systemdcatfile" & + exec 15>"$_systemdcatfile" + elif ! [ -S /dev/log ] && [ -w /dev/log ] || ! command -v logger >/dev/null; then + # We cannot log to syslog, so turn this facility off. + kdump_kmsgloglvl=$kdump_sysloglvl + kdump_sysloglvl=0 + ret=1 + errmsg="No '/dev/log' or 'logger' included for syslog logging" + fi + fi + + kdump_maxloglvl=0 + for _dlog_lvl in $kdump_stdloglvl $kdump_sysloglvl $kdump_kmsgloglvl; do + [ $_dlog_lvl -gt $kdump_maxloglvl ] && kdump_maxloglvl=$_dlog_lvl + done + readonly kdump_maxloglvl + export kdump_maxloglvl + + if [ $kdump_stdloglvl -lt 4 ] && [ $kdump_kmsgloglvl -lt 4 ] && [ $kdump_sysloglvl -lt 4 ]; then + unset ddebug + ddebug() { :; }; + fi + + if [ $kdump_stdloglvl -lt 3 ] && [ $kdump_kmsgloglvl -lt 3 ] && [ $kdump_sysloglvl -lt 3 ]; then + unset dinfo + dinfo() { :; }; + fi + + if [ $kdump_stdloglvl -lt 2 ] && [ $kdump_kmsgloglvl -lt 2 ] && [ $kdump_sysloglvl -lt 2 ]; then + unset dwarn + dwarn() { :; }; + unset dwarning + dwarning() { :; }; + fi + + if [ $kdump_stdloglvl -lt 1 ] && [ $kdump_kmsgloglvl -lt 1 ] && [ $kdump_sysloglvl -lt 1 ]; then + unset derror + derror() { :; }; + fi + + [ -n "$errmsg" ] && derror "$errmsg" + + return $ret +} + +## @brief Converts numeric level to logger priority defined by POSIX.2. +# +# @param $1: Numeric logging level in range from 1 to 4. +# @retval 1 if @a lvl is out of range. +# @retval 0 if @a lvl is correct. +# @result Echoes logger priority. +_lvl2syspri() { + case "$1" in + 1) echo error;; + 2) echo warning;; + 3) echo info;; + 4) echo debug;; + *) return 1;; + esac +} + +## @brief Converts logger numeric level to syslog log level +# +# @param $1: Numeric logging level in range from 1 to 4. +# @retval 1 if @a lvl is out of range. +# @retval 0 if @a lvl is correct. +# @result Echoes kernel console numeric log level +# +# Conversion is done as follows: +# +# <tt> +# none -> LOG_EMERG (0) +# none -> LOG_ALERT (1) +# none -> LOG_CRIT (2) +# ERROR(1) -> LOG_ERR (3) +# WARN(2) -> LOG_WARNING (4) +# none -> LOG_NOTICE (5) +# INFO(3) -> LOG_INFO (6) +# DEBUG(4) -> LOG_DEBUG (7) +# </tt> +# +# @see /usr/include/sys/syslog.h +_dlvl2syslvl() { + case "$1" in + 1) set -- 3;; + 2) set -- 4;; + 3) set -- 6;; + 4) set -- 7;; + *) return 1;; + esac + + # The number is constructed by multiplying the facility by 8 and then + # adding the level. + # About The Syslog Protocol, please refer to the RFC5424 for more details. + echo $((24 + $1)) +} + +## @brief Prints to stderr, to syslog and/or /dev/kmsg given message with +# given level (priority). +# +# @param $1: Numeric logging level. +# @param $2: Message. +# @retval 0 It's always returned, even if logging failed. +# +# @note This function is not supposed to be called manually. Please use +# dinfo(), ddebug(), or others instead which wrap this one. +# +# This is core logging function which logs given message to standard error +# and/or syslog (with POSIX shell command <tt>logger</tt>) and/or to /dev/kmsg. +# The format is following: +# +# <tt>X: some message</tt> +# +# where @c X is the first letter of logging level. See module description for +# details on that. +# +# Message to syslog is sent with tag @c kdump. Priorities are mapped as +# following: +# - @c ERROR to @c error +# - @c WARN to @c warning +# - @c INFO to @c info +# - @c DEBUG to @c debug +_do_dlog() { + [ "$1" -le $kdump_stdloglvl ] && printf -- 'kdump: %s\n' "$2" >&2 + + if [ "$1" -le $kdump_sysloglvl ]; then + if [ "$_dlogfd" ]; then + printf -- "<%s>%s\n" "$(($(_dlvl2syslvl "$1") & 7))" "$2" 1>&$_dlogfd + else + logger -t "kdump[$$]" -p "$(_lvl2syspri "$1")" -- "$2" + fi + fi + + [ "$1" -le $kdump_kmsgloglvl ] && \ + echo "<$(_dlvl2syslvl "$1")>kdump[$$] $2" >/dev/kmsg +} + +## @brief Internal helper function for _do_dlog() +# +# @param $1: Numeric logging level. +# @param $2 [...]: Message. +# @retval 0 It's always returned, even if logging failed. +# +# @note This function is not supposed to be called manually. Please use +# dinfo(), ddebug(), or others instead which wrap this one. +# +# This function calls _do_dlog() either with parameter msg, or if +# none is given, it will read standard input and will use every line as +# a message. +# +# This enables: +# dwarn "This is a warning" +# echo "This is a warning" | dwarn +dlog() { + [ -z "$kdump_maxloglvl" ] && return 0 + [ "$1" -le "$kdump_maxloglvl" ] || return 0 + + if [ $# -gt 1 ]; then + _dlog_lvl=$1; shift + _do_dlog "$_dlog_lvl" "$*" + else + while read -r line || [ -n "$line" ]; do + _do_dlog "$1" "$line" + done + fi +} + +## @brief Logs message at DEBUG level (4) +# +# @param msg Message. +# @retval 0 It's always returned, even if logging failed. +ddebug() { + set +x + dlog 4 "$@" + if [ -n "$debug" ]; then + set -x + fi +} + +## @brief Logs message at INFO level (3) +# +# @param msg Message. +# @retval 0 It's always returned, even if logging failed. +dinfo() { + set +x + dlog 3 "$@" + if [ -n "$debug" ]; then + set -x + fi +} + +## @brief Logs message at WARN level (2) +# +# @param msg Message. +# @retval 0 It's always returned, even if logging failed. +dwarn() { + set +x + dlog 2 "$@" + if [ -n "$debug" ]; then + set -x + fi +} + +## @brief It's an alias to dwarn() function. +# +# @param msg Message. +# @retval 0 It's always returned, even if logging failed. +dwarning() { + set +x + dwarn "$@" + if [ -n "$debug" ]; then + set -x + fi +} + +## @brief Logs message at ERROR level (1) +# +# @param msg Message. +# @retval 0 It's always returned, even if logging failed. +derror() { + set +x + dlog 1 "$@" + if [ -n "$debug" ]; then + set -x + fi +} diff --git a/SOURCES/kdump-migrate-action.sh b/SOURCES/kdump-migrate-action.sh new file mode 100755 index 0000000..c516639 --- /dev/null +++ b/SOURCES/kdump-migrate-action.sh @@ -0,0 +1,8 @@ +#!/bin/sh + +systemctl is-active kdump +if [ $? -ne 0 ]; then + exit 0 +fi + +/usr/lib/kdump/kdump-restart.sh diff --git a/SOURCES/kdump-restart.sh b/SOURCES/kdump-restart.sh new file mode 100644 index 0000000..a9ecfc1 --- /dev/null +++ b/SOURCES/kdump-restart.sh @@ -0,0 +1,8 @@ +#!/bin/bash +export PATH="$PATH:/usr/bin:/usr/sbin" + +exec >>/var/log/kdump-migration.log 2>&1 + +echo "kdump: Partition Migration detected. Rebuilding initramfs image to reload." +/usr/bin/kdumpctl rebuild +/usr/bin/kdumpctl reload diff --git a/SOURCES/kdump-udev-throttler b/SOURCES/kdump-udev-throttler new file mode 100755 index 0000000..cd77a31 --- /dev/null +++ b/SOURCES/kdump-udev-throttler @@ -0,0 +1,42 @@ +#!/bin/bash +# This util helps to reduce the workload of kdump service restarting +# on udev event. When hotplugging memory / CPU, multiple udev +# events may be triggered concurrently, and obviously, we don't want +# to restart kdump service for each event. + +# This script will be called by udev, and make sure kdump service is +# restart after all events we are watching are settled. + +# On each call, this script will update try to aquire the $throttle_lock +# The first instance acquired the file lock will keep waiting for events +# to settle and then reload kdump. Other instances will just exit +# In this way, we can make sure kdump service is restarted immediately +# and for exactly once after udev events are settled. + +throttle_lock="/var/lock/kdump-udev-throttle" + +exec 9>$throttle_lock +if [ $? -ne 0 ]; then + echo "Failed to create the lock file! Fallback to non-throttled kdump service restart" + /bin/kdumpctl reload + exit 1 +fi + +flock -n 9 +if [ $? -ne 0 ]; then + echo "Throttling kdump restart for concurrent udev event" + exit 0 +fi + +# Wait for at least 1 second, at most 4 seconds for udev to settle +# Idealy we will have a less than 1 second lag between udev events settle +# and kdump reload +sleep 1 && udevadm settle --timeout 3 + +# Release the lock, /bin/kdumpctl will block and make the process +# holding two locks at the same time and we might miss some events +exec 9>&- + +/bin/kdumpctl reload + +exit 0 diff --git a/SOURCES/kdump.conf b/SOURCES/kdump.conf new file mode 100644 index 0000000..d4fc78b --- /dev/null +++ b/SOURCES/kdump.conf @@ -0,0 +1,192 @@ +# This file contains a series of commands to perform (in order) in the kdump +# kernel after a kernel crash in the crash kernel(1st kernel) has happened. +# +# Directives in this file are only applicable to the kdump initramfs, and have +# no effect once the root filesystem is mounted and the normal init scripts are +# processed. +# +# Currently, only one dump target and path can be specified. If the dumping to +# the configured target fails, the failure action which can be configured via +# the "failure_action" directive will be performed. +# +# Supported options: +# +# auto_reset_crashkernel <yes|no> +# - whether to reset kernel crashkernel to new default value +# or not when kexec-tools updates the default crashkernel value and +# existing kernels using the old default kernel crashkernel value. +# The default value is yes. +# +# raw <partition> +# - Will dd /proc/vmcore into <partition>. +# Use persistent device names for partition devices, +# such as /dev/vg/<devname>. +# +# nfs <nfs mount> +# - Will mount nfs to <mnt>, and copy /proc/vmcore to +# <mnt>/<path>/%HOST-%DATE/, supports DNS. +# +# ssh <user@server> +# - Will save /proc/vmcore to <user@server>:<path>/%HOST-%DATE/, +# supports DNS. +# NOTE: make sure the user has write permissions on the server. +# +# sshkey <path> +# - Will use the sshkey to do ssh dump. +# Specify the path of the ssh key to use when dumping +# via ssh. The default value is /root/.ssh/kdump_id_rsa. +# +# <fs type> <partition> +# - Will mount -t <fs type> <partition> <mnt>, and copy +# /proc/vmcore to <mnt>/<path>/%HOST_IP-%DATE/. +# NOTE: <partition> can be a device node, label or uuid. +# It's recommended to use persistent device names +# such as /dev/vg/<devname>. +# Otherwise it's suggested to use label or uuid. +# +# path <path> +# - "path" represents the file system path in which vmcore +# will be saved. If a dump target is specified in +# kdump.conf, then "path" is relative to the specified +# dump target. +# +# Interpretation of "path" changes a bit if the user didn't +# specify any dump target explicitly in kdump.conf. In this +# case, "path" represents the absolute path from root. The +# dump target and adjusted path are arrived at automatically +# depending on what's mounted in the current system. +# +# Ignored for raw device dumps. If unset, will use the default +# "/var/crash". +# +# core_collector <command> <options> +# - This allows you to specify the command to copy +# the vmcore. The default is makedumpfile, which on +# some architectures can drastically reduce vmcore size. +# See /sbin/makedumpfile --help for a list of options. +# Note that the -i and -g options are not needed here, +# as the initrd will automatically be populated with a +# config file appropriate for the running kernel. +# The default core_collector for raw/ssh dump is: +# "makedumpfile -F -l --message-level 7 -d 31". +# The default core_collector for other targets is: +# "makedumpfile -l --message-level 7 -d 31". +# +# "makedumpfile -F" will create a flattened vmcore. +# You need to use "makedumpfile -R" to rearrange the dump data to +# a normal dumpfile readable with analysis tools. For example: +# "makedumpfile -R vmcore < vmcore.flat". +# +# For core_collector format details, you can refer to +# kexec-kdump-howto.txt or kdump.conf manpage. +# +# kdump_post <binary | script> +# - This directive allows you to run a executable binary +# or script after the vmcore dump process terminates. +# The exit status of the current dump process is fed to +# the executable binary or script as its first argument. +# All files under /etc/kdump/post.d are collectively sorted +# and executed in lexical order, before binary or script +# specified kdump_post parameter is executed. +# +# kdump_pre <binary | script> +# - Works like the "kdump_post" directive, but instead of running +# after the dump process, runs immediately before it. +# Exit status of this binary is interpreted as follows: +# 0 - continue with dump process as usual +# non 0 - run the final action (reboot/poweroff/halt) +# All files under /etc/kdump/pre.d are collectively sorted and +# executed in lexical order, after binary or script specified +# kdump_pre parameter is executed. +# Even if the binary or script in /etc/kdump/pre.d directory +# returns non 0 exit status, the processing is continued. +# +# extra_bins <binaries | shell scripts> +# - This directive allows you to specify additional binaries or +# shell scripts to be included in the kdump initrd. +# Generally they are useful in conjunction with a kdump_post +# or kdump_pre binary or script which depends on these extra_bins. +# +# extra_modules <module(s)> +# - This directive allows you to specify extra kernel modules +# that you want to be loaded in the kdump initrd. +# Multiple modules can be listed, separated by spaces, and any +# dependent modules will automatically be included. +# +# failure_action <reboot | halt | poweroff | shell | dump_to_rootfs> +# - Action to perform in case dumping fails. +# reboot: Reboot the system. +# halt: Halt the system. +# poweroff: Power down the system. +# shell: Drop to a bash shell. +# Exiting the shell reboots the system by default, +# or perform "final_action". +# dump_to_rootfs: Dump vmcore to rootfs from initramfs context and +# reboot by default or perform "final_action". +# Useful when non-root dump target is specified. +# The default option is "reboot". +# +# default <reboot | halt | poweroff | shell | dump_to_rootfs> +# - Same as the "failure_action" directive above, but this directive +# is obsolete and will be removed in the future. +# +# final_action <reboot | halt | poweroff> +# - Action to perform in case dumping succeeds. Also performed +# when "shell" or "dump_to_rootfs" failure action finishes. +# Each action is same as the "failure_action" directive above. +# The default is "reboot". +# +# force_rebuild <0 | 1> +# - By default, kdump initrd will only be rebuilt when necessary. +# Specify 1 to force rebuilding kdump initrd every time when kdump +# service starts. +# +# force_no_rebuild <0 | 1> +# - By default, kdump initrd will be rebuilt when necessary. +# Specify 1 to bypass rebuilding of kdump initrd. +# +# force_no_rebuild and force_rebuild options are mutually +# exclusive and they should not be set to 1 simultaneously. +# +# override_resettable <0 | 1> +# - Usually an unresettable block device can't be a dump target. +# Specifying 1 when you want to dump even though the block +# target is unresettable +# By default, it is 0, which will not try dumping destined to fail. +# +# dracut_args <arg(s)> +# - Pass extra dracut options when rebuilding kdump initrd. +# +# fence_kdump_args <arg(s)> +# - Command line arguments for fence_kdump_send (it can contain +# all valid arguments except hosts to send notification to). +# +# fence_kdump_nodes <node(s)> +# - List of cluster node(s) except localhost, separated by spaces, +# to send fence_kdump notifications to. +# (this option is mandatory to enable fence_kdump). +# + +#raw /dev/vg/lv_kdump +#ext4 /dev/vg/lv_kdump +#ext4 LABEL=/boot +#ext4 UUID=03138356-5e61-4ab3-b58e-27507ac41937 +#nfs my.server.com:/export/tmp +#nfs [2001:db8::1:2:3:4]:/export/tmp +#ssh user@my.server.com +#ssh user@2001:db8::1:2:3:4 +#sshkey /root/.ssh/kdump_id_rsa +auto_reset_crashkernel yes +path /var/crash +core_collector makedumpfile -l --message-level 7 -d 31 +#core_collector scp +#kdump_post /var/crash/scripts/kdump-post.sh +#kdump_pre /var/crash/scripts/kdump-pre.sh +#extra_bins /usr/bin/lftp +#extra_modules gfs2 +#failure_action shell +#force_rebuild 1 +#force_no_rebuild 1 +#dracut_args --omit-drivers "cfg80211 snd" --add-drivers "ext2 ext3" +#fence_kdump_args -p 7410 -f auto -c 0 -i 10 +#fence_kdump_nodes node1 node2 diff --git a/SOURCES/kdump.conf.5 b/SOURCES/kdump.conf.5 new file mode 100644 index 0000000..e3e9900 --- /dev/null +++ b/SOURCES/kdump.conf.5 @@ -0,0 +1,387 @@ +.TH KDUMP.CONF 5 "07/23/2008" "kexec-tools" + +.SH NAME +kdump.conf \- configuration file for kdump kernel. + +.SH DESCRIPTION + +kdump.conf is a configuration file for the kdump kernel crash +collection service. + +kdump.conf provides post-kexec instructions to the kdump kernel. It is +stored in the initrd file managed by the kdump service. If you change +this file and do not want to reboot in order for the changes to take +effect, restart the kdump service to rebuild the initrd. + +For most configurations, you can simply review the examples provided +in the stock /etc/kdump.conf. + +.B NOTE: +For filesystem dumps the dump target must be mounted before building +kdump initramfs. + +kdump.conf only affects the behavior of the initramfs. Please read the +kdump operational flow section of kexec-kdump-howto.txt in the docs to better +understand how this configuration file affects the behavior of kdump. + +.SH OPTIONS + +.B auto_reset_crashkernel <yes|no> +.RS +determine whether to reset kernel crashkernel to new default value +or not when kexec-tools updates the default crashkernel value and +existing kernels using the old default kernel crashkernel value + +.B raw <partition> +.RS +Will dd /proc/vmcore into <partition>. Use persistent device names for +partition devices, such as /dev/vg/<devname>. +.RE + +.B nfs <nfs mount> +.RS +Will mount nfs to <mnt>, and copy /proc/vmcore to <mnt>/<path>/%HOST-%DATE/, +supports DNS. Note that a fqdn should be used as the server name in the +mount point. +.RE + +.B ssh <user@server> +.RS +Will save /proc/vmcore through ssh pipe to <user@server>:<path>/%HOST-%DATE/, +supports DNS. NOTE: make sure user has necessary write permissions on +server and that a fqdn is used as the server name. +.RE + +.B sshkey <path> +.RS +Specify the path of the ssh key to use when dumping via ssh. +The default value is /root/.ssh/kdump_id_rsa. +.RE + +.B <fs type> <partition> +.RS +Will mount -t <fs type> <partition> <mnt>, and copy /proc/vmcore to +<mnt>/<path>/%HOST_IP-%DATE/. NOTE: <partition> can be a device node, label +or uuid. It's recommended to use persistent device names such as +/dev/vg/<devname>. Otherwise it's suggested to use label or uuid. +.RE + +.B path <path> +.RS +"path" represents the file system path in which vmcore will be saved. +If a dump target is specified in kdump.conf, then "path" is relative to the +specified dump target. +.PP +Interpretation of "path" changes a bit if the user didn't specify any dump +target explicitly in kdump.conf. In this case, "path" represents the +absolute path from root. The dump target and adjusted path are arrived +at automatically depending on what's mounted in the current system. +.PP +Ignored for raw device dumps. If unset, will use the default "/var/crash". +.RE + +.B core_collector <command> <options> +.RS +This allows you to specify the command to copy the vmcore. +The default is makedumpfile, which on some architectures can drastically reduce +core file size. See /sbin/makedumpfile --help for a list of options. +Note that the -i and -g options are not needed here, as the initrd +will automatically be populated with a config file appropriate +for the running kernel. +.PP +Note 1: About default core collector: +The default core_collector for raw/ssh dump is: +"makedumpfile -F -l --message-level 7 -d 31". +The default core_collector for other targets is: +"makedumpfile -l --message-level 7 -d 31". +Even if core_collector option is commented out in kdump.conf, makedumpfile +is the default core collector and kdump uses it internally. +If one does not want makedumpfile as default core_collector, then they +need to specify one using core_collector option to change the behavior. +.PP +Note 2: If "makedumpfile -F" is used then you will get a flattened format +vmcore.flat, you will need to use "makedumpfile -R" to rearrange the +dump data from standard input to a normal dumpfile (readable with analysis +tools). +ie. "makedumpfile -R vmcore < vmcore.flat" +.PP +Note 3: If specified core_collector simply copy the vmcore file to the +dump target (eg: cp, scp), the vmcore could be significantly large. +Please make sure the dump target has enough space, at leaset larger +than the system's RAM. + +.RE + +.B kdump_post <binary | script> +.RS +This directive allows you to run a specified executable +just after the vmcore dump process terminates. The exit +status of the current dump process is fed to the kdump_post +executable as its first argument($1). Executable can modify +it to indicate the new exit status of succeeding dump process, +.PP +All files under /etc/kdump/post.d are collectively sorted +and executed in lexical order, before binary or script +specified kdump_post parameter is executed. +.PP +Note that scripts written for use with this directive must use the /bin/bash +interpreter. And since these scripts run in kdump enviroment, the reference to +the storage or network device in the scripts should adhere to the section +'Supported dump target types and requirements' in kexec-kdump-howto.txt. + +.RE + +.B kdump_pre <binary | script> +.RS +Works just like the "kdump_post" directive, but instead +of running after the dump process, runs immediately +before. Exit status of this binary is interpreted +as follows: +.PP +0 - continue with dump process as usual +.PP +non 0 - run the final action (reboot/poweroff/halt) +.PP +All files under /etc/kdump/pre.d are collectively sorted and +executed in lexical order, after binary or script specified +kdump_pre parameter is executed. +Even if the binary or script in /etc/kdump/pre.d directory +returns non 0 exit status, the processing is continued. +.PP +Note that scripts written for use with this directive must use the /bin/bash +interpreter. And since these scripts run in kdump enviroment, the reference to +the storage or network device in the scripts should adhere to the section +'Supported dump target types and requirements' in kexec-kdump-howto.txt. + +.RE + +.B extra_bins <binaries | shell scripts> +.RS +This directive allows you to specify additional +binaries or shell scripts you'd like to include in +your kdump initrd. Generally only useful in +conjunction with a kdump_post binary or script that +relies on other binaries or scripts. +.RE + +.B extra_modules <module(s)> +.RS +This directive allows you to specify extra kernel +modules that you want to be loaded in the kdump +initrd, typically used to set up access to +non-boot-path dump targets that might otherwise +not be accessible in the kdump environment. Multiple +modules can be listed, separated by spaces, and any +dependent modules will automatically be included. +.RE + +.B failure_action <reboot | halt | poweroff | shell | dump_to_rootfs> +.RS +Action to perform in case dumping to the intended target fails. The default is "reboot". +reboot: Reboot the system (this is what most people will want, as it returns the system +to a normal state). halt: Halt the system and lose the vmcore. poweroff: The system +will be powered down. shell: Drop to a shell session inside the initramfs, from which +you can manually perform additional recovery actions. Exiting this shell reboots the +system by default or performs "final_action". +Note: kdump uses bash as the default shell. dump_to_rootfs: If non-root dump +target is specified, the failure action can be set as dump_to_rootfs. That means when +dumping to target fails, dump vmcore to rootfs from initramfs context and reboot +by default or perform "final_action". +.RE + +.B default <reboot | halt | poweroff | shell | dump_to_rootfs> +.RS +Same as the "failure_action" directive above, but this directive is obsolete +and will be removed in the future. +.RE + +.B final_action <reboot | halt | poweroff> +.RS +Action to perform in case dumping to the intended target succeeds. +Also performed when "shell" or "dump_to_rootfs" failure action finishes. +Each action is same as the "failure_action" directive above. +The default is "reboot". +.RE + +.B force_rebuild <0 | 1> +.RS +By default, kdump initrd will only be rebuilt when necessary. +Specify 1 to force rebuilding kdump initrd every time when kdump service starts. +.RE + +.B force_no_rebuild <0 | 1> +.RS +By default, kdump initrd will be rebuilt when necessary. +Specify 1 to bypass rebuilding of kdump initrd. + +.PP +force_no_rebuild and force_rebuild options are mutually exclusive and +they should not be set to 1 simultaneously. +.RE + +.B override_resettable <0 | 1> +.RS +Usually an unresettable block device can't be a dump target. Specifying 1 means +that even though the block target is unresettable, the user wants to try dumping anyway. +By default, it's set to 0, which will not try something destined to fail. +.RE + + +.B dracut_args <arg(s)> +.RS +Kdump uses dracut to generate initramfs for second kernel. This option +allows a user to pass arguments to dracut directly. +.RE + + +.B fence_kdump_args <arg(s)> +.RS +Command line arguments for fence_kdump_send (it can contain all valid +arguments except hosts to send notification to). +.RE + + +.B fence_kdump_nodes <node(s)> +.RS +List of cluster node(s) except localhost, separated by spaces, to send fence_kdump notification +to (this option is mandatory to enable fence_kdump). +.RE + + +.SH DEPRECATED OPTIONS + +.B net <nfs mount>|<user@server> +.RS +net option is replaced by nfs and ssh options. Use nfs or ssh options +directly. +.RE + +.B options <module> <option list> +.RS +Use KDUMP_COMMANDLINE_APPEND in /etc/sysconfig/kdump to add module options as +kernel command line parameters. For example, specify 'loop.max_loop=1' to limit +maximum loop devices to 1. +.RE + +.B link_delay <seconds> +.RS +link_delay was used to wait for a network device to initialize before using it. +Now dracut network module takes care of this issue automatically. +.RE + +.B disk_timeout <seconds> +.RS +Similar to link_delay, dracut ensures disks are ready before kdump uses them. +.RE + +.B debug_mem_level <0-3> +.RS +Turn on verbose debug output of kdump scripts regarding free/used memory at +various points of execution. This feature has been +moved to dracut now. +Use KDUMP_COMMANDLINE_APPEND in /etc/sysconfig/kdump and +append dracut cmdline param rd.memdebug=[0-3] to enable the debug output. + +Higher level means more debugging output. +.PP +0 - no output +.PP +1 - partial /proc/meminfo +.PP +2 - /proc/meminfo +.PP +3 - /proc/meminfo + /proc/slabinfo +.RE + +.B blacklist <list of kernel modules> +.RS +blacklist option was recently being used to prevent loading modules in +initramfs. General terminology for blacklist has been that module is +present in initramfs but it is not actually loaded in kernel. Hence +retaining blacklist option creates more confusing behavior. It has been +deprecated. +.PP +Instead, use rd.driver.blacklist option on second kernel to blacklist +a certain module. One can edit /etc/sysconfig/kdump.conf and edit +KDUMP_COMMANDLINE_APPEND to pass kernel command line options. Refer +to dracut.cmdline man page for more details on module blacklist option. +.RE + +.RE + +.SH EXAMPLES +Here are some examples for core_collector option: +.PP +Core collector command format depends on dump target type. Typically for +filesystem (local/remote), core_collector should accept two arguments. +First one is source file and second one is target file. For ex. +.TP +ex1. +core_collector "cp --sparse=always" + +Above will effectively be translated to: + +cp --sparse=always /proc/vmcore <dest-path>/vmcore +.TP +ex2. +core_collector "makedumpfile -l --message-level 7 -d 31" + +Above will effectively be translated to: + +makedumpfile -l --message-level 7 -d 31 /proc/vmcore <dest-path>/vmcore +.PP +For dump targets like raw and ssh, in general, core collector should expect +one argument (source file) and should output the processed core on standard +output (There is one exception of "scp", discussed later). This standard +output will be saved to destination using appropriate commands. + +raw dumps examples: +.TP +ex3. +core_collector "cat" + +Above will effectively be translated to. + +cat /proc/vmcore | dd of=<target-device> +.TP +ex4. +core_collector "makedumpfile -F -l --message-level 7 -d 31" + +Above will effectively be translated to. + +makedumpfile -F -l --message-level 7 -d 31 | dd of=<target-device> +.PP +ssh dumps examples +.TP +ex5. +core_collector "cat" + +Above will effectively be translated to. + +cat /proc/vmcore | ssh <options> <remote-location> "dd of=path/vmcore" +.TP +ex6. +core_collector "makedumpfile -F -l --message-level 7 -d 31" + +Above will effectively be translated to. + +makedumpfile -F -l --message-level 7 -d 31 | ssh <options> <remote-location> "dd of=path/vmcore" + +There is one exception to standard output rule for ssh dumps. And that is +scp. As scp can handle ssh destinations for file transfers, one can +specify "scp" as core collector for ssh targets (no output on stdout). +.TP +ex7. +core_collector "scp" + +Above will effectively be translated to. + +scp /proc/vmcore <user@host>:path/vmcore + +.PP +examples for other options please see +.I /etc/kdump.conf + +.SH SEE ALSO + +kexec(8) mkdumprd(8) dracut.cmdline(7) diff --git a/SOURCES/kdump.service b/SOURCES/kdump.service new file mode 100644 index 0000000..99feed8 --- /dev/null +++ b/SOURCES/kdump.service @@ -0,0 +1,16 @@ +[Unit] +Description=Crash recovery kernel arming +After=network.target network-online.target remote-fs.target basic.target +DefaultDependencies=no +ConditionKernelCommandLine=crashkernel + +[Service] +Type=oneshot +ExecStart=/usr/bin/kdumpctl start +ExecStop=/usr/bin/kdumpctl stop +ExecReload=/usr/bin/kdumpctl reload +RemainAfterExit=yes +StartLimitInterval=0 + +[Install] +WantedBy=multi-user.target diff --git a/SOURCES/kdump.sysconfig b/SOURCES/kdump.sysconfig new file mode 100644 index 0000000..70ebf04 --- /dev/null +++ b/SOURCES/kdump.sysconfig @@ -0,0 +1,53 @@ +# Kernel Version string for the -kdump kernel, such as 2.6.13-1544.FC5kdump +# If no version is specified, then the init script will try to find a +# kdump kernel with the same version number as the running kernel. +KDUMP_KERNELVER="" + +# The kdump commandline is the command line that needs to be passed off to +# the kdump kernel. This will likely match the contents of the grub kernel +# line. For example: +# KDUMP_COMMANDLINE="ro root=LABEL=/" +# Dracut depends on proper root= options, so please 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=". +# If a command line is not specified, the default will be taken from +# /proc/cmdline +KDUMP_COMMANDLINE="" + +# This variable lets us remove arguments from the current kdump commandline +# as taken from either KDUMP_COMMANDLINE above, or from /proc/cmdline +# NOTE: some arguments such as crashkernel will always be removed +KDUMP_COMMANDLINE_REMOVE="hugepages hugepagesz slub_debug quiet log_buf_len swiotlb cma hugetlb_cma" + +# This variable lets us append arguments to the current kdump commandline +# after processed by KDUMP_COMMANDLINE_REMOVE +KDUMP_COMMANDLINE_APPEND="irqpoll maxcpus=1 reset_devices novmcoredd cma=0 hugetlb_cma=0" + +# Any additional kexec arguments required. In most situations, this should +# be left empty +# +# Example: +# KEXEC_ARGS="--elf32-core-headers" +KEXEC_ARGS="" + +#Where to find the boot image +#KDUMP_BOOTDIR="/boot" + +#What is the image type used for kdump +KDUMP_IMG="vmlinuz" + +# 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) +# - @var KDUMP_KMSGLOGLVL - logging level to /dev/kmsg (only for boot-time) +# +# In the second kernel, kdump will use the rd.kdumploglvl option to set the +# log level in the above KDUMP_COMMANDLINE_APPEND. +# - @var rd.kdumploglvl - logging level to syslog (by logger command) +# - for example: add the rd.kdumploglvl=3 option to KDUMP_COMMANDLINE_APPEND +# +# Logging levels: no logging(0), error(1),warn(2),info(3),debug(4) +# +# KDUMP_STDLOGLVL=3 +# KDUMP_SYSLOGLVL=0 +# KDUMP_KMSGLOGLVL=0 diff --git a/SOURCES/kdump.sysconfig.aarch64 b/SOURCES/kdump.sysconfig.aarch64 new file mode 100644 index 0000000..67a2af7 --- /dev/null +++ b/SOURCES/kdump.sysconfig.aarch64 @@ -0,0 +1,53 @@ +# Kernel Version string for the -kdump kernel, such as 2.6.13-1544.FC5kdump +# If no version is specified, then the init script will try to find a +# kdump kernel with the same version number as the running kernel. +KDUMP_KERNELVER="" + +# The kdump commandline is the command line that needs to be passed off to +# the kdump kernel. This will likely match the contents of the grub kernel +# line. For example: +# KDUMP_COMMANDLINE="ro root=LABEL=/" +# Dracut depends on proper root= options, so please 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=". +# If a command line is not specified, the default will be taken from +# /proc/cmdline +KDUMP_COMMANDLINE="" + +# This variable lets us remove arguments from the current kdump commandline +# as taken from either KDUMP_COMMANDLINE above, or from /proc/cmdline +# NOTE: some arguments such as crashkernel will always be removed +KDUMP_COMMANDLINE_REMOVE="hugepages hugepagesz slub_debug quiet log_buf_len swiotlb cma hugetlb_cma" + +# This variable lets us append arguments to the current kdump commandline +# after processed by KDUMP_COMMANDLINE_REMOVE +KDUMP_COMMANDLINE_APPEND="irqpoll nr_cpus=1 reset_devices cgroup_disable=memory udev.children-max=2 panic=10 swiotlb=noforce novmcoredd cma=0 hugetlb_cma=0" + +# Any additional kexec arguments required. In most situations, this should +# be left empty +# +# Example: +# KEXEC_ARGS="--elf32-core-headers" +KEXEC_ARGS="-s" + +#Where to find the boot image +#KDUMP_BOOTDIR="/boot" + +#What is the image type used for kdump +KDUMP_IMG="vmlinuz" + +# 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) +# - @var KDUMP_KMSGLOGLVL - logging level to /dev/kmsg (only for boot-time) +# +# In the second kernel, kdump will use the rd.kdumploglvl option to set the +# log level in the above KDUMP_COMMANDLINE_APPEND. +# - @var rd.kdumploglvl - logging level to syslog (by logger command) +# - for example: add the rd.kdumploglvl=3 option to KDUMP_COMMANDLINE_APPEND +# +# Logging levels: no logging(0), error(1),warn(2),info(3),debug(4) +# +# KDUMP_STDLOGLVL=3 +# KDUMP_SYSLOGLVL=0 +# KDUMP_KMSGLOGLVL=0 diff --git a/SOURCES/kdump.sysconfig.i386 b/SOURCES/kdump.sysconfig.i386 new file mode 100644 index 0000000..7e18c1c --- /dev/null +++ b/SOURCES/kdump.sysconfig.i386 @@ -0,0 +1,56 @@ +# Kernel Version string for the -kdump kernel, such as 2.6.13-1544.FC5kdump +# If no version is specified, then the init script will try to find a +# kdump kernel with the same version number as the running kernel. +KDUMP_KERNELVER="" + +# The kdump commandline is the command line that needs to be passed off to +# the kdump kernel. This will likely match the contents of the grub kernel +# line. For example: +# KDUMP_COMMANDLINE="ro root=LABEL=/" +# Dracut depends on proper root= options, so please 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=". +# If a command line is not specified, the default will be taken from +# /proc/cmdline +KDUMP_COMMANDLINE="" + +# This variable lets us remove arguments from the current kdump commandline +# as taken from either KDUMP_COMMANDLINE above, or from /proc/cmdline +# NOTE: some arguments such as crashkernel will always be removed +KDUMP_COMMANDLINE_REMOVE="hugepages hugepagesz slub_debug quiet log_buf_len swiotlb cma hugetlb_cma" + +# This variable lets us append arguments to the current kdump commandline +# after processed by KDUMP_COMMANDLINE_REMOVE +KDUMP_COMMANDLINE_APPEND="irqpoll nr_cpus=1 reset_devices numa=off udev.children-max=2 panic=10 transparent_hugepage=never novmcoredd cma=0 hugetlb_cma=0" + +# Any additional kexec arguments required. In most situations, this should +# be left empty +# +# Example: +# KEXEC_ARGS="--elf32-core-headers" +KEXEC_ARGS="" + +#Where to find the boot image +#KDUMP_BOOTDIR="/boot" + +#What is the image type used for kdump +KDUMP_IMG="vmlinuz" + +#What is the images extension. Relocatable kernels don't have one +KDUMP_IMG_EXT="" + +# 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) +# - @var KDUMP_KMSGLOGLVL - logging level to /dev/kmsg (only for boot-time) +# +# In the second kernel, kdump will use the rd.kdumploglvl option to set the +# log level in the above KDUMP_COMMANDLINE_APPEND. +# - @var rd.kdumploglvl - logging level to syslog (by logger command) +# - for example: add the rd.kdumploglvl=3 option to KDUMP_COMMANDLINE_APPEND +# +# Logging levels: no logging(0), error(1),warn(2),info(3),debug(4) +# +# KDUMP_STDLOGLVL=3 +# KDUMP_SYSLOGLVL=0 +# KDUMP_KMSGLOGLVL=0 diff --git a/SOURCES/kdump.sysconfig.ppc64 b/SOURCES/kdump.sysconfig.ppc64 new file mode 100644 index 0000000..ebb22f6 --- /dev/null +++ b/SOURCES/kdump.sysconfig.ppc64 @@ -0,0 +1,58 @@ +# Kernel Version string for the -kdump kernel, such as 2.6.13-1544.FC5kdump +# If no version is specified, then the init script will try to find a +# kdump kernel with the same version number as the running kernel. +KDUMP_KERNELVER="" + +# The kdump commandline is the command line that needs to be passed off to +# the kdump kernel. This will likely match the contents of the grub kernel +# line. For example: +# KDUMP_COMMANDLINE="ro root=LABEL=/" +# Dracut depends on proper root= options, so please 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=". +# If a command line is not specified, the default will be taken from +# /proc/cmdline +KDUMP_COMMANDLINE="" + +# This variable lets us remove arguments from the current kdump commandline +# as taken from either KDUMP_COMMANDLINE above, or from /proc/cmdline +# NOTE: some arguments such as crashkernel will always be removed +KDUMP_COMMANDLINE_REMOVE="hugepages hugepagesz slub_debug quiet log_buf_len swiotlb hugetlb_cma" + +# This variable lets us append arguments to the current kdump commandline +# after processed by KDUMP_COMMANDLINE_REMOVE +KDUMP_COMMANDLINE_APPEND="irqpoll maxcpus=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" + +# Any additional kexec arguments required. In most situations, this should +# be left empty +# +# Example: +# KEXEC_ARGS="--elf32-core-headers" +KEXEC_ARGS="--dt-no-old-root" + +#Where to find the boot image +#KDUMP_BOOTDIR="/boot" + +#What is the image type used for kdump +KDUMP_IMG="vmlinuz" + +#What is the images extension. Relocatable kernels don't have one +KDUMP_IMG_EXT="" + +#Specify the action after failure + +# 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) +# - @var KDUMP_KMSGLOGLVL - logging level to /dev/kmsg (only for boot-time) +# +# In the second kernel, kdump will use the rd.kdumploglvl option to set the +# log level in the above KDUMP_COMMANDLINE_APPEND. +# - @var rd.kdumploglvl - logging level to syslog (by logger command) +# - for example: add the rd.kdumploglvl=3 option to KDUMP_COMMANDLINE_APPEND +# +# Logging levels: no logging(0), error(1),warn(2),info(3),debug(4) +# +# KDUMP_STDLOGLVL=3 +# KDUMP_SYSLOGLVL=0 +# KDUMP_KMSGLOGLVL=0 diff --git a/SOURCES/kdump.sysconfig.ppc64le b/SOURCES/kdump.sysconfig.ppc64le new file mode 100644 index 0000000..270a2cf --- /dev/null +++ b/SOURCES/kdump.sysconfig.ppc64le @@ -0,0 +1,58 @@ +# Kernel Version string for the -kdump kernel, such as 2.6.13-1544.FC5kdump +# If no version is specified, then the init script will try to find a +# kdump kernel with the same version number as the running kernel. +KDUMP_KERNELVER="" + +# The kdump commandline is the command line that needs to be passed off to +# the kdump kernel. This will likely match the contents of the grub kernel +# line. For example: +# KDUMP_COMMANDLINE="ro root=LABEL=/" +# Dracut depends on proper root= options, so please 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=". +# If a command line is not specified, the default will be taken from +# /proc/cmdline +KDUMP_COMMANDLINE="" + +# This variable lets us remove arguments from the current kdump commandline +# as taken from either KDUMP_COMMANDLINE above, or from /proc/cmdline +# NOTE: some arguments such as crashkernel will always be removed +KDUMP_COMMANDLINE_REMOVE="hugepages hugepagesz slub_debug quiet log_buf_len swiotlb hugetlb_cma" + +# This variable lets us append arguments to the current kdump commandline +# after processed by KDUMP_COMMANDLINE_REMOVE +KDUMP_COMMANDLINE_APPEND="irqpoll maxcpus=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" + +# Any additional kexec arguments required. In most situations, this should +# be left empty +# +# Example: +# KEXEC_ARGS="--elf32-core-headers" +KEXEC_ARGS="--dt-no-old-root -s" + +#Where to find the boot image +#KDUMP_BOOTDIR="/boot" + +#What is the image type used for kdump +KDUMP_IMG="vmlinuz" + +#What is the images extension. Relocatable kernels don't have one +KDUMP_IMG_EXT="" + +#Specify the action after failure + +# 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) +# - @var KDUMP_KMSGLOGLVL - logging level to /dev/kmsg (only for boot-time) +# +# In the second kernel, kdump will use the rd.kdumploglvl option to set the +# log level in the above KDUMP_COMMANDLINE_APPEND. +# - @var rd.kdumploglvl - logging level to syslog (by logger command) +# - for example: add the rd.kdumploglvl=3 option to KDUMP_COMMANDLINE_APPEND +# +# Logging levels: no logging(0), error(1),warn(2),info(3),debug(4) +# +# KDUMP_STDLOGLVL=3 +# KDUMP_SYSLOGLVL=0 +# KDUMP_KMSGLOGLVL=0 diff --git a/SOURCES/kdump.sysconfig.s390x b/SOURCES/kdump.sysconfig.s390x new file mode 100644 index 0000000..234cfe9 --- /dev/null +++ b/SOURCES/kdump.sysconfig.s390x @@ -0,0 +1,59 @@ +# Kernel Version string for the -kdump kernel, such as 2.6.13-1544.FC5kdump +# If no version is specified, then the init script will try to find a +# kdump kernel with the same version number as the running kernel. +KDUMP_KERNELVER="" + +# The kdump commandline is the command line that needs to be passed off to +# the kdump kernel. This will likely match the contents of the grub kernel +# line. For example: +# KDUMP_COMMANDLINE="ro root=LABEL=/" +# Dracut depends on proper root= options, so please 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=". +# If a command line is not specified, the default will be taken from +# /proc/cmdline +KDUMP_COMMANDLINE="" + +# This variable lets us remove arguments from the current kdump commandline +# as taken from either KDUMP_COMMANDLINE above, or from /proc/cmdline +# NOTE: some arguments such as crashkernel will always be removed +KDUMP_COMMANDLINE_REMOVE="hugepages hugepagesz slub_debug quiet log_buf_len swiotlb vmcp_cma cma hugetlb_cma prot_virt" + +# This variable lets us append arguments to the current kdump commandline +# after processed by KDUMP_COMMANDLINE_REMOVE +KDUMP_COMMANDLINE_APPEND="nr_cpus=1 cgroup_disable=memory numa=off udev.children-max=2 panic=10 transparent_hugepage=never novmcoredd vmcp_cma=0 cma=0 hugetlb_cma=0" + +# Any additional /sbin/mkdumprd arguments required. +MKDUMPRD_ARGS="" + +# Any additional kexec arguments required. In most situations, this should +# be left empty +# +# Example: +# KEXEC_ARGS="--elf32-core-headers" +KEXEC_ARGS="-s" + +#Where to find the boot image +#KDUMP_BOOTDIR="/boot" + +#What is the image type used for kdump +KDUMP_IMG="vmlinuz" + +#What is the images extension. Relocatable kernels don't have one +KDUMP_IMG_EXT="" + +# 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) +# - @var KDUMP_KMSGLOGLVL - logging level to /dev/kmsg (only for boot-time) +# +# In the second kernel, kdump will use the rd.kdumploglvl option to set the +# log level in the above KDUMP_COMMANDLINE_APPEND. +# - @var rd.kdumploglvl - logging level to syslog (by logger command) +# - for example: add the rd.kdumploglvl=3 option to KDUMP_COMMANDLINE_APPEND +# +# Logging levels: no logging(0), error(1),warn(2),info(3),debug(4) +# +# KDUMP_STDLOGLVL=3 +# KDUMP_SYSLOGLVL=0 +# KDUMP_KMSGLOGLVL=0 diff --git a/SOURCES/kdump.sysconfig.x86_64 b/SOURCES/kdump.sysconfig.x86_64 new file mode 100644 index 0000000..188ba3c --- /dev/null +++ b/SOURCES/kdump.sysconfig.x86_64 @@ -0,0 +1,56 @@ +# Kernel Version string for the -kdump kernel, such as 2.6.13-1544.FC5kdump +# If no version is specified, then the init script will try to find a +# kdump kernel with the same version number as the running kernel. +KDUMP_KERNELVER="" + +# The kdump commandline is the command line that needs to be passed off to +# the kdump kernel. This will likely match the contents of the grub kernel +# line. For example: +# KDUMP_COMMANDLINE="ro root=LABEL=/" +# Dracut depends on proper root= options, so please 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=". +# If a command line is not specified, the default will be taken from +# /proc/cmdline +KDUMP_COMMANDLINE="" + +# This variable lets us remove arguments from the current kdump commandline +# as taken from either KDUMP_COMMANDLINE above, or from /proc/cmdline +# NOTE: some arguments such as crashkernel will always be removed +KDUMP_COMMANDLINE_REMOVE="hugepages hugepagesz slub_debug quiet log_buf_len swiotlb cma hugetlb_cma" + +# This variable lets us append arguments to the current kdump commandline +# after processed by KDUMP_COMMANDLINE_REMOVE +KDUMP_COMMANDLINE_APPEND="irqpoll nr_cpus=1 reset_devices cgroup_disable=memory mce=off numa=off udev.children-max=2 panic=10 acpi_no_memhotplug transparent_hugepage=never nokaslr hest_disable novmcoredd cma=0 hugetlb_cma=0" + +# Any additional kexec arguments required. In most situations, this should +# be left empty +# +# Example: +# KEXEC_ARGS="--elf32-core-headers" +KEXEC_ARGS="-s" + +#Where to find the boot image +#KDUMP_BOOTDIR="/boot" + +#What is the image type used for kdump +KDUMP_IMG="vmlinuz" + +#What is the images extension. Relocatable kernels don't have one +KDUMP_IMG_EXT="" + +# 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) +# - @var KDUMP_KMSGLOGLVL - logging level to /dev/kmsg (only for boot-time) +# +# In the second kernel, kdump will use the rd.kdumploglvl option to set the +# log level in the above KDUMP_COMMANDLINE_APPEND. +# - @var rd.kdumploglvl - logging level to syslog (by logger command) +# - for example: add the rd.kdumploglvl=3 option to KDUMP_COMMANDLINE_APPEND +# +# Logging levels: no logging(0), error(1),warn(2),info(3),debug(4) +# +# KDUMP_STDLOGLVL=3 +# KDUMP_SYSLOGLVL=0 +# KDUMP_KMSGLOGLVL=0 diff --git a/SOURCES/kdumpctl b/SOURCES/kdumpctl new file mode 100755 index 0000000..d169089 --- /dev/null +++ b/SOURCES/kdumpctl @@ -0,0 +1,1820 @@ +#!/bin/bash +KEXEC=/sbin/kexec + +KDUMP_KERNELVER="" +KDUMP_KERNEL="" +KDUMP_COMMANDLINE="" +KEXEC_ARGS="" +KDUMP_LOG_PATH="/var/log" +MKDUMPRD="/sbin/mkdumprd -f" +MKFADUMPRD="/sbin/mkfadumprd" +DRACUT_MODULES_FILE="/usr/lib/dracut/modules.txt" +SAVE_PATH=/var/crash +SSH_KEY_LOCATION="/root/.ssh/kdump_id_rsa" +INITRD_CHECKSUM_LOCATION="/boot/.fadump_initrd_checksum" +DUMP_TARGET="" +DEFAULT_INITRD="" +DEFAULT_INITRD_BAK="" +KDUMP_INITRD="" +TARGET_INITRD="" +FADUMP_REGISTER_SYS_NODE="/sys/kernel/fadump_registered" +#kdump shall be the default dump mode +DEFAULT_DUMP_MODE="kdump" +image_time=0 + +standard_kexec_args="-d -p" + +# Some default values in case /etc/sysconfig/kdump doesn't include +KDUMP_COMMANDLINE_REMOVE="hugepages hugepagesz slub_debug" + +if [[ -f /etc/sysconfig/kdump ]]; then + . /etc/sysconfig/kdump +fi + +[[ $dracutbasedir ]] || dracutbasedir=/usr/lib/dracut +. $dracutbasedir/dracut-functions.sh +. /lib/kdump/kdump-lib.sh +. /lib/kdump/kdump-logger.sh + +#initiate the kdump logger +if ! dlog_init; then + echo "failed to initiate the kdump logger." + exit 1 +fi + +single_instance_lock() +{ + local rc timeout=5 + + if ! exec 9> /var/lock/kdump; then + derror "Create file lock failed" + exit 1 + fi + + flock -n 9 + rc=$? + + while [[ $rc -ne 0 ]]; do + dinfo "Another app is currently holding the kdump lock; waiting for it to exit..." + flock -w $timeout 9 + rc=$? + done +} + +determine_dump_mode() +{ + # Check if firmware-assisted dump is enabled + # if yes, set the dump mode as fadump + if is_fadump_capable; then + dinfo "Dump mode is fadump" + DEFAULT_DUMP_MODE="fadump" + fi + ddebug "DEFAULT_DUMP_MODE=$DEFAULT_DUMP_MODE" +} + +save_core() +{ + coredir="/var/crash/$(date +"%Y-%m-%d-%H:%M")" + + mkdir -p "$coredir" + ddebug "cp --sparse=always /proc/vmcore $coredir/vmcore-incomplete" + if cp --sparse=always /proc/vmcore "$coredir/vmcore-incomplete"; then + mv "$coredir/vmcore-incomplete" "$coredir/vmcore" + dinfo "saved a vmcore to $coredir" + else + derror "failed to save a vmcore to $coredir" + fi + + # pass the dmesg to Abrt tool if exists, in order + # to collect the kernel oops message. + # https://fedorahosted.org/abrt/ + if [[ -x /usr/bin/dumpoops ]]; then + ddebug "makedumpfile --dump-dmesg $coredir/vmcore $coredir/dmesg" + makedumpfile --dump-dmesg "$coredir/vmcore" "$coredir/dmesg" > /dev/null 2>&1 + ddebug "dumpoops -d $coredir/dmesg" + if dumpoops -d "$coredir/dmesg" > /dev/null 2>&1; then + dinfo "kernel oops has been collected by abrt tool" + fi + fi +} + +rebuild_fadump_initrd() +{ + if ! $MKFADUMPRD "$DEFAULT_INITRD_BAK" "$TARGET_INITRD" --kver "$KDUMP_KERNELVER"; then + derror "mkfadumprd: failed to make fadump initrd" + return 1 + fi + + return 0 +} + +check_earlykdump_is_enabled() +{ + grep -q -w "rd.earlykdump" /proc/cmdline + return $? +} + +rebuild_kdump_initrd() +{ + ddebug "rebuild kdump initrd: $MKDUMPRD $TARGET_INITRD $KDUMP_KERNELVER" + if ! $MKDUMPRD "$TARGET_INITRD" "$KDUMP_KERNELVER"; then + derror "mkdumprd: failed to make kdump initrd" + return 1 + fi + + if check_earlykdump_is_enabled; then + dwarn "Tips: If early kdump is enabled, also require rebuilding the system initramfs to make the changes take effect for early kdump." + fi + + return 0 +} + +rebuild_initrd() +{ + if [[ ! -w $(dirname "$TARGET_INITRD") ]]; then + derror "$(dirname "$TARGET_INITRD") does not have write permission. Cannot rebuild $TARGET_INITRD" + return 1 + fi + + if [[ $DEFAULT_DUMP_MODE == "fadump" ]]; then + rebuild_fadump_initrd + else + rebuild_kdump_initrd + fi + + return $? +} + +#$1: the files to be checked with IFS=' ' +check_exist() +{ + for file in $1; do + if [[ ! -e $file ]]; then + derror "Error: $file not found." + return 1 + fi + done +} + +#$1: the files to be checked with IFS=' ' +check_executable() +{ + for file in $1; do + if [[ ! -x $file ]]; then + derror "Error: $file is not executable." + return 1 + fi + done +} + +backup_default_initrd() +{ + ddebug "backup default initrd: $DEFAULT_INITRD" + + if [[ ! -f $DEFAULT_INITRD ]]; then + return + fi + + if [[ ! -e $DEFAULT_INITRD_BAK ]]; then + dinfo "Backing up $DEFAULT_INITRD before rebuild." + # save checksum to verify before restoring + sha1sum "$DEFAULT_INITRD" > "$INITRD_CHECKSUM_LOCATION" + if ! cp "$DEFAULT_INITRD" "$DEFAULT_INITRD_BAK"; then + dwarn "WARNING: failed to backup $DEFAULT_INITRD." + rm -f "$DEFAULT_INITRD_BAK" + fi + fi +} + +restore_default_initrd() +{ + ddebug "restore default initrd: $DEFAULT_INITRD" + + if [[ ! -f $DEFAULT_INITRD ]]; then + return + fi + + # If a backup initrd exists, we must be switching back from + # fadump to kdump. Restore the original default initrd. + if [[ -f $DEFAULT_INITRD_BAK ]] && [[ -f $INITRD_CHECKSUM_LOCATION ]]; then + # verify checksum before restoring + backup_checksum=$(sha1sum "$DEFAULT_INITRD_BAK" | awk '{ print $1 }') + default_checksum=$(awk '{ print $1 }' "$INITRD_CHECKSUM_LOCATION") + if [[ $default_checksum != "$backup_checksum" ]]; then + dwarn "WARNING: checksum mismatch! Can't restore original initrd.." + else + rm -f $INITRD_CHECKSUM_LOCATION + if mv "$DEFAULT_INITRD_BAK" "$DEFAULT_INITRD"; then + derror "Restoring original initrd as fadump mode is disabled." + sync + fi + fi + fi +} + +check_config() +{ + local -A _opt_rec + while read -r config_opt config_val; do + case "$config_opt" in + dracut_args) + if [[ $config_val == *--mount* ]]; then + if [[ $(echo "$config_val" | grep -o "\-\-mount" | wc -l) -ne 1 ]]; then + derror 'Multiple mount targets specified in one "dracut_args".' + return 1 + fi + config_opt=_target + fi + ;; + raw) + if [[ -d "/proc/device-tree/ibm,opal/dump" ]]; then + dwarn "WARNING: Won't capture opalcore when 'raw' dump target is used." + fi + config_opt=_target + ;; + ext[234] | minix | btrfs | xfs | nfs | ssh) + config_opt=_target + ;; + sshkey | path | core_collector | kdump_post | kdump_pre | extra_bins | extra_modules | failure_action | default | final_action | force_rebuild | force_no_rebuild | fence_kdump_args | fence_kdump_nodes | auto_reset_crashkernel) ;; + + net | options | link_delay | disk_timeout | debug_mem_level | blacklist) + derror "Deprecated kdump config option: $config_opt. Refer to kdump.conf manpage for alternatives." + return 1 + ;; + '') + continue + ;; + *) + derror "Invalid kdump config option $config_opt" + return 1 + ;; + esac + + if [[ -z $config_val ]]; then + derror "Invalid kdump config value for option '$config_opt'" + return 1 + fi + + if [[ -n ${_opt_rec[$config_opt]} ]]; then + if [[ $config_opt == _target ]]; then + derror "More than one dump targets specified" + else + derror "Duplicated kdump config value of option $config_opt" + fi + return 1 + fi + _opt_rec[$config_opt]="$config_val" + done <<< "$(kdump_read_conf)" + + check_failure_action_config || return 1 + check_final_action_config || return 1 + check_fence_kdump_config || return 1 + + return 0 +} + +# get_pcs_cluster_modified_files <image timestamp> +# return list of modified file for fence_kdump modified in Pacemaker cluster +get_pcs_cluster_modified_files() +{ + local time_stamp + local modified_files + + is_generic_fence_kdump && return 1 + is_pcs_fence_kdump || return 1 + + time_stamp=$(pcs cluster cib | xmllint --xpath 'string(/cib/@cib-last-written)' - | xargs -0 date +%s --date) + + if [[ -n $time_stamp ]] && [[ $time_stamp -gt $image_time ]]; then + modified_files="cluster-cib" + fi + + if [[ -f $FENCE_KDUMP_CONFIG_FILE ]]; then + time_stamp=$(stat -c "%Y" "$FENCE_KDUMP_CONFIG_FILE") + if [[ $time_stamp -gt $image_time ]]; then + modified_files="$modified_files $FENCE_KDUMP_CONFIG_FILE" + fi + fi + + echo "$modified_files" +} + +setup_initrd() +{ + if ! prepare_kdump_bootinfo; then + derror "failed to prepare for kdump bootinfo." + return 1 + fi + + DEFAULT_INITRD_BAK="$KDUMP_BOOTDIR/.$(basename "$DEFAULT_INITRD").default" + if [[ $DEFAULT_DUMP_MODE == "fadump" ]]; then + TARGET_INITRD="$DEFAULT_INITRD" + + # backup initrd for reference before replacing it + # with fadump aware initrd + backup_default_initrd + else + TARGET_INITRD="$KDUMP_INITRD" + + # check if a backup of default initrd exists. If yes, + # it signifies a switch from fadump mode. So, restore + # the backed up default initrd. + restore_default_initrd + fi +} + +check_files_modified() +{ + local modified_files="" + + #also rebuild when Pacemaker cluster conf is changed and fence kdump is enabled. + modified_files=$(get_pcs_cluster_modified_files) + + EXTRA_BINS=$(kdump_get_conf_val kdump_post) + CHECK_FILES=$(kdump_get_conf_val kdump_pre) + HOOKS="/etc/kdump/post.d/ /etc/kdump/pre.d/" + if [[ -d /etc/kdump/post.d ]]; then + for file in /etc/kdump/post.d/*; do + if [[ -x $file ]]; then + POST_FILES="$POST_FILES $file" + fi + done + fi + if [[ -d /etc/kdump/pre.d ]]; then + for file in /etc/kdump/pre.d/*; do + if [[ -x $file ]]; then + PRE_FILES="$PRE_FILES $file" + fi + done + fi + HOOKS="$HOOKS $POST_FILES $PRE_FILES" + CORE_COLLECTOR=$(kdump_get_conf_val core_collector | awk '{print $1}') + CORE_COLLECTOR=$(type -P "$CORE_COLLECTOR") + # POST_FILES and PRE_FILES are already checked against executable, need not to check again. + EXTRA_BINS="$EXTRA_BINS $CHECK_FILES" + CHECK_FILES=$(kdump_get_conf_val extra_bins) + EXTRA_BINS="$EXTRA_BINS $CHECK_FILES" + files="$KDUMP_CONFIG_FILE $KDUMP_KERNEL $EXTRA_BINS $CORE_COLLECTOR" + [[ -e /etc/fstab ]] && files="$files /etc/fstab" + + # Check for any updated extra module + EXTRA_MODULES="$(kdump_get_conf_val extra_modules)" + if [[ -n $EXTRA_MODULES ]]; then + if [[ -e /lib/modules/$KDUMP_KERNELVER/modules.dep ]]; then + files="$files /lib/modules/$KDUMP_KERNELVER/modules.dep" + fi + for _module in $EXTRA_MODULES; do + if _module_file="$(modinfo --set-version "$KDUMP_KERNELVER" --filename "$_module" 2> /dev/null)"; then + files="$files $_module_file" + for _dep_modules in $(modinfo -F depends "$_module" | tr ',' ' '); do + files="$files $(modinfo --set-version "$KDUMP_KERNELVER" --filename "$_dep_modules" 2> /dev/null)" + done + else + # If it's not a module nor builtin, give an error + if ! (modprobe --set-version "$KDUMP_KERNELVER" --dry-run "$_module" &> /dev/null); then + dwarn "Module $_module not found" + fi + fi + done + fi + + # HOOKS is mandatory and need to check the modification time + files="$files $HOOKS" + check_exist "$files" && check_executable "$EXTRA_BINS" || return 2 + + for file in $files; do + if [[ -e $file ]]; then + time_stamp=$(stat -c "%Y" "$file") + if [[ $time_stamp -gt $image_time ]]; then + modified_files="$modified_files $file" + fi + if [[ -L $file ]]; then + file=$(readlink -m "$file") + time_stamp=$(stat -c "%Y" "$file") + if [[ $time_stamp -gt $image_time ]]; then + modified_files="$modified_files $file" + fi + fi + else + dwarn "$file doesn't exist" + fi + done + + if [[ -n $modified_files ]]; then + dinfo "Detected change(s) in the following file(s): $modified_files" + return 1 + fi + + return 0 +} + +check_drivers_modified() +{ + local _target _new_drivers _old_drivers _module_name _module_filename + + # If it's dump target is on block device, detect the block driver + _target=$(get_block_dump_target) + if [[ -n $_target ]]; then + _record_block_drivers() + { + local _drivers + _drivers=$(udevadm info -a "/dev/block/$1" | sed -n 's/\s*DRIVERS=="\(\S\+\)"/\1/p') + for _driver in $_drivers; do + if ! [[ " $_new_drivers " == *" $_driver "* ]]; then + _new_drivers="$_new_drivers $_driver" + fi + done + + ddebug "MAJ:MIN=$1 drivers='$_drivers'" + } + check_block_and_slaves_all _record_block_drivers "$(get_maj_min "$_target")" + fi + + # Include watchdog drivers if watchdog module is not omitted + is_dracut_mod_omitted watchdog || _new_drivers+=" $(get_watchdog_drvs)" + [[ -z $_new_drivers ]] && return 0 + + if is_fadump_capable; then + _old_drivers="$(lsinitrd "$TARGET_INITRD" -f /usr/lib/dracut/fadump-kernel-modules.txt | tr '\n' ' ')" + else + _old_drivers="$(lsinitrd "$TARGET_INITRD" -f /usr/lib/dracut/hostonly-kernel-modules.txt | tr '\n' ' ')" + fi + + ddebug "Modules required for kdump: '$_new_drivers'" + ddebug "Modules included in old initramfs: '$_old_drivers'" + for _driver in $_new_drivers; do + # Skip deprecated/invalid driver name or built-in module + _module_name=$(modinfo --set-version "$KDUMP_KERNELVER" -F name "$_driver" 2> /dev/null) + _module_filename=$(modinfo --set-version "$KDUMP_KERNELVER" -n "$_driver" 2> /dev/null) + if [[ -z $_module_name ]] || [[ -z $_module_filename ]] || [[ $_module_filename == *"(builtin)"* ]]; then + continue + fi + if ! [[ " $_old_drivers " == *" $_module_name "* ]]; then + dinfo "Detected change in block device driver, new loaded module: $_module_name" + return 1 + fi + done +} + +check_fs_modified() +{ + local _old_dev _old_mntpoint _old_fstype + local _new_dev _new_mntpoint _new_fstype + local _target _dracut_args + + # No need to check in case of mount target specified via "dracut_args". + if is_mount_in_dracut_args; then + return 0 + fi + + # No need to check in case of raw target. + # Currently we do not check also if ssh/nfs target is specified + if is_ssh_dump_target || is_nfs_dump_target || is_raw_dump_target; then + return 0 + fi + + _target=$(get_block_dump_target) + _new_fstype=$(get_fs_type_from_target "$_target") + if [[ -z $_target ]] || [[ -z $_new_fstype ]]; then + derror "Dump target is invalid" + return 2 + fi + + ddebug "_target=$_target _new_fstype=$_new_fstype" + _new_dev=$(kdump_get_persistent_dev "$_target") + if [[ -z $_new_dev ]]; then + perror "Get persistent device name failed" + return 2 + fi + + _new_mntpoint="$(get_kdump_mntpoint_from_target "$_target")" + _dracut_args=$(lsinitrd "$TARGET_INITRD" -f usr/lib/dracut/build-parameter.txt) + if [[ -z $_dracut_args ]]; then + dwarn "Warning: No dracut arguments found in initrd" + return 0 + fi + + # if --mount argument present then match old and new target, mount + # point and file system. If any of them mismatches then rebuild + if echo "$_dracut_args" | grep -q "\-\-mount"; then + # shellcheck disable=SC2046 + set -- $(echo "$_dracut_args" | awk -F "--mount '" '{print $2}' | cut -d' ' -f1,2,3) + _old_dev=$1 + _old_mntpoint=$2 + _old_fstype=$3 + [[ $_new_dev == "$_old_dev" && $_new_mntpoint == "$_old_mntpoint" && $_new_fstype == "$_old_fstype" ]] && return 0 + # otherwise rebuild if target device is not a root device + else + [[ $_target == "$(get_root_fs_device)" ]] && return 0 + fi + + dinfo "Detected change in File System" + return 1 +} + +# returns 0 if system is not modified +# returns 1 if system is modified +# returns 2 if system modification is invalid +check_system_modified() +{ + local ret + + [[ -f $TARGET_INITRD ]] || return 1 + + check_files_modified + ret=$? + if [[ $ret -ne 0 ]]; then + return $ret + fi + + check_fs_modified + ret=$? + if [[ $ret -ne 0 ]]; then + return $ret + fi + + check_drivers_modified + ret=$? + if [[ $ret -ne 0 ]]; then + return $ret + fi + + return 0 +} + +check_rebuild() +{ + local capture_capable_initrd="1" + local force_rebuild force_no_rebuild + local ret system_modified="0" + + setup_initrd || return 1 + + force_no_rebuild=$(kdump_get_conf_val force_no_rebuild) + force_no_rebuild=${force_no_rebuild:-0} + if [[ $force_no_rebuild != "0" ]] && [[ $force_no_rebuild != "1" ]]; then + derror "Error: force_no_rebuild value is invalid" + return 1 + fi + + force_rebuild=$(kdump_get_conf_val force_rebuild) + force_rebuild=${force_rebuild:-0} + if [[ $force_rebuild != "0" ]] && [[ $force_rebuild != "1" ]]; then + derror "Error: force_rebuild value is invalid" + return 1 + fi + + if [[ $force_no_rebuild == "1" && $force_rebuild == "1" ]]; then + derror "Error: force_rebuild and force_no_rebuild are enabled simultaneously in kdump.conf" + return 1 + fi + + # Will not rebuild kdump initrd + if [[ $force_no_rebuild == "1" ]]; then + return 0 + fi + + #check to see if dependent files has been modified + #since last build of the image file + if [[ -f $TARGET_INITRD ]]; then + image_time=$(stat -c "%Y" "$TARGET_INITRD" 2> /dev/null) + + #in case of fadump mode, check whether the default/target + #initrd is already built with dump capture capability + if [[ $DEFAULT_DUMP_MODE == "fadump" ]]; then + capture_capable_initrd=$(lsinitrd -f $DRACUT_MODULES_FILE "$TARGET_INITRD" | grep -c -e ^kdumpbase$ -e ^zz-fadumpinit$) + fi + fi + + check_system_modified + ret=$? + if [[ $ret -eq 2 ]]; then + return 1 + elif [[ $ret -eq 1 ]]; then + system_modified="1" + fi + + if [[ $image_time -eq 0 ]]; then + dinfo "No kdump initial ramdisk found." + elif [[ $capture_capable_initrd == "0" ]]; then + dinfo "Rebuild $TARGET_INITRD with dump capture support" + elif [[ $force_rebuild != "0" ]]; then + dinfo "Force rebuild $TARGET_INITRD" + elif [[ $system_modified != "0" ]]; then + : + else + return 0 + fi + + dinfo "Rebuilding $TARGET_INITRD" + rebuild_initrd + return $? +} + +# On ppc64le LPARs, the keys trusted by firmware do not end up in +# .builtin_trusted_keys. So instead, add the key to the .ima keyring +function load_kdump_kernel_key() +{ + # this is only called inside is_secure_boot_enforced, + # no need to retest + + # this is only required if DT /ibm,secure-boot is a file. + # if it is a dir, we are on OpenPower and don't need this. + if ! [[ -f /proc/device-tree/ibm,secure-boot ]]; then + return + fi + + KDUMP_KEY_ID=$(keyctl padd asymmetric kernelkey-$RANDOM %:.ima < "/usr/share/doc/kernel-keys/$KDUMP_KERNELVER/kernel-signing-ppc.cer") +} + +# remove a previously loaded key. There's no real security implication +# to leaving it around, we choose to do this because it makes it easier +# to be idempotent and so as to reduce the potential for confusion. +function remove_kdump_kernel_key() +{ + if [[ -z $KDUMP_KEY_ID ]]; then + return + fi + + keyctl unlink "$KDUMP_KEY_ID" %:.ima +} + +# Load the kdump kernel specified in /etc/sysconfig/kdump +# If none is specified, try to load a kdump kernel with the same version +# as the currently running kernel. +load_kdump() +{ + local ret + + KEXEC_ARGS=$(prepare_kexec_args "${KEXEC_ARGS}") + KDUMP_COMMANDLINE=$(prepare_cmdline "${KDUMP_COMMANDLINE}" "${KDUMP_COMMANDLINE_REMOVE}" "${KDUMP_COMMANDLINE_APPEND}") + + # For secureboot enabled machines, use new kexec file based syscall. + # Old syscall will always fail as it does not have capability to + # to kernel signature verification. + if is_secure_boot_enforced; then + dinfo "Secure Boot is enabled. Using kexec file based syscall." + KEXEC_ARGS="$KEXEC_ARGS -s" + load_kdump_kernel_key + fi + + ddebug "$KEXEC $KEXEC_ARGS $standard_kexec_args --command-line=$KDUMP_COMMANDLINE --initrd=$TARGET_INITRD $KDUMP_KERNEL" + + # The '12' represents an intermediate temporary file descriptor + # to store the standard error file descriptor '2', and later + # restore the error file descriptor with the file descriptor '12' + # and release it. + exec 12>&2 + exec 2>> $KDUMP_LOG_PATH/kdump.log + PS4='+ $(date "+%Y-%m-%d %H:%M:%S") ${BASH_SOURCE}@${LINENO}: ' + set -x + + # shellcheck disable=SC2086 + $KEXEC $KEXEC_ARGS $standard_kexec_args \ + --command-line="$KDUMP_COMMANDLINE" \ + --initrd="$TARGET_INITRD" "$KDUMP_KERNEL" + + ret=$? + set +x + exec 2>&12 12>&- + + remove_kdump_kernel_key + + if [[ $ret == 0 ]]; then + dinfo "kexec: loaded kdump kernel" + return 0 + else + derror "kexec: failed to load kdump kernel" + return 1 + fi +} + +check_ssh_config() +{ + local SSH_TARGET + + while read -r config_opt config_val; do + case "$config_opt" in + sshkey) + # remove inline comments after the end of a directive. + if [[ -f $config_val ]]; then + # canonicalize the path + SSH_KEY_LOCATION=$(/usr/bin/readlink -m "$config_val") + else + dwarn "WARNING: '$config_val' doesn't exist, using default value '$SSH_KEY_LOCATION'" + fi + ;; + path) + SAVE_PATH=$config_val + ;; + ssh) + DUMP_TARGET=$config_val + ;; + *) ;; + + esac + done <<< "$(kdump_read_conf)" + + #make sure they've configured kdump.conf for ssh dumps + SSH_TARGET=$(echo -n "$DUMP_TARGET" | sed -n '/.*@/p') + if [[ -z $SSH_TARGET ]]; then + return 1 + fi + return 0 +} + +# ipv6 host address may takes a long time to be ready. +# Instead of checking against ipv6 address, we just check the network reachable +# by the return val of 'ssh' +check_and_wait_network_ready() +{ + local start_time + local warn_once=1 + local cur + local diff + local retval + local errmsg + + start_time=$(date +%s) + while true; do + errmsg=$(ssh -i "$SSH_KEY_LOCATION" -o BatchMode=yes "$DUMP_TARGET" mkdir -p "$SAVE_PATH" 2>&1) + retval=$? + + # ssh exits with the exit status of the remote command or with 255 if an error occurred + if [[ $retval -eq 0 ]]; then + return 0 + elif [[ $retval -ne 255 ]]; then + derror "Could not create $DUMP_TARGET:$SAVE_PATH, you should check the privilege on server side" + return 1 + fi + + # if server removes the authorized_keys or, no /root/.ssh/kdump_id_rsa + ddebug "$errmsg" + if echo "$errmsg" | grep -q "Permission denied\|No such file or directory\|Host key verification failed"; then + derror "Could not create $DUMP_TARGET:$SAVE_PATH, you probably need to run \"kdumpctl propagate\"" + return 1 + fi + + if [[ $warn_once -eq 1 ]]; then + dwarn "Network dump target is not usable, waiting for it to be ready..." + warn_once=0 + fi + + cur=$(date +%s) + diff=$((cur - start_time)) + # 60s time out + if [[ $diff -gt 180 ]]; then + break + fi + sleep 1 + done + + dinfo "Could not create $DUMP_TARGET:$SAVE_PATH, ipaddr is not ready yet. You should check network connection" + return 1 +} + +check_ssh_target() +{ + check_and_wait_network_ready +} + +propagate_ssh_key() +{ + if ! check_ssh_config; then + derror "No ssh config specified in $KDUMP_CONFIG_FILE. Can't propagate" + exit 1 + fi + + local KEYFILE=$SSH_KEY_LOCATION + local errmsg="Failed to propagate ssh key" + + #Check to see if we already created key, if not, create it. + if [[ -f $KEYFILE ]]; then + dinfo "Using existing keys..." + else + dinfo "Generating new ssh keys... " + /usr/bin/ssh-keygen -t rsa -f "$KEYFILE" -N "" 2>&1 > /dev/null + dinfo "done." + fi + + #now find the target ssh user and server to contact. + SSH_USER=$(echo "$DUMP_TARGET" | cut -d@ -f1) + SSH_SERVER=$(echo "$DUMP_TARGET" | sed -e's/\(.*@\)\(.*$\)/\2/') + + #now send the found key to the found server + ssh-copy-id -i "$KEYFILE" "$SSH_USER@$SSH_SERVER" + RET=$? + if [[ $RET == 0 ]]; then + dinfo "$KEYFILE has been added to ~$SSH_USER/.ssh/authorized_keys on $SSH_SERVER" + return 0 + else + derror "$errmsg, $KEYFILE failed in transfer to $SSH_SERVER" + exit 1 + fi +} + +show_reserved_mem() +{ + local mem + local mem_mb + + mem=$(< /sys/kernel/kexec_crash_size) + mem_mb=$((mem / 1024 / 1024)) + + dinfo "Reserved ${mem_mb}MB memory for crash kernel" +} + +check_current_fadump_status() +{ + # Check if firmware-assisted dump has been registered. + rc=$(< $FADUMP_REGISTER_SYS_NODE) + [[ $rc -eq 1 ]] && return 0 + return 1 +} + +check_current_status() +{ + if [[ $DEFAULT_DUMP_MODE == "fadump" ]]; then + check_current_fadump_status + else + check_current_kdump_status + fi + + return $? +} + +save_raw() +{ + local kdump_dir + local raw_target + + raw_target=$(kdump_get_conf_val raw) + [[ -z $raw_target ]] && return 0 + [[ -b $raw_target ]] || { + derror "raw partition $raw_target not found" + return 1 + } + check_fs=$(lsblk --nodeps -npo FSTYPE "$raw_target") + if [[ $(echo "$check_fs" | wc -w) -ne 0 ]]; then + dwarn "Warning: Detected '$check_fs' signature on $raw_target, data loss is expected." + return 0 + fi + kdump_dir=$(kdump_get_conf_val path) + if [[ -z ${kdump_dir} ]]; then + coredir="/var/crash/$(date +"%Y-%m-%d-%H:%M")" + else + coredir="${kdump_dir}/$(date +"%Y-%m-%d-%H:%M")" + fi + + mkdir -p "$coredir" + [[ -d $coredir ]] || { + derror "failed to create $coredir" + return 1 + } + if makedumpfile -R "$coredir/vmcore" < "$raw_target" > /dev/null 2>&1; then + # dump found + dinfo "Dump saved to $coredir/vmcore" + # wipe makedumpfile header + dd if=/dev/zero of="$raw_target" bs=1b count=1 2> /dev/null + else + rm -rf "$coredir" + fi + + return 0 +} + +local_fs_dump_target() +{ + local _target + + if _target=$(grep -E "^ext[234]|^xfs|^btrfs|^minix" /etc/kdump.conf); then + echo "$_target" | awk '{print $2}' + fi +} + +path_to_be_relabeled() +{ + local _path _target _mnt="/" _rmnt + + if is_user_configured_dump_target; then + if is_mount_in_dracut_args; then + return + fi + + _target=$(local_fs_dump_target) + if [[ -n $_target ]]; then + _mnt=$(get_mntpoint_from_target "$_target") + if ! is_mounted "$_mnt"; then + return + fi + else + return + fi + fi + + _path=$(get_save_path) + # if $_path is masked by other mount, we will not relabel it. + _rmnt=$(df "$_mnt/$_path" 2> /dev/null | tail -1 | awk '{ print $NF }') + if [[ $_rmnt == "$_mnt" ]]; then + echo "$_mnt/$_path" + fi +} + +selinux_relabel() +{ + local _path _i _attr + + _path=$(path_to_be_relabeled) + if [[ -z $_path ]] || ! [[ -d $_path ]]; then + return + fi + + while IFS= read -r -d '' _i; do + _attr=$(getfattr -m "security.selinux" "$_i" 2> /dev/null) + if [[ -z $_attr ]]; then + restorecon "$_i" + fi + done < <(find "$_path" -print0) +} + +check_fence_kdump_config() +{ + local hostname + local ipaddrs + local nodes + + hostname=$(hostname) + ipaddrs=$(hostname -I) + nodes=$(kdump_get_conf_val "fence_kdump_nodes") + + for node in $nodes; do + if [[ $node == "$hostname" ]]; then + derror "Option fence_kdump_nodes cannot contain $hostname" + return 1 + fi + # node can be ipaddr + if echo "$ipaddrs " | grep -q "$node "; then + derror "Option fence_kdump_nodes cannot contain $node" + return 1 + fi + done + + return 0 +} + +check_dump_feasibility() +{ + if [[ $DEFAULT_DUMP_MODE == "fadump" ]]; then + return 0 + fi + + check_kdump_feasibility + return $? +} + +start_fadump() +{ + echo 1 > $FADUMP_REGISTER_SYS_NODE + if ! check_current_fadump_status; then + derror "fadump: failed to register" + return 1 + fi + + dinfo "fadump: registered successfully" + return 0 +} + +start_dump() +{ + if [[ $DEFAULT_DUMP_MODE == "fadump" ]]; then + start_fadump + else + load_kdump + fi + + return $? +} + +check_failure_action_config() +{ + local default_option + local failure_action + local option="failure_action" + + default_option=$(kdump_get_conf_val default) + failure_action=$(kdump_get_conf_val failure_action) + + if [[ -z $failure_action ]] && [[ -z $default_option ]]; then + return 0 + elif [[ -n $failure_action ]] && [[ -n $default_option ]]; then + derror "Cannot specify 'failure_action' and 'default' option together" + return 1 + fi + + if [[ -n $default_option ]]; then + option="default" + failure_action="$default_option" + fi + + case "$failure_action" in + reboot | halt | poweroff | shell | dump_to_rootfs) + return 0 + ;; + *) + dinfo $"Usage kdump.conf: $option {reboot|halt|poweroff|shell|dump_to_rootfs}" + return 1 + ;; + esac +} + +check_final_action_config() +{ + local final_action + + final_action=$(kdump_get_conf_val final_action) + if [[ -z $final_action ]]; then + return 0 + else + case "$final_action" in + reboot | halt | poweroff) + return 0 + ;; + *) + dinfo $"Usage kdump.conf: final_action {reboot|halt|poweroff}" + return 1 + ;; + esac + fi +} + +start() +{ + if ! check_dump_feasibility; then + derror "Starting kdump: [FAILED]" + return 1 + fi + + if ! check_config; then + derror "Starting kdump: [FAILED]" + return 1 + fi + + if sestatus 2> /dev/null | grep -q "SELinux status.*enabled"; then + selinux_relabel + fi + + if ! save_raw; then + derror "Starting kdump: [FAILED]" + return 1 + fi + + if check_current_status; then + dwarn "Kdump already running: [WARNING]" + return 0 + fi + + if check_ssh_config; then + if ! check_ssh_target; then + derror "Starting kdump: [FAILED]" + return 1 + fi + fi + + if ! check_rebuild; then + derror "Starting kdump: [FAILED]" + return 1 + fi + + if ! start_dump; then + derror "Starting kdump: [FAILED]" + return 1 + fi + + dinfo "Starting kdump: [OK]" +} + +reload() +{ + if ! check_current_status; then + dwarn "Kdump was not running: [WARNING]" + fi + + if [[ $DEFAULT_DUMP_MODE == "fadump" ]]; then + reload_fadump + return $? + else + if ! stop_kdump; then + derror "Stopping kdump: [FAILED]" + return 1 + fi + fi + + dinfo "Stopping kdump: [OK]" + + if ! setup_initrd; then + derror "Starting kdump: [FAILED]" + return 1 + fi + + if ! start_dump; then + derror "Starting kdump: [FAILED]" + return 1 + fi + + dinfo "Starting kdump: [OK]" +} + +stop_fadump() +{ + echo 0 > $FADUMP_REGISTER_SYS_NODE + if check_current_fadump_status; then + derror "fadump: failed to unregister" + return 1 + fi + + dinfo "fadump: unregistered successfully" + return 0 +} + +stop_kdump() +{ + if is_secure_boot_enforced; then + $KEXEC -s -p -u + else + $KEXEC -p -u + fi + + # shellcheck disable=SC2181 + if [[ $? != 0 ]]; then + derror "kexec: failed to unload kdump kernel" + return 1 + fi + + dinfo "kexec: unloaded kdump kernel" + return 0 +} + +reload_fadump() +{ + if echo 1 > $FADUMP_REGISTER_SYS_NODE; then + dinfo "fadump: re-registered successfully" + return 0 + else + # FADump could fail on older kernel where re-register + # support is not enabled. Try stop/start from userspace + # to handle such scenario. + if stop_fadump; then + start_fadump + return $? + fi + fi + + return 1 +} + +stop() +{ + if [[ $DEFAULT_DUMP_MODE == "fadump" ]]; then + stop_fadump + else + stop_kdump + fi + + # shellcheck disable=SC2181 + if [[ $? != 0 ]]; then + derror "Stopping kdump: [FAILED]" + return 1 + fi + + dinfo "Stopping kdump: [OK]" + return 0 +} + +rebuild() +{ + check_config || return 1 + + if check_ssh_config; then + if ! check_ssh_target; then + return 1 + fi + fi + + setup_initrd || return 1 + + dinfo "Rebuilding $TARGET_INITRD" + rebuild_initrd + return $? +} + +do_estimate() +{ + local kdump_mods + local -A large_mods + local baseline + local kernel_size mod_size initrd_size baseline_size runtime_size reserved_size estimated_size recommended_size + local size_mb=$((1024 * 1024)) + + setup_initrd + if [[ ! -f $TARGET_INITRD ]]; then + derror "kdumpctl estimate: kdump initramfs is not built yet." + exit 1 + fi + + kdump_mods="$(lsinitrd "$TARGET_INITRD" -f /usr/lib/dracut/hostonly-kernel-modules.txt | tr '\n' ' ')" + baseline=$(kdump_get_arch_recommend_size) + if [[ ${baseline: -1} == "M" ]]; then + baseline=${baseline%M} + elif [[ ${baseline: -1} == "G" ]]; then + baseline=$((${baseline%G} * 1024)) + elif [[ ${baseline: -1} == "T" ]]; then + baseline=$((${baseline%Y} * 1048576)) + fi + + # The default pre-reserved crashkernel value + baseline_size=$((baseline * size_mb)) + # Current reserved crashkernel size + reserved_size=$(< /sys/kernel/kexec_crash_size) + # A pre-estimated value for userspace usage and kernel + # runtime allocation, 64M should good for most cases + runtime_size=$((64 * size_mb)) + # Kernel image size + kernel_size=$(get_kernel_size "$KDUMP_KERNEL") + # Kdump initramfs size + initrd_size=$(du -b "$TARGET_INITRD" | awk '{print $1}') + # Kernel modules static size after loaded + mod_size=0 + while read -r _name _size _; do + if [[ " $kdump_mods " != *" $_name "* ]]; then + continue + fi + mod_size=$((mod_size + _size)) + + # Mark module with static size larger than 2M as large module + if [[ $((_size / size_mb)) -ge 1 ]]; then + large_mods[$_name]=$_size + fi + done <<< "$(< /proc/modules)" + + # Extra memory usage required for LUKS2 decryption + crypt_size=0 + for _dev in $(get_all_kdump_crypt_dev); do + _crypt_info=$(cryptsetup luksDump "/dev/block/$_dev") + [[ $(echo "$_crypt_info" | sed -n "s/^Version:\s*\(.*\)/\1/p") == "2" ]] || continue + for _mem in $(echo "$_crypt_info" | sed -n "s/\sMemory:\s*\(.*\)/\1/p" | sort -n); do + crypt_size=$((crypt_size + _mem * 1024)) + break + done + done + [[ $crypt_size -ne 0 ]] && echo -e "Encrypted kdump target requires extra memory, assuming using the keyslot with minimun memory requirement\n" + + estimated_size=$((kernel_size + mod_size + initrd_size + runtime_size + crypt_size)) + if [[ $baseline_size -gt $estimated_size ]]; then + recommended_size=$baseline_size + else + recommended_size=$estimated_size + fi + + echo "Reserved crashkernel: $((reserved_size / size_mb))M" + echo "Recommended crashkernel: $((recommended_size / size_mb))M" + echo + echo "Kernel image size: $((kernel_size / size_mb))M" + echo "Kernel modules size: $((mod_size / size_mb))M" + echo "Initramfs size: $((initrd_size / size_mb))M" + echo "Runtime reservation: $((runtime_size / size_mb))M" + [[ $crypt_size -ne 0 ]] && + echo "LUKS required size: $((crypt_size / size_mb))M" + echo -n "Large modules:" + if [[ ${#large_mods[@]} -eq 0 ]]; then + echo " <none>" + else + echo "" + for _mod in "${!large_mods[@]}"; do + echo " $_mod: ${large_mods[$_mod]}" + done + fi + + if [[ $reserved_size -lt $recommended_size ]]; then + echo "WARNING: Current crashkernel size is lower than recommended size $((recommended_size / size_mb))M." + fi +} + +get_default_crashkernel() +{ + local _dump_mode=$1 + + kdump_get_arch_recommend_crashkernel "$_dump_mode" +} + +# Read kernel cmdline parameter for a specific kernel +# $1: kernel path, DEFAULT or kernel path, ALL not accepted +# $2: kernel cmldine parameter +get_grub_kernel_boot_parameter() +{ + local _kernel_path=$1 _para=$2 + + [[ $_kernel_path == ALL ]] && derror "kernel_path=ALL invalid for get_grub_kernel_boot_parameter" && return 1 + grubby --info="$_kernel_path" | sed -En -e "/^args=.*$/{s/^.*(\s|\")${_para}=(\S*).*\"$/\2/p;q}" +} + +# get dump mode by fadump value +# return +# - fadump, if fadump=on or fadump=nocma +# - kdump, if fadump=off or empty fadump, return kdump +# - error if otherwise +get_dump_mode_by_fadump_val() +{ + local _fadump_val=$1 + + if [[ -z $_fadump_val ]] || [[ $_fadump_val == off ]]; then + echo -n kdump + elif [[ $_fadump_val == on ]] || [[ $_fadump_val == nocma ]]; then + echo -n fadump + else + derror "invalid fadump=$_fadump_val" + return 1 + fi +} + +# get dump mode of a specific kernel +# based on its fadump kernel cmdline parameter +get_dump_mode_by_kernel() +{ + local _kernel_path=$1 _fadump_val _dump_mode + + _fadump_val=$(get_grub_kernel_boot_parameter "$_kernel_path" fadump) + if _dump_mode=$(get_dump_mode_by_fadump_val "$_fadump_val"); then + echo -n "$_dump_mode" + else + derror "failed to get dump mode for kernel $_kernel_path" + exit + fi +} + +_filter_grubby_kernel_str() +{ + local _grubby_kernel_str=$1 + echo -n "$_grubby_kernel_str" | sed -n -e 's/^kernel="\(.*\)"/\1/p' +} + +_find_kernel_path_by_release() +{ + local _release="$1" _grubby_kernel_str _kernel_path + _grubby_kernel_str=$(grubby --info ALL | grep "^kernel=.*$_release") + _kernel_path=$(_filter_grubby_kernel_str "$_grubby_kernel_str") + if [[ -z $_kernel_path ]]; then + derror "kernel $_release doesn't exist" + return 1 + fi + echo -n "$_kernel_path" +} + +_get_current_running_kernel_path() +{ + local _release _path + + _release=$(uname -r) + if _path=$(_find_kernel_path_by_release "$_release"); then + echo -n "$_path" + else + return 1 + fi +} + +_update_grub() +{ + local _kernel_path=$1 _crashkernel=$2 _dump_mode=$3 _fadump_val=$4 + + if is_atomic; then + if rpm-ostree kargs | grep -q "crashkernel="; then + rpm-ostree kargs --replace="crashkernel=$_crashkernel" + else + rpm-ostree kargs --append="crashkernel=$_crashkernel" + fi + else + [[ -f /etc/zipl.conf ]] && zipl_arg="--zipl" + grubby --args "crashkernel=$_crashkernel" --update-kernel "$_kernel_path" $zipl_arg + if [[ $_dump_mode == kdump ]]; then + grubby --remove-args="fadump" --update-kernel "$_kernel_path" + else + grubby --args="fadump=$_fadump_val" --update-kernel "$_kernel_path" + fi + fi + [[ $zipl_arg ]] && zipl > /dev/null +} + +_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 + + for _line in $(grubby --info "$_grubby_kernel_path" | grep "^kernel="); do + _kernel_path=$(_filter_grubby_kernel_str "$_line") + _kernels="$_kernels $_kernel_path" + done + echo -n "$_kernels" +} + +GRUB_ETC_DEFAULT="/etc/default/grub" +# Update a kernel parameter in default grub conf +# +# If a value is specified, it will be inserted in the end. Otherwise it +# would remove given kernel parameter. +# +# Note this function doesn't address the following cases, +# 1. The kernel ignores everything on the command line after a '--'. So +# simply adding the new entry to the end will fail if the cmdline +# contains a --. +# 2. If the value for a parameter contains spaces it can be quoted using +# double quotes, for example param="value with spaces". This will +# break the [^[:space:]\"] regex for the value. +# 3. Dashes and underscores in the parameter name are equivalent. So +# some_parameter and some-parameter are identical. +# 4. Some parameters, e.g. efivar_ssdt, can be given multiple times. +# 5. Some kernel parameters, e.g. quiet, doesn't have value +# +# $1: the name of the kernel command line parameter +# $2: new value. If empty, given parameter would be removed +_update_kernel_arg_in_grub_etc_default() +{ + local _para=$1 _val=$2 _para_val + + if [[ -n $_val ]]; then + _para_val="$_para=$_val" + fi + + # Update the command line /etc/default/grub, i.e. + # on the line that starts with 'GRUB_CMDLINE_LINUX=', + # 1) remove $para=$val if the it's the first arg + # 2) remove all occurences of $para=$val + # 3) insert $_para_val to end + # 4) remove duplicate spaces left over by 1) or 2) or 3) + # 5) remove space at the beginning of the string left over by 1) or 2) or 3) + # 6) remove space at the end of the string left over by 1) or 2) or 3) + sed -i -E "/^GRUB_CMDLINE_LINUX=/ { + s/\"${_para}=[^[:space:]\"]*/\"/g; + s/[[:space:]]+${_para}=[^[:space:]\"]*/ /g; + s/\"$/ ${_para_val}\"/ + s/[[:space:]]+/ /g; + s/(\")[[:space:]]+/\1/g; + s/[[:space:]]+(\")/\1/g; + }" "$GRUB_ETC_DEFAULT" +} + +# Read the kernel arg in default grub conf. + +# Note reading a kernel parameter that doesn't have a value isn't supported. +# +# $1: the name of the kernel command line parameter +_read_kernel_arg_in_grub_etc_default() +{ + sed -n -E "s/^GRUB_CMDLINE_LINUX=.*[[:space:]\"]${1}=([^[:space:]\"]*).*$/\1/p" "$GRUB_ETC_DEFAULT" +} + +reset_crashkernel() +{ + local _opt _val _dump_mode _fadump_val _reboot _grubby_kernel_path _kernel _kernels + local _old_crashkernel _new_crashkernel _new_dump_mode _crashkernel_changed + local _new_fadump_val _old_fadump_val _what_is_updated + + for _opt in "$@"; do + case "$_opt" in + --fadump=*) + _val=${_opt#*=} + if _dump_mode=$(get_dump_mode_by_fadump_val $_val); then + _fadump_val=$_val + else + derror "failed to determine dump mode" + exit + fi + ;; + --kernel=*) + _val=${_opt#*=} + if ! _valid_grubby_kernel_path $_val; then + derror "Invalid $_opt, please specify a valid kernel path, ALL or DEFAULT" + exit + fi + _grubby_kernel_path=$_val + ;; + --reboot) + _reboot=yes + ;; + *) + derror "$_opt not recognized" + exit 1 + ;; + esac + done + + # 1. CoreOS uses "rpm-ostree kargs" instead of grubby to manage kernel command + # line. --kernel=ALL doesn't make sense for CoreOS. + # 2. CoreOS doesn't support POWER so the dump mode is always kdump. + # 3. "rpm-ostree kargs" would prompt the user to reboot the system after + # modifying the kernel command line so there is no need for kexec-tools + # to repeat it. + if is_atomic; then + _old_crashkernel=$(rpm-ostree kargs | sed -n -E 's/.*(^|\s)crashkernel=(\S*).*/\2/p') + _new_dump_mode=kdump + _new_crashkernel=$(kdump_get_arch_recommend_crashkernel "$_new_dump_mode") + if [[ $_old_crashkernel != "$_new_crashkernel" ]]; then + _update_grub "" "$_new_crashkernel" "$_new_dump_mode" "" + if [[ $_reboot == yes ]]; then + systemctl reboot + fi + fi + return + fi + + # For non-ppc64le systems, the dump mode is always kdump since only ppc64le + # has FADump. + if [[ -z $_dump_mode && $(uname -m) != ppc64le ]]; then + _dump_mode=kdump + _fadump_val=off + fi + + # If the dump mode is determined, we can also know the default crashkernel value + if [[ -n $_dump_mode ]]; then + _crashkernel=$(kdump_get_arch_recommend_crashkernel "$_dump_mode") + fi + + # If --kernel-path=ALL, update GRUB_CMDLINE_LINUX in /etc/default/grub. + # + # An exception case is when the ppc64le user doesn't specify the fadump value. + # In this case, the dump mode would be determined by parsing the kernel + # command line of the kernel(s) to be updated thus don't update GRUB_CMDLINE_LINUX. + # + # The following code has been simplified because of what has been done early, + # - set the dump mode as kdump for non-ppc64le cases + # - retrieved the default crashkernel value for given dump mode + if [[ $_grubby_kernel_path == ALL && -n $_dump_mode ]]; then + _update_kernel_arg_in_grub_etc_default crashkernel "$_crashkernel" + # remove the fadump if fadump is disabled + if [[ $_fadump_val == off ]]; then + _fadump_val="" + fi + _update_kernel_arg_in_grub_etc_default fadump "$_fadump_val" + fi + + # If kernel-path not specified, either + # - use KDUMP_KERNELVER if it's defined + # - use current running kernel + if [[ -z $_grubby_kernel_path ]]; then + if [[ -z $KDUMP_KERNELVER ]] || + ! _kernel_path=$(_find_kernel_path_by_release "$KDUMP_KERNELVER"); then + if ! _kernel_path=$(_get_current_running_kernel_path); then + derror "no running kernel found" + exit 1 + fi + fi + _kernels=$_kernel_path + else + _kernels=$(_get_all_kernels_from_grubby "$_grubby_kernel_path") + fi + + for _kernel in $_kernels; do + if [[ -z $_dump_mode ]]; then + _new_dump_mode=$(get_dump_mode_by_kernel "$_kernel") + _new_crashkernel=$(kdump_get_arch_recommend_crashkernel "$_new_dump_mode") + _new_fadump_val=$(get_grub_kernel_boot_parameter "$_kernel" fadump) + else + _new_dump_mode=$_dump_mode + _new_crashkernel=$_crashkernel + _new_fadump_val=$_fadump_val + fi + + _old_crashkernel=$(get_grub_kernel_boot_parameter "$_kernel" crashkernel) + _old_fadump_val=$(get_grub_kernel_boot_parameter "$_kernel" fadump) + if [[ $_old_crashkernel != "$_new_crashkernel" || $_old_fadump_val != "$_new_fadump_val" ]]; then + _update_grub "$_kernel" "$_new_crashkernel" "$_new_dump_mode" "$_new_fadump_val" + if [[ $_reboot != yes ]]; then + if [[ $_old_crashkernel != "$_new_crashkernel" ]]; then + _what_is_updated="Updated crashkernel=$_new_crashkernel" + else + # This case happens only when switching between fadump=on and fadump=nocma + _what_is_updated="Updated fadump=$_new_fadump_val" + fi + dwarn "$_what_is_updated for kernel=$_kernel. Please reboot the system for the change to take effect." + fi + _crashkernel_changed=yes + fi + done + + if [[ $_reboot == yes && $_crashkernel_changed == yes ]]; then + reboot + fi +} + +# update the crashkernel value in GRUB_ETC_DEFAULT if necessary +# +# called by reset_crashkernel_after_update and inherit its array variable +# _crashkernel_vals +update_crashkernel_in_grub_etc_default_after_update() +{ + local _crashkernel _fadump_val + local _dump_mode _old_default_crashkernel _new_default_crashkernel + + _crashkernel=$(_read_kernel_arg_in_grub_etc_default crashkernel) + + if [[ -z $_crashkernel ]]; then + return + fi + + _fadump_val=$(_read_kernel_arg_in_grub_etc_default fadump) + _dump_mode=$(get_dump_mode_by_fadump_val "$_fadump_val") + + _old_default_crashkernel=${_crashkernel_vals[old_${_dump_mode}]} + _new_default_crashkernel=${_crashkernel_vals[new_${_dump_mode}]} + + if [[ $_crashkernel == auto ]] || + [[ $_crashkernel == "$_old_default_crashkernel" && + $_new_default_crashkernel != "$_old_default_crashkernel" ]]; then + _update_kernel_arg_in_grub_etc_default crashkernel "$_new_default_crashkernel" + fi +} + +# shellcheck disable=SC2154 # false positive when dereferencing an array +reset_crashkernel_after_update() +{ + local _kernel _crashkernel _dump_mode _fadump_val _old_default_crashkernel _new_default_crashkernel + declare -A _crashkernel_vals + + _crashkernel_vals[old_kdump]=$(cat /tmp/old_default_crashkernel 2> /dev/null) + _crashkernel_vals[old_fadump]=$(cat /tmp/old_default_crashkernel_fadump 2> /dev/null) + _crashkernel_vals[new_kdump]=$(get_default_crashkernel kdump) + _crashkernel_vals[new_fadump]=$(get_default_crashkernel fadump) + + 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" + elif [[ -n $_crashkernel ]]; then + _dump_mode=$(get_dump_mode_by_kernel "$_kernel") + _old_default_crashkernel=${_crashkernel_vals[old_${_dump_mode}]} + _new_default_crashkernel=${_crashkernel_vals[new_${_dump_mode}]} + if [[ $_crashkernel == "$_old_default_crashkernel" ]] && + [[ $_new_default_crashkernel != "$_old_default_crashkernel" ]]; then + _fadump_val=$(get_grub_kernel_boot_parameter "$_kernel" fadump) + if _update_grub "$_kernel" "$_new_default_crashkernel" "$_dump_mode" "$_fadump_val"; then + echo "For kernel=$_kernel, crashkernel=$_new_default_crashkernel now." + fi + fi + fi + done + + update_crashkernel_in_grub_etc_default_after_update +} + +# read the value of an environ variable from given environ file path +# +# The environment variable entries in /proc/[pid]/environ are separated +# by null bytes instead of by spaces. +# +# $1: environment variable +# $2: environ file path +read_proc_environ_var() +{ + local _var=$1 _environ_path=$2 + sed -n -E "s/.*(^|\x00)${_var}=([^\x00]*).*/\2/p" < "$_environ_path" +} + +_OSBUILD_ENVIRON_PATH='/proc/1/environ' +_is_osbuild() +{ + [[ $(read_proc_environ_var container "$_OSBUILD_ENVIRON_PATH") == bwrap-osbuild ]] +} + +reset_crashkernel_for_installed_kernel() +{ + local _installed_kernel _running_kernel _crashkernel _crashkernel_running + local _dump_mode_running _fadump_val_running + + if ! _installed_kernel=$(_find_kernel_path_by_release "$1"); then + exit 1 + fi + + if _is_osbuild; then + if ! grep -qs crashkernel= /etc/kernel/cmdline; then + reset_crashkernel "--kernel=$_installed_kernel" + fi + return + fi + + if ! _running_kernel=$(_get_current_running_kernel_path); then + derror "Couldn't find current running kernel" + exit + fi + + _crashkernel=$(get_grub_kernel_boot_parameter "$_installed_kernel" crashkernel) + _crashkernel_running=$(get_grub_kernel_boot_parameter "$_running_kernel" crashkernel) + _dump_mode_running=$(get_dump_mode_by_kernel "$_running_kernel") + _fadump_val_running=$(get_grub_kernel_boot_parameter "$_kernel" fadump) + + if [[ $_crashkernel != "$_crashkernel_running" ]]; then + if _update_grub "$_installed_kernel" "$_crashkernel_running" "$_dump_mode_running" "$_fadump_val_running"; then + echo "kexec-tools has reset $_installed_kernel to use the new default crashkernel value $_crashkernel_running" + fi + fi +} + +if [[ ! -f $KDUMP_CONFIG_FILE ]]; then + derror "Error: No kdump config file found!" + exit 1 +fi + +main() +{ + # Determine if the dump mode is kdump or fadump + determine_dump_mode + + case "$1" in + start) + if [[ -s /proc/vmcore ]]; then + save_core + reboot + else + start + fi + ;; + stop) + stop + ;; + status) + EXIT_CODE=0 + check_current_status + case "$?" in + 0) + dinfo "Kdump is operational" + EXIT_CODE=0 + ;; + 1) + dinfo "Kdump is not operational" + EXIT_CODE=3 + ;; + esac + exit $EXIT_CODE + ;; + reload) + reload + ;; + restart) + stop + start + ;; + rebuild) + rebuild + ;; + condrestart) ;; + + propagate) + propagate_ssh_key + ;; + showmem) + show_reserved_mem + ;; + estimate) + do_estimate + ;; + get-default-crashkernel) + get_default_crashkernel "$2" + ;; + reset-crashkernel) + shift + reset_crashkernel "$@" + ;; + reset-crashkernel-after-update) + if [[ $(kdump_get_conf_val auto_reset_crashkernel) != no ]]; then + reset_crashkernel_after_update + fi + ;; + reset-crashkernel-for-installed_kernel) + if [[ $(kdump_get_conf_val auto_reset_crashkernel) != no ]]; then + reset_crashkernel_for_installed_kernel "$2" + fi + ;; + *) + dinfo $"Usage: $0 {estimate|start|stop|status|restart|reload|rebuild|reset-crashkernel|propagate|showmem}" + exit 1 + ;; + esac +} + +# Other kdumpctl instances will block in queue, until this one exits +single_instance_lock + +# To avoid fd 9 leaking, we invoke a subshell, close fd 9 and call main. +# So that fd isn't leaking when main is invoking a subshell. +( + exec 9<&- + main "$@" +) + +exit $? diff --git a/SOURCES/kdumpctl.8 b/SOURCES/kdumpctl.8 new file mode 100644 index 0000000..067117b --- /dev/null +++ b/SOURCES/kdumpctl.8 @@ -0,0 +1,69 @@ +.TH KDUMPCTL 8 2015-07-13 kexec-tools + +.SH NAME +kdumpctl \- control interface for kdump + +.SH SYNOPSIS +.B kdumpctl +.I COMMAND + +.SH DESCRIPTION +.B kdumpctl +is used to check or control the kdump service. +In most cases, you should use +.B systemctl +to start / stop / enable kdump service instead. However, +.B kdumpctl +provides more details for debug and a helper to setup ssh key authentication. + +.SH COMMANDS +.TP +.I start +Start the service. +.TP +.I stop +Stop the service. +.TP +.I status +Prints the current status of kdump service. +It returns non-zero value if kdump is not operational. +.TP +.I restart +Is equal to +.I start; stop +.TP +.I reload +reload crash kernel image and initramfs without triggering a rebuild. +.TP +.I rebuild +rebuild the crash kernel initramfs. +.TP +.I propagate +Helps to setup key authentication for ssh storage since it's +impossible to use password authentication during kdump. +.TP +.I showmem +Prints the size of reserved memory for crash kernel in megabytes. +.TP +.I estimate +Estimate a suitable crashkernel value for current machine. This is a +best-effort estimate. It will print a recommanded crashkernel value +based on current kdump setup, and list some details of memory usage. +.TP +.I reset-crashkernel [--kernel=path_to_kernel] [--reboot] +Reset crashkernel to default value recommended by kexec-tools. If no kernel +is specified, will reset KDUMP_KERNELVER if it's defined in /etc/sysconfig/kdump +or current running kernel's crashkernel value if KDUMP_KERNELVER is empty. You can +also specify --kernel=ALL and --kernel=DEFAULT which have the same meaning as +grubby's kernel-path=ALL and kernel-path=DEFAULT. ppc64le supports FADump and +supports an additonal [--fadump=[on|off|nocma]] parameter to toggle FADump +on/off. + +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. + +.SH "SEE ALSO" +.BR kdump.conf (5), +.BR mkdumprd (8) diff --git a/SOURCES/kexec-kdump-howto.txt b/SOURCES/kexec-kdump-howto.txt new file mode 100644 index 0000000..1aeffc7 --- /dev/null +++ b/SOURCES/kexec-kdump-howto.txt @@ -0,0 +1,1047 @@ +================= +Kexec/Kdump HOWTO +================= + + +Introduction +============ + +Kexec and kdump are new features in the 2.6 mainstream kernel. These features +are included in Red Hat Enterprise Linux 5. The purpose of these features +is to ensure faster boot up and creation of reliable kernel vmcores for +diagnostic purposes. + + +Overview +======== + +Kexec +----- + +Kexec is a fastboot mechanism which allows booting a Linux kernel from the +context of already running kernel without going through BIOS. BIOS can be very +time consuming especially on the big servers with lots of peripherals. This can +save a lot of time for developers who end up booting a machine numerous times. + +Kdump +----- + +Kdump is a new kernel crash dumping mechanism and is very reliable because +the crash dump is captured from the context of a freshly booted kernel and +not from the context of the crashed kernel. Kdump uses kexec to boot into +a second kernel whenever system crashes. This second kernel, often called +a capture kernel, boots with very little memory and captures the dump image. + +The first kernel reserves a section of memory that the second kernel uses +to boot. Kexec enables booting the capture kernel without going through BIOS +hence contents of first kernel's memory are preserved, which is essentially +the kernel crash dump. + +Kdump is supported on the i686, x86_64, ia64 and ppc64 platforms. The +standard kernel and capture kernel are one in the same on i686, x86_64, +ia64 and ppc64. + +If you're reading this document, you should already have kexec-tools +installed. If not, you install it via the following command: + + # yum install kexec-tools + +Now load a kernel with kexec: + + # kver=`uname -r` # kexec -l /boot/vmlinuz-$kver + --initrd=/boot/initrd-$kver.img \ + --command-line="`cat /proc/cmdline`" + +NOTE: The above will boot you back into the kernel you're currently running, +if you want to load a different kernel, substitute it in place of `uname -r`. + +Now reboot your system, taking note that it should bypass the BIOS: + + # reboot + + +How to configure kdump +====================== + +Again, we assume if you're reading this document, you should already have +kexec-tools installed. If not, you install it via the following command: + + # yum install kexec-tools + +To be able to do much of anything interesting in the way of debug analysis, +you'll also need to install the kernel-debuginfo package, of the same arch +as your running kernel, and the crash utility: + + # yum --enablerepo=\*debuginfo install kernel-debuginfo.$(uname -m) crash + +Next up, we need to modify some boot parameters to reserve a chunk of memory for +the capture kernel. With the help of grubby, it's very easy to append +"crashkernel=128M" to the end of your kernel boot parameters. Note that the X +values are such that X = the amount of memory to reserve for the capture kernel. +And based on arch and system configuration, one might require more than 128M to +be reserved for kdump. One need to experiment and test kdump, if 128M is not +sufficient, try reserving more memory. + + # grubby --args="crashkernel=128M" --update-kernel=/boot/vmlinuz-`uname -r` + +Note that there is an alternative form in which to specify a crashkernel +memory reservation, in the event that more control is needed over the size and +placement of the reserved memory. The format is: + +crashkernel=range1:size1[,range2:size2,...][@offset] + +Where range<n> specifies a range of values that are matched against the amount +of physical RAM present in the system, and the corresponding size<n> value +specifies the amount of kexec memory to reserve. For example: + +crashkernel=512M-2G:64M,2G-:128M + +This line tells kexec to reserve 64M of ram if the system contains between +512M and 2G of physical memory. If the system contains 2G or more of physical +memory, 128M should be reserved. + +Besides, since kdump needs to access /proc/kallsyms during a kernel +loading if KASLR is enabled, check /proc/sys/kernel/kptr_restrict to +make sure that the content of /proc/kallsyms is exposed correctly. +We recommend to set the value of kptr_restrict to '1'. Otherwise +capture kernel loading could fail. + +After making said changes, reboot your system, so that the X MB of memory is +left untouched by the normal system, reserved for the capture kernel. Take note +that the output of 'free -m' will show X MB less memory than without this +parameter, which is expected. You may be able to get by with less than 128M, but +testing with only 64M has proven unreliable of late. On ia64, as much as 512M +may be required. + +Now that you've got that reserved memory region set up, you want to turn on +the kdump init script: + + # chkconfig kdump on + +Then, start up kdump as well: + + # systemctl start kdump.service + +This should load your kernel-kdump image via kexec, leaving the system ready +to capture a vmcore upon crashing. To test this out, you can force-crash +your system by echo'ing a c into /proc/sysrq-trigger: + + # echo c > /proc/sysrq-trigger + +You should see some panic output, followed by the system restarting into +the kdump kernel. When the boot process gets to the point where it starts +the kdump service, your vmcore should be copied out to disk (by default, +in /var/crash/<YYYY-MM-DD-HH:MM>/vmcore), then the system rebooted back into +your normal kernel. + +Once back to your normal kernel, you can use the previously installed crash +kernel in conjunction with the previously installed kernel-debuginfo to +perform postmortem analysis: + + # crash /usr/lib/debug/lib/modules/2.6.17-1.2621.el5/vmlinux + /var/crash/2006-08-23-15:34/vmcore + + crash> bt + +and so on... + + +Notes on kdump +============== + +When kdump starts, the kdump kernel is loaded together with the kdump +initramfs. To save memory usage and disk space, the kdump initramfs is +generated strictly against the system it will run on, and contains the +minimum set of kernel modules and utilities to boot the machine to a stage +where the dump target could be mounted. + +With kdump service enabled, kdumpctl will try to detect possible system +change and rebuild the kdump initramfs if needed. But it can not guarantee +to cover every possible case. So after a hardware change, disk migration, +storage setup update or any similar system level changes, it's highly +recommended to rebuild the initramfs manually with following command: + + # kdumpctl rebuild + + +Saving vmcore-dmesg.txt +======================= + +Kernel log bufferes are one of the most important information available +in vmcore. Now before saving vmcore, kernel log bufferes are extracted +from /proc/vmcore and saved into a file vmcore-dmesg.txt. After +vmcore-dmesg.txt, vmcore is saved. Destination disk and directory for +vmcore-dmesg.txt is same as vmcore. Note that kernel log buffers will +not be available if dump target is raw device. + + +Dump Triggering methods +======================= + +This section talks about the various ways, other than a Kernel Panic, in which +Kdump can be triggered. The following methods assume that Kdump is configured +on your system, with the scripts enabled as described in the section above. + +1) AltSysRq C + +Kdump can be triggered with the combination of the 'Alt','SysRq' and 'C' +keyboard keys. Please refer to the following link for more details: + +http://kbase.redhat.com/faq/FAQ_43_5559.shtm + +In addition, on PowerPC boxes, Kdump can also be triggered via Hardware +Management Console(HMC) using 'Ctrl', 'O' and 'C' keyboard keys. + +2) NMI_WATCHDOG + +In case a machine has a hard hang, it is quite possible that it does not +respond to keyboard interrupts. As a result 'Alt-SysRq' keys will not help +trigger a dump. In such scenarios Nmi Watchdog feature can prove to be useful. +The following link has more details on configuring Nmi watchdog option. + +http://kbase.redhat.com/faq/FAQ_85_9129.shtm + +Once this feature has been enabled in the kernel, any lockups will result in an +OOPs message to be generated, followed by Kdump being triggered. + +3) Kernel OOPs + +If we want to generate a dump everytime the Kernel OOPses, we can achieve this +by setting the 'Panic On OOPs' option as follows: + + # echo 1 > /proc/sys/kernel/panic_on_oops + +This is enabled by default on RHEL5. + +4) NMI(Non maskable interrupt) button + +In cases where the system is in a hung state, and is not accepting keyboard +interrupts, using NMI button for triggering Kdump can be very useful. NMI +button is present on most of the newer x86 and x86_64 machines. Please refer +to the User guides/manuals to locate the button, though in most occasions it +is not very well documented. In most cases it is hidden behind a small hole +on the front or back panel of the machine. You could use a toothpick or some +other non-conducting probe to press the button. + +For example, on the IBM X series 366 machine, the NMI button is located behind +a small hole on the bottom center of the rear panel. + +To enable this method of dump triggering using NMI button, you will need to set +the 'unknown_nmi_panic' option as follows: + + # echo 1 > /proc/sys/kernel/unknown_nmi_panic + +5) PowerPC specific methods: + +On IBM PowerPC machines, issuing a soft reset invokes the XMON debugger(if +XMON is configured). To configure XMON one needs to compile the kernel with +the CONFIG_XMON and CONFIG_XMON_DEFAULT options, or by compiling with +CONFIG_XMON and booting the kernel with xmon=on option. + +Following are the ways to remotely issue a soft reset on PowerPC boxes, which +would drop you to XMON. Pressing a 'X' (capital alphabet X) followed by an +'Enter' here will trigger the dump. + +5.1) HMC + +Hardware Management Console(HMC) available on Power4 and Power5 machines allow +partitions to be reset remotely. This is specially useful in hang situations +where the system is not accepting any keyboard inputs. + +Once you have HMC configured, the following steps will enable you to trigger +Kdump via a soft reset: + +On Power4 + Using GUI + + * In the right pane, right click on the partition you wish to dump. + * Select "Operating System->Reset". + * Select "Soft Reset". + * Select "Yes". + + Using HMC Commandline + + # reset_partition -m <machine> -p <partition> -t soft + +On Power5 + Using GUI + + * In the right pane, right click on the partition you wish to dump. + * Select "Restart Partition". + * Select "Dump". + * Select "OK". + + Using HMC Commandline + + # chsysstate -m <managed system name> -n <lpar name> -o dumprestart -r lpar + +5.2) Blade Management Console for Blade Center + +To initiate a dump operation, go to Power/Restart option under "Blade Tasks" in +the Blade Management Console. Select the corresponding blade for which you want +to initate the dump and then click "Restart blade with NMI". This issues a +system reset and invokes xmon debugger. + + +Dump targets +============ + +In addition to being able to capture a vmcore to your system's local file +system, kdump can be configured to capture a vmcore to a number of other +locations, including a raw disk partition, a dedicated file system, an NFS +mounted file system, or a remote system via ssh/scp. Additional options +exist for specifying the relative path under which the dump is captured, +what to do if the capture fails, and for compressing and filtering the dump +(so as to produce smaller, more manageable, vmcore files, see "Advanced Setups" +for more detail on these options). + +In theory, dumping to a location other than the local file system should be +safer than kdump's default setup, as its possible the default setup will try +dumping to a file system that has become corrupted. The raw disk partition and +dedicated file system options allow you to still dump to the local system, +but without having to remount your possibly corrupted file system(s), +thereby decreasing the chance a vmcore won't be captured. Dumping to an +NFS server or remote system via ssh/scp also has this advantage, as well +as allowing for the centralization of vmcore files, should you have several +systems from which you'd like to obtain vmcore files. Of course, note that +these configurations could present problems if your network is unreliable. + +Kdump target and advanced setups are configured via modifications to +/etc/kdump.conf, which out of the box, is fairly well documented itself. +Any alterations to /etc/kdump.conf should be followed by a restart of the +kdump service, so the changes can be incorporated in the kdump initrd. +Restarting the kdump service is as simple as '/sbin/systemctl restart kdump.service'. + +There are two ways to config the dump target, config dump target only +using "path", and config dump target explicitly. Interpretation of "path" +also differs in two config styles. + +Config dump target only using "path" +------------------------------------ + +You can change the dump target by setting "path" to a mount point where +dump target is mounted. When there is no explicitly configured dump target, +"path" in kdump.conf represents the current file system path in which vmcore +will be saved. Kdump will automatically detect the underlying device of +"path" and use that as the dump target. + +In fact, upon dump, kdump creates a directory $hostip-$date with-in "path" +and saves vmcore there. So practically dump is saved in $path/$hostip-$date/. + +Kdump will only check current mount status for mount entry corresponding to +"path". So please ensure the dump target is mounted on "path" before kdump +service starts. + +NOTES: + +- It's strongly recommanded to put an mount entry for "path" in /etc/fstab + and have it auto mounted on boot. This make sure the dump target is + reachable from the machine and kdump's configuration is stable. + +EXAMPLES: + +- path /var/crash/ + + This is the default configuration. Assuming there is no disk mounted + on /var/ or on /var/crash, dump will be saved on disk backing rootfs + in directory /var/crash. + +- path /var/crash/ (A separate disk mounted on /var/crash) + + Say a disk /dev/sdb is mounted on /var. In this case dump target will + become /dev/sdb and path will become "/" and dump will be saved + on "sdb:/var/crash/" directory. + +- path /var/crash/ (NFS mounted on /var) + + Say foo.com:/export/tmp is mounted on /var. In this case dump target is + nfs server and path will be adjusted to "/crash" and dump will be saved to + foo.com:/export/tmp/crash/ directory. + +Config dump target explicitely +------------------------------ + +You can set the dump target explicitly in kdump.conf, and "path" will be +the relative path in the specified dump target. For example, if dump +target is "ext4 /dev/sda", then dump will be saved in "path" directory +on /dev/sda. + +Same is the case for nfs dump. If user specified "nfs foo.com:/export/tmp/" +as dump target, then dump will effectively be saved in +"foo.com:/export/tmp/var/crash/" directory. + +If the dump target is "raw", then "path" is ignored. + +If it's a filesystem target, kdump will need to know the right mount option. +Kdump will check current mount status, and then /etc/fstab for mount options +corresponding to the specified dump target and use it. If there are +special mount option required for the dump target, it could be set by put +an entry in fstab. + +If there are no related mount entry, mount option is set to "defaults". + +NOTES: + +- It's recommended to put an entry for the dump target in /etc/fstab + and have it auto mounted on boot. This make sure the dump target is + reachable from the machine and kdump won't fail. + +- Kdump ignores some mount options, including "noauto", "ro". This + make it possible to keep the dump target unmounted or read-only + when not used. + +EXAMPLES: + +- ext4 /dev/sda (mounted) + path /var/crash/ + + In this case dump target is set to /dev/sdb, path is the absolute path + "/var/crash" in /dev/sda, vmcore path will saved on + "sda:/var/crash" directory. + +- nfs foo.com:/export/tmp (mounted) + path /var/crash/ + + In this case dump target is nfs server, path is the absolute path + "/var/crash", vmcore path will saved on "foo.com:/export/tmp/crash/" directory. + +- nfs foo.com:/export/tmp (not mounted) + path /var/crash/ + + Same with above case, kdump will use "defaults" as the mount option + for the dump target. + +- nfs foo.com:/export/tmp (not mounted, entry with option "noauto,nolock" exists in /etc/fstab) + path /var/crash/ + + In this case dump target is nfs server, vmcore path will saved on + "foo.com:/export/tmp/crash/" directory, and kdump will inherit "nolock" option. + +Dump target and mkdumprd +------------------------ + +MKdumprd is the tool used to create kdump initramfs, and it may change +the mount status of the dump target in some condition. + +Usually the dump target should be used only for kdump. If you worry about +someone uses the filesystem for something else other than dumping vmcore +you can mount it as read-only or make it a noauto mount. Mkdumprd will +mount/remount it as read-write for creating dump directory and will +move it back to it's original state afterwards. + +Supported dump target types and requirements +-------------------------------------------- + +1) Raw partition + +Raw partition dumping requires that a disk partition in the system, at least +as large as the amount of memory in the system, be left unformatted. Assuming +/dev/vg/lv_kdump is left unformatted, kdump.conf can be configured with +'raw /dev/vg/lv_kdump', and the vmcore file will be copied via dd directly +onto partition /dev/vg/lv_kdump. Restart the kdump service via +'/sbin/systemctl restart kdump.service' to commit this change to your kdump +initrd. Dump target should be persistent device name, such as lvm or device +mapper canonical name. + +2) Dedicated file system + +Similar to raw partition dumping, you can format a partition with the file +system of your choice, Again, it should be at least as large as the amount +of memory in the system. Assuming it should be at least as large as the +amount of memory in the system. Assuming /dev/vg/lv_kdump has been +formatted ext4, specify 'ext4 /dev/vg/lv_kdump' in kdump.conf, and a +vmcore file will be copied onto the file system after it has been mounted. +Dumping to a dedicated partition has the advantage that you can dump multiple +vmcores to the file system, space permitting, without overwriting previous ones, +as would be the case in a raw partition setup. Restart the kdump service via +'/sbin/systemctl restart kdump.service' to commit this change to +your kdump initrd. Note that for local file systems ext4 and ext2 are +supported as dumpable targets. Kdump will not prevent you from specifying +other filesystems, and they will most likely work, but their operation +cannot be guaranteed. for instance specifying a vfat filesystem or msdos +filesystem will result in a successful load of the kdump service, but during +crash recovery, the dump will fail if the system has more than 2GB of memory +(since vfat and msdos filesystems do not support more than 2GB files). +Be careful of your filesystem selection when using this target. + +It is recommended to use persistent device names or UUID/LABEL for file system +dumps. One example of persistent device is /dev/vg/<devname>. + +3) NFS mount + +Dumping over NFS requires an NFS server configured to export a file system +with full read/write access for the root user. All operations done within +the kdump initial ramdisk are done as root, and to write out a vmcore file, +we obviously must be able to write to the NFS mount. Configuring an NFS +server is outside the scope of this document, but either the no_root_squash +or anonuid options on the NFS server side are likely of interest to permit +the kdump initrd operations write to the NFS mount as root. + +Assuming your're exporting /dump on the machine nfs-server.example.com, +once the mount is properly configured, specify it in kdump.conf, via +'nfs nfs-server.example.com:/dump'. The server portion can be specified either +by host name or IP address. Following a system crash, the kdump initrd will +mount the NFS mount and copy out the vmcore to your NFS server. Restart the +kdump service via '/sbin/systemctl restart kdump.service' to commit this change +to your kdump initrd. + +4) Special mount via "dracut_args" + +You can utilize "dracut_args" to pass "--mount" to kdump, see dracut manpage +about the format of "--mount" for details. If there is any "--mount" specified +via "dracut_args", kdump will build it as the mount target without doing any +validation (mounting or checking like mount options, fs size, save path, etc), +so you must test it to ensure all the correctness. You cannot use other targets +in /etc/kdump.conf if you use "--mount" in "dracut_args". You also cannot specify +mutliple "--mount" targets via "dracut_args". + +One use case of "--mount" in "dracut_args" is you do not want to mount dump target +before kdump service startup, for example, to reduce the burden of the shared nfs +server. Such as the example below: +dracut_args --mount "192.168.1.1:/share /mnt/test nfs4 defaults" + +NOTE: +- <mountpoint> must be specified as an absolute path. + +5) Remote system via ssh/scp + +Dumping over ssh/scp requires setting up passwordless ssh keys for every +machine you wish to have dump via this method. First up, configure kdump.conf +for ssh/scp dumping, adding a config line of 'ssh user@server', where 'user' +can be any user on the target system you choose, and 'server' is the host +name or IP address of the target system. Using a dedicated, restricted user +account on the target system is recommended, as there will be keyless ssh +access to this account. + +Once kdump.conf is appropriately configured, issue the command +'kdumpctl propagate' to automatically set up the ssh host keys and transmit +the necessary bits to the target server. You'll have to type in 'yes' +to accept the host key for your targer server if this is the first time +you've connected to it, and then input the target system user's password +to send over the necessary ssh key file. Restart the kdump service via +'/sbin/systemctl restart kdump.service' to commit this change to your kdump initrd. + +Advanced Setups +=============== + +About /etc/sysconfig/kdump +------------------------------ + +Currently, there are a few options in /etc/sysconfig/kdump, which are +usually used to control the behavior of kdump kernel. Basically, all of +these options have default values, usually we do not need to change them, +but sometimes, we may modify them in order to better control the behavior +of kdump kernel such as debug, etc. + +-KDUMP_BOOTDIR + +Usually kdump kernel is the same as 1st kernel. So kdump will try to find +kdump kernel under /boot according to /proc/cmdline. E.g we execute below +command and get an output: + cat /proc/cmdline + BOOT_IMAGE=/xxx/vmlinuz-3.yyy.zzz root=xxxx ..... + +Then kdump kernel will be /boot/xxx/vmlinuz-3.yyy.zzz. However, this option +is provided to user if kdump kernel is put in a different directory. + +-KDUMP_IMG + +This represents the image type used for kdump. The default value is "vmlinuz". + +-KDUMP_IMG_EXT + +This represents the images extension. Relocatable kernels don't have one. +Currently, it is a null string by default. + +-KEXEC_ARGS + +Any additional kexec arguments required. For example: +KEXEC_ARGS="--elf32-core-headers". + +In most situations, this should be left empty. But, sometimes we hope to get +additional kexec loading debugging information, we can add the '-d' option +for the debugging. + +-KDUMP_KERNELVER + +This is a kernel version string for the kdump kernel. If the version is not +specified, the init script will try to find a kdump kernel with the same +version number as the running kernel. + +-KDUMP_COMMANDLINE + +The value of 'KDUMP_COMMANDLINE' will be passed to kdump kernel as command +line parameters, this will likely match the contents of the grub kernel line. + +In general, if a command line is not specified, which means that it is a null +string such as KDUMP_COMMANDLINE="", the default will be taken automatically +from the '/proc/cmdline'. + +-KDUMP_COMMANDLINE_REMOVE + +This option allows us to remove arguments from the current kdump command line. +If we don't specify any parameters for the KDUMP_COMMANDLINE, it will inherit +all values from the '/proc/cmdline', which is not expected. As you know, some +default kernel parameters could affect kdump, furthermore, that could cause +the failure of kdump kernel boot. + +In addition, the option is also helpful to debug the kdump kernel, we can use +this option to change kdump kernel command line. + +For more kernel parameters, please refer to kernel document. + +-KDUMP_COMMANDLINE_APPEND + +This option allows us to append arguments to the current kdump command line +after processed by the KDUMP_COMMANDLINE_REMOVE. For kdump kernel, some +specific modules require to be disabled like the mce, cgroup, numa, hest_disable, +etc. Those modules may waste memory or kdump kernel doesn't need them, +furthermore, there may affect kdump kernel boot. + +Just like above option, it can be used to disable or enable some kernel +modules so that we can exclude any errors for kdump kernel, this is very +meaningful for debugging. + +-KDUMP_STDLOGLVL | KDUMP_SYSLOGLVL | KDUMP_KMSGLOGLVL + +These variables are used to control the kdump log level in the first kernel. +In the second kernel, kdump will use the rd.kdumploglvl option to set the log +level in the above KDUMP_COMMANDLINE_APPEND. + +Logging levels: no logging(0), error(1), warn(2), info(3), debug(4) + +Kdump Post-Capture Executable +----------------------------- + +It is possible to specify a custom script or binary you wish to run following +an attempt to capture a vmcore. The executable is passed an exit code from +the capture process, which can be used to trigger different actions from +within your post-capture executable. +If /etc/kdump/post.d directory exist, All files in the directory are +collectively sorted and executed in lexical order, before binary or script +specified kdump_post parameter is executed. + +In these scripts, the reference to the storage or network device should adhere +to the section 'Supported dump target types and requirements' + +Kdump Pre-Capture Executable +---------------------------- + +It is possible to specify a custom script or binary you wish to run before +capturing a vmcore. Exit status of this binary is interpreted: +0 - continue with dump process as usual +non 0 - run the final action (reboot/poweroff/halt) +If /etc/kdump/pre.d directory exists, all files in the directory are collectively +sorted and executed in lexical order, after binary or script specified +kdump_pre parameter is executed. +Even if the binary or script in /etc/kdump/pre.d directory returns non 0 +exit status, the processing is continued. + +In these scripts, the reference to the storage or network device should adhere +to the section 'Supported dump target types and requirements' + +Extra Binaries +-------------- + +If you have specific binaries or scripts you want to have made available +within your kdump initrd, you can specify them by their full path, and they +will be included in your kdump initrd, along with all dependent libraries. +This may be particularly useful for those running post-capture scripts that +rely on other binaries. + +Extra Modules +------------- + +By default, only the bare minimum of kernel modules will be included in your +kdump initrd. Should you wish to capture your vmcore files to a non-boot-path +storage device, such as an iscsi target disk or clustered file system, you may +need to manually specify additional kernel modules to load into your kdump +initrd. + +Failure action +-------------- + +Failure action specifies what to do when dump to configured dump target +fails. By default, failure action is "reboot" and that is system reboots +if attempt to save dump to dump target fails. + +There are other failure actions available though. + +- dump_to_rootfs + This option tries to mount root and save dump on root filesystem + in a path specified by "path". This option will generally make + sense when dump target is not root filesystem. For example, if + dump is being saved over network using "ssh" then one can specify + failure action to "dump_to_rootfs" to try saving dump to root + filesystem if dump over network fails. + +- shell + Drop into a shell session inside initramfs. + +- halt + Halt system after failure + +- poweroff + Poweroff system after failure. + +Compression and filtering +------------------------- + +The 'core_collector' parameter in kdump.conf allows you to specify a custom +dump capture method. The most common alternate method is makedumpfile, which +is a dump filtering and compression utility provided with kexec-tools. On +some architectures, it can drastically reduce the size of your vmcore files, +which becomes very useful on systems with large amounts of memory. + +A typical setup is 'core_collector makedumpfile -F -l --message-level 7 -d 31', +but check the output of '/sbin/makedumpfile --help' for a list of all available +options (-i and -g don't need to be specified, they're automatically taken care +of). Note that use of makedumpfile requires that the kernel-debuginfo package +corresponding with your running kernel be installed. + +Core collector command format depends on dump target type. Typically for +filesystem (local/remote), core_collector should accept two arguments. +First one is source file and second one is target file. For ex. + +- ex1. + + core_collector "cp --sparse=always" + + Above will effectively be translated to: + + cp --sparse=always /proc/vmcore <dest-path>/vmcore + +- ex2. + + core_collector "makedumpfile -l --message-level 7 -d 31" + + Above will effectively be translated to: + + makedumpfile -l --message-level 7 -d 31 /proc/vmcore <dest-path>/vmcore + +For dump targets like raw and ssh, in general, core collector should expect +one argument (source file) and should output the processed core on standard +output (There is one exception of "scp", discussed later). This standard +output will be saved to destination using appropriate commands. + +raw dumps core_collector examples: + +- ex3. + + core_collector "cat" + + Above will effectively be translated to. + + cat /proc/vmcore | dd of=<target-device> + +- ex4. + + core_collector "makedumpfile -F -l --message-level 7 -d 31" + + Above will effectively be translated to. + + makedumpfile -F -l --message-level 7 -d 31 | dd of=<target-device> + +ssh dumps core_collector examples: + +- ex5. + + core_collector "cat" + + Above will effectively be translated to. + + cat /proc/vmcore | ssh <options> <remote-location> "dd of=path/vmcore" + +- ex6. + + core_collector "makedumpfile -F -l --message-level 7 -d 31" + + Above will effectively be translated to. + + makedumpfile -F -l --message-level 7 -d 31 | ssh <options> <remote-location> "dd of=path/vmcore" + +There is one exception to standard output rule for ssh dumps. And that is +scp. As scp can handle ssh destinations for file transfers, one can +specify "scp" as core collector for ssh targets (no output on stdout). + +- ex7. + + core_collector "scp" + + Above will effectively be translated to. + + scp /proc/vmcore <user@host>:path/vmcore + +About default core collector +---------------------------- + +Default core_collector for ssh/raw dump is: +"makedumpfile -F -l --message-level 7 -d 31". +Default core_collector for other targets is: +"makedumpfile -l --message-level 7 -d 31". + +Even if core_collector option is commented out in kdump.conf, makedumpfile +is default core collector and kdump uses it internally. + +If one does not want makedumpfile as default core_collector, then they +need to specify one using core_collector option to change the behavior. + +Note: If "makedumpfile -F" is used then you will get a flattened format +vmcore.flat, you will need to use "makedumpfile -R" to rearrange the +dump data from stdard input to a normal dumpfile (readable with analysis +tools). +For example: "makedumpfile -R vmcore < vmcore.flat" + + +Caveats +======= + +Console frame-buffers and X are not properly supported. If you typically run +with something along the lines of "vga=791" in your kernel config line or +have X running, console video will be garbled when a kernel is booted via +kexec. Note that the kdump kernel should still be able to create a dump, +and when the system reboots, video should be restored to normal. + + +Notes +===== + +Notes on resetting video: +------------------------- + +Video is a notoriously difficult issue with kexec. Video cards contain ROM code +that controls their initial configuration and setup. This code is nominally +accessed and executed from the Bios, and otherwise not safely executable. Since +the purpose of kexec is to reboot the system without re-executing the Bios, it +is rather difficult if not impossible to reset video cards with kexec. The +result is, that if a system crashes while running in a graphical mode (i.e. +running X), the screen may appear to become 'frozen' while the dump capture is +taking place. A serial console will of course reveal that the system is +operating and capturing a vmcore image, but a casual observer will see the +system as hung until the dump completes and a true reboot is executed. + +There are two possiblilties to work around this issue. One is by adding +--reset-vga to the kexec command line options in /etc/sysconfig/kdump. This +tells kdump to write some reasonable default values to the video card register +file, in the hopes of returning it to a text mode such that boot messages are +visible on the screen. It does not work with all video cards however. +Secondly, it may be worth trying to add vga15fb.ko to the extra_modules list in +/etc/kdump.conf. This will attempt to use the video card in framebuffer mode, +which can blank the screen prior to the start of a dump capture. + +Notes on rootfs mount +--------------------- + +Dracut is designed to mount rootfs by default. If rootfs mounting fails it +will refuse to go on. So kdump 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. + +Notes on watchdog module handling +--------------------------------- + +If a watchdog is active in first kernel then, we must have it's module +loaded in crash kernel, so that either watchdog is deactivated or started +being kicked in second kernel. Otherwise, we might face watchdog reboot +when vmcore is being saved. When dracut watchdog module is enabled, it +installs kernel watchdog module of active watchdog device in initrd. +kexec-tools always add "-a watchdog" to the dracut_args if there exists at +least one active watchdog and user has not added specifically "-o watchdog" +in dracut_args of kdump.conf. If a watchdog module (such as hp_wdt) has +not been written in watchdog-core framework then this option will not have +any effect and module will not be added. Please note that only systemd +watchdog daemon is supported as watchdog kick application. + +Notes for disk images +--------------------- + +Kdump initramfs is a critical component for capturing the crash dump. +But it's strictly generated for the machine it will run on, and have +no generality. If you install a new machine with a previous disk image +(eg. VMs created with disk image or snapshot), kdump could be broken +easily due to hardware changes or disk ID changes. So it's strongly +recommended to not include the kdump initramfs in the disk image in the +first place, this helps to save space, and kdumpctl will build the +initramfs automatically if it's missing. If you have already installed +a machine with a disk image which have kdump initramfs embedded, you +should rebuild the initramfs using "kdumpctl rebuild" command manually, +or else kdump may not work as expeceted. + +Notes on encrypted dump target +------------------------------ + +Currently, kdump is not working well with encrypted dump target. +First, user have to give the password manually in capture kernel, +so a working interactive terminal is required in the capture kernel. +And another major issue is that an OOM problem will occur with certain +encryption setup. For example, the default setup for LUKS2 will use a +memory hard key derivation function to mitigate brute force attach, +it's impossible to reduce the memory usage for mounting the encrypted +target. In such case, you have to either reserved enough memory for +crash kernel according, or update your encryption setup. +It's recommanded to use a non-encrypted target (eg. remote target) +instead. + +Notes on device dump +-------------------- + +Device dump allows drivers to append dump data to vmcore, so you can +collect driver specified debug info. The drivers could append the +data without any limit, and the data is stored in memory, this may +bring a significant memory stress. So device dump is disabled by default +by passing "novmcoredd" command line option to the kdump capture kernel. +If you want to collect debug data with device dump, you need to modify +"KDUMP_COMMANDLINE_APPEND=" value in /etc/sysconfig/kdump and remove the +"novmcoredd" option. You also need to increase the "crashkernel=" value +accordingly in case of OOM issue. +Besides, kdump initramfs won't automatically include the device drivers +which support device dump, only device drivers that are required for +the dump target setup will be included. To ensure the device dump data +will be included in the vmcore, you need to force include related +device drivers by using "extra_modules" option in /etc/kdump.conf + + +Parallel Dumping Operation +========================== + +Kexec allows kdump using multiple cpus. So parallel feature can accelerate +dumping substantially, especially in executing compression and filter. +For example: + + 1."makedumpfile -c --num-threads [THREAD_NUM] /proc/vmcore dumpfile" + 2."makedumpfile -c /proc/vmcore dumpfile", + + 1 has better performance than 2, if THREAD_NUM is larger than two + and the usable cpus number is larger than THREAD_NUM. + +Notes on how to use multiple cpus on a capture kernel on x86 system: + +Make sure that you are using a kernel that supports disable_cpu_apicid +kernel option as a capture kernel, which is needed to avoid x86 specific +hardware issue (*). The disable_cpu_apicid kernel option is automatically +appended by kdumpctl script and is ignored if the kernel doesn't support it. + +You need to specify how many cpus to be used in a capture kernel by specifying +the number of cpus in nr_cpus kernel option in /etc/sysconfig/kdump. nr_cpus +is 1 at default. + +You should use necessary and sufficient number of cpus on a capture kernel. +Warning: Don't use too many cpus on a capture kernel, or the capture kernel +may lead to panic due to Out Of Memory. + +(*) Without disable_cpu_apicid kernel option, capture kernel may lead to +hang, system reset or power-off at boot, depending on your system and runtime +situation at the time of crash. + + +Debugging Tips +============== + +- One can drop into a shell before/after saving vmcore with the help of + using kdump_pre/kdump_post hooks. Use following in one of the pre/post + scripts to drop into a shell. + + #!/bin/bash + _ctty=/dev/ttyS0 + setsid /bin/sh -i -l 0<>$_ctty 1<>$_ctty 2<>$_ctty + + One might have to change the terminal depending on what they are using. + +- Serial console logging for virtual machines + + I generally use "virsh console <domain-name>" to get to serial console. + I noticed after dump saving system reboots and when grub menu shows up + some of the previously logged messages are no more there. That means + any important debugging info at the end will be lost. + + One can log serial console as follows to make sure messages are not lost. + + virsh ttyconsole <domain-name> + ln -s <name-of-tty> /dev/modem + minicom -C /tmp/console-logs + + Now minicom should be logging serial console in file console-logs. + +- Using the logger to output kdump log messages + + You can configure the kdump log level for the first kernel in the + /etc/sysconfig/kdump. For example: + + KDUMP_STDLOGLVL=3 + KDUMP_SYSLOGLVL=0 + KDUMP_KMSGLOGLVL=0 + + The above configurations indicate that kdump messages will be printed + to the console, and the KDUMP_STDLOGLVL is set to 3(info), but the + KDUMP_SYSLOGLVL and KDUMP_KMSGLOGLVL are set to 0(no logging). This + is also the current default log levels in the first kernel. + + In the second kernel, you can add the 'rd.kdumploglvl=X' option to the + KDUMP_COMMANDLINE_APPEND in the /etc/sysconfig/kdump so that you can also + set the log levels for the second kernel. The 'X' represents the logging + levels, the default log level is 3(info) in the second kernel, for example: + + # cat /etc/sysconfig/kdump |grep rd.kdumploglvl + KDUMP_COMMANDLINE_APPEND="irqpoll nr_cpus=1 reset_devices cgroup_disable=memory mce=off numa=off udev.children-max=2 panic=10 acpi_no_memhotplug transparent_hugepage=never nokaslr hest_disable novmcoredd rd.kdumploglvl=3" + + Logging levels: no logging(0), error(1),warn(2),info(3),debug(4) + + The ERROR level designates error events that might still allow the application + to continue running. + + The WARN level designates potentially harmful situations. + + The INFO level designates informational messages that highlight the progress + of the application at coarse-grained level. + + The DEBUG level designates fine-grained informational events that are most + useful to debug an application. + + Note: if you set the log level to 0, that will disable the logs at the + corresponding log level, which indicates that it has no log output. + + At present, the logger works in both the first kernel(kdump service debugging) + and the second kernel. + + In the first kernel, you can find the historical logs with the journalctl + command and check kdump service debugging information. In addition, the + 'kexec -d' debugging messages are also saved to /var/log/kdump.log in the + first kernel. For example: + + [root@ibm-z-109 ~]# ls -al /var/log/kdump.log + -rw-r--r--. 1 root root 63238 Oct 28 06:40 /var/log/kdump.log + + If you want to get the debugging information of building kdump initramfs, you + can enable the '--debug' option for the dracut_args in the /etc/kdump.conf, and + then rebuild the kdump initramfs as below: + + # systemctl restart kdump.service + + That will rebuild the kdump initramfs and gerenate some logs to journald, you + can find the dracut logs with the journalctl command. + + In the second kernel, kdump will automatically put the kexec-dmesg.log to a same + directory with the vmcore, the log file includes the debugging messages like dmesg + and journald logs. For example: + + [root@ibm-z-109 ~]# ls -al /var/crash/127.0.0.1-2020-10-28-02\:01\:23/ + drwxr-xr-x. 2 root root 67 Oct 28 02:02 . + drwxr-xr-x. 6 root root 154 Oct 28 02:01 .. + -rw-r--r--. 1 root root 21164 Oct 28 02:01 kexec-dmesg.log + -rw-------. 1 root root 74238698 Oct 28 02:01 vmcore + -rw-r--r--. 1 root root 17532 Oct 28 02:01 vmcore-dmesg.txt + + If you want to get more debugging information in the second kernel, you can add + the 'rd.debug' option to the KDUMP_COMMANDLINE_APPEND in the /etc/sysconfig/kdump, + and then reload them in order to make the changes take effect. + + In addition, you can also add the 'rd.memdebug=X' option to the KDUMP_COMMANDLINE_APPEND + in the /etc/sysconfig/kdump in order to output the additional information about + kernel module memory consumption during loading. + + For more details, please refer to the /etc/sysconfig/kdump, or the man page of + dracut.cmdline and kdump.conf. diff --git a/SOURCES/kexec-tools-2.0.22-01-s390_handle_R_390_PLT32DBL_reloc_entries_in_machine_apply_elf_rel_.patch b/SOURCES/kexec-tools-2.0.22-01-s390_handle_R_390_PLT32DBL_reloc_entries_in_machine_apply_elf_rel_.patch new file mode 100644 index 0000000..10bc5ef --- /dev/null +++ b/SOURCES/kexec-tools-2.0.22-01-s390_handle_R_390_PLT32DBL_reloc_entries_in_machine_apply_elf_rel_.patch @@ -0,0 +1,95 @@ +commit 186e7b0752d8fce1618fa37519671c834c46340e +Author: Alexander Egorenkov <egorenar@linux.ibm.com> +Date: Wed Dec 15 18:48:53 2021 +0100 + + s390: handle R_390_PLT32DBL reloc entries in machine_apply_elf_rel() + + Starting with gcc 11.3, the C compiler will generate PLT-relative function + calls even if they are local and do not require it. Later on during linking, + the linker will replace all PLT-relative calls to local functions with + PC-relative ones. Unfortunately, the purgatory code of kexec/kdump is + not being linked as a regular executable or shared library would have been, + and therefore, all PLT-relative addresses remain in the generated purgatory + object code unresolved. This in turn lets kexec-tools fail with + "Unknown rela relocation: 0x14 0x73c0901c" for such relocation types. + + Furthermore, the clang C compiler has always behaved like described above + and this commit should fix the purgatory code built with the latter. + + Because the purgatory code is no regular executable or shared library, + contains only calls to local functions and has no PLT, all R_390_PLT32DBL + relocation entries can be resolved just like a R_390_PC32DBL one. + + * https://refspecs.linuxfoundation.org/ELF/zSeries/lzsabi0_zSeries/x1633.html#AEN1699 + + Relocation entries of purgatory code generated with gcc 11.3 + ------------------------------------------------------------ + + $ readelf -r purgatory/purgatory.o + + Relocation section '.rela.text' at offset 0x6e8 contains 27 entries: + Offset Info Type Sym. Value Sym. Name + Addend + 00000000000c 000300000013 R_390_PC32DBL 0000000000000000 .data + 2 + 00000000001a 001000000014 R_390_PLT32DBL 0000000000000000 sha256_starts + 2 + 000000000030 001100000014 R_390_PLT32DBL 0000000000000000 sha256_update + 2 + 000000000046 001200000014 R_390_PLT32DBL 0000000000000000 sha256_finish + 2 + 000000000050 000300000013 R_390_PC32DBL 0000000000000000 .data + 102 + 00000000005a 001300000014 R_390_PLT32DBL 0000000000000000 memcmp + 2 + ... + 000000000118 001600000014 R_390_PLT32DBL 0000000000000000 setup_arch + 2 + 00000000011e 000300000013 R_390_PC32DBL 0000000000000000 .data + 2 + 00000000012c 000f00000014 R_390_PLT32DBL 0000000000000000 verify_sha256_digest + 2 + 000000000142 001700000014 R_390_PLT32DBL 0000000000000000 + post_verification[...] + 2 + + Relocation entries of purgatory code generated with gcc 11.2 + ------------------------------------------------------------ + + $ readelf -r purgatory/purgatory.o + + Relocation section '.rela.text' at offset 0x6e8 contains 27 entries: + Offset Info Type Sym. Value Sym. Name + Addend + 00000000000e 000300000013 R_390_PC32DBL 0000000000000000 .data + 2 + 00000000001c 001000000013 R_390_PC32DBL 0000000000000000 sha256_starts + 2 + 000000000036 001100000013 R_390_PC32DBL 0000000000000000 sha256_update + 2 + 000000000048 001200000013 R_390_PC32DBL 0000000000000000 sha256_finish + 2 + 000000000052 000300000013 R_390_PC32DBL 0000000000000000 .data + 102 + 00000000005c 001300000013 R_390_PC32DBL 0000000000000000 memcmp + 2 + ... + 00000000011a 001600000013 R_390_PC32DBL 0000000000000000 setup_arch + 2 + 000000000120 000300000013 R_390_PC32DBL 0000000000000000 .data + 122 + 000000000130 000f00000013 R_390_PC32DBL 0000000000000000 verify_sha256_digest + 2 + 000000000146 001700000013 R_390_PC32DBL 0000000000000000 post_verification[...] + 2 + + Corresponding s390 kernel discussion: + * https://lore.kernel.org/linux-s390/20211208105801.188140-1-egorenar@linux.ibm.com/T/#u + + Signed-off-by: Alexander Egorenkov <egorenar@linux.ibm.com> + Reported-by: Tao Liu <ltao@redhat.com> + Suggested-by: Philipp Rudo <prudo@redhat.com> + Reviewed-by: Philipp Rudo <prudo@redhat.com> + [hca@linux.ibm.com: changed commit message as requested by Philipp Rudo] + Signed-off-by: Heiko Carstens <hca@linux.ibm.com> + Signed-off-by: Simon Horman <horms@verge.net.au> + +diff --git a/kexec/arch/s390/kexec-elf-rel-s390.c b/kexec/arch/s390/kexec-elf-rel-s390.c +index a5e1b73455785ae3bc3aa72b3beee13ae202e82f..91ba86a9991dad4271b834fc3b24861c40309e52 100644 +--- a/kexec/arch/s390/kexec-elf-rel-s390.c ++++ b/kexec/arch/s390/kexec-elf-rel-s390.c +@@ -56,6 +56,7 @@ void machine_apply_elf_rel(struct mem_ehdr *UNUSED(ehdr), + case R_390_PC16: /* PC relative 16 bit. */ + case R_390_PC16DBL: /* PC relative 16 bit shifted by 1. */ + case R_390_PC32DBL: /* PC relative 32 bit shifted by 1. */ ++ case R_390_PLT32DBL: /* 32 bit PC rel. PLT shifted by 1. */ + case R_390_PC32: /* PC relative 32 bit. */ + case R_390_PC64: /* PC relative 64 bit. */ + val -= address; +@@ -63,7 +64,7 @@ void machine_apply_elf_rel(struct mem_ehdr *UNUSED(ehdr), + *(unsigned short *) loc = val; + else if (r_type == R_390_PC16DBL) + *(unsigned short *) loc = val >> 1; +- else if (r_type == R_390_PC32DBL) ++ else if (r_type == R_390_PC32DBL || r_type == R_390_PLT32DBL) + *(unsigned int *) loc = val >> 1; + else if (r_type == R_390_PC32) + *(unsigned int *) loc = val; diff --git a/SOURCES/kexec-tools-2.0.23-makedumpfile-sadump-kaslr-fix-failure-of-calculating-kaslr_.patch b/SOURCES/kexec-tools-2.0.23-makedumpfile-sadump-kaslr-fix-failure-of-calculating-kaslr_.patch new file mode 100644 index 0000000..e7a47b5 --- /dev/null +++ b/SOURCES/kexec-tools-2.0.23-makedumpfile-sadump-kaslr-fix-failure-of-calculating-kaslr_.patch @@ -0,0 +1,49 @@ +From 59b1726fbcc251155140c8a1972384498fee4daf Mon Sep 17 00:00:00 2001 +From: HATAYAMA Daisuke <d.hatayama@fujitsu.com> +Date: Tue, 25 Jan 2022 12:55:15 +0000 +Subject: [PATCH] [PATCH] sadump, kaslr: fix failure of calculating + kaslr_offset + +On kernels v5.8 or later, makedumpfile fails for memory dumps in the +sadump-related formats as follows: + + # makedumpfile -f -l -d 31 -x ./vmlinux /dev/sdd4 /root/vmcore-ld31 + __vtop4_x86_64: Can't get a valid pud_pte. + ...110 lines of the same message... + __vtop4_x86_64: Can't get a valid pud_pte. + calc_kaslr_offset: failed to calculate kaslr_offset and phys_base; default to 0 + readmem: type_addr: 1, addr:ffffffff85411858, size:8 + __vtop4_x86_64: Can't get pgd (page_dir:ffffffff85411858). + readmem: Can't convert a virtual address(ffffffff059be980) to physical address. + readmem: type_addr: 0, addr:ffffffff059be980, size:1024 + cpu_online_mask_init: Can't read cpu_online_mask memory. + + makedumpfile Failed. + +This is caused by the kernel commit 9d06c4027f21 ("x86/entry: Convert +Divide Error to IDTENTRY") that renamed divide_error to +asm_exc_divide_error, breaking logic for calculating kaslr offset. + +Fix this by adding initialization of asm_exc_divide_error. + +Signed-off-by: HATAYAMA Daisuke <d.hatayama@fujitsu.com> +--- + makedumpfile.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/makedumpfile-1.7.0/makedumpfile.c b/makedumpfile-1.7.0/makedumpfile.c +index a51bdaf..7ed9756 100644 +--- a/makedumpfile-1.7.0/makedumpfile.c ++++ b/makedumpfile-1.7.0/makedumpfile.c +@@ -1667,6 +1667,8 @@ get_symbol_info(void) + SYMBOL_INIT(cur_cpu_spec, "cur_cpu_spec"); + + SYMBOL_INIT(divide_error, "divide_error"); ++ if (SYMBOL(divide_error) == NOT_FOUND_SYMBOL) ++ SYMBOL_INIT(divide_error, "asm_exc_divide_error"); + SYMBOL_INIT(idt_table, "idt_table"); + SYMBOL_INIT(saved_command_line, "saved_command_line"); + SYMBOL_INIT(pti_init, "pti_init"); +-- +2.33.1 + diff --git a/SOURCES/live-image-kdump-howto.txt b/SOURCES/live-image-kdump-howto.txt new file mode 100644 index 0000000..1695a1c --- /dev/null +++ b/SOURCES/live-image-kdump-howto.txt @@ -0,0 +1,25 @@ +Kdump now works on live images with some manual configurations. Here is the step +by step guide. + +1. Enable crashkernel reservation + +Since there isn't any config file that can be used to configure kernel +parameters for live images before booting them, we have to append 'crashkernel' +argument in boot menu every time we boot a live image. + +2. Change dump target in /etc/kdump.conf + +When kdump kernel boots in a live environment, the default target /var/crash is +in RAM so you need to change the dump target to an external disk or a network +dump target. + +Besides, make sure that "default dump_to_rootfs" is not specified. + +3. Start kdump service + + $ kdumpctl start + +4. Trigger a kdump test + + $ echo 1 > /proc/sys/kernel/sysrq + $ echo c > /proc/sysrq-trigger diff --git a/SOURCES/mkdumprd b/SOURCES/mkdumprd new file mode 100644 index 0000000..500146b --- /dev/null +++ b/SOURCES/mkdumprd @@ -0,0 +1,469 @@ +#!/bin/bash --norc +# New mkdumprd +# +# Copyright 2011 Red Hat, Inc. +# +# Written by Cong Wang <amwang@redhat.com> +# + +if [[ -f /etc/sysconfig/kdump ]]; then + . /etc/sysconfig/kdump +fi + +[[ $dracutbasedir ]] || dracutbasedir=/usr/lib/dracut +. $dracutbasedir/dracut-functions.sh +. /lib/kdump/kdump-lib.sh +. /lib/kdump/kdump-logger.sh +export IN_KDUMP=1 + +#initiate the kdump logger +if ! dlog_init; then + echo "failed to initiate the kdump logger." + exit 1 +fi + +SSH_KEY_LOCATION="/root/.ssh/kdump_id_rsa" +SAVE_PATH=$(get_save_path) +OVERRIDE_RESETTABLE=0 + +extra_modules="" +dracut_args=(--add kdumpbase --quiet --hostonly --hostonly-cmdline --hostonly-i18n --hostonly-mode strict -o "plymouth resume ifcfg earlykdump") + +MKDUMPRD_TMPDIR="$(mktemp -d -t mkdumprd.XXXXXX)" +[ -d "$MKDUMPRD_TMPDIR" ] || perror_exit "dracut: mktemp -p -d -t dracut.XXXXXX failed." +MKDUMPRD_TMPMNT="$MKDUMPRD_TMPDIR/target" + +trap ' + ret=$?; + is_mounted $MKDUMPRD_TMPMNT && umount -f $MKDUMPRD_TMPMNT; + [[ -d $MKDUMPRD_TMPDIR ]] && rm --one-file-system -rf -- "$MKDUMPRD_TMPDIR"; + exit $ret; + ' EXIT + +# clean up after ourselves no matter how we die. +trap 'exit 1;' SIGINT + +add_dracut_arg() +{ + dracut_args+=("$@") +} + +add_dracut_mount() +{ + add_dracut_arg "--mount" "$1" +} + +add_dracut_sshkey() +{ + add_dracut_arg "--sshkey" "$1" +} + +# caller should ensure $1 is valid and mounted in 1st kernel +to_mount() +{ + local _target=$1 _fstype=$2 _options=$3 _sed_cmd _new_mntpoint _pdev + + _new_mntpoint=$(get_kdump_mntpoint_from_target "$_target") + _fstype="${_fstype:-$(get_fs_type_from_target "$_target")}" + _options="${_options:-$(get_mntopt_from_target "$_target")}" + _options="${_options:-defaults}" + + if [[ $_fstype == "nfs"* ]]; then + _pdev=$_target + _sed_cmd+='s/,\(mount\)\?addr=[^,]*//g;' + _sed_cmd+='s/,\(mount\)\?proto=[^,]*//g;' + _sed_cmd+='s/,clientaddr=[^,]*//;' + else + # for non-nfs _target converting to use udev persistent name + _pdev="$(kdump_get_persistent_dev "$_target")" + if [[ -z $_pdev ]]; then + return 1 + fi + fi + + # mount fs target as rw in 2nd kernel + _sed_cmd+='s/\(^\|,\)ro\($\|,\)/\1rw\2/g;' + # with 'noauto' in fstab nfs and non-root disk mount will fail in 2nd + # kernel, filter it out here. + _sed_cmd+='s/\(^\|,\)noauto\($\|,\)/\1/g;' + # drop nofail or nobootwait + _sed_cmd+='s/\(^\|,\)nofail\($\|,\)/\1/g;' + _sed_cmd+='s/\(^\|,\)nobootwait\($\|,\)/\1/g;' + + _options=$(echo "$_options" | sed "$_sed_cmd") + + echo "$_pdev $_new_mntpoint $_fstype $_options" +} + +#Function: get_ssh_size +#$1=dump target +#called from while loop and shouldn't read from stdin, so we're using "ssh -n" +get_ssh_size() +{ + local _out + local _opt=("-i" "$SSH_KEY_LOCATION" "-o" "BatchMode=yes" "-o" "StrictHostKeyChecking=yes") + + if ! _out=$(ssh -q -n "${_opt[@]}" "$1" "df" "--output=avail" "$SAVE_PATH"); then + perror_exit "checking remote ssh server available size failed." + fi + + echo -n "$_out" | tail -1 +} + +#mkdir if save path does not exist on ssh dump target +#$1=ssh dump target +#caller should ensure write permission on $1:$SAVE_PATH +#called from while loop and shouldn't read from stdin, so we're using "ssh -n" +mkdir_save_path_ssh() +{ + local _opt _dir + _opt=(-i "$SSH_KEY_LOCATION" -o BatchMode=yes -o StrictHostKeyChecking=yes) + ssh -qn "${_opt[@]}" "$1" mkdir -p "$SAVE_PATH" &> /dev/null || + perror_exit "mkdir failed on $1:$SAVE_PATH" + + # check whether user has write permission on $1:$SAVE_PATH + _dir=$(ssh -qn "${_opt[@]}" "$1" mktemp -dqp "$SAVE_PATH" 2> /dev/null) || + perror_exit "Could not create temporary directory on $1:$SAVE_PATH. Make sure user has write permission on destination" + ssh -qn "${_opt[@]}" "$1" rmdir "$_dir" + + return 0 +} + +#Function: get_fs_size +#$1=dump target +get_fs_size() +{ + df --output=avail "$(get_mntpoint_from_target "$1")/$SAVE_PATH" | tail -1 +} + +#Function: get_raw_size +#$1=dump target +get_raw_size() +{ + fdisk -s "$1" +} + +#Function: check_size +#$1: dump type string ('raw', 'fs', 'ssh') +#$2: dump target +check_size() +{ + local avail memtotal + + memtotal=$(awk '/MemTotal/{print $2}' /proc/meminfo) + case "$1" in + raw) + avail=$(get_raw_size "$2") + ;; + ssh) + avail=$(get_ssh_size "$2") + ;; + fs) + avail=$(get_fs_size "$2") + ;; + *) + return + ;; + esac || perror_exit "Check dump target size failed" + + if [[ $avail -lt $memtotal ]]; then + dwarn "Warning: There might not be enough space to save a vmcore." + dwarn " The size of $2 should be greater than $memtotal kilo bytes." + fi +} + +check_save_path_fs() +{ + local _path=$1 + + if [[ ! -d $_path ]]; then + perror_exit "Dump path $_path does not exist." + fi +} + +mount_failure() +{ + local _target=$1 + local _mnt=$2 + local _fstype=$3 + local msg="Failed to mount $_target" + + if [[ -n $_mnt ]]; then + msg="$msg on $_mnt" + fi + + msg="$msg for kdump preflight check." + + if [[ $_fstype == "nfs" ]]; then + msg="$msg Please make sure nfs-utils has been installed." + fi + + perror_exit "$msg" +} + +check_user_configured_target() +{ + local _target=$1 _cfg_fs_type=$2 _mounted + local _mnt _opt _fstype + + _mnt=$(get_mntpoint_from_target "$_target") + _opt=$(get_mntopt_from_target "$_target") + _fstype=$(get_fs_type_from_target "$_target") + + if [[ -n $_fstype ]]; then + # In case of nfs4, nfs should be used instead, nfs* options is deprecated in kdump.conf + [[ $_fstype == "nfs"* ]] && _fstype=nfs + + if [[ -n $_cfg_fs_type ]] && [[ $_fstype != "$_cfg_fs_type" ]]; then + perror_exit "\"$_target\" have a wrong type config \"$_cfg_fs_type\", expected \"$_fstype\"" + fi + else + _fstype="$_cfg_fs_type" + _fstype="$_cfg_fs_type" + fi + + # For noauto mount, mount it inplace with default value. + # Else use the temporary target directory + if [[ -n $_mnt ]]; then + if ! is_mounted "$_mnt"; then + if [[ $_opt == *",noauto"* ]]; then + mount "$_mnt" || mount_failure "$_target" "$_mnt" "$_fstype" + _mounted=$_mnt + else + perror_exit "Dump target \"$_target\" is neither mounted nor configured as \"noauto\"" + fi + fi + else + _mnt=$MKDUMPRD_TMPMNT + mkdir -p "$_mnt" + mount "$_target" "$_mnt" -t "$_fstype" -o defaults || mount_failure "$_target" "" "$_fstype" + _mounted=$_mnt + fi + + # For user configured target, use $SAVE_PATH as the dump path within the target + if [[ ! -d "$_mnt/$SAVE_PATH" ]]; then + perror_exit "Dump path \"$_mnt/$SAVE_PATH\" does not exist in dump target \"$_target\"" + fi + + check_size fs "$_target" + + # Unmount it early, if function is interrupted and didn't reach here, the shell trap will clear it up anyway + if [[ -n $_mounted ]]; then + umount -f -- "$_mounted" + fi +} + +# $1: core_collector config value +verify_core_collector() +{ + local _cmd="${1%% *}" + local _params="${1#* }" + + if [[ $_cmd != "makedumpfile" ]]; then + if is_raw_dump_target; then + dwarn "Warning: specifying a non-makedumpfile core collector, you will have to recover the vmcore manually." + fi + return + fi + + if is_ssh_dump_target || is_raw_dump_target; then + if ! strstr "$_params" "-F"; then + perror_exit 'The specified dump target needs makedumpfile "-F" option.' + fi + _params="$_params vmcore" + else + _params="$_params vmcore dumpfile" + fi + + # shellcheck disable=SC2086 + if ! $_cmd --check-params $_params; then + perror_exit "makedumpfile parameter check failed." + fi +} + +add_mount() +{ + local _mnt + + _mnt=$(to_mount "$@") || exit 1 + + add_dracut_mount "$_mnt" +} + +#handle the case user does not specify the dump target explicitly +handle_default_dump_target() +{ + local _target + local _mntpoint + + is_user_configured_dump_target && return + + check_save_path_fs "$SAVE_PATH" + + _save_path=$(get_bind_mount_source "$SAVE_PATH") + _target=$(get_target_from_path "$_save_path") + _mntpoint=$(get_mntpoint_from_target "$_target") + + SAVE_PATH=${_save_path##"$_mntpoint"} + add_mount "$_target" + check_size fs "$_target" +} + +# $1: function name +for_each_block_target() +{ + local dev majmin + + for dev in $(get_kdump_targets); do + [[ -b $dev ]] || continue + majmin=$(get_maj_min "$dev") + check_block_and_slaves "$1" "$majmin" && return 1 + done + + return 0 +} + +#judge if a specific device with $1 is unresettable +#return false if unresettable. +is_unresettable() +{ + local path device resettable=1 + + path="/sys/$(udevadm info --query=all --path="/sys/dev/block/$1" | awk '/^P:/ {print $2}' | sed -e 's/\(cciss[0-9]\+\/\).*/\1/g' -e 's/\/block\/.*$//')/resettable" + if [[ -f $path ]]; then + resettable="$(< "$path")" + [[ $resettable -eq 0 ]] && [[ $OVERRIDE_RESETTABLE -eq 0 ]] && { + device=$(udevadm info --query=all --path="/sys/dev/block/$1" | awk -F= '/DEVNAME/{print $2}') + derror "Error: Can not save vmcore because device $device is unresettable" + return 0 + } + fi + + return 1 +} + +#check if machine is resettable. +#return true if resettable +check_resettable() +{ + local _target _override_resettable + + _override_resettable=$(kdump_get_conf_val override_resettable) + OVERRIDE_RESETTABLE=${_override_resettable:-$OVERRIDE_RESETTABLE} + if [ "$OVERRIDE_RESETTABLE" != "0" ] && [ "$OVERRIDE_RESETTABLE" != "1" ]; then + perror_exit "override_resettable value '$OVERRIDE_RESETTABLE' is invalid" + fi + + for_each_block_target is_unresettable && return + + return 1 +} + +check_crypt() +{ + local _dev + + for _dev in $(get_kdump_targets); do + if [[ -n $(get_luks_crypt_dev "$(get_maj_min "$_dev")") ]]; then + derror "Device $_dev is encrypted." && return 1 + fi + done +} + +if ! check_resettable; then + exit 1 +fi + +if ! check_crypt; then + dwarn "Warning: Encrypted device is in dump path, which is not recommended, see kexec-kdump-howto.txt for more details." +fi + +# firstly get right SSH_KEY_LOCATION +keyfile=$(kdump_get_conf_val sshkey) +if [[ -f $keyfile ]]; then + # canonicalize the path + SSH_KEY_LOCATION=$(/usr/bin/readlink -m "$keyfile") +fi + +while read -r config_opt config_val; do + # remove inline comments after the end of a directive. + case "$config_opt" in + extra_modules) + extra_modules="$extra_modules $config_val" + ;; + ext[234] | xfs | btrfs | minix | nfs) + check_user_configured_target "$config_val" "$config_opt" + add_mount "$config_val" "$config_opt" + ;; + raw) + # checking raw disk writable + dd if="$config_val" count=1 of=/dev/null > /dev/null 2>&1 || { + perror_exit "Bad raw disk $config_val" + } + _praw=$(persistent_policy="by-id" kdump_get_persistent_dev "$config_val") + if [[ -z $_praw ]]; then + exit 1 + fi + add_dracut_arg "--device" "$_praw" + check_size raw "$config_val" + ;; + ssh) + if strstr "$config_val" "@"; then + mkdir_save_path_ssh "$config_val" + check_size ssh "$config_val" + add_dracut_sshkey "$SSH_KEY_LOCATION" + else + perror_exit "Bad ssh dump target $config_val" + fi + ;; + core_collector) + verify_core_collector "$config_val" + ;; + dracut_args) + while read -r dracut_arg; do + add_dracut_arg "$dracut_arg" + done <<< "$(echo "$config_val" | xargs -n 1 echo)" + ;; + *) ;; + + esac +done <<< "$(kdump_read_conf)" + +handle_default_dump_target + +if ! have_compression_in_dracut_args; then + # Here zstd is set as the default compression method. If squash module + # is available for dracut, libzstd will be used by mksquashfs. If + # squash module is unavailable, command zstd will be used instead. + if is_squash_available || is_zstd_command_available; then + add_dracut_arg "--compress" "zstd" + fi +fi + +if [[ -n $extra_modules ]]; then + add_dracut_arg "--add-drivers" "$extra_modules" +fi + +# TODO: The below check is not needed anymore with the introduction of +# 'zz-fadumpinit' module, that isolates fadump's capture kernel initrd, +# but still sysroot.mount unit gets generated based on 'root=' kernel +# parameter available in fadump case. So, find a way to fix that first +# before removing this check. +if ! is_fadump_capable; then + # The 2nd rootfs mount stays behind the normal dump target mount, + # so it doesn't affect the logic of check_dump_fs_modified(). + is_dump_to_rootfs && add_mount "$(to_dev_name "$(get_root_fs_device)")" + + add_dracut_arg "--no-hostonly-default-device" +fi + +# This is RHEL-only to work around nvme problem, then real fix should go to dracut +if [[ -d /sys/module/nvme ]]; then + add_dracut_arg "--add-drivers" "nvme" +fi + +dracut "${dracut_args[@]}" "$@" + +_rc=$? +sync +exit $_rc diff --git a/SOURCES/mkdumprd.8 b/SOURCES/mkdumprd.8 new file mode 100644 index 0000000..2ac3d5a --- /dev/null +++ b/SOURCES/mkdumprd.8 @@ -0,0 +1,39 @@ +.TH MKDUMRD 8 "Fri Feb 9 2007" +.SH NAME +mkdumprd \- creates initial ramdisk images for kdump crash recovery +.SH SYNOPSIS +\fBmkdumprd\fR [OPTION] + +.SH DESCRIPTION +\fBmkdumprd\fR creates an initial ram file system for use in conjunction with +the booting of a kernel within the kdump framework for crash recovery. +\fBmkdumprds\fR purpose is to create an initial ram filesystem capable of copying +the crashed systems vmcore image to a location specified in \fI/etc/kdump.conf + +\fBmkdumprd\fR interrogates the running system to understand what modules need to +be loaded in the initramfs (based on configuration retrieved from +\fI/etc/kdump.conf)\fR + +\fBmkdumprd\fR add a new \fBdracut\fR module 99kdumpbase and use \fBdracut\fR +utility to generate the initramfs. When generating a kdump initramfs, \fBmkdumprd\fR +will determine how much disk space is available, if the dump target's available +space is not greater than the total system memory, \fBmkdumprd\fR will print a +warning to remind that there might not be enough space to save a vmcore. The +warning covers extreme scenarios such as the slab explodes with non-zero data or +a full vmcore, etc. Therefore, need to prevent users from having minimum disk +space for crash dump. + +\fBmkdumprd\fR was not intended for casual use outside of the service +initialization script for the kdump utility, and should not be run manually. If +you require a custom kdump initramfs image, it is suggested that you use the +kdump service infrastructure to create one, and then manually unpack, modify and +repack the image. + + +.SH OPTIONS +.TP +All options here are passed to dracut directly, please refer \fBdracut\fR docs +for the info. + +.SH "SEE ALSO" +.BR dracut (8) diff --git a/SOURCES/mkfadumprd b/SOURCES/mkfadumprd new file mode 100644 index 0000000..86dfcee --- /dev/null +++ b/SOURCES/mkfadumprd @@ -0,0 +1,74 @@ +#!/bin/bash --norc +# Generate an initramfs image that isolates dump capture capability within +# the default initramfs using zz-fadumpinit dracut module. + +if [[ -f /etc/sysconfig/kdump ]]; then + . /etc/sysconfig/kdump +fi + +[[ $dracutbasedir ]] || dracutbasedir=/usr/lib/dracut +. $dracutbasedir/dracut-functions.sh +. /lib/kdump/kdump-lib.sh +. /lib/kdump/kdump-logger.sh + +#initiate the kdump logger +if ! dlog_init; then + echo "mkfadumprd: failed to initiate the kdump logger." + exit 1 +fi + +MKFADUMPRD_TMPDIR="$(mktemp -d -t mkfadumprd.XXXXXX)" +[ -d "$MKFADUMPRD_TMPDIR" ] || perror_exit "mkfadumprd: mktemp -d -t mkfadumprd.XXXXXX failed." +trap ' + ret=$?; + [[ -d $MKFADUMPRD_TMPDIR ]] && rm --one-file-system -rf -- "$MKFADUMPRD_TMPDIR"; + exit $ret; + ' EXIT + +# clean up after ourselves no matter how we die. +trap 'exit 1;' SIGINT + +MKDUMPRD="/sbin/mkdumprd -f" +# Default boot initramfs to be rebuilt +REBUILD_INITRD="$1" && shift +TARGET_INITRD="$1" && shift +FADUMP_INITRD="$MKFADUMPRD_TMPDIR/fadump.img" + +### First build an initramfs with dump capture capability +# this file tells the initrd is fadump enabled +touch "$MKFADUMPRD_TMPDIR/fadump.initramfs" +ddebug "rebuild fadump initrd: $FADUMP_INITRD $DEFAULT_INITRD $KDUMP_KERNELVER" +if ! $MKDUMPRD "$FADUMP_INITRD" -i "$MKFADUMPRD_TMPDIR/fadump.initramfs" /etc/fadump.initramfs; then + perror_exit "mkfadumprd: failed to build image with dump capture support" +fi + +### Unpack the initramfs having dump capture capability +mkdir -p "$MKFADUMPRD_TMPDIR/fadumproot" +if ! (pushd "$MKFADUMPRD_TMPDIR/fadumproot" > /dev/null && lsinitrd --unpack "$FADUMP_INITRD" && + popd > /dev/null); then + derror "mkfadumprd: failed to unpack '$MKFADUMPRD_TMPDIR'" + exit 1 +fi + +### Pack it into the normal boot initramfs with zz-fadumpinit module +_dracut_isolate_args=( + --rebuild "$REBUILD_INITRD" --add zz-fadumpinit + -i "$MKFADUMPRD_TMPDIR/fadumproot" /fadumproot + -i "$MKFADUMPRD_TMPDIR/fadumproot/usr/lib/dracut/hostonly-kernel-modules.txt" + /usr/lib/dracut/fadump-kernel-modules.txt +) + +if is_squash_available; then + _dracut_isolate_args+=(--add squash) +fi + +# Same as setting zstd in mkdumprd +if ! have_compression_in_dracut_args; then + if is_squash_available || is_zstd_command_available; then + _dracut_isolate_args+=(--compress zstd) + fi +fi + +if ! dracut --force --quiet "${_dracut_isolate_args[@]}" "$@" "$TARGET_INITRD"; then + perror_exit "mkfadumprd: failed to setup '$TARGET_INITRD' with dump capture capability" +fi diff --git a/SOURCES/supported-kdump-targets.txt b/SOURCES/supported-kdump-targets.txt new file mode 100644 index 0000000..640fabc --- /dev/null +++ b/SOURCES/supported-kdump-targets.txt @@ -0,0 +1,119 @@ +Supported Kdump Targets + +This document try to list all supported kdump targets, and those supported +or unknown/tech-preview targets, this can help users to decide whether a dump +solution is available. + +Dump Target support status +========================== +This section tries to come up with some kind of guidelines in terms of +what dump targets are supported/not supported. Whatever is listed here +is not binding in any manner. It is just sharing of current understanding +and if something is not right, this section needs to be edited. + +Following are 3 lists. First one contains supported targets. These are +generic configurations which should work and some configuration most +likely has worked in testing. Second list is known unsupported targets. +These targets we know either don't work or we don't support. And third +list is unknown/tech-preview. We either don't yet know the status of kdump +on these targets or these are under tech-preview. + +Note, these lists are not set in stone and can be changed at any point of +time. Also these lists might not be complete. We will add/remove items to +it as we get more testing information. Also, there are many corner cases +which can't possibly be listed. For example in general we might be +supporting software iscsi but there might be some configurations of it +which don't work. + +So if any target is listed in supported section, it does not mean it works +in all possible configurations. It just means that in common configurations +it should work but there can be issues with particular configurations which +are not supported. As we come to know of particular issues, we will keep on +updating lists accordingly. + + +Supported Dump targets +---------------------- +storage: + LVM volume (no thinp) + FC disks (qla2xxx, lpfc, bnx2fc, bfa) + software initiator based iSCSI + software RAID (mdraid) + hardware RAID (smartpqi, hpsa, megaraid, mpt3sas, aacraid, mpi3mr) + SCSI/SATA disks + iSCSI HBA (all offload) + hardware FCoE (qla2xxx, lpfc) + software FCoE (bnx2fc) (Extra configuration required, + please read "Note on FCoE" section below) + +network: + Hardware using kernel modules: (igb, ixgbe, ice, i40e, e1000e, igc, + tg3, bnx2x, bnxt_en, qede, cxgb4, be2net, enic, sfc, mlx4_en, + mlx5_core, r8169, atlantic, nfp, ionic; nicvf (aarch64 only)) + protocol: ipv4 + bonding + vlan + bridge + vlan tagged bonding + bridge over bond/vlan + +hypervisor: + kvm + xen (Supported in select configurations only) + +filesystem: + ext[234] + xfs + nfs + +firmware: + BIOS + UEFI + +hypervisor: + VMWare ESXi 4.x 5.x would not be tested/supported any more. + only support ESXi 6.6, 6.7, 7.0 + Hyper-V 2012 R2 (RHEL Gen1 UP Guest only), later version will + also be tested/supported + +Unsupported Dump targets +------------------------ +storage: + BIOS RAID + Thin provisioning volume + Software iSCSI with iBFT (bnx2i, cxgb3i, cxgb4i) + Software iSCSI with hybrid (be2iscsi) + FCoE + legacy IDE + glusterfs + gfs2/clvm/halvm + +network: + hardware using kernel modules: (sfc SRIOV, cxgb4vf, pch_gbe) + protocol: ipv6 + wireless + Infiniband (IB) + vlan over bridge/team + +filesystem: + btrfs + +Unknown/tech-preview +-------------------- +storage: + PCI Express based SSDs + +hypervisor: + Hyper-V 2008 + Hyper-V 2012 + + +Note on FCoE +===================== +If you are trying to dump to a software FCoE target, you may encounter OOM +issue, because some software FCoE requires more memory to work. In such case, +you may need to increase the kdump reserved memory size in "crashkernel=" +kernel parameter. + +For hardware FCoE, kdump should work naturally as firmware will do the +initialization job. The capture kernel and kdump tools will run just fine. diff --git a/SPECS/kexec-tools.spec b/SPECS/kexec-tools.spec new file mode 100644 index 0000000..1d9c8c2 --- /dev/null +++ b/SPECS/kexec-tools.spec @@ -0,0 +1,2402 @@ +%global eppic_ver e8844d3793471163ae4a56d8f95897be9e5bd554 +%global eppic_shortver %(c=%{eppic_ver}; echo ${c:0:7}) +%global mkdf_ver 1.7.0 +%global mkdf_shortver %(c=%{mkdf_ver}; echo ${c:0:7}) + +Name: kexec-tools +Version: 2.0.23 +Release: 9_1%{?dist} +License: GPLv2 +Summary: The kexec/kdump userspace component + +Source0: http://kernel.org/pub/linux/utils/kernel/kexec/%{name}-%{version}.tar.xz +Source1: kdumpctl +Source2: kdump.sysconfig +Source3: kdump.sysconfig.x86_64 +Source4: kdump.sysconfig.i386 +Source5: kdump.sysconfig.ppc64 +Source7: mkdumprd +Source8: kdump.conf +Source9: https://github.com/makedumpfile/makedumpfile/archive/%{mkdf_ver}/makedumpfile-%{mkdf_shortver}.tar.gz +Source10: kexec-kdump-howto.txt +Source11: fadump-howto.txt +Source12: mkdumprd.8 +Source13: 98-kexec.rules +Source14: 98-kexec.rules.ppc64 +Source15: kdump.conf.5 +Source16: kdump.service +Source18: kdump.sysconfig.s390x +Source19: https://github.com/lucchouina/eppic/archive/%{eppic_ver}/eppic-%{eppic_shortver}.tar.gz +Source20: kdump-lib.sh +Source21: kdump-in-cluster-environment.txt +Source22: kdump-dep-generator.sh +Source23: kdump-lib-initramfs.sh +Source24: kdump.sysconfig.ppc64le +Source25: kdumpctl.8 +Source26: live-image-kdump-howto.txt +Source27: early-kdump-howto.txt +Source28: kdump-udev-throttler +Source29: kdump.sysconfig.aarch64 +Source30: 60-kdump.install +Source31: kdump-logger.sh +Source32: mkfadumprd +Source33: 92-crashkernel.install +Source34: crashkernel-howto.txt +Source35: kdump-migrate-action.sh +Source36: kdump-restart.sh +Source37: supported-kdump-targets.txt + +####################################### +# These are sources for mkdumpramfs +# Which is currently in development +####################################### +Source100: dracut-kdump.sh +Source101: dracut-module-setup.sh +Source102: dracut-monitor_dd_progress +Source104: dracut-kdump-emergency.service +Source106: dracut-kdump-capture.service +Source107: dracut-kdump-emergency.target +Source108: dracut-early-kdump.sh +Source109: dracut-early-kdump-module-setup.sh + +Source200: dracut-fadump-init-fadump.sh +Source201: dracut-fadump-module-setup.sh + +%ifarch ppc64 ppc64le +Requires(post): servicelog +Recommends: keyutils +%endif +Requires(pre): coreutils sed zlib +Requires: dracut >= 050 +Requires: dracut-network >= 050 +Requires: dracut-squash >= 050 +Requires: ethtool +Recommends: zstd +Recommends: grubby +Recommends: hostname +BuildRequires: make +BuildRequires: zlib-devel elfutils-devel glib2-devel bzip2-devel ncurses-devel bison flex lzo-devel snappy-devel libzstd-devel +BuildRequires: pkgconfig intltool gettext +BuildRequires: systemd-rpm-macros +BuildRequires: automake autoconf libtool +%ifarch %{ix86} x86_64 ppc64 ppc s390x ppc64le +Obsoletes: diskdumputils netdump kexec-tools-eppic +%endif + +%ifnarch s390x +Requires: systemd-udev%{?_isa} +%endif + +#START INSERT + +# +# Patches 0 through 100 are meant for x86 kexec-tools enablement +# + +# +# Patches 101 through 200 are meant for x86_64 kexec-tools enablement +# + +# +# Patches 301 through 400 are meant for ppc64 kexec-tools enablement +# + +# +# Patches 401 through 500 are meant for s390 kexec-tools enablement +# +# +# Patches 501 through 600 are meant for ARM kexec-tools enablement +# + +# +# Patches 601 onward are generic patches +# +Patch601: ./kexec-tools-2.0.22-01-s390_handle_R_390_PLT32DBL_reloc_entries_in_machine_apply_elf_rel_.patch +Patch602: ./kexec-tools-2.0.23-makedumpfile-sadump-kaslr-fix-failure-of-calculating-kaslr_.patch + +%description +kexec-tools provides /sbin/kexec binary that facilitates a new +kernel to boot using the kernel's kexec feature either on a +normal or a panic reboot. This package contains the /sbin/kexec +binary and ancillary utilities that together form the userspace +component of the kernel's kexec feature. + +%prep +%setup -q + +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 + +%build +autoreconf +%configure \ +%ifarch ppc64 + --host=powerpc64-redhat-linux-gnu \ + --build=powerpc64-redhat-linux-gnu \ +%endif +%ifarch ppc64le + --host=powerpc64le-redhat-linux-gnu \ + --build=powerpc64le-redhat-linux-gnu \ +%endif + --sbindir=/usr/sbin +rm -f kexec-tools.spec.in +# setup the docs +cp %{SOURCE10} . +cp %{SOURCE11} . +cp %{SOURCE21} . +cp %{SOURCE26} . +cp %{SOURCE27} . +cp %{SOURCE34} . +cp %{SOURCE37} . + +make +%ifarch %{ix86} x86_64 ppc64 s390x ppc64le aarch64 +make -C eppic-%{eppic_ver}/libeppic +make -C makedumpfile-%{mkdf_ver} LINKTYPE=dynamic USELZO=on USESNAPPY=on USEZSTD=on +make -C makedumpfile-%{mkdf_ver} LDFLAGS="$LDFLAGS -I../eppic-%{eppic_ver}/libeppic -L../eppic-%{eppic_ver}/libeppic" eppic_makedumpfile.so +%endif + +%install +mkdir -p -m755 $RPM_BUILD_ROOT/usr/sbin +mkdir -p -m755 $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig +mkdir -p -m755 $RPM_BUILD_ROOT%{_sysconfdir}/kdump +mkdir -p -m755 $RPM_BUILD_ROOT%{_sysconfdir}/kdump/pre.d +mkdir -p -m755 $RPM_BUILD_ROOT%{_sysconfdir}/kdump/post.d +mkdir -p -m755 $RPM_BUILD_ROOT%{_localstatedir}/crash +mkdir -p -m755 $RPM_BUILD_ROOT%{_mandir}/man8/ +mkdir -p -m755 $RPM_BUILD_ROOT%{_mandir}/man5/ +mkdir -p -m755 $RPM_BUILD_ROOT%{_docdir} +mkdir -p -m755 $RPM_BUILD_ROOT%{_datadir}/kdump +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%{_sharedstatedir}/kdump +install -m 755 %{SOURCE1} $RPM_BUILD_ROOT%{_bindir}/kdumpctl + +install -m 755 build/sbin/kexec $RPM_BUILD_ROOT/usr/sbin/kexec +install -m 755 build/sbin/vmcore-dmesg $RPM_BUILD_ROOT/usr/sbin/vmcore-dmesg +install -m 644 build/man/man8/kexec.8 $RPM_BUILD_ROOT%{_mandir}/man8/ +install -m 644 build/man/man8/vmcore-dmesg.8 $RPM_BUILD_ROOT%{_mandir}/man8/ + +SYSCONFIG=$RPM_SOURCE_DIR/kdump.sysconfig.%{_target_cpu} +[ -f $SYSCONFIG ] || SYSCONFIG=$RPM_SOURCE_DIR/kdump.sysconfig.%{_arch} +[ -f $SYSCONFIG ] || SYSCONFIG=$RPM_SOURCE_DIR/kdump.sysconfig +install -m 644 $SYSCONFIG $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/kdump + +install -m 755 %{SOURCE7} $RPM_BUILD_ROOT/usr/sbin/mkdumprd +install -m 755 %{SOURCE32} $RPM_BUILD_ROOT/usr/sbin/mkfadumprd +install -m 644 %{SOURCE8} $RPM_BUILD_ROOT%{_sysconfdir}/kdump.conf +install -m 644 kexec/kexec.8 $RPM_BUILD_ROOT%{_mandir}/man8/kexec.8 +install -m 644 %{SOURCE12} $RPM_BUILD_ROOT%{_mandir}/man8/mkdumprd.8 +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 +%ifarch ppc64 ppc64le +install -m 755 %{SOURCE35} $RPM_BUILD_ROOT%{_prefix}/lib/kdump/kdump-migrate-action.sh +install -m 755 %{SOURCE36} $RPM_BUILD_ROOT%{_prefix}/lib/kdump/kdump-restart.sh +%endif +%ifnarch s390x +install -m 755 %{SOURCE28} $RPM_BUILD_ROOT%{_udevrulesdir}/../kdump-udev-throttler +%endif +%ifnarch s390x ppc64 ppc64le +# For s390x the ELF header is created in the kdump kernel and therefore kexec +# udev rules are not required +install -m 644 %{SOURCE13} $RPM_BUILD_ROOT%{_udevrulesdir}/98-kexec.rules +%endif +%ifarch ppc64 ppc64le +install -m 644 %{SOURCE14} $RPM_BUILD_ROOT%{_udevrulesdir}/98-kexec.rules +%endif +install -m 644 %{SOURCE15} $RPM_BUILD_ROOT%{_mandir}/man5/kdump.conf.5 +install -m 644 %{SOURCE16} $RPM_BUILD_ROOT%{_unitdir}/kdump.service +install -m 755 -D %{SOURCE22} $RPM_BUILD_ROOT%{_prefix}/lib/systemd/system-generators/kdump-dep-generator.sh +install -m 755 -D %{SOURCE30} $RPM_BUILD_ROOT%{_prefix}/lib/kernel/install.d/60-kdump.install +install -m 755 -D %{SOURCE33} $RPM_BUILD_ROOT%{_prefix}/lib/kernel/install.d/92-crashkernel.install + +%ifarch %{ix86} x86_64 ppc64 s390x ppc64le aarch64 +install -m 755 makedumpfile-%{mkdf_ver}/makedumpfile $RPM_BUILD_ROOT/usr/sbin/makedumpfile +install -m 644 makedumpfile-%{mkdf_ver}/makedumpfile.8.gz $RPM_BUILD_ROOT/%{_mandir}/man8/makedumpfile.8.gz +install -m 644 makedumpfile-%{mkdf_ver}/makedumpfile.conf.5.gz $RPM_BUILD_ROOT/%{_mandir}/man5/makedumpfile.conf.5.gz +install -m 644 makedumpfile-%{mkdf_ver}/makedumpfile.conf $RPM_BUILD_ROOT/%{_sysconfdir}/makedumpfile.conf.sample +install -m 755 makedumpfile-%{mkdf_ver}/eppic_makedumpfile.so $RPM_BUILD_ROOT/%{_libdir}/eppic_makedumpfile.so +mkdir -p $RPM_BUILD_ROOT/usr/share/makedumpfile/eppic_scripts/ +install -m 644 makedumpfile-%{mkdf_ver}/eppic_scripts/* $RPM_BUILD_ROOT/usr/share/makedumpfile/eppic_scripts/ +%endif + +%define remove_dracut_prefix() %(echo -n %1|sed 's/.*dracut-//g') +%define remove_dracut_early_kdump_prefix() %(echo -n %1|sed 's/.*dracut-early-kdump-//g') +%define remove_dracut_fadump_prefix() %(echo -n %1|sed 's/.*dracut-fadump-//g') + +# deal with dracut modules +mkdir -p -m755 $RPM_BUILD_ROOT/etc/kdump-adv-conf/kdump_dracut_modules/99kdumpbase +cp %{SOURCE100} $RPM_BUILD_ROOT/etc/kdump-adv-conf/kdump_dracut_modules/99kdumpbase/%{remove_dracut_prefix %{SOURCE100}} +cp %{SOURCE101} $RPM_BUILD_ROOT/etc/kdump-adv-conf/kdump_dracut_modules/99kdumpbase/%{remove_dracut_prefix %{SOURCE101}} +cp %{SOURCE102} $RPM_BUILD_ROOT/etc/kdump-adv-conf/kdump_dracut_modules/99kdumpbase/%{remove_dracut_prefix %{SOURCE102}} +cp %{SOURCE104} $RPM_BUILD_ROOT/etc/kdump-adv-conf/kdump_dracut_modules/99kdumpbase/%{remove_dracut_prefix %{SOURCE104}} +cp %{SOURCE106} $RPM_BUILD_ROOT/etc/kdump-adv-conf/kdump_dracut_modules/99kdumpbase/%{remove_dracut_prefix %{SOURCE106}} +cp %{SOURCE107} $RPM_BUILD_ROOT/etc/kdump-adv-conf/kdump_dracut_modules/99kdumpbase/%{remove_dracut_prefix %{SOURCE107}} +chmod 755 $RPM_BUILD_ROOT/etc/kdump-adv-conf/kdump_dracut_modules/99kdumpbase/%{remove_dracut_prefix %{SOURCE100}} +chmod 755 $RPM_BUILD_ROOT/etc/kdump-adv-conf/kdump_dracut_modules/99kdumpbase/%{remove_dracut_prefix %{SOURCE101}} +mkdir -p -m755 $RPM_BUILD_ROOT/etc/kdump-adv-conf/kdump_dracut_modules/99earlykdump +cp %{SOURCE108} $RPM_BUILD_ROOT/etc/kdump-adv-conf/kdump_dracut_modules/99earlykdump/%{remove_dracut_prefix %{SOURCE108}} +cp %{SOURCE109} $RPM_BUILD_ROOT/etc/kdump-adv-conf/kdump_dracut_modules/99earlykdump/%{remove_dracut_early_kdump_prefix %{SOURCE109}} +chmod 755 $RPM_BUILD_ROOT/etc/kdump-adv-conf/kdump_dracut_modules/99earlykdump/%{remove_dracut_prefix %{SOURCE108}} +chmod 755 $RPM_BUILD_ROOT/etc/kdump-adv-conf/kdump_dracut_modules/99earlykdump/%{remove_dracut_early_kdump_prefix %{SOURCE109}} +%ifarch ppc64 ppc64le +mkdir -p -m755 $RPM_BUILD_ROOT/etc/kdump-adv-conf/kdump_dracut_modules/99zz-fadumpinit +cp %{SOURCE200} $RPM_BUILD_ROOT/etc/kdump-adv-conf/kdump_dracut_modules/99zz-fadumpinit/%{remove_dracut_fadump_prefix %{SOURCE200}} +cp %{SOURCE201} $RPM_BUILD_ROOT/etc/kdump-adv-conf/kdump_dracut_modules/99zz-fadumpinit/%{remove_dracut_fadump_prefix %{SOURCE201}} +chmod 755 $RPM_BUILD_ROOT/etc/kdump-adv-conf/kdump_dracut_modules/99zz-fadumpinit/%{remove_dracut_fadump_prefix %{SOURCE200}} +chmod 755 $RPM_BUILD_ROOT/etc/kdump-adv-conf/kdump_dracut_modules/99zz-fadumpinit/%{remove_dracut_fadump_prefix %{SOURCE201}} +%endif + + +%define dracutlibdir %{_prefix}/lib/dracut +#and move the custom dracut modules to the dracut directory +mkdir -p $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/ +mv $RPM_BUILD_ROOT/etc/kdump-adv-conf/kdump_dracut_modules/* $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/ + +%pre +# save the old default crashkernel values to /tmp/ when upgrading the package +if ! grep -qs "ostree" /proc/cmdline && [ $1 == 2 ] && grep -q get-default-crashkernel /usr/bin/kdumpctl; then + kdumpctl get-default-crashkernel kdump > /tmp/old_default_crashkernel 2>/dev/null +%ifarch ppc64 ppc64le + kdumpctl get-default-crashkernel fadump > /tmp/old_default_crashkernel_fadump 2>/dev/null +%endif +fi + +%post +# Initial installation +%systemd_post kdump.service + +touch /etc/kdump.conf + +%ifarch ppc64 ppc64le +servicelog_notify --remove --command=/usr/lib/kdump/kdump-migrate-action.sh 2>/dev/null +servicelog_notify --add --command=/usr/lib/kdump/kdump-migrate-action.sh --match='refcode="#MIGRATE" and serviceable=0' --type=EVENT --method=pairs_stdin +%endif + +# This portion of the script is temporary. Its only here +# to fix up broken boxes that require special settings +# in /etc/sysconfig/kdump. It will be removed when +# These systems are fixed. + +if [ -d /proc/bus/mckinley ] +then + # This is for HP zx1 machines + # They require machvec=dig on the kernel command line + sed -e's/\(^KDUMP_COMMANDLINE_APPEND.*\)\("$\)/\1 machvec=dig"/' \ + /etc/sysconfig/kdump > /etc/sysconfig/kdump.new + mv /etc/sysconfig/kdump.new /etc/sysconfig/kdump +elif [ -d /proc/sgi_sn ] +then + # This is for SGI SN boxes + # They require the --noio option to kexec + # since they don't support legacy io + sed -e's/\(^KEXEC_ARGS.*\)\("$\)/\1 --noio"/' \ + /etc/sysconfig/kdump > /etc/sysconfig/kdump.new + mv /etc/sysconfig/kdump.new /etc/sysconfig/kdump +fi + + +%postun +%systemd_postun_with_restart kdump.service + +%preun +%ifarch ppc64 ppc64le +servicelog_notify --remove --command=/usr/lib/kdump/kdump-migrate-action.sh +%endif +%systemd_preun kdump.service + +%triggerin -- kernel-kdump +touch %{_sysconfdir}/kdump.conf + + +%triggerpostun -- kernel kernel-xen kernel-debug kernel-PAE kernel-kdump +# List out the initrds here, strip out version nubmers +# and search for corresponding kernel installs, if a kernel +# is not found, remove the corresponding kdump initrd + + +IMGDIR=/boot +for i in `ls $IMGDIR/initramfs*kdump.img 2>/dev/null` +do + KDVER=`echo $i | sed -e's/^.*initramfs-//' -e's/kdump.*$//'` + if [ ! -e $IMGDIR/vmlinuz-$KDVER ] + then + # We have found an initrd with no corresponding kernel + # so we should be able to remove it + rm -f $i + fi +done + +%posttrans +# try to reset kernel crashkernel value to new default value when upgrading +# the package +if ! grep -qs "ostree" /proc/cmdline && [ $1 == 1 ]; then + kdumpctl reset-crashkernel-after-update + rm /tmp/old_default_crashkernel 2>/dev/null +%ifarch ppc64 ppc64le + rm /tmp/old_default_crashkernel_fadump 2>/dev/null +%endif + # dnf would complain about the exit code not being 0. To keep it happy, + # always return 0 + : +fi + + +%files +/usr/sbin/kexec +%ifarch %{ix86} x86_64 ppc64 s390x ppc64le aarch64 +/usr/sbin/makedumpfile +%endif +/usr/sbin/mkdumprd +/usr/sbin/mkfadumprd +/usr/sbin/vmcore-dmesg +%{_bindir}/* +%{_datadir}/kdump +%{_prefix}/lib/kdump +%ifarch %{ix86} x86_64 ppc64 s390x ppc64le aarch64 +%{_sysconfdir}/makedumpfile.conf.sample +%endif +%config(noreplace,missingok) %{_sysconfdir}/sysconfig/kdump +%config(noreplace,missingok) %verify(not mtime) %{_sysconfdir}/kdump.conf +%ifnarch s390x +%config %{_udevrulesdir} +%{_udevrulesdir}/../kdump-udev-throttler +%endif +%{dracutlibdir}/modules.d/* +%dir %{_localstatedir}/crash +%dir %{_sysconfdir}/kdump +%dir %{_sysconfdir}/kdump/pre.d +%dir %{_sysconfdir}/kdump/post.d +%dir %{_sharedstatedir}/kdump +%{_mandir}/man8/kdumpctl.8.gz +%{_mandir}/man8/kexec.8.gz +%ifarch %{ix86} x86_64 ppc64 s390x ppc64le aarch64 +%{_mandir}/man8/makedumpfile.8.gz +%endif +%{_mandir}/man8/mkdumprd.8.gz +%{_mandir}/man8/vmcore-dmesg.8.gz +%{_mandir}/man5/* +%{_unitdir}/kdump.service +%{_prefix}/lib/systemd/system-generators/kdump-dep-generator.sh +%{_prefix}/lib/kernel/install.d/60-kdump.install +%{_prefix}/lib/kernel/install.d/92-crashkernel.install +%doc News +%license COPYING +%doc TODO +%doc kexec-kdump-howto.txt +%doc early-kdump-howto.txt +%doc fadump-howto.txt +%doc kdump-in-cluster-environment.txt +%doc live-image-kdump-howto.txt +%doc crashkernel-howto.txt +%doc supported-kdump-targets.txt +%ifarch %{ix86} x86_64 ppc64 s390x ppc64le aarch64 +%{_libdir}/eppic_makedumpfile.so +/usr/share/makedumpfile/ +%endif + +%changelog +* Mon Mar 7 2022 Tao Liu <ltao@redhat.com> - 2.0.23-9_1 +- try to update the crashkernel in GRUB_ETC_DEFAULT after kexec-tools updates the default crashkernel value +- address the case where there are multiple values for the same kernel arg + +* Fri Feb 25 2022 Tao Liu <ltao@redhat.com> - 2.0.23-9 +- makedumpfile: sadump, kaslr: fix failure of calculating kaslr_offset + +* Mon Feb 21 2022 Tao Liu <ltao@redhat.com> - 2.0.23-8 +- update kernel crashkernel in posttrans RPM scriptlet when updating kexec-tools + +* Mon Feb 14 2022 Tao Liu <ltao@redhat.com> - 2.0.23-7 +- fix incorrect usage of _get_all_kernels_from_grubby +- fix the mistake of swapping function parameters of read_proc_environ_var + +* Wed Jan 26 2022 Tao Liu <ltao@redhat.com> - 2.0.23-6 +- Revert "Remove trace_buf_size and trace_event from the kernel bootparameters of the kdump kernel" +- fix broken kdump_get_arch_recommend_size +- remove the upper bound of 102400T for the range in default crashkernel +- fix the error of parsing the container environ variable for osbuild +- mkdumprd (RHEL-only): add nvme module by force +- Remove dropped patches +- s390: handle R_390_PLT32DBL reloc entries in machine_apply_elf_rel() +- spec: add hostname.rpm into Recommends list +- move variable FENCE_KDUMP_SEND from kdump-lib.sh to kdump-lib-initramfs.sh + +* Tue Jan 11 2022 Tao Liu <ltao@redhat.com> - 2.0.23-5 +- Set zstd as recommented for kexec-tools +- fix "kdump: Invalid kdump config option auto_reset_crashkernel" error +- use grep -s to suppress error messages about nonexistent or unreadable files + +* Thu Jan 6 2022 Tao Liu <ltao@redhat.com> - 2.0.23-4 +- Set zstd as the default compression method for kdump initrd +- kdump-lib.sh: Escape '|' for 'failure_action|default' in is_dump_to_rootfs +- dracut-early-kdump-module-setup.sh: install xargs and kdump-lib-initramfs.sh +- update crashkernel-howto +- set up kernel crashkernel for osbuild in kernel hook +- reset kernel crashkernel for the special case where the kernel is updated right after kexec-tools +- try to reset kernel crashkernel when kexec-tools updates the default crashkernel value +- introduce the auto_reset_crashkernel option to kdump.conf +- rewrite reset_crashkernel to support fadump and to used by RPM scriptlet +- fix incorrect usage of rpm-ostree to update kernel command line parameters +- add helper functions to get kernel path by kernel release and the path of current running kernel +- add helper functions to get dump mode +- add a helper function to read kernel cmdline parameter from grubby --info +- provide kdumpctl get-default-crashkernel for kdump_anaconda_addon and RPM scriptlet +- factor out kdump_get_arch_recommend_crashkernel +- update default crashkernel value +- ppc64/ppc64le: drop cpu online rule in 40-redhat.rules in kdump initramfs + +* Wed Dec 8 2021 Tao Liu <ltao@redhat.com> - 2.0.23-3 +- Update eppic to latest upstream snapshot +- Update crashkernel-howto.txt +- Remove references to systemd-sysv-convert +- kdump/ppc64: suppress the error message "Could not find a registered notification tool" from servicelog_notify +- fadump: improve fadump-howto.txt about remote dump target setup +- Don't exit 1 from 92-crashkernel.install if zipl is absent (#1993505) +- Document/kexec-kdump-howto.txt: improve notes for kdump_pre and kdump_post scripts + +* Fri Dec 3 2021 Tao Liu <ltao@redhat.com> - 2.0.23-2 +- kdump/ppc64: migration action registration clean up +- kdump/ppc64: rebuild initramfs image after migration +- Update supported-kdump-targets.txt +- add keyutils as a weak dependency for POWER +- kdumpctl: enable secure boot on ppc64le LPARs +- kdump.sysconfig: make kexec_file_load as default option on arm64 +- kdump.sysconfig: make kexec_file_load as default option on ppc64le + +* Thu Nov 11 2021 Tao Liu <ltao@redhat.com> - 2.0.23-1 +- Enable zstd compression for makedumpfile in kexec-tools.spec +- Update makedumpfile to 1.7.0 + +* Wed Nov 10 2021 Tao Liu <ltao@redhat.com> - 2.0.22-16 +- fix broken extra_bins when installing multiple binaries +- mkdumprd: drop mountaddr/mountproto nfs mount options +- 92-crashkernel.install: fix exit code +- dracut-early-kdump.sh: make it POSIX compatible +- Add header comment for POSIX compliant scripts +- mkdumprd: allow using dash +- kdump-logger.sh: make it POSIX compatible +- kdump-lib.sh: reformat with shfmt +- kdump-lib.sh: declare and assign separately +- kdump-lib.sh: fix variable quoting issue +- Remove trace_buf_size and trace_event from the kernel bootparameters of the kdump kernel +- kdump-lib.sh: fix a few ambiguous or redundant code +- kdump-lib.sh: fix arithmetic operation syntax +- kdump-lib.sh: remove useless echo and cat +- kdump-lib.sh: rework nmcli related functions +- kdump-lib.sh: replace '[ ]' with '[[ ]]' and get rid of legacy `` +- kdump-lib-initramfs.sh: make it POSIX compatible +- dracut-kdump.sh: reformat with shfmt +- dracut-kdump.sh: make it POSIX compatible +- dracut-kdump.sh: POSIX doesn't support pipefail +- dracut-kdump.sh: Use stat instead of ls to get vmcore size +- dracut-kdump.sh: simplify dump_ssh +- dracut-kdump.sh: remove add_dump_code +- dracut-kdump.sh: don't put KDUMP_SCRIPT_DIR in PATH +- kdump-lib-initramfs.sh: move dump related functions to kdump.sh +- Merge kdump-error-handler.sh into kdump.sh +- kdump-lib-initramfs.sh: prepare to be a POSIX compatible lib +- bash scripts: reformat with shfmt +- bash scripts: declare and assign separately +- bash scripts: fix redundant exit code check +- bash scripts: fix variable quoting issue +- Don't use die in dracut-module-setup.sh +- bash scripts: replace '[ ]' with '[[ ]]' for bash scripts +- mkdumprd: display the absolute path of dump location in the check_user_configured_target() +- Don't iterate the whole /sys/devices just to find drm device +- mkdumprd: prompt the user to install nfs-utils when mounting NFS fs failed +- bash scripts: use $(...) notation instead of legacy `...` +- bash scripts: always use "read -r" +- bash scripts: get rid of unnecessary sed calls +- bash scripts: get rid of expr and let +- bash scripts: remove useless cat +- dracut-module-setup.sh: remove surrounding $() for subshell +- dracut-module-setup.sh: make iscsi check fail early if cd failed +- dracut-module-setup.sh: fix a loop over ls issue +- dracut-module-setup.sh: fix a ambiguous variable reference +- dracut-module-setup.sh: use "*" to expend array as string +- dracut-module-setup.sh: fix _bondoptions wrong references +- dracut-module-setup.sh: remove an unused variable +- dracut-module-setup.sh: rework kdump_get_ip_route_field +- mkfadumprd: make _dracut_isolate_args an array +- mkdumprd: use array to store ssh arguments in mkdir_save_path_ssh +- mkdumprd: remove an awk call in get_fs_size +- mkdumprd: fix multiple issues with get_ssh_size +- mkdumprd: remove some redundant echo +- mkdumprd: make dracut_args an array again +- mkdumprd: use kdump_get_conf_val to read config values +- kdumpctl: refine grep usage +- kdumpctl: fix fragile loops over find output +- kdumpctl: use kdump_get_conf_val to read config values +- kdump-lib.sh: use kdump_get_conf_val to read config values +- kdump-lib.sh: add a config value retrive helper +- kdump-lib.sh: add a config format and read helper +- Add a .editorconfig file +- Remove hard requirement on grubby + +* Wed Sep 8 2021 Tao Liu <ltao@redhat.com> - 2.0.22-15 +- Add file supported-kdump-targets.txt to kexec-tools + +* Mon Aug 09 2021 Mohan Boddu <mboddu@redhat.com> - 2.0.22-14 +- Rebuilt for IMA sigs, glibc 2.34, aarch64 flags + Related: rhbz#1991688 + +* Mon Aug 9 2021 Tao Liu <ltao@redhat.com> - 2.0.22-13 +- Clear old crashkernl=auto in comment and doc + +* Mon Aug 2 2021 Tao Liu <ltao@redhat.com> - 2.0.22-12 +- kdumpctl: fix a typo +- kdump_get_arch_recommend_size uses crashkernel.default + +* Mon Jul 26 2021 Tao Liu <ltao@redhat.com> - 2.0.22-11 +- Make `dump_to_rootfs` wait for 90s for real +- Check the existence of /sys/bus/ccwgroup/devices/*/online beforehand +- kdump.sysconfig.s390: Remove "prot_virt" from kdump kernel cmdline + +* Tue Jul 20 2021 Tao Liu <ltao@redhat.com> - 2.0.22-10 +- fadump-init: clean up mount points properly +- fadump: kdumpctl should check the modules used by the fadump initramfs +- fadump: isolate fadump initramfs image within the default one +- Cleanup dead systemd services before start sysroot.mount +- Revert "Revert "x86_64: enable the kexec file load by default"" + +* Tue Jun 29 2021 Tao Liu <ltao@redhat.com> - 2.0.22-9 +- Add a crashkernel-howto.txt doc +- Add a new hook: 92-crashkernel.install +- kdumpctl: Add kdumpctl reset-crashkernel +- Revert "kdump-lib.sh: Remove is_atomic" +- fix format issue in find_online_znet_device +- check the existence of /sys/bus/ccwgroup/devices before trying to find online network device + +* Tue Jun 29 2021 Tao Liu <ltao@redhat.com> - 2.0.22-8 +- check for invalid physical address of /proc/kcore when making ELF dumpfile +- Increase SECTION_MAP_LAST_BIT to 5 +- kdumpctl: fix check_config error when kdump.conf is empty +- kdump-lib.sh: fix a warning in prepare_kdump_bootinfo() + +* Wed Jun 23 2021 Tao Liu <ltao@redhat.com> - 2.0.22-7 +- Write to `/var/lib/kdump` if $KDUMP_BOOTDIR not writable + +* Wed Jun 16 2021 Tao Liu <ltao@redhat.com> - 2.0.22-6 +- Add gating.yaml to RHEL-9 kexec-tools +- Iterate /sys/bus/ccwgroup/devices to tell if we should set up rd.znet + +* Mon Jun 7 2021 Tao Liu <ltao@redhat.com> - 2.0.22-5 +- Use a customized emergency shell +- Remove the kdump error handler isolation wrapper +- Don's try to restart dracut-initqueue if it's already there + +* Thu May 27 2021 Tao Liu <ltao@redhat.com> - 2.0.22-4 +- kdump-lib.sh: fix the case if no enough total RAM for kdump in get_recommend_size() + +* Mon May 24 2021 Tao Liu <ltao@redhat.com> - 2.0.22-3 +- kdumpctl: Add kdumpctl estimate +- mkdumprd: make use of the new get_luks_crypt_dev helper +- kdump-lib.sh: introduce a helper to get all crypt dev used by kdump +- kdump-lib.sh: introduce a helper to get underlying crypt device +- Revert "Always set vm.zone_reclaim_mode = 3 in kdump kernel" + +* Fri May 14 2021 Tao Liu <ltao@redhat.com> - 2.0.22-2 +- Stop reloading kdump service on CPU hotplug event for FADump +- Make dracut-squash required for kexec-tools +- Fix incorrect file permissions of vmcore-dmesg-incomplete.txt +- Disable CMA in kdump 2nd kernel +- update makedumpfile to v1.6.9 +- (upstream/c9s) Warn the user if network scripts are used +- Set up bond cmdline by "nmcli --get-values" +- Set up dns cmdline by parsing "nmcli --get-values" +- Set up s390 znet cmdline by "nmcli --get-values" +- Add helper to get nmcli connection show cmd by ifname +- Add helper to get nmcli connection apath by ifname +- Add helper to get value by field using "nmcli --get-values" + +* Thu May 13 2021 Tao Liu <ltao@redhat.com> - 2.0.22-1 +- Update to kexec-tools 2.0.22 +- rd.route should use the name from kdump_setup_ifname +- get kdump ifname once in kdump_install_net +- Implement IP netmask calculation to replace "ipcalc -m" +- kdump-lib.sh: introduce functions to return recommened mem size + +* Sun Apr 25 2021 Tao Liu <ltao@redhat.com> - 2.0.21-7 +- Fix incorrect vmcore permissions when dumped through ssh +- Fix incorrect permissions on kdump dmesg file + +* Fri Apr 16 2021 Mohan Boddu <mboddu@redhat.com> - 2.0.21-6 +- Rebuilt for RHEL 9 BETA on Apr 15th 2021. Related: rhbz#1947937 + +* Tue Jan 26 2021 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.21-5 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild + +* Fri Jan 22 2021 Kairui Song <kasong@redhat.com> - 2.0.21-4 +- dracut-module-setup.sh: enable ForwardToConsole=yes in fadump mode +- kdump.conf: add ipv6 example for nfs and ssh dump +- fix kdump failure of saving vmcore with the scp + ipv6 method + +* Wed Jan 20 2021 Kairui Song <kasong@redhat.com> - 2.0.21-3 +- module-setup.sh: don't polute the namespace unnecessarily +- module-setup.sh: don't source $dracutfunctions +- logger: source the logger file individually +- Fix dump_fs mount point detection and fallback mount +- Revert "Don's try to restart dracut-initqueue if it's already failed" +- Revert "Append both nofail and x-systemd.before to kdump mount target" +- Doc: Improve the kdump sysconfig document +- kdump.conf: Update doc about core_collector for ssh target +- Merge #4 `Make dracut-squash a weak dep` +- Fix a date error in the change log + +* Fri Jan 08 2021 Kairui Song <kasong@redhat.com> - 2.0.21-2 +- makedumpfile: make use of 'uts_namespace.name' offset in VMCOREINFO +- kdumpctl: fix a variable expansion in check_fence_kdump_config() +- Add BuildRequires: make +- Save the final failure information to log file if saving vmcore failed + +* Wed Dec 23 2020 Kairui Song <kasong@redhat.com> - 2.0.21-1 +- makedumpfile: printk: use committed/finalized state values +- makedumpfile: printk: add support for lockless ringbuffer +- dracut-module-setup.sh: Use systemctl call to replace ln_r +- Doc: improve mkdumprd man page +- Don's try to restart dracut-initqueue if it's already failed +- dracut-module-setup.sh: use auto6 for ipv6 + +* Mon Nov 30 2020 Kairui Song <kasong@redhat.com> - 2.0.20-21 +- Rebase makedumpfile to 1.6.8 +- fadump-howto: update about 'nocma' and 'off' options for 'fadump=' parameter +- module-setup.sh: enable vlan on team interface +- kdump-lib: Fix get_bind_mount_source to support btrfs and fstab +- Make get_mount_info work with bind mount +- Set watchdog's pretimeout to zero in kdump kernel +- kdump-lib.sh: Use a more generic helper to detect omitted dracut module +- Fix the watchdog drivers detection code +- Add a helper for detecting watchdog drivers +- Remove a redundant nfs check +- kdumpctl: split the driver detection from fs dection function + +* Thu Nov 19 2020 Kairui Song <kasong@redhat.com> - 2.0.20-20 +- selftest: Fix several test issue with Fedora 33 +- selftest: add more detailed log and fix a test failure issue +- selftest: Update test base image to Fedora 33 +- selftest: Fix qcow2 image format detect +- selftest: Always use the get_image_fmt helper +- Doc: improve the usage documentation of the logger +- Update the kdump sysconfig +- Capitalize the configuration name of log level +- Add the rd.kdumploglvl option to control log level in the second kernel +- Appropriately converts logger numeric level to syslog log level +- Remove unused log levels for kdump logger +- Add sanity checks for the log levels +- Move watchdog detect and install code to module-setup.sh +- Add a helper to omit non-mandatory dracut module +- Move some dracut module dependencies checks to module-setup.sh +- Add code comments to help better understanding + +* Thu Nov 05 2020 Kairui Song <kasong@redhat.com> - 2.0.20-19 +- Fix comment about ssh dump target +- mkdumprd: Ensure kdumpbase is added +- kdump.service: use ConditionKernelCommandLine=crashkernel +- Revert "Revert "s390x: enable the kexec file load by def +- increase makdumpfile default message level to 7 +- Fix error when using raw target with opalcore +- module-setup.sh: Instead of drop journalctl log, just don't read kmsg +- Doc: add a documentation for the usage of logger +- Improve debugging in the kdump kernel +- kdumpctl: add the '-d' option to enable the kexec loading debugging messages +- kdump.sysconfig: add the kdump logger configurations +- enable the logger for kdump +- introduce the kdump logger from the dracut +- Rework check_config and warn on any duplicated option +- (watchdog) kdump-lib.sh: detect secure boot on s390 +- Don't drop journalctl content if failure action is "shell" +- dracut-module-install: Move systemd conf install code to a function +- selftest: Show the path of dumped vmcore on test end +- selftest: Add document for selftests +- selftest: Add basic test framework +- selftest: Add basic infrastructure to build test image + +* Thu Aug 27 2020 Kairui Song <kasong@redhat.com> - 2.0.20-18 +- mkdumprd: Improve the warning message when using encrypted target +- kdump-lib.sh: Remove is_atomic +- Refactor kernel image and initrd detection code +- early-kdump: Use consistent symbol link for kernel and initramfs +- Add a kernel install hook to clean up kdump initramfs + +* Tue Aug 04 2020 Kairui Song <kasong@redhat.com> - 2.0.20-17 +- Drop static lib dependencies +- Revert "x86_64: enable the kexec file load by default" +- Revert "s390x: enable the kexec file load by default" +- kdumpctl: exit if either pre.d or post.d is missing +- kdump_pre: make notes more precise +- dracut-kdump.sh: exit shell when machine reboot +- kdumpctl: detect modification of scripts by its directory's timestamp +- module-setup.sh: suppress false alarm +- kexec-tools.spec: make the existence of pre.d and post.d mandatory +- ppc64/kdump: use kexec_file_load when secureboot is enabled + +* Sat Aug 01 2020 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.20-16 +- Second attempt - Rebuilt for + https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild + +* Tue Jul 28 2020 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.20-15 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild + +* Wed Jul 1 2020 Kairui Song <kasong@redhat.com> - 2.0.20-14 +- s390x: enable the kexec file load by default +- x86_64: enable the kexec file load by default +- Revert "s390x: add kdump sysconfig option to use the kexec_file_load() syscall" +- Revert "kdump-lib: switch to the kexec_file_load() syscall on x86_64 by default" +- kdump.conf: fix a grammar issue +- man: improve description about /etc/kdump/{pre.d,post.d}interface +- mkdumprd: Improve the error message for umounted dump target +- mkdumprd: Fix nfs detection in to_mount +- Always wrap up call to dracut get_persistent_dev function +- s390x: add kdump sysconfig option to use the kexec_file_load() syscall +- mkdumprd: Fix dracut error on multiple extra_modules +- Fix kdump failure when mount target specified by dracut_args +- kdump.conf: Specify /etc/kdump/{pre.d,post.d}interface +- dracut-kdump.sh: Execute the binary and script filesin /etc/kdump/{pre.d,post.d} +- kdumpctl: Check the update of the binary and script files in /etc/kdump/{pre.d,post.d} +- dracut-module-setup.sh: Install files under /etc/kdump/{pre.d,post.d} into kdump initramfs +- Drop switch root capability for non fadump initramfs +- fadump: update fadump-howto.txt with some more troubleshooting help +- fadump-howto.txt: source it in spec file +- Don't inherit swiotlb parameter form 1st kernel by default +- module-setup.sh: Add "rd.neednet" parameter if network is needed +- Revert "Add a hook to wait for kdump target in initqueue" +- kdump.sysconfig: Remove the option 'log_buf_len' from kdump command line + +* Fri May 22 2020 Kairui Song <kasong@redhat.com> - 2.0.20-13 +- Update docs for the new noauto dump target support +- kexec-kdump-howto.txt: Add some format to the document +- mkdumprd: generate usable kdump initramfs even target is not mounted +- User get_mount_info to replace findmnt calls +- kdump-lib.sh: add fstab failback helper for getting mount info +- Allow calling mkdumprd from kdumpctl even if targat not mounted +- Add a is_mounted helper +- Introduce get_kdump_mntpoint_from_target and fix duplicated / +- Append both nofail and x-systemd.before to kdump mount target +- Fix the problem that kdump prints redundant / +- Partially Revert "Don't mount the dump target unless needed" +- fadump: update fadump-howto.txt with some troubleshooting help +- Add a new option 'rd.znet_ifname' in order to use it in udev rules +- Don't unmount the dump target just after saving vmcore +- dracut-module-setup.sh: fix breakage in get_pcs_fence_kdump_nodes() +- dracut-module-setup.sh: ensure cluster info is ready before query + +* Thu Apr 2 2020 Kairui Song <kasong@redhat.com> - 2.0.20-12 +- Remove adjust_bind_mount_path call +- No longer treat atomic/silverblue specially +- mkdumprd: Simplify handling of user specified target +- mkdumprd: Use get_save_path instead of parsing config +- Remove is_dump_target_configured +- dracut-module-setup.sh: improve get_alias() + +* Tue Mar 24 2020 Kairui Song <kasong@redhat.com> - 2.0.20-11 +- Fix a potential syntax error +- Use read_strip_comments to filter the installed kdump.conf +- kdumpctl: fix driver change detection on latest Fedora +- kdumpctl: check hostonly-kernel-modules.txt for kernel module +- dracut-module-setup.sh: Ensure initrd.target.wants dir exists +- mkdumprd: Use DUMP_TARGET which printing error message during ssh +- kdump-lib.sh: Fix is_user_configured_dump_target() +- mkdumprd: Use makedumpfile --check-params option +- makedumpfile: Introduce --check-params option +- Improves the early-kdump-howto.txt document in several points: + +* Thu Feb 13 2020 Kairui Song <kasong@redhat.com> - 2.0.20-10 +- Add --force option to step 2 in early-kdump-howto.txt +- Fix typo in early-kdump-howto.txt +- kexec-tools/module-setup: Ensure eth devices get IP address for VLAN +- powerpc: enable the scripts to capture dump on POWERNV platform +- kdump-lib: switch to the kexec_file_load() syscall on x86_64 by default + +* Wed Jan 29 2020 Kairui Song <kasong@redhat.com> - 2.0.20-9 +- Fix building failure + +* Wed Jan 29 2020 Kairui Song <kasong@redhat.com> - 2.0.20-8 +- Update makedumpfile to 1.6.7 +- Add a hook to wait for kdump target in initqueue +- Always install sed and awk +- Fix potential ssh/nfs kdump failure of missing "ip" command +- kdump-lib.sh: Fix is_nfs_dump_target +- Always use get_save_path to get the 'path' option +- kdump-lib: Don't abuse echo, and clean up + +* Sun Dec 29 2019 Kairui Song <kasong@redhat.com> - 2.0.20-7 +- Fix building failure due to makedumpfile's compile flag +- mkdumprd: Fix dracut args parsing + +* Thu Nov 28 2019 Kairui Song <kasong@redhat.com> - 2.0.20-6 +- kdump-error-handler.service: Remove ExecStopPost +- mkdumprd: simplify dracut args parsing +- Always set vm.zone_reclaim_mode = 3 in kdump kernel +- kdumpctl: make reload fail proof +- spec: move binaries from /sbin to /usr/sbin +- Don't execute final_action if failure_action terminates the system +- module-setup.sh: Simplify the network setup code +- mkdumprd: ensure ssh path exists before check size +- module-setup: re-fix 99kdumpbase network dependency +- kdumpctl: bail out immediately if host key verification failed + +* Tue Oct 15 2019 Kairui Song <kasong@redhat.com> - 2.0.20-5 +- Don't mount the dump target unless needed +- kdump-lib: strip grub device from kdump_bootdir +- Add systemd-udev require. + +* Tue Sep 24 2019 Kairui Song <kasong@redhat.com> - 2.0.20-4 +- kdumpctl: echo msg when waiting for connection +- makedumpfile: Fix inconsistent return value from find_vmemmap() +- makedumpfile: Fix exclusion range in find_vmemmap_pages() +- makedumpfile: x86_64: Fix incorrect exclusion by -e option with KASLR +- kdumpctl: distinguish the failed reason of ssh +- kexec-kdump-howto.txt: Add notes about device dump +- Disable device dump by default +- dracut-module-setup: fix bond ifcfg processing +- dracut-module-setup: filter out localhost for generic_fence_kdump +- dracut-module-setup: get localhost alias by manual + +* Mon Aug 12 2019 Kairui Song <kasong@redhat.com> - 2.0.20-3 +- kdumpctl: wait a while for network ready if dump target is ssh +- makedumpfile: Increase SECTION_MAP_LAST_BIT to 4 +- makedumpfile: Do not proceed when get_num_dumpable_cyclic() fails +- Don't forward and drop journalctl logs for fadump + +* Fri Aug 02 2019 Kairui Song <kasong@redhat.com> - 2.0.20-2 +- x86: Fix broken multiboot2 buliding for i386 +- dracut-module-setup.sh: skip alias of localhost in get_pcs_fence_kdump_nodes() + +* Wed Jul 31 2019 Kairui Song <kasong@redhat.com> - 2.0.20-1 +- Update makedumpfile to 1.6.6 +- dracut-module-setup.sh: Don't use squash module for fadump +- Forward logs in kdump kernel to console directly +- kdump.sysconfig/x86_64: Disable HEST by default +- dracut-kdump-capture.service: Use OnFailureJobMode instead of deprecated OnFailureIsolate +- makedumpfile: x86_64: Add support for AMD Secure Memory Encryption +- aarch64/kdump.sysconfig: Make config options similar to x86_64 +- Add aarch64 specific kdump.sysconfig and use 'nr_cpus' instead of 'maxcpus' +- kdumpctl: check for ssh path availability when rebuild +- kdumpctl: Check kdump.conf for error when rebuild is called + +* Thu Jul 25 2019 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.19-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild + +* Mon May 20 2019 Kairui Song <kasong@redhat.com> - 2.0.19-2 +- kdumpctl: don't always rebuild when extra_modules is set +- kdumpctl: follow symlink when checking for modified files +- Get rid of duplicated strip_comments when reading config +- earlykdump: provide a prompt message after the rebuilding of kdump initramfs. +- kexec-kdump-howto.txt: Add document about encrypted targets +- kexec-kdump-howto.txt: Add document about initramfs rebiuld +- kdumpctl: Detect block device driver change for initramfs rebuild +- Revert "kdumpctl: Rebuild initramfs if loaded kernel modules changed" +- kexec.rules: create dedicated udev rules for ppc64 +- kexec-kdump-howto: Add note on setting correct value of kptr_restrict +- Update man page for new kdumpctl command: reload / rebuild +- kdumpctl: add rebuild support +- mkdumprd: Improve the config reading logic + +* Fri Mar 22 2019 Kairui Song <kasong@redhat.com> - 2.0.19-1 +- Update eppic to latest snapshot +- fadump: leverage kernel support to re-regisgter FADump +- fadump: use the original initrd to rebuild fadump initrdfrom + +* Fri Feb 22 2019 Kairui Song <kasong@redhat.com> - 2.0.18-5 +- Update eppic to latest upstream snapshot +- Enable building with hardening flags +- Remove unused patches +- Remove obsolete Group tag +- mkdumprd: refine regex on dropping mount options + +* Fri Feb 01 2019 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.18-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild + +* Tue Jan 22 2019 Kairui Song <kasong@redhat.com> - 2.0.18-3 +- earlykdump: Add a note of final_action option to avoid crash loop +- Add final_action option to kdump.conf +- Add failure_action as alias of default and make default obsolete +- mkdumprd: force drop earlykdump module +- earlykdump: warn when installed kernel version differs from dracut target +- earlykdump: add more sanity check when generating initramfs +- earlykdump: generate symlink with stable name to kernel image and iniramfs +- earlykdump: fix kexec fails to load the early kdump kernel +- mkdumprd: allow spaces after 'path' config phrase with network dump setting +- dracut-module-setup: Don't build squashed image if required modules are missing +- kdump-lib-initramfs.sh: using -force option when poweroff + +* Fri Dec 7 2018 Kairui Song <kasong@redhat.com> - 2.0.18-2 +- Update makedumpfile 1.6.5 +- Make udev reload rules quiet during bootup +- dracut-module-setup: Fix routing failure on multipath route +- mkdumprd: drop some nfs mount options when reading from kernel +- doc/kdump.conf: Local dump path should be <mnt>/<path>/%HOST_IP-%DATE +- As /etc/kdump.conf timestamp is updated do not compare it when doing rpm --verify +- Add missing usage info + +* Mon Nov 5 2018 Kairui Song <kasong@redhat.com> - 2.0.18-1 +- Update to kexec-tools 2.0.18 + +* Thu Nov 1 2018 Kairui Song <kasong@redhat.com> - 2.0.17-12 +- Throttle kdump reload request triggered by udev event +- Rewrite kdump's udev rules +- kdumpctl: Add reload support + +* Mon Oct 15 2018 Kairui Song <kasong@redhat.com> - 2.0.17-11 +- Enable dracut squash module +- kdumpctl: Print warning in case the raw device is formatted and contains filesystem +- kdump-lib-initramfs.sh: Add check to remount to rw mode only if dump target is ro + +* Wed Aug 22 2018 Kairui Song <kasong@redhat.com> - 2.0.17-10 +- kexec: fix for "Unhandled rela relocation: R_X86_64_PLT32" error +- kdumpctl: Error out if path is set more than once +- Always drop nofail or nobootwait options + +* Tue Aug 07 2018 Kairui Song <kasong@redhat.com> - 2.0.17-9 +- Remove redundant kdump-anaconda-addon source codes +- dracut-module-setup: Fix DRM module inclusion test for hyper-v +- Remove kdump-anaconda subpackage + +* Thu Jul 26 2018 Dave Young <dyoung@redhat.com> - 2.0.17-8 +- Fix armv7hl build failure + +* Thu Jul 26 2018 Dave Young <dyoung@redhat.com> - 2.0.17-7 +- Remove koji build workaround patch +- kexec-tools.spec: Drop kexec-tools-2.0.3-disable-kexec-test.patch +- Remove obsolete kdump tool +- dracut-module-setup.sh: don't include multipath-hostonly +- kdumpctl: Rebuild initramfs if loaded kernel modules changed + +* Fri Jul 13 2018 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.17-6 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild + +* Mon Jul 9 2018 Dave Young <dyoung@redhat.com> - 2.0.17-5 +- Update makedumpfile 1.6.4 +- dracut-module-setup.sh: pass ip=either6 param for ipv6 +- dracut-module-setup.sh: install /etc/hosts when using fence_kdump + +* Wed Jun 27 2018 Dave Young <dyoung@redhat.com> - 2.0.17-4 +- kdump anaconda addon fix for rhbz1594827 + +* Wed May 30 2018 Dave Young <dyoung@redhat.com> - 2.0.17-3 +- Add early kdump support in initramfs. +- move some common functions from kdumpctl to kdump-lib.sh +- Fix kdumpctl showmem +- kdumpctl: Remove 'netroot' and 'iscsi initiator' entries from kdump +- kdumpctl: add showmem cmd +- Revert "dracut-module-setup.sh: pass correct ip= param for ipv6" + +* Sat Apr 28 2018 Dave Young <dyoung@redhat.com> - 2.0.17-2 +- pull in makedumpfile 1.6.3 + +* Sat Apr 28 2018 Dave Young <dyoung@redhat.com> - 2.0.17-1 +- pull in 2.0.17 + +* Sun Apr 08 2018 Dave Young <dyoung@redhat.com> - 2.0.16-6 +- kdump.sysconfig.ppc64(le): remove "root=" param from ppc64(le) 2nd kernel +- kdumpctl: Check the modification time of core_collector +- dracut-module-setup.sh: pass correct ip= param for ipv6 + +* Fri Feb 09 2018 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 2.0.16-5 +- Escape macros in %%changelog + +* Wed Feb 7 2018 Dave Young <dyoung@redhat.com> - 2.0.16-4 +- update anaconda addon migrate with Anaconda changes. + +* Fri Dec 8 2017 Dave Young <dyoung@redhat.com> - 2.0.16-3 +- workaround koji build failure (rhbz1520805) + +* Mon Dec 4 2017 Dave Young <dyoung@redhat.com> - 2.0.16-2 +- dracut-module-setup.sh: check whether to include multipath-hostonly or not +- Revert "kdumpctl: sanity check of nr_cpus for x86_64 in case running out of vectors" +- kdumpctl: skip selinux-relabel for dracut_args --mount dump target + +* Tue Nov 21 2017 Dave Young <dyoung@redhat.com> - 2.0.16-1 +- update to kexec-tools 2.0.16 + +* Thu Nov 9 2017 Dave Young <dyoung@redhat.com> - 2.0.15-15 +- Use absolute path /usr/bin/dracut in mkdumprd + +* Wed Oct 11 2017 Dave Young <dyoung@redhat.com> - 2.0.15-14 +- kdumpctl: Error out in case there are white spaces before an option name + +* Wed Sep 6 2017 Dave Young <dyoung@redhat.com> - 2.0.15-13 +- dracut-module-setup.sh: eliminate redundant kdump_get_mac_addr call +- mkdumprd: use --quiet dracut argument to speedup initramfs build +- mkdumprd: fix patterns to modify mount options +- fadump: rebuild default initrd with dump capture capability +- module-setup: remove software iscsi cmdline generated by dracut +- kdumpctl: remove some cmdline inheritage from 1st kernel +- mkdumprd: apply dracut "--hostonly-cmdline" and "--no-hostonly-default-device" +- Change dump_to_rootfs to use "--mount" instead of "root=X" +- kdumpctl: move is_fadump_capable() to kdump-lib.sh +- Revert "kdumpctl: use generated rd.lvm.lv=X" +- Revert "mkdumprd: omit crypt when there is no crypt kdump target" +- Revert "mkdumprd: omit dracut modules in case of no dm target" +- Revert "mkdumprd: omit dracut modules in case of network dumping" +- update bogus date in rpm spec + +* Thu Aug 17 2017 Dave Young <dyoung@redhat.com> - 2.0.15-12 +- makedumpfile: fix 4.13 kernel larget vmcore bug +- Revert "Improve 'cpu add' udev rules" + +* Tue Aug 15 2017 Dave Young <dyoung@redhat.com> - 2.0.15-11 +- Own the /usr/share/makedumpfile dir +- Mark COPYING as %%license + +* Tue Aug 8 2017 Dave Young <dyoung@redhat.com> - 2.0.15-10 +- Improve 'cpu add' udev rules +- module-setup: suppress the early iscsi error messages +- mkdumprd: use 300s as the default systemd unit timeout for kdump mount + +* Mon Aug 7 2017 Dave Young <dyoung@redhat.com> - 2.0.15-9 +- fix makedumpfile bug 1474706 + +* Thu Aug 03 2017 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.15-8 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild + +* Sun Jul 30 2017 Florian Weimer <fweimer@redhat.com> - 2.0.15-7 +- Rebuild with binutils fix for ppc64le (#1475636) + +* Fri Jul 28 2017 Dave Young <dyoung@redhat.com> - 2.0.15-6 +- update upstream makedumpfile 1.6.2 + +* Wed Jul 26 2017 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.15-5 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild + +* Wed Jul 19 2017 Dave Young <dyoung@redhat.com> - 2.0.15-4 +- mkdumprd: remove useless "x-initrd.mount" +- kdumpctl: use "apicid" other than "initial apicid" + +* Fri Jul 14 2017 Dave Young <dyoung@redhat.com> - 2.0.15-3 +- module-setup: fix 99kdumpbase network dependency +- mkdumprd: omit dracut modules in case of network dumping +- mkdumprd: omit dracut modules in case of no dm target +- mkdumprd: omit crypt when there is no crypt kdump target +- kdumpctl: use generated rd.lvm.lv=X +- mkdumprd: change for_each_block_target() to use get_kdump_targets() +- kdump-lib.sh: introduce get_kdump_targets() +- kdump-lib.sh: fix improper get_block_dump_target() +- kdumpctl: fix infinite loop caused by running under bash + +* Wed Jun 28 2017 Dave Young <dyoung@redhat.com> - 2.0.15-2 +- enable makedumpfile for arm64 + +* Fri Jun 23 2017 Dave Young <dyoung@redhat.com> - 2.0.15-1 +- rebase kexec-tools-2.0.15 + +* Thu Jun 15 2017 Dave Young <dyoung@redhat.com> - 2.0.14-13 +- kexec-tools.spec: Fix whitespace errors +- dracut-module-setup: Fix test for inclusion of DRM modules +- kdump.conf.5: clarify the fence_kdump_nodes option + +* Thu May 18 2017 Dave Young <dyoung@redhat.com> - 2.0.14-12 +- kdumpctl: for fence_kdump, the ipaddr of this node should be excluded + +* Fri May 12 2017 Dave Young <dyoung@redhat.com> - 2.0.14-11 +- kdumpctl: change the shebang header to use /bin/bash +- kdumpctl: call strip_comments only when necessary to speedup +- Revert "kdumpctl: improve "while read" time for /etc/kdump.conf" (rhbz1449801) + +* Fri May 5 2017 Dave Young <dyoung@redhat.com> - 2.0.14-10 +- kdumpctl: improve "while read" time for /etc/kdump.conf +- kdumpctl: update check_dump_fs_modified() to use "lsinitrd -f" +- kdumpctl: improve check_wdt_modified() +- kdumpctl: remove is_mode_switched() +- kdumpctl: bail out earlier in case of no reserved memory + +* Thu Apr 27 2017 Dave Young <dyoung@redhat.com> - 2.0.14-9 +- kdump: Introduce 'force_no_rebuild' option +- kdump-lib-initramfs.sh: ignore the failure of echo +- kdump.sysconfig/x86_64: Add nokaslr to kdump kernel cmdline + +* Tue Apr 11 2017 Dave Young <dyoung@redhat.com> - 2.0.14-8 +- kdumpctl: fix status check when CONFIG_CRASH_DUMP is not enabled in kernel +- kdumpctl: fix a bug in remove_cmdline_param() +- kdumpctl: remove "root=X" for kdump boot +- Revert "kdumpctl: filter 'root' kernel parameter when running in live images" + +* Fri Mar 31 2017 Dave Young <dyoung@redhat.com> - 2.0.14-7 +- kdump-emergency: fix "Transaction is destructive" emergency failure +- mkdumprd: reduce lvm2 memory under kdump + +* Fri Mar 17 2017 Dave Young <dyoung@redhat.com> - 2.0.14-6 +- Fix kernel kaslr caused regressions (kexec -p and makedumpfile --mem-usage) + +* Thu Mar 9 2017 Dave Young <dyoung@redhat.com> - 2.0.14-5 +- kdump-lib.sh: fix incorrect usage with pipe as input for grep -q in is_pcs_fence_kdump() +- Document: fix incorrect link in fadump-how.txt + +* Mon Jan 23 2017 Dave Young <dyoung@redhat.com> - 2.0.14-4 +- drop kdump script rhcrashkernel-param in kexec-tools repo +- kdumpctl: sanity check of nr_cpus for x86_64 in case running out of vectors +- kdumpctl: change prepare_cmdline() to operate KDUMP_COMMANDLINE directly +- use --hostonly-i18n for dracut + +* Wed Jan 4 2017 Dave Young <dyoung@redhat.com> - 2.0.14-3 +- Rebase makedumpfile 1.6.1 +- Delete unused patches + +* Tue Dec 20 2016 Dave Young <dyoung@redhat.com> - 2.0.14-2 +- rebase upstream kexec-tools 2.0.14 +- update kdump anaconda addon +- cleanup sources file + +* Mon Nov 28 2016 Dave Young <dyoung@redhat.com> - 2.0.14-1 +- kexec-tools 2.0.14-1 + +* Mon Nov 28 2016 Dave Young <dyoung@redhat.com> - 2.0.13-9 +- rename function kdump_to_udev_name +- Raw dump: use by-id as persistent policy in 2nd kernel +- drop dracut duplicate functions +- dracut-kdump: use POSIX shell syntax +- Correct two typos in kdumpctl and kdump.conf + +* Fri Nov 11 2016 Dave Young <dyoung@redhat.com> - 2.0.13-8 +- kexec/arch/i386: Add support for KASLR memory randomization +- Update kdump anaconda addon +- fadump: restore default initrd when fadump mode is disabled +- kdump/fadump: fix network interface name when switching from fadump to kdump +- kdumpctl: filter 'root' kernel parameter when running in live images +- Documentation: step by step guide on confiuring kdump in live images + +* Thu Oct 27 2016 Dave Young <dyoung@redhat.com> - 2.0.13-7 +- fix wrong page_offset added in 2.0.13-6 + +* Wed Oct 26 2016 Dave Young <dyoung@redhat.com> - 2.0.13-6 +- add kexec support for arm64 +- support x86 kaslr which is enabled by default in F25 kernel + +* Fri Sep 16 2016 Dave Young <dyoung@redhat.com> - 2.0.13-5 +- Fix bug 1373958 for system boot without initrd +- Do not depend on /etc/fstab in kdumpctl in case it does not exist + +* Fri Aug 26 2016 Dave Young <dyoung@redhat.com> - 2.0.13-4 +- Add special dump target "--mount" in dracut_args + +* Tue Aug 9 2016 Dave Young <dyoung@redhat.com> - 2.0.13-3 +- Fix armv7 build failure + +* Tue Aug 9 2016 Dave Young <dyoung@redhat.com> - 2.0.13-2 +- Drop old patches for 2.0.12 + +* Tue Aug 9 2016 Dave Young <dyoung@redhat.com> - 2.0.13-1 +- Rebase kexec-tools 2.0.13 + +* Thu Jul 21 2016 Dave Young <dyoung@redhat.com> - 2.0.12-10 +- kdump.conf manpage and kdump.conf comments fixes. +- kdump watchdog support. + +* Wed Jul 13 2016 Dave Young <dyoung@redhat.com> - 2.0.12-9 +- Update kdump anaconda addon +- makedumpfile: Support _count -> _refcount rename in struct page +- module-setup: Don't handle iBFT in kdump + +* Wed Jul 6 2016 Dave Young <dyoung@redhat.com> - 2.0.12-8 +- Rebase makedumpfile 1.6.0 + +* Mon Jun 27 2016 Dave Young <dyoung@redhat.com> - 2.0.12-7 +- Fix date format in spec file. + +* Mon Jun 27 2016 Dave Young <dyoung@redhat.com> - 2.0.12-6 +- get_persistent_dev(): fix name contention with dracut's similar function + +* Mon Jun 6 2016 Dave Young <dyoung@redhat.com> - 2.0.12-5 +- kdump-lib: Add get_ifcfg_filename() to get the proper ifcfg file +- module-setup: Use get_ifcfg_filename() to get the proper ifcfg file + +* Mon May 30 2016 Dave Young <dyoung@redhat.com> - 2.0.12-4 +- update kdump anaconda addon to add mem range in tui +- .gitignore: Update to make it more generic +- kdumpctl: check_rebuild improvement +- kdumpctl: Do not rebuild initramfs when $KDUMP_BOOTDIR is read only + +* Tue Mar 29 2016 Dave Young <dyoung@redhat.com> - 2.0.12-3 +- update kdump anaconda addon to adapt to blivet-2.0 API + +* Thu Mar 24 2016 Dave Young <dyoung@redhat.com> - 2.0.12-2 +- Release 2.0.12-2 +- ppc64le: fix kexec hang due to ppc64 elf abi breakage + +* Tue Mar 22 2016 Dave Young <dyoung@redhat.com> - 2.0.12-1 +- Rebase kexec-tools to 2.0.12 + +* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.11-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild + +* Fri Dec 11 2015 Dave Young <dyoung@redhat.com> - 2.0.11-3 +- use "systemctl reboot -f" for reboot action +- Remove kernel param "quiet" from kdump kernel cmdline +- kdump.sysconfig: add KDUMP_COMMANDLINE_REMOVE +- Add missing prefixes in default sysconfig file +- fix bogus date in changelog + +* Thu Nov 19 2015 Dave Young <dyoung@redhat.com> - 2.0.11-2 +- Rebase to upstream makedumpfile 1.5.9 + +* Mon Nov 9 2015 Dave Young <dyoung@redhat.com> - 2.0.11-1 +- Rebase to upstream kexec-tools 2.0.11 + +* Mon Oct 19 2015 Dave Young <dyoung@redhat.com> - 2.0.10-9 +- kexec-kdump-howto:Add introduction of parallel dumping +- Remove duplicate prefix path ${initdir} + +* Tue Sep 8 2015 Dave Young <dyoung@redhat.com> - 2.0.10-8 +- update kdump addon to fix a kickstart installationi issue + +* Wed Aug 19 2015 Dave Young <dyoung@redhat.com> - 2.0.10-7 +- add man page for kdumpctl + +* Thu Aug 13 2015 Baoquan He <bhe@redhat.com> - 2.0.10-6 +- mkdumprd: Remove ifcfg from dracut's modules +- module-setup: Choose the first matched gateway in kdump_static_ip +- module-setup: Add permanent option to detect static ip address or not + +* Tue Aug 4 2015 Dave Young <dyoung@redhat.com> - 2.0.10-5 +- Update kdump addon to fix an installation hang issue. + +* Tue Jul 28 2015 Dave Young <dyoung@redhat.com> - 2.0.10-4 +- ipv6 support (except for link scope addresses) +- Apply the manual DNS to the 2nd kernel +- load iTCO_wdt early in cmdline hook + +* Thu Jul 23 2015 Dave Young <dyoung@redhat.com> - 2.0.10-3 +- Update kdump addon icon +- Revert static route corner case patches per bhe. He discussed with Marc + it is just a corner case. + +* Mon Jul 13 2015 Dave Young <dyoung@redhat.com> - 2.0.10-2 +- update kdump addon icon + +* Thu Jul 9 2015 Dave Young <dyoung@redhat.com> - 2.0.10-1 +- Rebase kexec-tools 2.0.10 +- Rebase eppic git tree 050615 +- Enhance kdump.conf "default" parameters check + +* Thu Jul 2 2015 Dave Young <dyoung@redhat.com> - 2.0.9-2 +- Resolve bug 1236456, kexec load fail because koji add extra gcc flags. +- Remove -FPIC for makedumpfile since it is not necessary without harden build + +* Tue Jun 23 2015 Dave Young <dyoung@redhat.com> - 2.0.9-1 +- Rebase kexec-tools 2.0.9 +- Rebase makedumpfile 1.5.8 +- revert 6347630 since ipv6 patches has not been reviewed. + +* Wed Jun 17 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.0.8-13 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild + +* Thu Jun 11 2015 Dave Young <dyoung@redhat.com> -2.0.8-13 +- Update kdump anaconda addon icon again. + +* Wed Jun 10 2015 Dave Young <dyoung@redhat.com> -2.0.8-12 +- Update kdump anaconda addon, change an icon. + +* Wed Jun 03 2015 Baoquan He <bhe@redhat.com> -2.0.8-11 +- make kdump work when kernel crash after shutdown +- Disable transparent hugepages in second kernel +- Filtered out "noauto" options in 2nd kernel fstab + +* Tue Apr 21 2015 Baoquan He <bhe@redhat.com> -2.0.8-10 +- add fPIC to makefumpfile CFLAGS to support hardening +- dracut-module-setup: Enhance kdump to support the bind mounted feature in Atomic +- Fix the warning if the target path is bind mount in Atomic +- Get the mount point correctly, if the device has several mount point +- kdump-lib: Add new function to judge the system is Atomic or not +- kdump-lib: Add the new function to enhance bind mounted judgement +- Remove duplicate slash in save path + +* Thu Apr 09 2015 Baoquan He <bhe@redhat.com> -2.0.8-9 +- Revert "execute kdump_post after do_default_action" +- dracut-module-setup.sh: change the insecure use of /tmp/*$$* filenames +- make kdump saving directory name consistent with RHEL6 + +* Sun Feb 15 2015 Dave Young <dyoung@redhat.com> - 2.0.8-8 +- execute kdump_post after do_default_action +- update kdump anaconda addon (translations/help text issus) + +* Fri Jan 30 2015 Baoquan He <bhe@redhat.com> - 2.0.8-7 +- kdumpctl: adjust the boot dir if kernel is put in sub dir of /boot + +* Tue Jan 13 2015 WANG Chao <chaowang@redhat.com> - 2.0.8-6 +- mount fail if its mount point doesn't exist in /sysroot +- rebuild initrd dependency during kdump restart +- fix a dump path issue + +* Tue Jan 06 2015 WANG Chao <chaowang@redhat.com> - 2.0.8-5 +- remove panic_on_warn kernel param in 2nd kernel +- remove sysctl.conf to restore sysctl default values in 2nd kernel +- fix a core_collector issue in ssh and raw dump case +- update to kdump-anaconda-addon-005-2-g86366ae.tar.gz +- some cleanups + +* Tue Nov 04 2014 WANG Chao <chaowang@redhat.com> - 2.0.8-4 +- Fix ppc64le installation issue +- Fix get_option_value function + +* Tue Oct 28 2014 WANG Chao <chaowang@redhat.com> - 2.0.8-3 +- fix static route corner case +- fadump fix + +* Tue Oct 21 2014 WANG Chao <chaowang@redhat.com> - 2.0.8-2 +- Fix build issue on ARM + +* Mon Oct 20 2014 WANG Chao <chaowang@redhat.com> - 2.0.8-1 +- Rebase kexec-tools-2.0.8 +- Remove subpackage kexec-tools-eppic +- Rebase kdump-anaconda-addon-005 + +* Fri Sep 26 2014 WANG Chao <chaowang@redhat.com> - 2.0.7-11 +- Fix build failure on ppc64le +- Fix an issue on iscsi boot environment + +* Tue Sep 23 2014 WANG Chao <chaowang@redhat.com> - 2.0.7-10 +- Enable ppc64le arch. +- Rebase makedumpfile-1.5.7 +- add sample eppic scripts to kexec-tools-eppic package +- Restart kdump service on cpu ADD/REMOVE events + +* Wed Sep 10 2014 Baoquan He <bhe@redhat.com> - 2.0.7-9 +- kdumpctl: Use kexec file based syscall for secureboot enabled machines +- kdumpctl: Use kexec file based mode to unload kdump kernel +- kdumpctl: Do not redirect error messages to /dev/null +- kexec: Provide an option to use new kexec system call + +* Fri Aug 29 2014 WANG Chao <chaowang@redhat.com> - 2.0.7-8 +- use absolute path for executable in systemd service +- update to kdump-anaconda-addon-003 +- remove dead kdump firstboot module and po files + +* Thu Aug 21 2014 WANG Chao <chaowang@redhat.com> - 2.0.7-7 +- install 98-kexec.rules to /usr/lib/ +- update kdump-anaconda-addon-0.2 + +* Sat Aug 16 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.0.7-6 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild + +* Wed Aug 06 2014 WANG Chao <chaowang@redhat.com> - 2.0.7-5 +- rework of kdump error handling +- add fadump support +- add static route support +- systemd will take care of shutdown and umount filesystems + +* Thu Jul 24 2014 WANG Chao <chaowang@redhat.com> - 2.0.7-4 +- update to kdump-anaconda-addon-001-4-g03898ef.tar.gz +- prefix "kdump-" to eth name + +* Mon Jul 21 2014 WANG Chao <chaowang@redhat.com> - 2.0.7-3 +- update to kdump-anaconda-addon-20140721.tar.gz + +* Wed Jul 16 2014 WANG Chao <chaowang@redhat.com> - 2.0.7-2 +- Fix makedumpfile OOM issue + +* Tue Jun 10 2014 WANG Chao <chaowang@redhat.com> - 2.0.7-1 +- Rebase kexec-tools-2.0.7 + +* Sun Jun 08 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.0.6-9 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild + +* Thu May 22 2014 WANG Chao <chaowang@redhat.com> - 2.0.6-8 +- re-construct anaconda-addon file hierarchy + +* Wed May 21 2014 WANG Chao <chaowang@redhat.com> - 2.0.6-7 +- fix a typo in kexec-tools.spec + +* Tue May 20 2014 WANG Chao <chaowang@redhat.com> - 2.0.6-6 +- New package kdump-anaconda-addon +- fixes for udev event based service restart + +* Wed Apr 30 2014 WANG Chao <chaowang@redhat.com> - 2.0.6-5 +- Remove nofail mount option +- Rebase makedumpfile-1.5.6 + +* Thu Apr 17 2014 WANG Chao <chaowang@redhat.com> - 2.0.6-4 +- generate kdump service dependencies on the fly +- kdump.conf: a standalone path directive becomes a relative path to it's backed disk. + +* Wed Apr 02 2014 WANG Chao <chaowang@redhat.com> - 2.0.6-3 +- Add README to git repo +- Add fence_kdump support for generic clusters + +* Thu Mar 27 2014 Peter Robinson <pbrobinson@fedoraproject.org> 2.0.6-2 +- Exclude AArch64 + +* Wed Mar 26 2014 WANG Chao <chaowang@redhat.com> - 2.0.6-1 +- Rebase kexec-tools-2.0.6 +- fix an issue when dump path is mounted on nfs +- vmcore-dmesg: stack smashing fix +- get_ssh_size fix for localized df output + +* Mon Mar 10 2014 WANG Chao <chaowang@redhat.com> - 2.0.5-2 +- Warn about save vmcore patch mounted by another disk +- Omit dracut resume module + +* Tue Mar 04 2014 WANG Chao <chaowang@redhat.com> - 2.0.5-1 +- Rebase kexec-tools-2.0.5 +- backport several patches from upstream for i386 build + +* Mon Mar 03 2014 WANG Chao <chaowang@redhat.com> - 2.0.4-25 +- Pass disable_cpu_apicid to kexec of capture kernel +- Relax restriction of dumping on encrypted target +- regression fix on wdt kernel drivers instal + +* Mon Feb 17 2014 WANG Chao <chaowang@redhat.com> - 2.0.4-24 +- add kdump-in-cluster-environment.txt to rpm pkg +- Secure Boot status check warning +- Some watchdog driver support + +* Wed Jan 29 2014 WANG Chao <chaowang@redhat.com> - 2.0.4-23 +- ssh dump: create random-seed manually +- makedumpfile: memset() in cyclic bitmap initialization introduce segment fault. +- Add acpi_no_memhotplug to kdump kernel +- Add fence kdump support + +* Tue Jan 28 2014 WANG Chao <chaowang@redhat.com> - 2.0.4-22 +- Rebase makedumpfile-1.5.5 + +* Wed Jan 22 2014 WANG Chao <chaowang@redhat.com> - 2.0.4-21 +- makedumpfile: Improve progress information for huge memory system +- s390: use nr_cpus=1 instead of maxcpus=1 + +* Fri Jan 17 2014 WANG Chao <chaowang@redhat.com> - 2.0.4-20 +- vmcore-dmesg: fix timestamp error in vmcore-dmesg.txt +- makedumpfile: re-enable mmap() and introduce --non-mmap +- kdump.conf uncomment default core_collector line +- fix an issue when 'ssh' directive appearing in kdump.conf, the rest part of + lines in this file are ignored + +* Tue Dec 24 2013 WANG Chao <chaowang@redhat.com> - 2.0.4-18 +- update translation files +- makedumpfile: default to lzo compression +- makedumpfile: add makedumpfile.conf.sample and its manpage + +* Sat Dec 21 2013 Ville Skyttä <ville.skytta@iki.fi> - 2.0.4-15 +- Fix Tamil (India) locale subdir name. +- Fix bogus date in %%changelog. + +* Tue Dec 03 2013 WANG Chao <chaowang@redhat.com> - 2.0.4-14 +- Add rd.memdebug in kdump module +- kdumpctl: Avoid leaking fd to subshell +- makedumpfile: Understand >= v3.11-rc4 dmesg +- makedumpfile, ppc: Support to filter dump for kernels that use CONFIG_SPARSEMEM_VMEMMAP. + +* Fri Nov 15 2013 WANG Chao <chaowang@redhat.com> - 2.0.4-13 +- makedumpfile: disable mmap() + +* Tue Oct 29 2013 WANG Chao <chaowang@redhat.com> - 2.0.4-12 +- fix sadump format phys_base calculating error +- kdump, x86: Process multiple Crash kernel in /proc/iomem +- makedumpfile: wrong cyclic buffer size recalculation causes bitmap data corruption +- Fix max_mapnr issue on system has over 44-bit addressing. + +* Sat Oct 12 2013 Baoquan He <bhe@redhat.com> -2.0.4-11 +- kdump-lib.sh: strip_comments is not implemented correcty + +* Fri Sep 27 2013 Baoquan He <bhe@redhat.com> - 2.0.4-10 +- Back port 2 revert commits +- kdump.sysconfig: default to "nofail" mount + +* Fri Sep 27 2013 Baoquan He <bhe@redhat.com> - 2.0.4-9 +- Strip inline comments from the kdump config file before use +- kdump-lib.sh: add common function strip_comments +- Introduce kdump-lib.sh for kdump shared functions +- kdump.service: Start kdump after network is online and remote fs is mounted +- dracut-module-setup: _dev to be a local variable +- kdumpctl: Run multiple kdumpctl instances one by one in serial order + +* Wed Aug 21 2013 Baoquan He <bhe@redhat.com> - 2.0.4-8 +- remove 98selinux dependency + +* Fri Aug 2 2013 Baoquan He <bhe@redhat.com> - 2.0.4-7 +- dracut-kdump.sh: add do_dump() and error out if dump vmcore fails +- dracut-module-setup.sh: setup correct system time and time zone in 2nd kernel. +- kernel cmdline: Remove hugepage allocations +- Use /lib/dracut/no-emergency-shell to control action on fail +- Revert: kdump.sysconfig: Add option action_on_fail and set its default as continue +- dracut-kdump.sh: Redirect kdump script stdout/stderr to /dev/console +- makedumpfile: Add vmap_area_list definition for ppc/ppc64. + +* Fri Jul 12 2013 Baoquan He <bhe@redhat.com> - 2.0.4-6 +- add snappy build +- add lzo build +- pull makedumpfile-1.5.4 +- mkdumprd: check return value of subshell +- mkdumprd: get_persistent_dev() return original dev if no persistent dev exists. +- dracut-kdump.sh: Merge dump_to_rootfs() to dump_fs() +- dracut-kdump.sh: explicitly sync after each dump +- Correct wrong weekday of changelog +- kexec-tools.spec: Remove incorrect description in changelog + +* Tue Jun 25 2013 Baoquan He <bhe@redhat.com> - 2.0.4-5 +- monitor-dd-progress fix +- rawdump: only show dd progress bar when core_collector is not makedumpfile +- kexec-tools.spec: replaces scriptlets with new systemd macros +- dracut-kdump.sh: umount fs right before kdump exit +- dracut-kdump.sh: recursively umount fs and its submounts +- dracut-kdump.sh: cleanup - using local variable names instead of $1/$2 in functions +- dracut-kdump.sh: name the invalid vmcore to vmcore-incomplete +- dracut-kdump.sh: Output top level information about the kdump progress. +- kexec-kdump-howto: Add a section for debugging tips + +* Tue Jun 18 2013 Baoquan He <bhe@redhat.com> - 2.0.4-4 +- dracut-module-setup.sh: improve the approach to get a bridged interface list +- dracut-module-setup.sh: cleanup - use kdump_get_mac_addr() function +- dracut-module-setup.sh: use kernel exported mac address in kdump_get_mac_addr() +- dracut-module-setup.sh: use perm addr of slaves to setup bonding network +- kdump: Do not output debug messages by default +- dracut-module-setup.sh: kdump module depends on drm module +- mkdumprd: return error if no write permission on save path of server for ssh + +* Thu Jun 13 2013 Baoquan He <bhe@redhat.com> - 2.0.4-3 +- mkdumprd: remove -M option for dracut +- kdumpctl: add selinux relabel when service startup +- depends on dracut selinux module +- dracut-kdump.sh: umount rootfs after dump_to_rootfs +- kdump.sysconfig: append "panic=10" to kdump cmdline +- kexec-kdump-howto: grubby is suggested modifing kernel cmdline +- kexec-tools.spec: removes kexec udev rules for s390 +- kdump.sysconfig: Add option action_on_fail and set its default as continue +- Add tab key as delimiter for core_collector in kdump.conf +- redirect stdout to stderr + +* Tue May 14 2013 Baoquan He <bhe@redhat.com> - 2.0.4-2 +- kdump: Save vmcore-dmesg.txt before saving vmcore +- Remove "ip=" overwrite to 40ip.conf +- Add support for bridge over bond/team/vlan. +- Fix bonding options syntax and get all specified options from ifcfg file. +- add dracut_args option to kdump.conf +- kexec-tools.spec: Add ethtool to dependency. +- error out if dump target is encrypted + +* Wed Apr 3 2013 Baoquan He <bhe@redhat.com> - 2.0.4-1 +- Delete several patches which have been merged into kexec-tools-2.0.4 +- Revert: Release 2.0.3-72 +- Release 2.0.3-72 +- Pull kexec-tools-2.0.4 +- Check if block device as dump target is resettable +- mkdumprd: add function perror_exit +- Deprecate blacklist option + +* Wed Mar 27 2013 Baoquan He <bhe@redhat.com> - 2.0.3-71 +- Remove eppic support on ppc and s390 arch + +* Mon Mar 18 2013 Baoquan He <bhe@redhat.com> - 2.0.3-70 +- Change rules related to eppic in kexec-tools.spec + +* Thu Mar 14 2013 Baoquan He <bhe@redhat.com> - 2.0.3-69 +- Support for eppic language as a subpackage + +* Thu Mar 14 2013 Baoquan He <bhe@redhat.com> - 2.0.3-68 +- tune sysconfig to save memory usage +- Remove useless codes related to LOGGER in kdumpctl +- kdumpctl:print out the service status +- Return to start() function when check_ssh_target failed +- use findmnt instead of blkid in mkdumprd +- check dump target mounting earlier +- kdumpctl: rename function name check_config +- add function to check kdump config file +- dracut-module-setup.sh: remove UUID/LABEL quotes before using it +- Change dump_to_rootfs to be a default option and reboot to be default action +- Remove "-F" in CORE_COLLECTOR when dump_to_rootfs + +* Tue Feb 19 2013 Baoquan He <bhe@redhat.com> - 2.0.3-67 +- Remove comma which is redundant +- Modify codes related to dump dir to make it clearer +- Rectify the get_host_ip implementation +- Revert: Merge an upstream patch for fix a ppc64 makedumpfile bug with with CONFIG_SPARSEMEM_EXTREME +- pull makedumpfile 1.5.3 + +* Tue Feb 5 2013 Dave Young <ruyang@redhat.com> - 2.0.3-66 +- Spec: remove kdump image when a corresponding kernel is removed +- Merge an upstream patch for fix a ppc64 makedumpfile bug + +* Mon Jan 28 2013 Dave Young <ruyang@redhat.com> - 2.0.3-65 +- Add support for team devices +- Update translation file po/it.po +- remove wait for net ok function +- add bootdev cmdline param +- kdumpnic cmdline file name cleanup + +* Fri Jan 4 2013 Dave Young <ruyang@redhat.com> - 2.0.3-64 +- fix issue of exec on stack for ppc32 + +* Fri Dec 21 2012 Dave Young <ruyang@redhat.com> - 2.0.3-63 +- revert explictly handling of PIPESTATUS +- enable pipefail bash option +- wrong ssh key fix +- build fix: Update 3 po files: po/gu.po po/or.po po/zh_CN.po + +* Fri Dec 21 2012 Dave Young <ruyang@redhat.com> - 2.0.3-62 +- Pull translated po files from zanata +- Optimize redundent code fetching server of network dump +- change the dump dir format to be more readable + +* Wed Dec 12 2012 Dave Young <ruyang@redhat.com> - 2.0.3-61 +- firstboot:fix reserve mem ui spinbox step size +- handle readonly mounted filesystem + +* Mon Dec 10 2012 Dave Young <ruyang@redhat.com> - 2.0.3-60 +- makedumpfile 1.5.1 +- Update po tar.gz +- Add a notes for zanata process +- Add two xmls file for po zanata translation +- Cleanup and recreate po files + +* Fri Nov 16 2012 Dave Young <ruyang@redhat.com> - 2.0.3-59 +- Enable kdump service after installation +- get MEM_RESERVED from sysfs attribute +- get_ssh_size: use -n to redirect stdin from /dev/null +- add random feeding code for ssh dump +- kdump option space checking improvement +- kdumpctl: multi dump target checking fix + +* Thu Oct 25 2012 Dave Young <ruyang@redhat.com> - 2.0.3-58 +- pull in two upstream patches + +* Thu Oct 11 2012 Dave Young <ruyang@redhat.com> - 2.0.3-57 +- improve persistent name handling + +* Sat Sep 29 2012 Dave Young <ruyang@redhat.com> - 2.0.3-56 +- Pull vmcore-dmesg patches from vivek +- ppc/ppc64: compile purgatory with gcc option msoft-float +- Update to support f18 grub2 efi config file +- pass persistent name to dracut --device +- pass persistent name to dracut --mount +- use persistent name in kdump.conf of initramfs +- mkdumprd: add function get_persistent_dev +- remove useless uuid and label handling + +* Thu Sep 06 2012 Dave Young <ruyang@redhat.com> - 2.0.3-55 +- doc fix for mount dump target before mkdumprd +- pull makedumpfile 1.5.0 + +* Wed Aug 29 2012 Dave Young <ruyang@redhat.com> - 2.0.3-54 +- pass raw device as dracut argument +- iscsi setup fix +- firstboot: add automatic and manual memory reservation for rhel +- firstboot: remove unnecessary underline shortkey +- firstboot: fix gtk warning about non-zero page size +- firstboot: update all kernels config in grubbyCmd +- firstboot: add actual reserved memory widget +- firstboot code cleanup +- rhcrashkernel-param: echo crashkernel=auto for rhel7 +- Remove the kernel-kdump handling +- s390x firstboot fix +- remove elilo support +- grub2 fix in firstboot +- Take closing the reboot dialog as no +- Handle new crashkernel= syntax in firstboot +- Fix a localized string in firstboot +- Configure kdump in firstboot +- fix firstboot to ensure kdump svc is disabled properly +- firstboot text domain fix +- Update to use systemctl instead of sysv chkconfig +- port force_rebuild kdump.conf option +- Change return value to indicate the result of dump_raw() correctly. +- call dracut function for default shell + +* Mon Jul 23 2012 Dave Young <ruyang@redhat.com> - 2.0.3-53 +- refactor net option +- use fstab-sys to mount nfs +- rename function dump_localfs +- dump_localfs error path fix +- update kexec-kdump-howto.txt about systemctl commands +- ssh propagate alert message fix +- remove useless dracut cmdline '-c /dev/null' +- remove useless dracut cmdline for kernel-modules and kdumpbase +- install core_collector in module-setup.sh +- install extra_bins in module-setup.sh +- remove busybox dependency +- improve warning message of space checking +- do not mount root twice +- do not add fstab-sys module in dracut cmdline +- omit dash module +- network dns config fix +- shell exit value fix + +* Thu Jul 19 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.0.3-52 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild + +* Thu Jul 5 2012 Dave Young <ruyang@redhat.com> - 2.0.3-51 +- add s390x netdev setup +- Add s390x support +- Cleanup temp file leaved at /tmp/ +- add check_size function for fs dump +- add ssh check_size +- blacklist patch apply fix +- Respect bonding mode +- Support dump over vlan tagged bonding + +* Fri Jun 22 2012 Dave Young <ruyang@redhat.com> - 2.0.3-50 +- add blacklist option, Resolves: bz805774 +- Add kdump_post and kdump_pre support, Resolves: bz805773 +- Port check_config from rhel6, Resolves: bz805778 +- raw core_collector fix +- ssh core_collector fix +- drcut-kdump.sh: cleanup kdump.conf check + +* Tue Jun 12 2012 Dave Young <ruyang@redhat.com> - 2.0.3-49 +- cleanup DUMP_INSTRUCTION handling +- final reboot behavior fix +- dump_rootfs for default target fix +- add vlan support +- fix and refactor bond handling code +- fix and refactor bridge handling code +- core_collector doc basic fix +- omit plymouth module, Resolves: bz821997 +- mkdumprd manpage cleanup manpage +- mkdumprd: remove --debug +- mkdumprd: remove noconf +- makedumprd: remove -d +- kdump.conf add sshkey +- kdump.conf remove disk_timeout +- kdump.conf make path uncommented +- kdump.conf.5 add default poweroff +- kdump.conf default shell fix +- kdump.conf default default action fix +- kdump.conf.5 remove module option +- kdump.conf remove kdump_pre/kdump_post +- kdump.conf: remove link_delay + +* Mon May 28 2012 Dave Young <ruyang@redhat.com> - 2.0.3-48 +- do_default_action cleanup, Resolves: bz805773 +- add rhcrashkernel-param for anaconda use, Resolves: bz707441 +- Basic iscsi target dump support (software initiator), Resolves bz822701 +- Static ip configuratio support, Resolves: bz822739 +- udev rules fix, Resolves: bz808817 + +* Thu May 3 2012 Dave Young <ruyang@redhat.com> - 2.0.3-47 +- remove dracut-files.tgz2 + +* Wed May 2 2012 Dave Young <ruyang@redhat.com> - 2.0.3-46 +- mkdumprd: Start using --hostonly and --add kdumpbase while calling dracut +- get_mp function cleanup +- move kdump script order to the end of pre pivot +- port raw dump from rhel6 +- remove multi dump + +* Mon Apr 23 2012 Dave Young <ruyang@redhat.com> - 2.0.3-45 +- update dracut-files.tbz2 + +* Thu Apr 19 2012 Dave Young <dyoung@redhat.com> - 2.0.3-44 +- update ppc64 sysconfig, resolve bug 811449 +- deal with nic rename issue, resolve bug 810107 +- update x86_64 sysconfig, resolve bug 813711 + +* Wed Apr 11 2012 Cong Wang <xiyou.wangcong@gmail.com> - 2.0.3-43 +- variable name fix from Dave Young. + +* Fri Mar 30 2012 Cong Wang <xiyou.wangcong@gmail.com> - 2.0.3-42 +- get ip addr with getent +- spec: depends on dracut-network +- Handle net option for nfs in kdump.conf correctly + +* Mon Feb 27 2012 Cong Wang <xiyou.wangcong@gmail.com> - 2.0.3-41 +- Bump this version. + +* Wed Feb 22 2012 Cong Wang <xiyou.wangcong@gmail.com> - 2.0.2-40 +- Fixup sysytemd service file. + +* Wed Feb 22 2012 Dave Young <ruyang@redhat.com> - 2.0.2-39 +- Add ssh dump support, resolve bug 789253. + +* Fri Jan 27 2012 Cong Wang <xiyou.wangcong@gmail.com> - 2.0.2-38 +- Pull the latest makedumpfile release, 1.4.2. + +* Fri Jan 27 2012 Cong Wang <xiyou.wangcong@gmail.com> - 2.0.2-37 +- Add initial NFS dump support, experimental. + +* Wed Jan 25 2012 Cong Wang <xiyou.wangcong@gmail.com> - 2.0.2-36 +- Really upload the dracut module. + +* Wed Jan 25 2012 Cong Wang <xiyou.wangcong@gmail.com> - 2.0.2-35 +- Fix various bugs for nfs dump. + +* Wed Jan 25 2012 Cong Wang <xiyou.wangcong@gmail.com> - 2.0.2-34 +- kdump.sh cleanup for fstab handling, from Dave Young. + +* Wed Jan 25 2012 Cong Wang <xiyou.wangcong@gmail.com> - 2.0.2-33 +- Handle rootfs correctly. + +* Tue Jan 10 2012 Cong Wang <xiyou.wangcong@gmail.com> - 2.0.2-32 +- Fix add_dracut_arg in mkdumprd. + +* Tue Jan 10 2012 Cong Wang <xiyou.wangcong@gmail.com> - 2.0.2-31 +- Update kdump dracut module with the latest dracut kdump branch. + +* Fri Dec 16 2011 Cong Wang <xiyou.wangcong@gmail.com> - 2.0.2-30 +- Update kdump dracut module to use the latest dracut feature. + +* Fri Sep 9 2011 Tom Callaway <spot@fedoraproject.org> - 2.0.2-29 +- fix systemd scriptlets + +* Wed Sep 7 2011 Cong Wang <xiyou.wangcong@gmail.com> - 2.0.2-28 +- Rename mkdumprd2 to mkdumpramfs. + +* Wed Aug 31 2011 Cong Wang <xiyou.wangcong@gmail.com> - 2.0.2-27 +- Add debug_mem_level debugging option, from Jan Stancek. + Resolve Bug 731395. + +* Mon Aug 15 2011 Cong Wang <xiyou.wangcong@gmail.com> - 2.0.2-26 +- Fix several issues caused by the previous revert. + +* Mon Aug 15 2011 Cong Wang <xiyou.wangcong@gmail.com> - 2.0.2-25 +- Switch back to old mkdumprd and also keep the new one. + +* Tue Aug 2 2011 Cong Wang <xiyou.wangcong@gmail.com> - 2.0.2-24 +- Fix default action handling. + +* Tue Aug 2 2011 Cong Wang <xiyou.wangcong@gmail.com> - 2.0.2-23 +- Install modified kdump.conf in initrd. + +* Tue Aug 2 2011 Cong Wang <xiyou.wangcong@gmail.com> - 2.0.2-22 +- Handle lvm in pre-pivot hook. + +* Tue Aug 2 2011 Cong Wang <xiyou.wangcong@gmail.com> - 2.0.2-21 +- Fix udev rules in module-setup.sh + +* Mon Aug 1 2011 Cong Wang <xiyou.wangcong@gmail.com> - 2.0.2-20 +- Generate udev rules in module-setup.sh + +* Mon Aug 1 2011 Cong Wang <xiyou.wangcong@gmail.com> - 2.0.2-19 +- Generate udev rules to handle device names. + +* Mon Aug 1 2011 Cong Wang <xiyou.wangcong@gmail.com> - 2.0.2-18 +- Fix dump to local filesystem and raw dump. + +* Mon Aug 1 2011 Cong Wang <xiyou.wangcong@gmail.com> - 2.0.2-17 +- Depend on dracut-network. + +* Mon Aug 1 2011 Cong Wang <xiyou.wangcong@gmail.com> - 2.0.2-16 +- Move dracut module detection code to module-setup.sh. + +* Thu Jul 28 2011 Cong Wang <xiyou.wangcong@gmail.com> - 2.0.2-15 +- Use shutdown module of dracut to handle reboot/shutdown/halt. + +* Wed Jul 27 2011 Cong Wang <xiyou.wangcong@gmail.com> - 2.0.2-14 +- Wait for loginit. + +* Wed Jul 27 2011 Cong Wang <xiyou.wangcong@gmail.com> - 2.0.2-13 +- Use absolute path of reboot/halt/poweroff. + +* Wed Jul 27 2011 Cong Wang <xiyou.wangcong@gmail.com> - 2.0.2-12 +- Don't use consolehelper, use real reboot/halt/poweroff. + +* Wed Jul 27 2011 Cong Wang <xiyou.wangcong@gmail.com> - 2.0.2-11 +- Rename initrd to initramfs. + +* Wed Jul 27 2011 Cong Wang <xiyou.wangcong@gmail.com> - 2.0.2-10 +- Don't depend on busybox, as it doesn't save much space. + +* Tue Jul 26 2011 Cong Wang <xiyou.wangcong@gmail.com> - 2.0.2-9 +- Parse default action. + +* Mon Jul 25 2011 Cong Wang <xiyou.wangcong@gmail.com> - 2.0.2-8 +- Move path/core_collector/default parsing code to initrd. + +* Mon Jul 25 2011 Cong Wang <xiyou.wangcong@gmail.com> - 2.0.2-7 +- Remove obsolete code in kdumpctl. + +* Mon Jul 25 2011 Cong Wang <xiyou.wangcong@gmail.com> - 2.0.2-6 +- Support core_collector and extran_bins. + +* Thu Jul 21 2011 Cong Wang <xiyou.wangcong@gmail.com> - 2.0.2-5 +- Bypass '-d' option. + +* Thu Jul 21 2011 Cong Wang <xiyou.wangcong@gmail.com> - 2.0.2-4 +- Update initramfs infrastructure to make it working + with dracut. + +* Wed Jul 06 2011 Neil Horman <nhorman@redhat.com> - 2.0.2-3 +- Removed sysv init script from package + +* Mon Jul 04 2011 Neil Horman <nhorman@redhat.com> - 2.0.2-2 +- Added systemd unit file (bz 716994) + +* Fri Jun 24 2011 Neil Horman <nhorman@redhat.com> - 2.0.2-1 +- Updated to upstream version 2.0.2 + +* Thu Jun 02 2011 Neil Horman <nhorman@redhat.com> - 2.0.0-47 +- Fixed misuse of readlink command after directory change (bz 710744) + +* Tue Apr 26 2011 Neil Horman <nhorman@redhat.com> - 2.0.0-46 +- Fix some grammer in man page (bz 673817) + +* Mon Mar 28 2011 Neil Horman <nhorman@redhat.com> - 2.0.0-45 +- Fix misuse of basename in mkdumprd (bz 683769) + +* Thu Mar 10 2011 Neil Horman <nhorman@redhat.com> - 2.0.0-44 +- Fix build break in purgatory makefile + +* Thu Mar 10 2011 Neil Horman <nhorman@redhat.com> - 2.0.0-43 +- Remove vestigual emitdms code and call from mkdumprd + +* Mon Feb 07 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.0.0-42 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild + +* Fri Oct 22 2010 Neil Horman <nhorman@redhat.com> - 2.0.0-41 +- Fixed dhcp retry mechanism (bz 645734) + +* Wed Sep 29 2010 jkeating - 2.0.0-40 +- Rebuilt for gcc bug 634757 + +* Wed Sep 22 2010 Neil Horman <nhorman@redhat.com> - 2.0.0-39 +- fix finding modalias/mkdumprd hang (bz 635893) + +* Wed Aug 11 2010 David Malcolm <dmalcolm@redhat.com> - 2.0.0-38 +- recompiling .py files against Python 2.7 (rhbz#623327) + +* Sun Jun 13 2010 Lubomir Rintel <lkundrak@v3.sk> - 2.0.0-37 +- Fix a syntax error in kdump init script + +* Sun Jun 13 2010 Lubomir Rintel <lkundrak@v3.sk> - 2.0.0-36 +- Cosmetic mkdumprd fixes (drop an unused function, streamline another) + +* Sat May 29 2010 CAI Qian <caiqian@redhat.com> - 2.0.0-35 +- Forward-port from F13 +- Fixed kernel text area search in kcore (bz 587750) + +* Sat May 29 2010 CAI Qian <caiqian@redhat.com> - 2.0.0-34 +- Massive forward-port from RHEL6 +- Update kexec-kdump-howto.txt +- Update docs to reflect use of ext4 +- Update mkdumprd to pull in all modules needed +- Fix mkdumprd typo +- Removed universal add of ata_piix from mkdumprd +- Fix infinite loop from modprobe changes +- Fixed kexec-kdump-howto.doc for RHEL6 +- Update makedumpfile to 1.3.5 +- Improved mkdumprd run time +- Cai's fix for broken regex +- Fixing crashkernel syntax parsing +- Fix initscript to return proper LSB return codes +- Fixed bad call to resolve_dm_name +- Added poweroff option to mkdumprd +- Fixed readlink issue +- Fixed x86_64 page_offset specifictaion +- Fixed lvm setup loop to not hang +- Added utsname support to makedumpfile for 2.6.32 +- Fix critical_disks list to exclude cciss/md +- Add help info for -b option +- Add ability to handle firmware hotplug events +- Update mkdumprd to deal with changes in busybox fsck +- Vitaly's fix to detect need for 64 bit elf +- Fix major/minor numbers on /dev/rtc +- Fix ssh id propogation w/ selinux +- Add blacklist feature to kdump.conf +- Removed rhpl code from firstboot +- Fixed firstboot enable sense +- Remove bogus debug comment from mkdumprd. +- Handle SPARSEMEM properly +- Fix scp monitoring script +- Fix firstboot to find grub on EFI systems +- Fixed mkdumprd to remove dup insmod +- Fixed kdump fsck pause +- Fixed kdump option handling +- fixed raid5 module detection + +* Thu Mar 11 2010 Neil Horman <nhorman@redhat.com> - 2.0.0-33 +- Remove nash references from mkdumprd + +* Wed Feb 17 2010 Neil Horman <nhorman@redhat.com> - 2.0.0-32 +- Fixed spec file error + +* Wed Feb 17 2010 Neil Horman <nhorman@redhat.com> - 2.0.0-31 +- Adding kdump.conf man page +- Adding disk timeout parameter (bz 566135) + +* Tue Dec 01 2009 Neil Horman <nhorman@redhat.com> - 2.0.0-30 +- Fix raid support in mkdumprd (bz 519767) + +* Mon Nov 23 2009 Neil Horman <nhorman@redhat.com> - 2.0.0-29 +- Updating firstboot script to RHEL-6 version (bz 539812) + +* Fri Nov 06 2009 Neil Horman <nhorman@redhat.com> - 2.0.0-28 +- Added abrt infrastructure to kdump init script (bz 533370) + +* Tue Sep 15 2009 Neil Horman <nhorman@redhat.com> - 2.0.0-27 +- Fixing permissions on dracut module files + +* Fri Sep 11 2009 Neil Horman <nhorman@redhat.com> - 2.0.0-26 +- Rebuild for translation team (bz 522415) + +* Thu Sep 10 2009 Neil Horman <nhorman@redhat.com> - 2.0.0-25 +- Fix dracut module check file (bz 522486) + +* Thu Aug 13 2009 Neil Horman <nhorman@redhat.com> - 2.0.0-24 +- update kdump adv conf init script & dracut module + +* Wed Jul 29 2009 Neil Horman <nhorman@redhat.com> - 2.0,0-23 +- Remove mkdumprd2 and start replacement with dracut + +* Fri Jul 24 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.0.0-22 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild + +* Mon Jul 06 2009 Neil Horman <nhorman@redhat.com> 2.0.0-21 +- Fixed build break + +* Mon Jul 06 2009 Neil Horman <nhorman@redhat.com> 2.0.0-20 +- Make makedumpfile a dynamic binary + +* Mon Jul 06 2009 Neil Horman <nhorman@redhat.com> 2.0.0-19 +- Fix build issue + +* Mon Jul 06 2009 Neil Horman <nhorman@redhat.com> 2.0.0-18 +- Updated initscript to use mkdumprd2 if manifest is present +- Updated spec to require dash +- Updated sample manifest to point to correct initscript +- Updated populate_std_files helper to fix sh symlink + +* Mon Jul 06 2009 Neil Horman <nhorman@redhat.com> 2.0.0-17 +- Fixed mkdumprd2 tarball creation + +* Tue Jun 23 2009 Neil Horman <nhorman@redhat.com> 2.0.0-16 +- Fix up kdump so it works with latest firstboot + +* Mon Jun 15 2009 Neil Horman <nhorman@redhat.com> 2.0.0-15 +- Fixed some stat drive detect bugs by E. Biederman (bz505701) + +* Wed May 20 2009 Neil Horman <nhorman@redhat.com> 2.0.0-14 +- Put early copy of mkdumprd2 out in the wild (bz 466392) + +* Fri May 08 2009 Neil Horman <nhorman@redhat.com> - 2.0.0-13 +- Update makedumpfile to v 1.3.3 (bz 499849) + +* Tue Apr 07 2009 Neil Horman <nhorman@redhat.com> - 2.0.0-12 +- Simplifed rootfs mounting code in mkdumprd (bz 494416) + +* Sun Apr 05 2009 Lubomir Rintel <lkundrak@v3.sk> - 2.0.0-11 +- Install the correct configuration for i586 + +* Fri Apr 03 2009 Neil Horman <nhorman@redhat.com> - 2.0.0-10 +- Fix problem with quoted CORE_COLLECTOR string (bz 493707) + +* Thu Apr 02 2009 Orion Poplawski <orion@cora.nwra.com> - 2.0.0-9 +- Add BR glibc-static + +* Wed Feb 25 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.0.0-8 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild + +* Thu Dec 04 2008 Ignacio Vazquez-Abrams <ivazqueznet+rpm@gmail.com> - 2.0.0-7 +- Rebuild for Python 2.6 + +* Mon Dec 01 2008 Neil Horman <nhorman@redhat.com> - 2.0.0.6 +- adding makedumpfile man page updates (bz 473212) + +* Mon Dec 01 2008 Ignacio Vazquez-Abrams <ivazqueznet+rpm@gmail.com> - 2.0.0-5 +- Rebuild for Python 2.6 + +* Wed Nov 05 2008 Neil Horman <nhorman@redhat.com> - 2.0.0-3 +- Correct source file to use proper lang package (bz 335191) + +* Wed Oct 29 2008 Neil Horman <nhorman@redhat.com> - 2.0.0-2 +- Fix mkdumprd typo (bz 469001) + +* Mon Sep 15 2008 Neil Horman <nhorman@redhat.com> - 2.0.0-2 +- Fix sysconfig files to not specify --args-linux on x86 (bz 461615) + +* Wed Aug 27 2008 Neil Horman <nhorman@redhat.com> - 2.0.0-1 +- Update kexec-tools to latest upstream version + +* Wed Aug 27 2008 Neil Horman <nhorman@redhat.com> - 1.102pre-16 +- Fix mkdumprd to properly use UUID/LABEL search (bz 455998) + +* Tue Aug 5 2008 Tom "spot" Callaway <tcallawa@redhat.com> - 1.102pre-15 +- fix license tag + +* Mon Jul 28 2008 Neil Horman <nhorman@redhat.com> - 1.102pre-14 +- Add video reset section to docs (bz 456572) + +* Fri Jul 11 2008 Neil Horman <nhorman@redhat.com> - 1.102pre-13 +- Fix mkdumprd to support dynamic busybox (bz 443878) + +* Wed Jun 11 2008 Neil Horman <nhorman@redhat.com> - 1.102pre-12 +- Added lvm to bin list (bz 443878) + +* Thu Jun 05 2008 Neil Horman <nhorman@redhat.com> - 1.102pre-11 +- Update to latest makedumpfile from upstream +- Mass import of RHEL fixes missing in rawhide + +* Thu Apr 24 2008 Neil Horman <nhorman@redhat.com> - 1.102pre-10 +- Fix mkdumprd to properly pull in libs for lvm/mdadm (bz 443878) + +* Wed Apr 16 2008 Neil Horman <nhorman@redhat.com> - 1.102pre-9 +- Fix cmdline length issue + +* Tue Mar 25 2008 Neil Horman <nhorman@redhat.com> - 1.102pre-8 +- Fixing ARCH definition for bz 438661 + +* Mon Mar 24 2008 Neil Horman <nhorman@redhat.com> - 1.102pre-7 +- Adding patches for bz 438661 + +* Fri Feb 22 2008 Neil Horman <nhorman@redhat.com> - 1.102pre-6 +- Bringing rawhide up to date with bugfixes from RHEL5 +- Adding patch to prevent kexec buffer overflow on ppc (bz 428684) + +* Tue Feb 19 2008 Neil Horman <nhorman@redhat.com> - 1.102pre-5 +- Modifying mkdumprd to include dynamic executibles (bz 433350) + +* Tue Feb 12 2008 Neil Horman <nhorman@redhat.com> - 1.102pre-4 +- bumping rev number for rebuild + +* Wed Jan 02 2008 Neil Horman <nhorman@redhat.com> - 1.102pre-3 +- Fix ARCH placement in kdump init script (bz 427201) +- Fix BuildRequires +- Fix Makedumpfile to build with new libelf + +* Mon Oct 01 2007 Neil Horman <nhorman@redhat.com> - 1.102pre-2 +- Fix triggerpostun script (bz 308151) + +* Thu Aug 30 2007 Neil Horman <nhorman@redhat.com> - 1.102pre-1 +- Bumping kexec version to latest horms tree (bz 257201) +- Adding trigger to remove initrds when a kernel is removed + +* Wed Aug 22 2007 Neil Horman <nhorman@redhat.com> - 1.101-81 +- Add xen-syms patch to makedumpfile (bz 250341) + +* Wed Aug 22 2007 Neil Horman <nhorman@redhat.com> - 1.101-80 +- Fix ability to determine space on nfs shares (bz 252170) + +* Tue Aug 21 2007 Neil Horman <nhorman@redhat.com> - 1.101-79 +- Update kdump.init to always create sparse files (bz 253714) + +* Fri Aug 10 2007 Neil Horman <nhorman@redhat.com> - 1.101-78 +- Update init script to handle xen kernel cmdlnes (bz 250803) + +* Wed Aug 01 2007 Neil Horman <nhorman@redhat.com> - 1.101-77 +- Update mkdumprd to suppres notifications /rev makedumpfile (bz 250341) + +* Thu Jul 19 2007 Neil Horman <nhorman@redhat.com> - 1.101-76 +- Fix mkdumprd to suppress informative messages (bz 248797) + +* Wed Jul 18 2007 Neil Horman <nhorman@redhat.com> - 1.101-75 +- Updated fr.po translations (bz 248287) + +* Tue Jul 17 2007 Neil Horman <nhorman@redhat.com> - 1.101-74 +- Fix up add_buff to retry locate_hole on segment overlap (bz 247989) + +* Mon Jul 09 2007 Neil Horman <nhorman@redhat.com> - 1.101-73 +- Fix up language files for kexec (bz 246508) + +* Thu Jul 05 2007 Neil Horman <nhorman@redhat.com> - 1.101-72 +- Fixing up initscript for LSB (bz 246967) + +* Tue Jun 19 2007 Neil Horman <nhorman@redhat.com> - 1.101-71 +- Fixed conflict in mkdumprd in use of /mnt (bz 222911) + +* Mon Jun 18 2007 Neil Horman <nhorman@redhat.com> - 1.101-70 +- Fixed kdump.init to properly read cmdline (bz 244649) + +* Wed Apr 11 2007 Neil Horman <nhorman@redhat.com> - 1.101-69 +- Fixed up kdump.init to enforce mode 600 on authorized_keys2 (bz 235986) + +* Tue Apr 10 2007 Neil Horman <nhorman@redhat.com> - 1.101-68 +- Fix alignment of bootargs and device-tree structures on ppc64 + +* Tue Apr 10 2007 Neil Horman <nhorman@redhat.com> - 1.101-67 +- Allow ppc to boot ppc64 kernels (bz 235608) + +* Tue Apr 10 2007 Neil Horman <nhorman@redhat.com> - 1.101-66 +- Reduce rmo_top to 0x7c000000 for PS3 (bz 235030) + +* Mon Mar 26 2007 Neil Horman <nhorman@redhat.com> - 1.101-65 +- Fix spec to own kexec_tools directory (bz 219035) + +* Wed Mar 21 2007 Neil Horman <nhorman@redhat.com> - 1.101-64 +- Add fix for ppc memory region computation (bz 233312) + +* Thu Mar 15 2007 Neil Horman <nhorman@redhat.com> - 1.101-63 +- Adding extra check to avoid oom kills on nfs mount failure (bz 215056) + +* Tue Mar 06 2007 Neil Horman <nhorman@redhat.com> - 1.101-62 +- Updating makedumpfile to version 1.1.1 (bz 2223743) + +* Thu Feb 22 2007 Neil Horman <nhorman@redhat.com> - 1.101-61 +- Adding multilanguage infrastructure to firstboot_kdump (bz 223175) + +* Mon Feb 12 2007 Neil Horman <nhorman@redhat.com> - 1.101-60 +- Fixing up file permissions on kdump.conf (bz 228137) + +* Fri Feb 09 2007 Neil Horman <nhorman@redhat.com> - 1.101-59 +- Adding mkdumprd man page to build + +* Thu Jan 25 2007 Neil Horman <nhorman@redhat.com> - 1.101-58 +- Updating kdump.init and mkdumprd with most recent RHEL5 fixes +- Fixing BuildReq to require elfutils-devel-static + +* Thu Jan 04 2007 Neil Horman <nhorman@redhat.com> - 1.101-56 +- Fix option parsing problem for bzImage files (bz 221272) + +* Fri Dec 15 2006 Neil Horman <nhorman@redhat.com> - 1.101-55 +- Wholesale update of RHEL5 revisions 55-147 + +* Tue Aug 29 2006 Neil Horman <nhorman@redhat.com> - 1.101-54 +- integrate default elf format patch + +* Tue Aug 29 2006 Neil Horman <nhorman@redhat.com> - 1.101-53 +- Taking Viveks x86_64 crashdump patch (rcv. via email) + +* Tue Aug 29 2006 Neil Horman <nhorman@redhat.com> - 1.101-52 +- Taking ia64 tools patch for bz 181358 + +* Mon Aug 28 2006 Neil Horman <nhorman@redhat.com> - 1.101-51 +- more doc updates +- added patch to fix build break from kernel headers change + +* Thu Aug 24 2006 Neil Horman <nhorman@redhat.com> - 1.101-50 +- repo patch to enable support for relocatable kernels. + +* Thu Aug 24 2006 Neil Horman <nhorman@redhat.com> - 1.101-49 +- rewriting kcp to properly do ssh and scp +- updating mkdumprd to use new kcp syntax + +* Wed Aug 23 2006 Neil Horman <nhorman@redhat.com> - 1.101-48 +- Bumping revision number + +* Tue Aug 22 2006 Jarod Wilson <jwilson@redhat.com> - 1.101-47 +- ppc64 no-more-platform fix + +* Mon Aug 21 2006 Jarod Wilson <jwilson@redhat.com> - 1.101-46 +- ppc64 fixups: + - actually build ppc64 binaries (bug 203407) + - correct usage output + - avoid segfault in command-line parsing +- install kexec man page +- use regulation Fedora BuildRoot + +* Fri Aug 18 2006 Neil Horman <nhorman@redhat.com> - 1.101-45 +- fixed typo in mkdumprd for bz 202983 +- fixed typo in mkdumprd for bz 203053 +- clarified docs in kdump.conf with examples per bz 203015 + +* Tue Aug 15 2006 Neil Horman <nhorman@redhat.com> - 1.101-44 +- updated init script to implement status function/scrub err messages + +* Wed Aug 09 2006 Jarod Wilson <jwilson@redhat.com> - 1.101-43 +- Misc spec cleanups and macro-ifications + +* Wed Aug 09 2006 Jarod Wilson <jwilson@redhat.com> - 1.101-42 +- Add %%dir /var/crash, so default kdump setup works + +* Thu Aug 03 2006 Neil Horman <nhorman@redhat.com> - 1.101-41 +- fix another silly makefile error for makedumpfile + +* Thu Aug 03 2006 Neil Horman <nhorman@redhat.com> - 1.101-40 +- exclude makedumpfile from build on non-x86[_64] arches + +* Thu Aug 03 2006 Neil Horman <nhorman@redhat.com> - 1.101-39 +- exclude makedumpfile from build on non-x86[_64] arches + +* Thu Aug 03 2006 Neil Horman <nhorman@redhat.com> - 1.101-38 +- updating makedumpfile makefile to use pkg-config on glib-2.0 + +* Thu Aug 03 2006 Neil Horman <nhorman@redhat.com> - 1.101-37 +- updating makedumpfile makefile to use pkg-config + +* Thu Aug 03 2006 Neil Horman <nhorman@redhat.com> - 1.101-36 +- Removing unneeded deps after Makefile fixup for makedumpfile + +* Thu Aug 03 2006 Neil Horman <nhorman@redhat.com> - 1.101-35 +- fixing up FC6/RHEL5 BuildRequires line to build in brew + +* Wed Aug 02 2006 Neil Horman <nhorman@redhat.com> - 1.101-34 +- enabling makedumpfile in build + +* Wed Aug 02 2006 Neil Horman <nhorman@redhat.com> - 1.101-33 +- added makedumpfile source to package + +* Mon Jul 31 2006 Neil Horman <nhorman@redhat.com> - 1.101-32 +- added et-dyn patch to allow loading of relocatable kernels + +* Thu Jul 27 2006 Neil Horman <nhorman@redhat.com> - 1.101-30 +- fixing up missing patch to kdump.init + +* Wed Jul 19 2006 Neil Horman <nhorman@redhat.com> - 1.101-30 +- add kexec frontend (bz 197695) + +* Wed Jul 12 2006 Jesse Keating <jkeating@redhat.com> - 1.101-29 +- rebuild + +* Fri Jul 07 2006 Neil Horman <nhorman@redhat.com> 1.101-27.fc6 +- Buildrequire zlib-devel + +* Thu Jun 22 2006 Neil Horman <nhorman@redhat.com> -1.101-19 +- Bumping rev number + +* Thu Jun 22 2006 Neil Horman <nhorman@redhat.com> -1.101-17 +- Add patch to allow ppc64 to ignore args-linux option + +* Wed Mar 08 2006 Bill Nottingham <notting@redhat.com> - 1.101-16 +- fix scriptlet - call chkconfig --add, change the default in the + script itself (#183633) + +* Wed Mar 08 2006 Thomas Graf <tgraf@redhat.com> - 1.101-15 +- Don't add kdump service by default, let the user manually add it to + avoid everyone seeing a warning. + +* Tue Mar 07 2006 Thomas Graf <tgraf@redhat.com> - 1.101-14 +- Fix kdump.init to call kexec from its new location + +* Mon Mar 6 2006 Jeremy Katz <katzj@redhat.com> - 1.101-13 +- proper requires for scriptlets + +* Mon Mar 06 2006 Thomas Graf <tgraf@redhat.com> - 1.101-12 +- Move kexec and kdump binaries to /sbin + +* Thu Mar 02 2006 Thomas Graf <tgraf@redhat.com> - 1.101-11 +- Fix argument order when stopping kexec + +* Mon Feb 27 2006 Thomas Graf <tgraf@redhat.com> - 1.101-10 +- kdump7.patch + o Remove elf32 core headers support for x86_64 + o Fix x86 prepare elf core header routine + o Fix ppc64 kexec -p failure for gcc 4.10 + o Fix few warnings for gcc 4.10 + o Add the missing --initrd option for ppc64 + o Fix ppc64 persistent root device bug +- Remove --elf32-core-headers from default configuration, users + may re-add it via KEXEC_ARGS. +- Remove obsolete KEXEC_HEADERS +* Wed Feb 22 2006 Thomas Graf <tgraf@redhat.com> - 1.101-9 +- Remove wrong quotes around --command-line in kdump.init + +* Fri Feb 17 2006 Jeff Moyer <jmoyer@redhat.com> - 1.101-8 +- Fix the service stop case. It was previously unloading the wrong kernel. +- Implement the "restart" function. +- Add the "irqpoll" option as a default kdump kernel commandline parameter. +- Create a default kernel command line in the sysconfig file upon rpm install. + +* Tue Feb 07 2006 Jesse Keating <jkeating@redhat.com> - 1.101-7.1.1 +- rebuilt for new gcc4.1 snapshot and glibc changes + +* Thu Feb 02 2006 Thomas Graf <tgraf@redhat.com> - 1.101-7.1 +- Add patch to enable the kdump binary for x86_64 +* Wed Feb 01 2006 Thomas Graf <tgraf@redhat.com> +- New kdump patch to support s390 arch + various fixes +- Include kdump in x86_64 builds +* Mon Jan 30 2006 Thomas Graf <tgraf@redhat.com> +- New kdump patch to support x86_64 userspace + +* Fri Dec 16 2005 Jesse Keating <jkeating@redhat.com> +- rebuilt for new gcj + +* Wed Nov 16 2005 Thomas Graf <tgraf@redhat.com> - 1.101-5 +- Report missing kdump kernel image as warning + +* Thu Nov 3 2005 Jeff Moyer <jmoyer@redhat.com> - 1.101-4 +- Build for x86_64 as well. Kdump support doesn't work there, but users + should be able to use kexec. + +* Fri Sep 23 2005 Jeff Moyer <jmoyer@redhat.com> - 1.101-3 +- Add a kdump sysconfig file and init script +- Spec file additions for pre/post install/uninstall + +* Thu Aug 25 2005 Jeff Moyer <jmoyer@redhat.com> +- Initial prototype for RH/FC5