diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..297060f --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +SOURCES/eppic_050615.tar.gz +SOURCES/kexec-tools-2.0.19.tar.xz +SOURCES/makedumpfile-1.6.5.tar.gz diff --git a/.kexec-tools.metadata b/.kexec-tools.metadata new file mode 100644 index 0000000..b43204b --- /dev/null +++ b/.kexec-tools.metadata @@ -0,0 +1,3 @@ +a096c8e0892b559f40b01916aae240652f75b68a SOURCES/eppic_050615.tar.gz +5d080337da7a1603e542fc3db1f08cf8685eda02 SOURCES/kexec-tools-2.0.19.tar.xz +700f2ff13f75d97a0df2303ff9f580cdddadf7b0 SOURCES/makedumpfile-1.6.5.tar.gz 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..1a91220 --- /dev/null +++ b/SOURCES/98-kexec.rules.ppc64 @@ -0,0 +1,15 @@ +SUBSYSTEM=="cpu", ACTION=="online", 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/dracut-early-kdump-module-setup.sh b/SOURCES/dracut-early-kdump-module-setup.sh new file mode 100755 index 0000000..e069867 --- /dev/null +++ b/SOURCES/dracut-early-kdump-module-setup.sh @@ -0,0 +1,65 @@ +#!/bin/bash + +. /etc/sysconfig/kdump +. /lib/kdump/kdump-lib.sh + +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() { + KDUMP_BOOTDIR=$(check_boot_dir "${KDUMP_BOOTDIR}") + if [ -z "$KDUMP_KERNELVER" ]; then + kdump_kver=`uname -r` + if [ "$kernel" != "$kdump_kver" ]; then + dwarn "Using current kernel version '$kdump_kver' for early kdump," \ + "but the initramfs is generated for kernel version '$kernel'" + fi + else + kdump_kver=$KDUMP_KERNELVER + fi + KDUMP_KERNEL="${KDUMP_BOOTDIR}/${KDUMP_IMG}-${kdump_kver}${KDUMP_IMG_EXT}" + KDUMP_INITRD="${KDUMP_BOOTDIR}/initramfs-${kdump_kver}kdump.img" +} + +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_script "/lib/kdump/kdump-lib.sh" "/lib/kdump-lib.sh" + inst_hook cmdline 00 "$moddir/early-kdump.sh" + inst_binary "$KDUMP_KERNEL" + inst_binary "$KDUMP_INITRD" + + ln_r "$KDUMP_KERNEL" "${KDUMP_BOOTDIR}/${KDUMP_IMG}-earlykdump${KDUMP_IMG_EXT}" + ln_r "$KDUMP_INITRD" "${KDUMP_BOOTDIR}/initramfs-earlykdump.img" + + 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..69a34eb --- /dev/null +++ b/SOURCES/dracut-early-kdump.sh @@ -0,0 +1,75 @@ +#! /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 + +prepare_parameters() +{ + EARLY_KDUMP_CMDLINE=$(prepare_cmdline "${KDUMP_COMMANDLINE}" "${KDUMP_COMMANDLINE_REMOVE}" "${KDUMP_COMMANDLINE_APPEND}") + KDUMP_BOOTDIR=$(check_boot_dir "${KDUMP_BOOTDIR}") + + EARLY_KDUMP_KERNEL="${KDUMP_BOOTDIR}/${KDUMP_IMG}-earlykdump${KDUMP_IMG_EXT}" + EARLY_KDUMP_INITRD="${KDUMP_BOOTDIR}/initramfs-earlykdump.img" +} + +early_kdump_load() +{ + check_kdump_feasibility + if [ $? -ne 0 ]; then + return 1 + fi + + if is_fadump_capable; then + echo "WARNING: early kdump doesn't support fadump." + return 1 + fi + + check_current_kdump_status + if [ $? == 0 ]; then + return 1 + fi + + prepare_parameters + + EARLY_KEXEC_ARGS=$(prepare_kexec_args "${KEXEC_ARGS}") + + if is_secure_boot_enforced; then + echo "Secure Boot is enabled. Using kexec file based syscall." + EARLY_KEXEC_ARGS="$EARLY_KEXEC_ARGS -s" + fi + + $KEXEC ${EARLY_KEXEC_ARGS} $standard_kexec_args \ + --command-line="$EARLY_KDUMP_CMDLINE" \ + --initrd=$EARLY_KDUMP_INITRD $EARLY_KDUMP_KERNEL + if [ $? == 0 ]; then + echo "kexec: loaded early-kdump kernel" + return 0 + else + echo "kexec: failed to load early-kdump kernel" + return 1 + fi +} + +set_early_kdump() +{ + if getargbool 0 rd.earlykdump; then + echo "early-kdump is enabled." + early_kdump_load + else + echo "early-kdump is disabled." + fi + + return 0 +} + +set_early_kdump 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..e023284 --- /dev/null +++ b/SOURCES/dracut-kdump-emergency.service @@ -0,0 +1,28 @@ +# 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. + +# This service will be placed in kdump initramfs and replace both the systemd +# emergency service and dracut emergency shell. IOW, any emergency will be +# kick this service and in turn isolating to kdump error handler. + +[Unit] +Description=Kdump Emergency +DefaultDependencies=no +IgnoreOnIsolate=yes + +[Service] +ExecStart=/usr/bin/systemctl --no-block isolate kdump-error-handler.service +Type=oneshot +StandardInput=tty-force +StandardOutput=inherit +StandardError=inherit +KillMode=process +IgnoreSIGPIPE=no + +# 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-error-handler.service b/SOURCES/dracut-kdump-error-handler.service new file mode 100644 index 0000000..32b74ab --- /dev/null +++ b/SOURCES/dracut-kdump-error-handler.service @@ -0,0 +1,34 @@ +# 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. + +# 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 +AllowIsolate=yes + +[Service] +Environment=HOME=/ +Environment=DRACUT_SYSTEMD=1 +Environment=NEWROOT=/sysroot +WorkingDirectory=/ +ExecStart=/bin/kdump-error-handler.sh +ExecStopPost=-/usr/bin/systemctl --fail --no-block default +Type=oneshot +StandardInput=tty-force +StandardOutput=inherit +StandardError=inherit +KillMode=process +IgnoreSIGPIPE=no + +# Bash ignores SIGTERM, so we send SIGHUP instead, to ensure that bash +# terminates cleanly. +KillSignal=SIGHUP diff --git a/SOURCES/dracut-kdump-error-handler.sh b/SOURCES/dracut-kdump-error-handler.sh new file mode 100755 index 0000000..fc2b932 --- /dev/null +++ b/SOURCES/dracut-kdump-error-handler.sh @@ -0,0 +1,10 @@ +#!/bin/sh + +. /lib/kdump-lib-initramfs.sh + +set -o pipefail +export PATH=$PATH:$KDUMP_SCRIPT_DIR + +get_kdump_confs +do_failure_action +do_final_action diff --git a/SOURCES/dracut-kdump.sh b/SOURCES/dracut-kdump.sh new file mode 100755 index 0000000..2ae1c7c --- /dev/null +++ b/SOURCES/dracut-kdump.sh @@ -0,0 +1,203 @@ +#!/bin/sh + +# continue here only if we have to save dump. +if [ -f /etc/fadump.initramfs ] && [ ! -f /proc/device-tree/rtas/ibm,kernel-dump ]; then + exit 0 +fi + +exec &> /dev/console +. /lib/dracut-lib.sh +. /lib/kdump-lib-initramfs.sh + +set -o pipefail +DUMP_RETVAL=0 + +export PATH=$PATH:$KDUMP_SCRIPT_DIR + +do_dump() +{ + local _ret + + eval $DUMP_INSTRUCTION + _ret=$? + + if [ $_ret -ne 0 ]; then + echo "kdump: saving vmcore failed" + fi + + return $_ret +} + +do_kdump_pre() +{ + if [ -n "$KDUMP_PRE" ]; then + "$KDUMP_PRE" + fi +} + +do_kdump_post() +{ + if [ -n "$KDUMP_POST" ]; then + "$KDUMP_POST" "$1" + fi +} + +add_dump_code() +{ + DUMP_INSTRUCTION=$1 +} + +dump_raw() +{ + local _raw=$1 + + [ -b "$_raw" ] || return 1 + + echo "kdump: saving to raw disk $_raw" + + if ! $(echo -n $CORE_COLLECTOR|grep -q makedumpfile); then + _src_size=`ls -l /proc/vmcore | cut -d' ' -f5` + _src_size_mb=$(($_src_size / 1048576)) + monitor_dd_progress $_src_size_mb & + fi + + echo "kdump: saving vmcore" + $CORE_COLLECTOR /proc/vmcore | dd of=$_raw bs=$DD_BLKSIZE >> /tmp/dd_progress_file 2>&1 || return 1 + sync + + echo "kdump: saving vmcore complete" + return 0 +} + +dump_ssh() +{ + local _opt="-i $1 -o BatchMode=yes -o StrictHostKeyChecking=yes" + local _dir="$KDUMP_PATH/$HOST_IP-$DATEDIR" + local _host=$2 + + echo "kdump: saving to $_host:$_dir" + + cat /var/lib/random-seed > /dev/urandom + ssh -q $_opt $_host mkdir -p $_dir || return 1 + + save_vmcore_dmesg_ssh ${DMESG_COLLECTOR} ${_dir} "${_opt}" $_host + + echo "kdump: saving vmcore" + + if [ "${CORE_COLLECTOR%%[[:blank:]]*}" = "scp" ]; then + scp -q $_opt /proc/vmcore "$_host:$_dir/vmcore-incomplete" || return 1 + ssh $_opt $_host "mv $_dir/vmcore-incomplete $_dir/vmcore" || return 1 + else + $CORE_COLLECTOR /proc/vmcore | ssh $_opt $_host "dd bs=512 of=$_dir/vmcore-incomplete" || return 1 + ssh $_opt $_host "mv $_dir/vmcore-incomplete $_dir/vmcore.flat" || return 1 + fi + + echo "kdump: saving vmcore complete" + return 0 +} + +save_vmcore_dmesg_ssh() { + local _dmesg_collector=$1 + local _path=$2 + local _opts="$3" + local _location=$4 + + echo "kdump: saving vmcore-dmesg.txt" + $_dmesg_collector /proc/vmcore | ssh $_opts $_location "dd of=$_path/vmcore-dmesg-incomplete.txt" + _exitcode=$? + + if [ $_exitcode -eq 0 ]; then + ssh -q $_opts $_location mv $_path/vmcore-dmesg-incomplete.txt $_path/vmcore-dmesg.txt + echo "kdump: saving vmcore-dmesg.txt complete" + else + echo "kdump: saving vmcore-dmesg.txt failed" + fi +} + +get_host_ip() +{ + local _host + if is_nfs_dump_target || is_ssh_dump_target + then + kdumpnic=$(getarg kdumpnic=) + [ -z "$kdumpnic" ] && echo "kdump: failed to get kdumpnic!" && return 1 + _host=`ip addr show dev $kdumpnic|grep '[ ]*inet'` + [ $? -ne 0 ] && echo "kdump: wrong kdumpnic: $kdumpnic" && return 1 + _host=`echo $_host | head -n 1 | cut -d' ' -f2` + _host="${_host%%/*}" + [ -z "$_host" ] && echo "kdump: wrong kdumpnic: $kdumpnic" && return 1 + HOST_IP=$_host + fi + return 0 +} + +read_kdump_conf() +{ + if [ ! -f "$KDUMP_CONF" ]; then + echo "kdump: $KDUMP_CONF not found" + return + fi + + get_kdump_confs + + # rescan for add code for dump target + while read 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") + [ -n "$config_val" ] && add_dump_code "dump_fs $config_val" + ;; + ext[234]|xfs|btrfs|minix|nfs) + add_dump_code "dump_fs $config_val" + ;; + raw) + add_dump_code "dump_raw $config_val" + ;; + ssh) + add_dump_code "dump_ssh $SSH_KEY_LOCATION $config_val" + ;; + esac + done <<< "$(read_strip_comments $KDUMP_CONF)" +} + +fence_kdump_notify() +{ + if [ -n "$FENCE_KDUMP_NODES" ]; then + $FENCE_KDUMP_SEND $FENCE_KDUMP_ARGS $FENCE_KDUMP_NODES & + fi +} + +read_kdump_conf +fence_kdump_notify + +get_host_ip +if [ $? -ne 0 ]; then + echo "kdump: get_host_ip exited with non-zero status!" + exit 1 +fi + +if [ -z "$DUMP_INSTRUCTION" ]; then + add_dump_code "dump_fs $NEWROOT" +fi + +do_kdump_pre +if [ $? -ne 0 ]; then + echo "kdump: kdump_pre script exited with non-zero status!" + do_final_action +fi +make_trace_mem "kdump saving vmcore" '1:shortmem' '2+:mem' '3+:slab' +do_dump +DUMP_RETVAL=$? + +do_kdump_post $DUMP_RETVAL +if [ $? -ne 0 ]; then + echo "kdump: 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..e3dc198 --- /dev/null +++ b/SOURCES/dracut-module-setup.sh @@ -0,0 +1,804 @@ +#!/bin/bash + +. $dracutfunctions +. /lib/kdump/kdump-lib.sh + +if ! [[ -d "${initdir}/tmp" ]]; then + mkdir -p "${initdir}/tmp" +fi + +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" + + 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 + } + + if is_squash_available; then + _dep="$_dep squash" + else + dwarning "Required modules to build a squashed kdump image is missing!" + fi + + if [ -n "$( find /sys/devices -name drm )" ] || [ -d /sys/module/hyperv_fb ]; then + _dep="$_dep drm" + fi + + if is_generic_fence_kdump -o is_pcs_fence_kdump; then + _dep="$_dep network" + fi + + echo $_dep + return 0 +} + +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") +} + +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 + + ifcfg_file=$(get_ifcfg_filename $1) + if [ -f "${ifcfg_file}" ]; then + . ${ifcfg_file} + else + dwarning "The ifcfg file of $1 is not found!" + fi +} + +# $1: netdev name +kdump_setup_dns() { + local _nameserver _dns + local _dnsfile=${initdir}/etc/cmdline.d/42dns.conf + + source_ifcfg_file $1 + + [ -n "$DNS1" ] && echo "nameserver=$DNS1" > "$_dnsfile" + [ -n "$DNS2" ] && echo "nameserver=$DNS2" >> "$_dnsfile" + + while read content; + do + _nameserver=$(echo $content | grep ^nameserver) + [ -z "$_nameserver" ] && continue + + _dns=$(echo $_nameserver | cut -d' ' -f2) + [ -z "$_dns" ] && continue + + if [ ! -f $_dnsfile ] || [ ! $(cat $_dnsfile | grep -q $_dns) ]; then + echo "nameserver=$_dns" >> "$_dnsfile" + fi + done < "/etc/resolv.conf" +} + +#$1: netdev name +#$2: srcaddr +#if it use static ip echo it, or echo null +kdump_static_ip() { + local _netdev="$1" _srcaddr="$2" _ipv6_flag + local _netmask _gateway _ipaddr _target _nexthop + + _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 + _netmask=$(ipcalc -m $_ipaddr | cut -d'=' -f2) + fi + echo -n "${_srcaddr}::${_gateway}:${_netmask}::" + fi + + /sbin/ip $_ipv6_flag route show | grep -v default | grep ".*via.* $_netdev " |\ + while read _route; do + _target=`echo $_route | cut -d ' ' -f1` + _nexthop=`echo $_route | cut -d ' ' -f3` + if [ "x" != "x"$_ipv6_flag ]; then + _target="[$_target]" + _nexthop="[$_nexthop]" + fi + echo "rd.route=$_target:$_nexthop:$_netdev" + done >> ${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=$(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 `ls /sys/class/net/$_netdev/brif/`; do + _kdumpdev=$_dev + if kdump_is_bond "$_dev"; then + kdump_setup_bond "$_dev" + 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:$(echo $_brif | sed -e 's/,$//')" >> ${initdir}/etc/cmdline.d/41bridge.conf +} + +kdump_setup_bond() { + local _netdev=$1 + local _dev _mac _slaves _kdumpdev + 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:$(echo $_slaves | sed 's/,$//')" >> ${initdir}/etc/cmdline.d/42bond.conf + # Get bond options specified in ifcfg + + source_ifcfg_file $_netdev + + bondoptions="$(echo :$BONDING_OPTS | sed 's/\s\+/,/')" + 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:$(echo $_slaves | sed -e 's/,$//')" >> ${initdir}/etc/cmdline.d/44team.conf + #Buggy version teamdctl outputs to stderr! + #Try to use the latest version of teamd. + teamdctl "$_netdev" config dump > ${initdir}/tmp/$$-$_netdev.conf + if [ $? -ne 0 ] + 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="$(awk '/^Device:/{print $2}' /proc/net/vlan/"$_netdev")" + local _netmac="$(kdump_get_mac_addr $_phydev)" + local _kdumpdev + + #Just support vlan over bond, it is not easy + #to support all other complex setup + if kdump_is_bridge "$_phydev"; then + derror "Vlan over bridge is not supported!" + exit 1 + elif kdump_is_team "$_phydev"; then + derror "Vlan over team is not supported!" + exit 1 + elif kdump_is_bond "$_phydev"; then + kdump_setup_bond "$_phydev" + echo " vlan=$_netdev:$_phydev" > ${initdir}/etc/cmdline.d/43vlan.conf + else + _kdumpdev="$(kdump_setup_ifname $_phydev)" + echo " vlan=$_netdev:$_kdumpdev ifname=$_kdumpdev:$_netmac" > ${initdir}/etc/cmdline.d/43vlan.conf + fi +} + +# setup s390 znet cmdline +# $1: netdev name +kdump_setup_znet() { + local _options="" + + source_ifcfg_file $1 + + for i in $OPTIONS; do + _options=${_options},$i + done + echo rd.znet=${NETTYPE},${SUBCHANNELS}${_options} > ${initdir}/etc/cmdline.d/30znet.conf +} + +# Setup dracut to bringup a given network interface +kdump_setup_netdev() { + local _netdev=$1 _srcaddr=$2 + local _static _proto _ip_conf _ip_opts _ifname_opts + local _netmac=$(kdump_get_mac_addr $_netdev) + + if [ "$(uname -m)" = "s390x" ]; then + kdump_setup_znet $_netdev + fi + + _static=$(kdump_static_ip $_netdev $_srcaddr) + if [ -n "$_static" ]; then + _proto=none + elif is_ipv6_address $_srcaddr; then + _proto=either6 + else + _proto=dhcp + fi + + _ip_conf="${initdir}/etc/cmdline.d/40ip.conf" + _ip_opts=" ip=${_static}$(kdump_setup_ifname $_netdev):${_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" + elif kdump_is_team "$_netdev"; then + kdump_setup_team "$_netdev" + elif kdump_is_vlan "$_netdev"; then + kdump_setup_vlan "$_netdev" + else + _ifname_opts=" ifname=$(kdump_setup_ifname $_netdev):$_netmac" + echo "$_ifname_opts" >> $_ip_conf + fi + + kdump_setup_dns "$_netdev" +} + +get_ip_route_field() +{ + if `echo $1 | grep -q $2`; then + echo ${1##*$2} | cut -d ' ' -f1 + fi +} + +#Function:kdump_install_net +#$1: config values of net line in kdump.conf +#$2: srcaddr of network device +kdump_install_net() { + local _server _netdev _srcaddr _route _serv_tmp + local config_val="$1" + + _server=$(get_remote_host $config_val) + + if is_hostname $_server; then + _serv_tmp=`getent ahosts $_server | grep -v : | head -n 1` + if [ -z "$_serv_tmp" ]; then + _serv_tmp=`getent ahosts $_server | head -n 1` + fi + _server=`echo $_serv_tmp | cut -d' ' -f1` + fi + + _route=`/sbin/ip -o route get to $_server 2>&1` + [ $? != 0 ] && echo "Bad kdump location: $config_val" && exit 1 + + #the field in the ip output changes if we go to another subnet + _srcaddr=$(get_ip_route_field "$_route" "src") + _netdev=$(get_ip_route_field "$_route" "dev") + + kdump_setup_netdev "${_netdev}" "${_srcaddr}" + + #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=$(kdump_setup_ifname $_netdev)" > ${initdir}/etc/cmdline.d/60kdumpnic.conf + echo "bootdev=$(kdump_setup_ifname $_netdev)" > ${initdir}/etc/cmdline.d/70bootdev.conf + fi +} + +default_dump_target_install_conf() +{ + local _target _fstype + local _mntpoint _save_path + + is_user_configured_dump_target && return + + _save_path=$(get_option_value "path") + [ -z "$_save_path" ] && _save_path=$DEFAULT_PATH + + # strip the duplicated "/" + _save_path=$(echo $_save_path | tr -s /) + + _mntpoint=$(get_mntpoint_from_path $_save_path) + _target=$(get_target_from_path $_save_path) + + if is_atomic && is_bind_mount $_mntpoint; then + _save_path=${_save_path##"$_mntpoint"} + # the real dump path in the 2nd kernel, if the mount point is bind mounted. + _save_path=$(get_bind_mount_directory $_mntpoint)/$_save_path + _mntpoint=$(get_mntpoint_from_target $_target) + + # the absolute path in the 1st kernel + _save_path=$_mntpoint/$_save_path + fi + + _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 + + # strip the duplicated "/" + _save_path=$(echo $_save_path | tr -s /) + # 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 +} + +adjust_bind_mount_path() +{ + local _target=$1 + local _save_path=$(get_option_value "path") + [ -z "$_save_path" ] && _save_path=$DEFAULT_PATH + + # strip the duplicated "/" + _save_path=$(echo $_save_path | tr -s /) + + local _absolute_save_path=$(get_mntpoint_from_target $_target)/$_save_path + _absolute_save_path=$(echo "$_absolute_save_path" | tr -s /) + local _mntpoint=$(get_mntpoint_from_path $_absolute_save_path) + + if is_bind_mount $_mntpoint; then + _save_path=${_absolute_save_path##"$_mntpoint"} + # the real dump path in the 2nd kernel, if the mount point is bind mounted. + _save_path=$(get_bind_mount_directory $_mntpoint)/$_save_path + + #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 + fi +} + +#install kdump.conf and what user specifies in kdump.conf +kdump_install_conf() { + local _opt _val _pdev + sed -ne '/^#/!p' /etc/kdump.conf > ${initdir}/tmp/$$-kdump.conf + + while read _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 + if is_atomic; then + adjust_bind_mount_path "$_val" + fi + ;; + 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) + dracut_install $_val + ;; + core_collector) + dracut_install "${_val%%[[:blank:]]*}" + ;; + esac + done <<< "$(read_strip_comments /etc/kdump.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 _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 netdev + local srcaddr + local idev + 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" + + netdev=$(/sbin/ip route get to ${tgt_ipaddr} | \ + sed 's|.*dev \(.*\).*|\1|g') + srcaddr=$(echo $netdev | awk '{ print $3; exit }') + netdev=$(echo $netdev | awk '{ print $1; exit }') + + kdump_setup_netdev $netdev $srcaddr + + # 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 + initiator_str=$(kdump_get_iscsi_initiator) + [ $? -ne "0" ] && derror "Failed to get initiator name" && return 1 + + # 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)" + 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 + } +} + +# retrieves fence_kdump nodes from Pacemaker cluster configuration +get_pcs_fence_kdump_nodes() { + local nodes + + # 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 [ "$nodename" = `hostname` -o "$nodename" = `hostname -s` ]; 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 +} + +# 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_option_value "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=`cat /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 +} + +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_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 "/sbin/makedumpfile" "/sbin/makedumpfile" + inst "/sbin/vmcore-dmesg" "/sbin/vmcore-dmesg" + inst "/lib/kdump/kdump-lib.sh" "/lib/kdump-lib.sh" + inst "/lib/kdump/kdump-lib-initramfs.sh" "/lib/kdump-lib-initramfs.sh" + inst "$moddir/kdump.sh" "/usr/bin/kdump.sh" + inst "$moddir/kdump-capture.service" "$systemdsystemunitdir/kdump-capture.service" + ln_r "$systemdsystemunitdir/kdump-capture.service" "$systemdsystemunitdir/initrd.target.wants/kdump-capture.service" + inst "$moddir/kdump-error-handler.sh" "/usr/bin/kdump-error-handler.sh" + inst "$moddir/kdump-error-handler.service" "$systemdsystemunitdir/kdump-error-handler.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 + + # 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 + + # Kdump turns out to require longer default systemd mount timeout + # than 1st kernel(90s by default), we use default 300s for kdump. + grep -r "^[[:space:]]*DefaultTimeoutStartSec=" ${initdir}/etc/systemd/system.conf* &>/dev/null + if [ $? -ne 0 ]; 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 +} 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..b8cab6a --- /dev/null +++ b/SOURCES/early-kdump-howto.txt @@ -0,0 +1,74 @@ +Early Kdump HOWTO + +Introduction +------------ + +Kdump service starts too late, so early crashes will have no chance to get +kdump kernel booting, this will cause crash information to be lost. It is +necessary to add a dracut module in order to load crash kernel and initramfs +as early as possible. You can provide "rd.earlykdump" in grub commandline +to enable, then the early kdump will load those files like the normal kdump, +which 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 --add earlykdump + +3. add rd.earlykdump in grub kernel command line. + +Note: +[1]. Early kdump initramfs size will be large because it includes vmlinuz and +kdump initramfs. And for step 2 if you are sure to overwrite system initramfs +you can backup the original initramfs and use "--force" option. + +[2]. 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. + +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 -x|grep early-kdump + +Then, you will see some useful logs, for exapmle: + +1. if early kdump is successful. +Mar 09 09:57:56 localhost.localdomain dracut-cmdline[190]: early-kdump is enabled. +Mar 09 09:57:56 localhost.localdomain dracut-cmdline[190]: kexec: loaded early- +kdump kernel + +2. if early kdump is disabled. +Mar 09 10:02:47 localhost.localdomain dracut-cmdline[189]: early-kdump is disabled. + +Limitation +---------- + +At present, early kdump doesn't support fadump. diff --git a/SOURCES/kdump-dep-generator.sh b/SOURCES/kdump-dep-generator.sh new file mode 100644 index 0000000..b6fab2d --- /dev/null +++ b/SOURCES/kdump-dep-generator.sh @@ -0,0 +1,22 @@ +#!/bin/sh + +# More details about systemd generator: +# http://www.freedesktop.org/wiki/Software/systemd/Generators/ + +. /usr/lib/kdump/kdump-lib.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..817ba01 --- /dev/null +++ b/SOURCES/kdump-lib-initramfs.sh @@ -0,0 +1,177 @@ +# These variables and functions are useful in 2nd kernel + +. /lib/kdump-lib.sh + +KDUMP_PATH="/var/crash" +CORE_COLLECTOR="" +DEFAULT_CORE_COLLECTOR="makedumpfile -l --message-level 1 -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" +KDUMP_SCRIPT_DIR="/kdumpscripts" +DD_BLKSIZE=512 +FINAL_ACTION="systemctl reboot -f" +KDUMP_CONF="/etc/kdump.conf" +KDUMP_PRE="" +KDUMP_POST="" +NEWROOT="/sysroot" + +get_kdump_confs() +{ + local config_opt config_val + + while read 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" + ;; + halt) + FAILURE_ACTION="halt" + ;; + poweroff) + FAILURE_ACTION="systemctl poweroff -f" + ;; + 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 <<< "$(read_strip_comments $KDUMP_CONF)" + + 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 +} + +# dump_fs <mount point| device> +dump_fs() +{ + + local _dev=$(findmnt -k -f -n -r -o SOURCE $1) + local _mp=$(findmnt -k -f -n -r -o TARGET $1) + + echo "kdump: dump target is $_dev" + + if [ -z "$_mp" ]; then + echo "kdump: error: Dump target $_dev is not mounted." + return 1 + fi + + # Remove -F in makedumpfile case. We don't want a flat format dump here. + [[ $CORE_COLLECTOR = *makedumpfile* ]] && CORE_COLLECTOR=`echo $CORE_COLLECTOR | sed -e "s/-F//g"` + + echo "kdump: saving to $_mp/$KDUMP_PATH/$HOST_IP-$DATEDIR/" + + mount -o remount,rw $_mp || return 1 + mkdir -p $_mp/$KDUMP_PATH/$HOST_IP-$DATEDIR || return 1 + + save_vmcore_dmesg_fs ${DMESG_COLLECTOR} "$_mp/$KDUMP_PATH/$HOST_IP-$DATEDIR/" + + echo "kdump: saving vmcore" + $CORE_COLLECTOR /proc/vmcore $_mp/$KDUMP_PATH/$HOST_IP-$DATEDIR/vmcore-incomplete || return 1 + mv $_mp/$KDUMP_PATH/$HOST_IP-$DATEDIR/vmcore-incomplete $_mp/$KDUMP_PATH/$HOST_IP-$DATEDIR/vmcore + sync + + echo "kdump: saving vmcore complete" + # improper kernel cmdline can cause the failure of echo, we can ignore this kind of failure + return 0 +} + +save_vmcore_dmesg_fs() { + local _dmesg_collector=$1 + local _path=$2 + + echo "kdump: saving vmcore-dmesg.txt" + $_dmesg_collector /proc/vmcore > ${_path}/vmcore-dmesg-incomplete.txt + _exitcode=$? + if [ $_exitcode -eq 0 ]; then + mv ${_path}/vmcore-dmesg-incomplete.txt ${_path}/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 + echo "kdump: saving vmcore-dmesg.txt complete" + else + echo "kdump: saving vmcore-dmesg.txt failed" + fi +} + +dump_to_rootfs() +{ + + echo "Kdump: trying to bring up rootfs device" + systemctl start dracut-initqueue + echo "Kdump: waiting for rootfs mount, will timeout after 90 seconds" + systemctl start sysroot.mount + + dump_fs $NEWROOT +} + +kdump_emergency_shell() +{ + echo "PS1=\"kdump:\\\${PWD}# \"" >/etc/profile + /bin/dracut-emergency + rm -f /etc/profile +} + +do_failure_action() +{ + echo "Kdump: Executing failure action $FAILURE_ACTION" + eval $FAILURE_ACTION +} + +do_final_action() +{ + eval $FINAL_ACTION +} diff --git a/SOURCES/kdump-lib.sh b/SOURCES/kdump-lib.sh new file mode 100755 index 0000000..ef0151f --- /dev/null +++ b/SOURCES/kdump-lib.sh @@ -0,0 +1,729 @@ +#!/bin/sh +# +# Kdump common variables and functions +# + +DEFAULT_PATH="/var/crash/" +FENCE_KDUMP_CONFIG_FILE="/etc/sysconfig/fence_kdump" +FENCE_KDUMP_SEND="/usr/libexec/fence_kdump_send" +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=`cat $FADUMP_ENABLED_SYS_NODE` + [ $rc -eq 1 ] && return 0 + fi + return 1 +} + +perror_exit() { + echo $@ >&2 + exit 1 +} + +perror() { + echo $@ >&2 +} + +is_ssh_dump_target() +{ + grep -q "^ssh[[:blank:]].*@" /etc/kdump.conf +} + +is_nfs_dump_target() +{ + grep -q "^nfs" /etc/kdump.conf || \ + [[ $(get_dracut_args_fstype "$(grep "^dracut_args .*\-\-mount" /etc/kdump.conf)") = nfs* ]] +} + +is_raw_dump_target() +{ + grep -q "^raw" /etc/kdump.conf +} + +is_fs_type_nfs() +{ + local _fstype=$1 + [ $_fstype = "nfs" ] || [ $_fstype = "nfs4" ] && return 0 + return 1 +} + +is_fs_dump_target() +{ + egrep -q "^ext[234]|^xfs|^btrfs|^minix" /etc/kdump.conf +} + +strip_comments() +{ + echo $@ | sed -e 's/\(.*\)#.*/\1/' +} + +# Read from kdump config file stripping all comments +read_strip_comments() +{ + # strip heading spaces, and print any content starting with + # neither space or #, and strip everything after # + sed -n -e "s/^\s*\([^# \t][^#]\+\).*/\1/gp" $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 + + grep -q "^fence_kdump_nodes" /etc/kdump.conf +} + +to_dev_name() { + local dev="${1//\"/}" + + case "$dev" in + UUID=*) + dev=`blkid -U "${dev#UUID=}"` + ;; + LABEL=*) + dev=`blkid -L "${dev#LABEL=}"` + ;; + esac + echo $dev +} + +is_user_configured_dump_target() +{ + return $(is_mount_in_dracut_args || is_ssh_dump_target || is_nfs_dump_target || \ + is_raw_dump_target || is_fs_dump_target) +} + +get_user_configured_dump_disk() +{ + local _target + + _target=$(egrep "^ext[234]|^xfs|^btrfs|^minix|^raw" /etc/kdump.conf 2>/dev/null |awk '{print $2}') + [ -n "$_target" ] && echo $_target && return + + _target=$(get_dracut_args_target "$(grep "^dracut_args .*\-\-mount" /etc/kdump.conf)") + [ -b "$_target" ] && echo $_target +} + +get_root_fs_device() +{ + local _target + _target=$(findmnt -k -f -n -o SOURCE /) + [ -n "$_target" ] && echo $_target + + return +} + +get_save_path() +{ + local _save_path=$(grep "^path" /etc/kdump.conf|awk '{print $2}') + if [ -z "$_save_path" ]; then + _save_path=$DEFAULT_PATH + fi + + echo $_save_path +} + +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" ] && echo $(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" ] && echo $(to_dev_name $_target) +} + +is_dump_to_rootfs() +{ + grep -E "^(failure_action|default)[[:space:]]dump_to_rootfs" /etc/kdump.conf >/dev/null +} + +get_failure_action_target() +{ + local _target + + if is_dump_to_rootfs; then + # Get rootfs device name + _target=$(get_root_fs_device) + [ -b "$_target" ] && echo $(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" -a "$kdump_targets" != "$_root" ]; then + kdump_targets="$kdump_targets $_root" + fi + + echo "$kdump_targets" +} + + +# findmnt uses the option "-v, --nofsroot" to exclusive the [/dir] +# in the SOURCE column for bind-mounts, then if $_mntpoint equals to +# $_mntpoint_nofsroot, the mountpoint is not bind mounted directory. +is_bind_mount() +{ + local _mntpoint=$(findmnt $1 | tail -n 1 | awk '{print $2}') + local _mntpoint_nofsroot=$(findmnt -v $1 | tail -n 1 | awk '{print $2}') + + if [[ $_mntpoint = $_mntpoint_nofsroot ]]; then + return 1 + else + return 0 + fi +} + +# 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_directory() +{ + local _mntpoint=$(findmnt $1 | tail -n 1 | awk '{print $2}') + local _mntpoint_nofsroot=$(findmnt -v $1 | tail -n 1 | awk '{print $2}') + + _mntpoint=${_mntpoint#*$_mntpoint_nofsroot} + + _mntpoint=${_mntpoint#[} + _mntpoint=${_mntpoint%]} + + echo $_mntpoint +} + +get_mntpoint_from_path() +{ + echo $(df $1 | tail -1 | awk '{print $NF}') +} + +get_target_from_path() +{ + local _target + + _target=$(df $1 2>/dev/null | tail -1 | awk '{print $1}') + [[ "$_target" == "/dev/root" ]] && [[ ! -e /dev/root ]] && _target=$(get_root_fs_device) + echo $_target +} + +get_fs_type_from_target() +{ + echo $(findmnt -k -f -n -r -o FSTYPE $1) +} + +# input: device path +# output: the general mount point +# find the general mount point, not the bind mounted point in atomic +# As general system, Use the previous code +# +# ERROR and EXIT: +# the device can be umounted the general mount point, if one of the mount point is bind mounted +# For example: +# mount /dev/sda /mnt/ +# mount -o bind /mnt/var /var +# umount /mnt +get_mntpoint_from_target() +{ + if is_atomic; then + for _mnt in $(findmnt -k -n -r -o TARGET $1) + do + if ! is_bind_mount $_mnt; then + echo $_mnt + return + fi + done + + echo "Mount $1 firstly, without the bind mode" >&2 + exit 1 + else + echo $(findmnt -k -f -n -r -o TARGET $1) + fi +} + +# get_option_value <option_name> +# retrieves value of option defined in kdump.conf +get_option_value() { + echo $(strip_comments `grep "^$1[[:space:]]\+" /etc/kdump.conf | tail -1 | cut -d\ -f2-`) +} + +#This function compose a absolute path with the mount +#point and the relative $SAVE_PATH. +#target is passed in as argument, could be UUID, LABEL, +#block device or even nfs server export of the form of +#"my.server.com:/tmp/export"? +#And possibly this could be used for both default case +#as well as when dump taret is specified. When dump +#target is not specified, then $target would be null. +make_absolute_save_path() +{ + local _target=$1 + local _mnt + + [ -n $_target ] && _mnt=$(get_mntpoint_from_target $1) + _mnt="${_mnt}/$SAVE_PATH" + + # strip the duplicated "/" + echo "$_mnt" | tr -s / +} + +check_save_path_fs() +{ + local _path=$1 + + if [ ! -d $_path ]; then + perror_exit "Dump path $_path does not exist." + fi +} + +is_atomic() +{ + grep -q "ostree" /proc/cmdline +} + +# fixme, try the best to decide whether the ipv6 addr is allocated by slaac or dhcp6 +is_ipv6_auto() +{ + local _netdev=$1 + local _auto=$(cat /proc/sys/net/ipv6/conf/$_netdev/autoconf) + if [ $_auto -eq 1 ]; then + return 0 + else + return 1 + fi +} + +is_ipv6_address() +{ + echo $1 | grep -q ":" +} + +# 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=`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_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 + + 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 + + local 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 watchdog module is desired in dracut_args +# returns 1 otherwise +is_wdt_mod_omitted() { + local dracut_args + local ret=1 + + dracut_args=$(grep "^dracut_args" /etc/kdump.conf) + [[ -z $dracut_args ]] && return $ret + + eval set -- $dracut_args + while :; do + [[ -z $1 ]] && break + case $1 in + -o|--omit) + echo $2 | grep -qw "watchdog" + [[ $? == 0 ]] && ret=0 + break + esac + shift + done + + return $ret +} + +# If "dracut_args" contains "--mount" information, use it +# directly without any check(users are expected to ensure +# its correctness). +is_mount_in_dracut_args() +{ + grep -q "^dracut_args .*\-\-mount" /etc/kdump.conf +} + +# 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 +} + +check_crash_mem_reserved() +{ + local mem_reserved + + mem_reserved=$(cat /sys/kernel/kexec_crash_size) + if [ $mem_reserved -eq 0 ]; then + echo "No memory reserved for crash kernel" + return 1 + fi + + return 0 +} + +check_kdump_feasibility() +{ + if [ ! -e /sys/kernel/kexec_crash_loaded ]; then + echo "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 + echo "Perhaps CONFIG_CRASH_DUMP is not enabled in kernel" + return 1 + fi + + rc=`cat /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 + + 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 + + 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" -o "$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 + echo -n "Warning: elf32-core-headers overrides correct elf64 setting" + echo + 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 +} + +check_boot_dir() +{ + local kdump_bootdir=$1 + #If user specify a boot dir for kdump kernel, let's use it. Otherwise + #check whether it's a atomic host. If yes parse the subdirectory under + #/boot; If not just find it under /boot. + if [ -n "$kdump_bootdir" ]; then + echo "$kdump_bootdir" + return + fi + + if ! is_atomic || [ "$(uname -m)" = "s390x" ]; then + kdump_bootdir="/boot" + else + eval $(cat /proc/cmdline| grep "BOOT_IMAGE" | cut -d' ' -f1) + kdump_bootdir="/boot"$(dirname $BOOT_IMAGE) + fi + echo $kdump_bootdir +} + +# +# 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 + + if [ -z "$1" ]; then + cmdline=$(cat /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 + cmdline=$(remove_cmdline_param "$cmdline" "$2") + + # 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 [ ! -z ${id} ] ; then + cmdline=$(append_cmdline "${cmdline}" disable_cpu_apicid ${id}) + fi + echo ${cmdline} +} 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..2b2fc89 --- /dev/null +++ b/SOURCES/kdump.conf @@ -0,0 +1,175 @@ +# 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: +# +# 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 scp /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>/%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 1 -d 31". +# The default core_collector for other targets is: +# "makedumpfile -l --message-level 1 -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. +# +# 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 - reboot the system +# +# 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 +#ssh user@my.server.com +#sshkey /root/.ssh/kdump_id_rsa +path /var/crash +core_collector makedumpfile -l --message-level 1 -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..fda3770 --- /dev/null +++ b/SOURCES/kdump.conf.5 @@ -0,0 +1,360 @@ +.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 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 scp /proc/vmcore 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>/%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 1 -d 31". +The default core_collector for other targets is: +"makedumpfile -l --message-level 1 -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" + +.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 +Note that scripts written for use with this directive must use +the /bin/bash interpreter. +.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 - reboot the system +.PP +Note that scripts written for this directive must use +the /bin/bash interpreter. +.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 1 -d 31" + +Above will effectively be translated to: + +makedumpfile -l --message-level 1 -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 1 -d 31" + +Above will effectively be translated to. + +makedumpfile -F -l --message-level 1 -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 1 -d 31" + +Above will effectively be translated to. + +makedumpfile -F -l --message-level 1 -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..f888dd6 --- /dev/null +++ b/SOURCES/kdump.service @@ -0,0 +1,15 @@ +[Unit] +Description=Crash recovery kernel arming +After=network.target network-online.target remote-fs.target basic.target +DefaultDependencies=no + +[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..df518d6 --- /dev/null +++ b/SOURCES/kdump.sysconfig @@ -0,0 +1,37 @@ +# 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" + +# 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" + +# 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" diff --git a/SOURCES/kdump.sysconfig.aarch64 b/SOURCES/kdump.sysconfig.aarch64 new file mode 100644 index 0000000..d5d7624 --- /dev/null +++ b/SOURCES/kdump.sysconfig.aarch64 @@ -0,0 +1,37 @@ +# 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" + +# 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" + +# 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" diff --git a/SOURCES/kdump.sysconfig.i386 b/SOURCES/kdump.sysconfig.i386 new file mode 100644 index 0000000..976aea6 --- /dev/null +++ b/SOURCES/kdump.sysconfig.i386 @@ -0,0 +1,40 @@ +# 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" + +# 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 rootflags=nofail transparent_hugepage=never novmcoredd" + +# 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="" diff --git a/SOURCES/kdump.sysconfig.ppc64 b/SOURCES/kdump.sysconfig.ppc64 new file mode 100644 index 0000000..6ddfc3d --- /dev/null +++ b/SOURCES/kdump.sysconfig.ppc64 @@ -0,0 +1,42 @@ +# 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" + +# 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 rootflags=nofail kvm_cma_resv_ratio=0 transparent_hugepage=never novmcoredd" + +# 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 diff --git a/SOURCES/kdump.sysconfig.ppc64le b/SOURCES/kdump.sysconfig.ppc64le new file mode 100644 index 0000000..6ddfc3d --- /dev/null +++ b/SOURCES/kdump.sysconfig.ppc64le @@ -0,0 +1,42 @@ +# 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" + +# 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 rootflags=nofail kvm_cma_resv_ratio=0 transparent_hugepage=never novmcoredd" + +# 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 diff --git a/SOURCES/kdump.sysconfig.s390x b/SOURCES/kdump.sysconfig.s390x new file mode 100644 index 0000000..68705f9 --- /dev/null +++ b/SOURCES/kdump.sysconfig.s390x @@ -0,0 +1,43 @@ +# 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" + +# 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 rootflags=nofail transparent_hugepage=never novmcoredd" + +# 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="" + +#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="" diff --git a/SOURCES/kdump.sysconfig.x86_64 b/SOURCES/kdump.sysconfig.x86_64 new file mode 100644 index 0000000..64432ac --- /dev/null +++ b/SOURCES/kdump.sysconfig.x86_64 @@ -0,0 +1,40 @@ +# 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" + +# 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 rootflags=nofail acpi_no_memhotplug transparent_hugepage=never nokaslr novmcoredd" + +# 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="" diff --git a/SOURCES/kdumpctl b/SOURCES/kdumpctl new file mode 100755 index 0000000..c6c1736 --- /dev/null +++ b/SOURCES/kdumpctl @@ -0,0 +1,1253 @@ +#!/bin/bash +KEXEC=/sbin/kexec + +KDUMP_KERNELVER="" +KDUMP_COMMANDLINE="" +KEXEC_ARGS="" +KDUMP_CONFIG_FILE="/etc/kdump.conf" +MKDUMPRD="/sbin/mkdumprd -f" +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="" +TARGET_INITRD="" +FADUMP_REGISTER_SYS_NODE="/sys/kernel/fadump_registered" +#kdump shall be the default dump mode +DEFAULT_DUMP_MODE="kdump" +image_time=0 + +[[ $dracutbasedir ]] || dracutbasedir=/usr/lib/dracut +. $dracutbasedir/dracut-functions.sh +. /lib/kdump/kdump-lib.sh + +standard_kexec_args="-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 + +single_instance_lock() +{ + local rc timeout=5 + + exec 9>/var/lock/kdump + if [ $? -ne 0 ]; then + echo "Create file lock failed" + exit 1 + fi + + flock -n 9 + rc=$? + + while [ $rc -ne 0 ]; do + echo "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 + echo "Dump mode is fadump" + DEFAULT_DUMP_MODE="fadump" + fi +} + +save_core() +{ + coredir="/var/crash/`date +"%Y-%m-%d-%H:%M"`" + + mkdir -p $coredir + cp --sparse=always /proc/vmcore $coredir/vmcore-incomplete + if [ $? == 0 ]; then + mv $coredir/vmcore-incomplete $coredir/vmcore + echo "saved a vmcore to $coredir" + else + echo "failed to save a vmcore to $coredir" >&2 + 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 + makedumpfile --dump-dmesg $coredir/vmcore $coredir/dmesg >/dev/null 2>&1 + dumpoops -d $coredir/dmesg >/dev/null 2>&1 + if [ $? == 0 ]; then + echo "kernel oops has been collected by abrt tool" + fi + fi +} + +rebuild_fadump_initrd() +{ + local target_initrd_tmp + + # this file tells the initrd is fadump enabled + touch /tmp/fadump.initramfs + target_initrd_tmp="$TARGET_INITRD.tmp" + $MKDUMPRD $target_initrd_tmp --rebuild $DEFAULT_INITRD_BAK --kver $kdump_kver \ + -i /tmp/fadump.initramfs /etc/fadump.initramfs + if [ $? != 0 ]; then + echo "mkdumprd: failed to rebuild initrd with fadump support" >&2 + rm -f /tmp/fadump.initramfs + return 1 + fi + rm -f /tmp/fadump.initramfs + + # updating fadump initrd + mv $target_initrd_tmp $TARGET_INITRD + sync + + return 0 +} + +check_earlykdump_is_enabled() +{ + grep -q -w "rd.earlykdump" /proc/cmdline + return $? +} + +rebuild_kdump_initrd() +{ + $MKDUMPRD $TARGET_INITRD $kdump_kver + if [ $? != 0 ]; then + echo "mkdumprd: failed to make kdump initrd" >&2 + return 1 + fi + + if check_earlykdump_is_enabled; then + echo "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 "$KDUMP_BOOTDIR" ]];then + echo "$KDUMP_BOOTDIR does not have write permission. Can not 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 [ ! -f "$file" ]; then + echo -n "Error: $file not found."; echo + return 1 + fi + done +} + +#$1: the files to be checked with IFS=' ' +check_executable() +{ + for file in $1; do + if [ ! -x "$file" ]; then + echo -n "Error: $file is not executable."; echo + return 1 + fi + done +} + +backup_default_initrd() +{ + if [ ! -f "$DEFAULT_INITRD" ]; then + return + fi + + if [ ! -e $DEFAULT_INITRD_BAK ]; then + echo "Backing up $DEFAULT_INITRD before rebuild." + # save checksum to verify before restoring + sha1sum $DEFAULT_INITRD > $INITRD_CHECKSUM_LOCATION + cp $DEFAULT_INITRD $DEFAULT_INITRD_BAK + if [ $? -ne 0 ]; then + echo "WARNING: failed to backup $DEFAULT_INITRD." + rm -f $DEFAULT_INITRD_BAK + fi + fi +} + +restore_default_initrd() +{ + # 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=`cat $INITRD_CHECKSUM_LOCATION | awk '{ print $1 }'` + if [ "$default_checksum" != "$backup_checksum" ]; then + echo "WARNING: checksum mismatch! Can't restore original initrd.." + else + rm -f $INITRD_CHECKSUM_LOCATION + mv $DEFAULT_INITRD_BAK $DEFAULT_INITRD + if [[ $? -eq 0 ]]; then + echo -n "Restoring original initrd as fadump mode " + echo "is disabled." + sync + fi + fi + fi +} + +check_config() +{ + local nr + + nr=$(awk 'BEGIN{cnt=0} /^raw|^ssh[[:blank:]]|^nfs|^ext[234]|^xfs|^btrfs|^minix|^dracut_args .*\-\-mount/{cnt++} END{print cnt}' $KDUMP_CONFIG_FILE) + [ $nr -gt 1 ] && { + echo "More than one dump targets specified." + return 1 + } + + nr=$(grep "^dracut_args .*\-\-mount" $KDUMP_CONFIG_FILE | grep -o "\-\-mount" | wc -l) + [ $nr -gt 1 ] && { + echo "Multiple mount targets specified in one \"dracut_args\"." + return 1 + } + + # Check if we have any leading spaces (or tabs) before the + # variable name in the kdump conf file + if grep -E -q '^[[:blank:]]+[a-z]' $KDUMP_CONFIG_FILE; then + echo "No whitespaces are allowed before a kdump option name in $KDUMP_CONFIG_FILE" + return 1 + fi + + while read config_opt config_val; do + case "$config_opt" in + \#* | "") + ;; + raw|ext2|ext3|ext4|minix|btrfs|xfs|nfs|ssh|sshkey|path|core_collector|kdump_post|kdump_pre|extra_bins|extra_modules|failure_action|default|final_action|force_rebuild|force_no_rebuild|dracut_args|fence_kdump_args|fence_kdump_nodes) + # remove inline comments after the end of a directive. + [ -z "$config_val" ] && { + echo "Invalid kdump config value for option $config_opt." + return 1; + } + ;; + net|options|link_delay|disk_timeout|debug_mem_level|blacklist) + echo "Deprecated kdump config option: $config_opt. Refer to kdump.conf manpage for alternatives." + return 1 + ;; + *) + echo "Invalid kdump config option $config_opt" + return 1; + ;; + esac + done <<< "$(read_strip_comments $KDUMP_CONFIG_FILE)" + + 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 -a $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() +{ + KDUMP_BOOTDIR=$(check_boot_dir "${KDUMP_BOOTDIR}") + + if [ -z "$KDUMP_KERNELVER" ]; then + kdump_kver=`uname -r` + else + kdump_kver=$KDUMP_KERNELVER + fi + + kdump_kernel="${KDUMP_BOOTDIR}/${KDUMP_IMG}-${kdump_kver}${KDUMP_IMG_EXT}" + + DEFAULT_INITRD="${KDUMP_BOOTDIR}/initramfs-`uname -r`.img" + DEFAULT_INITRD_BAK="${KDUMP_BOOTDIR}/.initramfs-`uname -r`.img.default" + if [ $DEFAULT_DUMP_MODE == "fadump" ]; then + TARGET_INITRD="$DEFAULT_INITRD" + if [ ! -s "$TARGET_INITRD" ]; then + echo "Error: No initrd found to rebuild!" + return 1 + fi + + # backup initrd for reference before replacing it + # with fadump aware initrd + backup_default_initrd + else + TARGET_INITRD="${KDUMP_BOOTDIR}/initramfs-${kdump_kver}kdump.img" + + # 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=`grep ^kdump_post $KDUMP_CONFIG_FILE | cut -d\ -f2` + CHECK_FILES=`grep ^kdump_pre $KDUMP_CONFIG_FILE | cut -d\ -f2` + CORE_COLLECTOR=`grep ^core_collector $KDUMP_CONFIG_FILE | cut -d\ -f2` + CORE_COLLECTOR=`type -P $CORE_COLLECTOR` + EXTRA_BINS="$EXTRA_BINS $CHECK_FILES" + CHECK_FILES=`grep ^extra_bins $KDUMP_CONFIG_FILE | cut -d\ -f2-` + 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="$(grep ^extra_modules $KDUMP_CONFIG_FILE | sed 's/^extra_modules\s*//')" + if [ -n "$EXTRA_MODULES" ]; then + if [ -e /lib/modules/$kdump_kver/modules.dep ]; then + files="$files /lib/modules/$kdump_kver/modules.dep" + fi + for _module in $EXTRA_MODULES; do + _module_file="$(modinfo --set-version "$kdump_kver" --filename "$_module" 2>/dev/null)" + if [[ $? -eq 0 ]]; then + files="$files $_module_file" + for _dep_modules in $(modinfo -F depends $_module | tr ',' ' '); do + files="$files $(modinfo --set-version "$kdump_kver" --filename $_dep_modules 2>/dev/null)" + done + else + # If it's not a module nor builtin, give an error + if ! ( modprobe --set-version "$kdump_kver" --dry-run "$_module" &>/dev/null ); then + echo "Module $_module not found" + fi + fi + done + fi + + check_exist "$files" && check_executable "$EXTRA_BINS" + [ $? -ne 0 ] && 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 + echo "$file doesn't exist" + fi + done + + if [ -n "$modified_files" ]; then + echo "Detected change(s) in the following file(s):" + echo -n " "; echo "$modified_files" | sed 's/\s/\n /g' + return 1 + fi + + return 0 +} + +check_dump_fs_modified() +{ + local _old_dev _old_mntpoint _old_fstype + local _new_dev _new_mntpoint _new_fstype + local _target _path _dracut_args + local _target_drivers _module_name + + local _old_drivers="$(lsinitrd $TARGET_INITRD -f /usr/lib/dracut/loaded-kernel-modules.txt | tr '\n' ' ')" + + # 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_user_configured_dump_disk) + + if [[ -n "$_target" ]]; then + _target=$(to_dev_name $_target) + _new_fstype=$(blkid $_target | awk -F"TYPE=" '{print $2}' | cut -d '"' -f 2) + else + _path=$(get_save_path) + _target=$(get_target_from_path $_path) + _target=$(to_dev_name $_target) + _new_fstype=$(get_fs_type_from_target $_target) + if [[ -z "$_target" || -z "$_new_fstype" ]];then + echo "Dump path $_path does not exist" + return 2 + fi + fi + + _record_block_drivers() { + local _drivers + if [[ -b /dev/block/$1 ]]; then + _drivers=$(udevadm info -a "/dev/block/$1" | sed -n 's/\s*DRIVERS=="\(\S\+\)"/\1/p') + fi + if [[ -b $1 ]]; then + _drivers=$(udevadm info -a "$1" | sed -n 's/\s*DRIVERS=="\(\S\+\)"/\1/p') + fi + for _driver in $_drivers; do + if ! [[ " $_target_drivers " == *" $_driver "* ]]; then + _target_drivers="$_target_drivers $_driver" + fi + done + return 1 + } + + check_block_and_slaves_all _record_block_drivers "$(get_maj_min "$_target")" + for _driver in $_target_drivers; do + # Target is mounted already, if module is not included by current kernel, + # could be a deprecated/invalid driver name or a built-in module + _module_name=$(modinfo --set-version "$kdump_kver" -F name $_driver 2>/dev/null) + if [ $? -ne 0 ] || [ -z "$_module_name" ]; then + continue + fi + if ! [[ " $_old_drivers " == *" $_module_name "* ]]; then + echo "Detected change in block device driver, new loaded module: $_module_name" + return 1 + fi + done + + if [[ $(expr substr $_new_fstype 1 3) = "nfs" ]];then + _new_dev=$_target + else + _new_dev=$(get_persistent_dev $_target) + if [ -z "$_new_dev" ]; then + echo "Get persistent device name failed" + return 2 + fi + fi + + if ! findmnt $_target >/dev/null; then + echo "Dump target $_target is probably not mounted." + return 2 + fi + + if [[ "$_target" = "$(get_root_fs_device)" ]]; then + _new_mntpoint="/sysroot" + else + _new_mntpoint="/kdumproot/$(get_mntpoint_from_target $_target)" + fi + + _dracut_args=$(lsinitrd $TARGET_INITRD -f usr/lib/dracut/build-parameter.txt) + if [[ -z "$_dracut_args" ]];then + echo "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 + echo $_dracut_args | grep "\-\-mount" &> /dev/null + if [[ $? -eq 0 ]];then + 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 + + echo "Detected change in File System" + return 1 +} + +check_wdt_modified() +{ + local -A _drivers + local _alldrivers _active _wdtdrv _wdtppath _dir + local wd_old wd_new + + is_wdt_mod_omitted + [[ $? -eq 0 ]] && return 0 + [[ -d /sys/class/watchdog/ ]] || return 0 + + # Copied logic from dracut 04watchdog/module-setup.sh::installkernel() + for _dir in /sys/class/watchdog/*; do + [[ -d "$_dir" ]] || continue + [[ -f "$_dir/state" ]] || continue + _active=$(< "$_dir/state") + [[ "$_active" = "active" ]] || continue + # device/modalias will return driver of this device + _wdtdrv=$(< "$_dir/device/modalias") + # There can be more than one module represented by same + # modalias. Currently load all of them. + # TODO: Need to find a way to avoid any unwanted module + # represented by modalias + _wdtdrv=$(modprobe --set-version "$kdump_kver" -R $_wdtdrv 2>/dev/null) + if [[ $_wdtdrv ]]; then + for i in $_wdtdrv; do + _drivers[$i]=1 + done + fi + # however in some cases, we also need to check that if there is + # a specific driver for the parent bus/device. In such cases + # we also need to enable driver for parent bus/device. + _wdtppath=$(readlink -f "$_dir/device") + while [[ -d "$_wdtppath" ]] && [[ "$_wdtppath" != "/sys" ]]; do + _wdtppath=$(readlink -f "$_wdtppath/..") + [[ -f "$_wdtppath/modalias" ]] || continue + + _wdtdrv=$(< "$_wdtppath/modalias") + _wdtdrv=$(modprobe --set-version "$kdump_kver" -R $_wdtdrv 2>/dev/null) + if [[ $_wdtdrv ]]; then + for i in $_wdtdrv; do + _drivers[$i]=1 + done + fi + done + done + + # ensure that watchdog module is loaded as early as possible + _alldrivers="${!_drivers[*]}" + [[ $_alldrivers ]] && wd_new="rd.driver.pre=${_alldrivers// /,}" + wd_old=$(lsinitrd $TARGET_INITRD -f etc/cmdline.d/00-watchdog.conf) + + [[ "$wd_old" = "$wd_new" ]] && return 0 + + 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_dump_fs_modified + ret=$? + if [ $ret -ne 0 ]; then + return $ret + fi + + check_wdt_modified + if [ $? -ne 0 ]; then + echo "Detected change in watchdog state" + return 1 + fi + + return 0 +} + +check_rebuild() +{ + local capture_capable_initrd="1" + local _force_rebuild force_rebuild="0" + local _force_no_rebuild force_no_rebuild="0" + local ret system_modified="0" + + setup_initrd + + if [ $? -ne 0 ]; then + return 1 + fi + + _force_no_rebuild=`grep ^force_no_rebuild $KDUMP_CONFIG_FILE 2>/dev/null` + if [ $? -eq 0 ]; then + force_no_rebuild=`echo $_force_no_rebuild | cut -d' ' -f2` + if [ "$force_no_rebuild" != "0" ] && [ "$force_no_rebuild" != "1" ];then + echo "Error: force_no_rebuild value is invalid" + return 1 + fi + fi + + _force_rebuild=`grep ^force_rebuild $KDUMP_CONFIG_FILE 2>/dev/null` + if [ $? -eq 0 ]; then + force_rebuild=`echo $_force_rebuild | cut -d' ' -f2` + if [ "$force_rebuild" != "0" ] && [ "$force_rebuild" != "1" ];then + echo "Error: force_rebuild value is invalid" + return 1 + fi + fi + + if [[ "$force_no_rebuild" == "1" && "$force_rebuild" == "1" ]]; then + echo "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 ^kdumpbase$ | wc -l) + 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 + echo -n "No kdump initial ramdisk found."; echo + elif [ "$capture_capable_initrd" == "0" ]; then + echo -n "Rebuild $TARGET_INITRD with dump capture support"; echo + elif [ "$force_rebuild" != "0" ]; then + echo -n "Force rebuild $TARGET_INITRD"; echo + elif [ "$system_modified" != "0" ]; then + : + else + return 0 + fi + + echo "Rebuilding $TARGET_INITRD" + rebuild_initrd + return $? +} + +# 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() +{ + 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 + echo "Secure Boot is enabled. Using kexec file based syscall." + KEXEC_ARGS="$KEXEC_ARGS -s" + fi + + $KEXEC $KEXEC_ARGS $standard_kexec_args \ + --command-line="$KDUMP_COMMANDLINE" \ + --initrd=$TARGET_INITRD $kdump_kernel + if [ $? == 0 ]; then + echo "kexec: loaded kdump kernel" + return 0 + else + echo "kexec: failed to load kdump kernel" >&2 + return 1 + fi +} + +check_ssh_config() +{ + while read 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 + echo "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 <<< "$(read_strip_comments $KDUMP_CONFIG_FILE)" + + #make sure they've configured kdump.conf for ssh dumps + local SSH_TARGET=`echo -n $DUMP_TARGET | sed -n '/.*@/p'` + if [ -z "$SSH_TARGET" ]; then + return 1 + fi + return 0 +} + +check_ssh_target() +{ + local _ret + ssh -q -i $SSH_KEY_LOCATION -o BatchMode=yes $DUMP_TARGET mkdir -p $SAVE_PATH + _ret=$? + if [ $_ret -ne 0 ]; then + echo "Could not create $DUMP_TARGET:$SAVE_PATH, you probably need to run \"kdumpctl propagate\"" >&2 + return 1 + fi + return 0 +} + +propagate_ssh_key() +{ + check_ssh_config + if [ $? -ne 0 ]; then + echo "No ssh config specified in $KDUMP_CONFIG_FILE. Can't propagate" >&2 + 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 + echo "Using existing keys..." + else + echo -n "Generating new ssh keys... " + /usr/bin/ssh-keygen -t rsa -f $KEYFILE -N "" 2>&1 > /dev/null + echo "done." + fi + + #now find the target ssh user and server to contact. + SSH_USER=`echo $DUMP_TARGET | cut -d\ -f2 | 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 + echo $KEYFILE has been added to ~$SSH_USER/.ssh/authorized_keys on $SSH_SERVER + return 0 + else + echo $errmsg, $KEYFILE failed in transfer to $SSH_SERVER >&2 + exit 1 + fi +} + +show_reserved_mem() +{ + local mem=$(cat /sys/kernel/kexec_crash_size) + local mem_mb=$(expr $mem / 1024 / 1024) + + echo "Reserved "$mem_mb"MB memory for crash kernel" +} + +check_current_fadump_status() +{ + # Check if firmware-assisted dump has been registered. + rc=`cat $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=$(awk '$1 ~ /^raw$/ { print $2; }' $KDUMP_CONFIG_FILE) + [ -z "$raw_target" ] && return 0 + [ -b "$raw_target" ] || { + echo "raw partition $raw_target not found" + return 1 + } + kdump_dir=`grep ^path $KDUMP_CONFIG_FILE | cut -d' ' -f2-` + 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" ] || { + echo "failed to create $coredir" + return 1 + } + if makedumpfile -R $coredir/vmcore <$raw_target >/dev/null 2>&1; then + # dump found + echo "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 +} + +is_dump_target_configured() +{ + local _target + + _target=$(egrep "^ext[234]|^xfs|^btrfs|^minix|^raw|^ssh|^nfs" /etc/kdump.conf) + + [ -n "$_target" ] +} + +local_fs_dump_target() +{ + local _target + + _target=$(egrep "^ext[234]|^xfs|^btrfs|^minix" /etc/kdump.conf) + if [ $? -eq 0 ]; then + echo $_target|awk '{print $2}' + fi +} + +path_to_be_relabeled() +{ + local _path _target _mnt="/" _rmnt + + if is_dump_target_configured; then + _target=$(local_fs_dump_target) + if [[ -n "$_target" ]]; then + _mnt=$(findmnt -k -f -n -r -o TARGET $_target) + if [ -z "$_mnt" ]; then + return + fi + else + return + fi + fi + + if is_mount_in_dracut_args; then + return; + 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 + + for _i in $(find $_path); do + _attr=$(getfattr -m "security.selinux" $_i 2>/dev/null) + if [ -z "$_attr" ]; then + restorecon $_i; + fi + done +} + +check_fence_kdump_config() +{ + local hostname=`hostname` + local ipaddrs=`hostname -I` + local nodes=$(get_option_value "fence_kdump_nodes") + + for node in $nodes; do + if [ "$node" = "$hostname" ]; then + echo "Option fence_kdump_nodes cannot contain $hostname" + return 1 + fi + # node can be ipaddr + echo $ipaddrs | grep $node > /dev/null + if [ $? -eq 0 ]; then + echo "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 + echo "fadump: failed to register" + return 1 + fi + + echo "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=$(awk '$1 ~ /^default$/ {print $2;}' $KDUMP_CONFIG_FILE) + failure_action=$(awk '$1 ~ /^failure_action$/ {print $2;}' $KDUMP_CONFIG_FILE) + + if [ -z "$failure_action" -a -z "$default_option" ]; then + return 0 + elif [ -n "$failure_action" -a -n "$default_option" ]; then + echo "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 + ;; + *) + echo $"Usage kdump.conf: $option {reboot|halt|poweroff|shell|dump_to_rootfs}" + return 1 + esac +} + +check_final_action_config() +{ + local final_action + + final_action=$(awk '$1 ~ /^final_action$/ {print $2;}' $KDUMP_CONFIG_FILE) + if [ -z "$final_action" ]; then + return 0 + else + case "$final_action" in + reboot|halt|poweroff) + return 0 + ;; + *) + echo $"Usage kdump.conf: final_action {reboot|halt|poweroff}" + return 1 + esac + fi +} + +start() +{ + check_dump_feasibility + if [ $? -ne 0 ]; then + echo "Starting kdump: [FAILED]" + return 1 + fi + + check_config + if [ $? -ne 0 ]; then + echo "Starting kdump: [FAILED]" + return 1 + fi + + if sestatus 2>/dev/null | grep -q "SELinux status.*enabled"; then + selinux_relabel + fi + + save_raw + if [ $? -ne 0 ]; then + echo "Starting kdump: [FAILED]" + return 1 + fi + + check_current_status + if [ $? == 0 ]; then + echo "Kdump already running: [WARNING]" + return 0 + fi + + if check_ssh_config; then + if ! check_ssh_target; then + echo "Starting kdump: [FAILED]" + return 1 + fi + fi + + check_rebuild + if [ $? != 0 ]; then + echo "Starting kdump: [FAILED]" + return 1 + fi + + start_dump + if [ $? != 0 ]; then + echo "Starting kdump: [FAILED]" + return 1 + fi + + echo "Starting kdump: [OK]" +} + +reload() +{ + check_current_status + if [ $? -ne 0 ]; then + echo "Kdump is not running: [WARNING]" + return 0 + fi + + if [ $DEFAULT_DUMP_MODE == "fadump" ]; then + reload_fadump + return $? + else + stop_kdump + fi + + if [ $? -ne 0 ]; then + echo "Stopping kdump: [FAILED]" + return 1 + fi + + echo "Stopping kdump: [OK]" + + setup_initrd + if [ $? -ne 0 ]; then + echo "Starting kdump: [FAILED]" + return 1 + fi + + start_dump + if [ $? -ne 0 ]; then + echo "Starting kdump: [FAILED]" + return 1 + fi + + echo "Starting kdump: [OK]" +} + +stop_fadump() +{ + echo 0 > $FADUMP_REGISTER_SYS_NODE + if check_current_fadump_status; then + echo "fadump: failed to unregister" + return 1 + fi + + echo "fadump: unregistered successfully" + return 0 +} + +stop_kdump() +{ + if is_secure_boot_enforced; then + $KEXEC -s -p -u + else + $KEXEC -p -u + fi + + if [ $? != 0 ]; then + echo "kexec: failed to unload kdump kernel" + return 1 + fi + + echo "kexec: unloaded kdump kernel" + return 0 +} + +reload_fadump() +{ + echo 1 > $FADUMP_REGISTER_SYS_NODE + if [ $? == 0 ]; then + echo "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. + stop_fadump + if [ $? == 0 ]; then + start_fadump + return $? + fi + fi + + return 1 +} + +stop() +{ + if [ $DEFAULT_DUMP_MODE == "fadump" ]; then + stop_fadump + else + stop_kdump + fi + + if [ $? != 0 ]; then + echo "Stopping kdump: [FAILED]" + return 1 + fi + + echo "Stopping kdump: [OK]" + return 0 +} + +rebuild() { + check_config + if [ $? -ne 0 ]; then + return 1 + fi + + if check_ssh_config; then + if ! check_ssh_target; then + return 1 + fi + fi + + setup_initrd + if [ $? -ne 0 ]; then + return 1 + fi + + echo "Rebuilding $TARGET_INITRD" + rebuild_initrd + return $? +} + +if [ ! -f "$KDUMP_CONFIG_FILE" ]; then + echo "Error: No kdump config file found!" >&2 + 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) + echo "Kdump is operational" + EXIT_CODE=0 + ;; + 1) + echo "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 + ;; + *) + echo $"Usage: $0 {start|stop|status|restart|reload|rebuild|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 $1) + +exit $? diff --git a/SOURCES/kdumpctl.8 b/SOURCES/kdumpctl.8 new file mode 100644 index 0000000..ae97af7 --- /dev/null +++ b/SOURCES/kdumpctl.8 @@ -0,0 +1,50 @@ +.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. + +.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..0da938e --- /dev/null +++ b/SOURCES/kexec-kdump-howto.txt @@ -0,0 +1,776 @@ +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: + +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: + +https://access.redhat.com/solutions/2023 + +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. + +https://access.redhat.com/solutions/125103 + +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. + + +Advanced Setups: + +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). + +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. + +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'. + + +Note that kdump.conf is used as a configuration mechanism for capturing dump +files from the initramfs (in the interests of safety), the root file system is +mounted, and the init process is started, only as a last resort if the +initramfs fails to capture the vmcore. As such, configuration made in +/etc/kdump.conf is only applicable to capture recorded in the initramfs. If +for any reason the init process is started on the root file system, only a +simple copying of the vmcore from /proc/vmcore to /var/crash/$DATE/vmcore will +be preformed. + +For both local filesystem and nfs dump the dump target must be mounted before +building kdump initramfs. That means one needs to put an entry for the dump +file system in /etc/fstab so that after reboot when kdump service starts, +it can find the dump target and build initramfs instead of failing. +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. Mkdumprd will still remount it as read-write +for creating dump directory and will move it back to read-only afterwards. + +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. + +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>. + +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. + +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. + +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. + +Path +==== +"path" represents the file system path in which vmcore will be saved. In +fact kdump creates a directory $hostip-$date with-in "path" and saves +vmcore there. So practically dump is saved in $path/$hostip-$date/. To +simplify discussion further, if we say dump will be saved in $path, it +is implied that kdump will create another directory inside path and +save vmcore there. + +If a dump target is specified in kdump.conf, then "path" is relative to 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. + +Interpretation of path changes a bit if user has not specified a dump +target explicitly in kdump.conf. In this case, "path" represents the +absolute path from root. And dump target and adjusted path are arrived +at automatically depending on what's mounted in the current system. + +Following are few examples. + +path /var/crash/ +---------------- +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) +-------------------------------------------------- +Say a disk /dev/sdb is mouted on /var. In this case dump target will +become /dev/sdb and path will become "/crash" and dump will be saved +on "sdb:/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. + +Kdump boot directory +==================== +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 a variable KDUMP_BOOTDIR in /etc/sysconfig/kdump is provided to +user if kdump kernel is put in a different directory. + +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. + +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 - reboot the system + +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 1 -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 1 -d 31" + +Above will effectively be translated to: + +makedumpfile -l --message-level 1 -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 1 -d 31" + +Above will effectively be translated to. + +makedumpfile -F -l --message-level 1 -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 1 -d 31" + +Above will effectively be translated to. + +makedumpfile -F -l --message-level 1 -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 1 -d 31". +Default core_collector for other targets is: +"makedumpfile -l --message-level 1 -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 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. + + diff --git a/SOURCES/kexec-tools-2.0.16-koji-build-fail-workaround.patch b/SOURCES/kexec-tools-2.0.16-koji-build-fail-workaround.patch new file mode 100644 index 0000000..c406063 --- /dev/null +++ b/SOURCES/kexec-tools-2.0.16-koji-build-fail-workaround.patch @@ -0,0 +1,13 @@ +diff --git a/purgatory/Makefile b/purgatory/Makefile +index 49ce80a..97b7a03 100644 +--- a/purgatory/Makefile ++++ b/purgatory/Makefile +@@ -67,7 +67,7 @@ $(PURGATORY): $(PURGATORY_OBJS) + $(MKDIR) -p $(@D) + $(CC) $(CFLAGS) $(LDFLAGS) -o $@.sym $^ + # $(LD) $(LDFLAGS) $(EXTRA_LDFLAGS) --no-undefined -e purgatory_start -r -o $@ $(PURGATORY_OBJS) $(UTIL_LIB) +- $(STRIP) --strip-debug -o $@ $@.sym ++ $(STRIP) --strip-debug --no-merge-notes -o $@ $@.sym + + echo:: + @echo "PURGATORY_SRCS $(PURGATORY_SRCS)" diff --git a/SOURCES/kexec-tools-2.0.18-eppic-fix-issues-with-hardening-flags.patch b/SOURCES/kexec-tools-2.0.18-eppic-fix-issues-with-hardening-flags.patch new file mode 100644 index 0000000..0eee6ea --- /dev/null +++ b/SOURCES/kexec-tools-2.0.18-eppic-fix-issues-with-hardening-flags.patch @@ -0,0 +1,51 @@ +From ce720608d5933e62f77f2c2f216859cf4f06adf8 Mon Sep 17 00:00:00 2001 +From: Kairui Song <kasong@redhat.com> +Date: Wed, 13 Feb 2019 00:03:51 +0800 +Subject: [PATCH] Fix eppic issue with hardening flags + +This is stash of two commits: + +commit f98cf5fe07f390554696755f0a5843f6bb9c4716 +Author: ryncsn <ryncsn@gmail.com> +Date: Tue Mar 19 13:39:25 2019 +0800 + + Tell gcc not to omit frame pointer + + After commit 0209874, it's now possible to enable optimization above O0. + But eppic might call __builtin_return_address(1). With O1, + -fomit-frame-pointer is enabled gcc may omit frame pointer. + __builtin_return_address(1) relies on callee preserves RBP as the stack + base, which is untrue if optimization is usded. In this case it may return + wrong value or crash. + + In case of any potential failure, use -fno-omit-frame-pointer globally. + + Signed-off-by: Kairui Song <ryncsn@gmail.com> + +commit 0209874f4b46b8af5a2d42662ba6775cf5a1dc44 +Author: Kairui Song <kasong@redhat.com> +Date: Wed Feb 13 00:03:51 2019 +0800 + + Drop O0 CFLAGS override in Makefile + +Signed-off-by: Kairui Song <kasong@redhat.com> +--- + libeppic/Makefile | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/libeppic/Makefile b/libeppic/Makefile +index bcf2edf..8b97c87 100644 +--- a/eppic/libeppic/Makefile ++++ b/eppic/libeppic/Makefile +@@ -24,7 +24,7 @@ LDIRT = lex.eppic.c lex.eppicpp.c eppic.tab.c eppic.tab.h eppicpp.tab.c \ + LIBDIR = /usr/lib + TARGETS = libeppic.a + +-CFLAGS += -O0 -g -fPIC ++CFLAGS += -g -fno-omit-frame-pointer -fPIC + ifeq ($(TARGET), PPC64) + CFLAGS += -m64 + endif +-- +2.20.1 + diff --git a/SOURCES/kexec-tools-2.0.18-makedumpfiles-exclude-pages-that-are-logically-offline.patch b/SOURCES/kexec-tools-2.0.18-makedumpfiles-exclude-pages-that-are-logically-offline.patch new file mode 100644 index 0000000..9825ef4 --- /dev/null +++ b/SOURCES/kexec-tools-2.0.18-makedumpfiles-exclude-pages-that-are-logically-offline.patch @@ -0,0 +1,149 @@ +From 0f9ee000904ffd1e171ba1f000a83e5ce3717e45 Mon Sep 17 00:00:00 2001 +From: David Hildenbrand <david@redhat.com> +Date: Thu, 22 Nov 2018 11:09:38 +0100 +Subject: [PATCH] [PATCH] exclude pages that are logically offline + +Linux marks pages that are logically offline via a page flag (map count). +Such pages e.g. include pages infated as part of a balloon driver or +pages that were not actually onlined when onlining the whole section. + +While the hypervisor usually allows to read such inflated memory, we +basically read and dump data that is completely irrelevant. Also, this +might result in quite some overhead in the hypervisor. In addition, +we saw some problems under Hyper-V, whereby we can crash the kernel by +dumping, when reading memory of a partially onlined memory segment +(for memory added by the Hyper-V balloon driver). + +Therefore, don't read and dump pages that are marked as being logically +offline. + +Signed-off-by: David Hildenbrand <david@redhat.com> +Signed-off-by: Pingfan Liu <piliu@redhat.com> +--- + makedumpfile.c | 34 ++++++++++++++++++++++++++++++---- + makedumpfile.h | 1 + + 2 files changed, 31 insertions(+), 4 deletions(-) + +diff --git a/makedumpfile.c b/makedumpfile.c +index 8923538..a5f2ea9 100644 +--- a/makedumpfile-1.6.5/makedumpfile.c ++++ b/makedumpfile-1.6.5/makedumpfile.c +@@ -88,6 +88,7 @@ mdf_pfn_t pfn_cache_private; + mdf_pfn_t pfn_user; + mdf_pfn_t pfn_free; + mdf_pfn_t pfn_hwpoison; ++mdf_pfn_t pfn_offline; + + mdf_pfn_t num_dumped; + +@@ -250,6 +251,21 @@ isHugetlb(unsigned long dtor) + } + + static int ++isOffline(unsigned long flags, unsigned int _mapcount) ++{ ++ if (NUMBER(PAGE_OFFLINE_MAPCOUNT_VALUE) == NOT_FOUND_NUMBER) ++ return FALSE; ++ ++ if (flags & (1UL << NUMBER(PG_slab))) ++ return FALSE; ++ ++ if (_mapcount == (int)NUMBER(PAGE_OFFLINE_MAPCOUNT_VALUE)) ++ return TRUE; ++ ++ return FALSE; ++} ++ ++static int + is_cache_page(unsigned long flags) + { + if (isLRU(flags)) +@@ -2287,6 +2303,8 @@ write_vmcoreinfo_data(void) + WRITE_NUMBER("PG_hwpoison", PG_hwpoison); + + WRITE_NUMBER("PAGE_BUDDY_MAPCOUNT_VALUE", PAGE_BUDDY_MAPCOUNT_VALUE); ++ WRITE_NUMBER("PAGE_OFFLINE_MAPCOUNT_VALUE", ++ PAGE_OFFLINE_MAPCOUNT_VALUE); + WRITE_NUMBER("phys_base", phys_base); + + WRITE_NUMBER("HUGETLB_PAGE_DTOR", HUGETLB_PAGE_DTOR); +@@ -2687,6 +2705,7 @@ read_vmcoreinfo(void) + READ_SRCFILE("pud_t", pud_t); + + READ_NUMBER("PAGE_BUDDY_MAPCOUNT_VALUE", PAGE_BUDDY_MAPCOUNT_VALUE); ++ READ_NUMBER("PAGE_OFFLINE_MAPCOUNT_VALUE", PAGE_OFFLINE_MAPCOUNT_VALUE); + READ_NUMBER("phys_base", phys_base); + #ifdef __aarch64__ + READ_NUMBER("VA_BITS", VA_BITS); +@@ -6042,6 +6061,12 @@ __exclude_unnecessary_pages(unsigned long mem_map, + pfn_counter = &pfn_hwpoison; + } + /* ++ * Exclude pages that are logically offline. ++ */ ++ else if (isOffline(flags, _mapcount)) { ++ pfn_counter = &pfn_offline; ++ } ++ /* + * Unexcludable page + */ + else +@@ -7522,7 +7547,7 @@ write_elf_pages_cyclic(struct cache_data *cd_header, struct cache_data *cd_page) + */ + if (info->flag_cyclic) { + pfn_zero = pfn_cache = pfn_cache_private = 0; +- pfn_user = pfn_free = pfn_hwpoison = 0; ++ pfn_user = pfn_free = pfn_hwpoison = pfn_offline = 0; + pfn_memhole = info->max_mapnr; + } + +@@ -8804,7 +8829,7 @@ write_kdump_pages_and_bitmap_cyclic(struct cache_data *cd_header, struct cache_d + * Reset counter for debug message. + */ + pfn_zero = pfn_cache = pfn_cache_private = 0; +- pfn_user = pfn_free = pfn_hwpoison = 0; ++ pfn_user = pfn_free = pfn_hwpoison = pfn_offline = 0; + pfn_memhole = info->max_mapnr; + + /* +@@ -9749,7 +9774,7 @@ print_report(void) + pfn_original = info->max_mapnr - pfn_memhole; + + pfn_excluded = pfn_zero + pfn_cache + pfn_cache_private +- + pfn_user + pfn_free + pfn_hwpoison; ++ + pfn_user + pfn_free + pfn_hwpoison + pfn_offline; + shrinking = (pfn_original - pfn_excluded) * 100; + shrinking = shrinking / pfn_original; + +@@ -9763,6 +9788,7 @@ print_report(void) + REPORT_MSG(" User process data pages : 0x%016llx\n", pfn_user); + REPORT_MSG(" Free pages : 0x%016llx\n", pfn_free); + REPORT_MSG(" Hwpoison pages : 0x%016llx\n", pfn_hwpoison); ++ REPORT_MSG(" Offline pages : 0x%016llx\n", pfn_offline); + REPORT_MSG(" Remaining pages : 0x%016llx\n", + pfn_original - pfn_excluded); + REPORT_MSG(" (The number of pages is reduced to %lld%%.)\n", +@@ -9790,7 +9816,7 @@ print_mem_usage(void) + pfn_original = info->max_mapnr - pfn_memhole; + + pfn_excluded = pfn_zero + pfn_cache + pfn_cache_private +- + pfn_user + pfn_free + pfn_hwpoison; ++ + pfn_user + pfn_free + pfn_hwpoison + pfn_offline; + shrinking = (pfn_original - pfn_excluded) * 100; + shrinking = shrinking / pfn_original; + total_size = info->page_size * pfn_original; +diff --git a/makedumpfile.h b/makedumpfile.h +index 73813ed..04c903f 100644 +--- a/makedumpfile-1.6.5/makedumpfile.h ++++ b/makedumpfile-1.6.5/makedumpfile.h +@@ -1927,6 +1927,7 @@ struct number_table { + long PG_hwpoison; + + long PAGE_BUDDY_MAPCOUNT_VALUE; ++ long PAGE_OFFLINE_MAPCOUNT_VALUE; + long SECTION_SIZE_BITS; + long MAX_PHYSMEM_BITS; + long HUGETLB_PAGE_DTOR; +-- +2.7.4 + diff --git a/SOURCES/kexec-tools-2.0.18-makedumpfiles-honor-the-CFLAGS-from-environment.patch b/SOURCES/kexec-tools-2.0.18-makedumpfiles-honor-the-CFLAGS-from-environment.patch new file mode 100644 index 0000000..e4052fa --- /dev/null +++ b/SOURCES/kexec-tools-2.0.18-makedumpfiles-honor-the-CFLAGS-from-environment.patch @@ -0,0 +1,41 @@ +From 2f007b48c581a81d7e95678b6bcb77cfbe177135 Mon Sep 17 00:00:00 2001 +From: Kairui Song <kasong@redhat.com> +Date: Tue, 29 Jan 2019 11:14:15 +0800 +Subject: [PATCH] [PATCH v2] honor the CFLAGS from environment variables + +This makes it possible to pass in extra cflags, for example, hardening +flags could be passed in with environment variable when building a +hardened package. + +Also introduce a CFLAGS_BASE to hold common CFLAGS, which simplify the +CFLAGS definition. + +Suggested-by: Kazuhito Hagio <k-hagio@ab.jp.nec.com> +Signed-off-by: Kairui Song <kasong@redhat.com> +--- + Makefile | 9 ++++----- + 1 file changed, 4 insertions(+), 5 deletions(-) + +diff --git a/Makefile b/Makefile +index ea3c47d..bd681d2 100644 +--- a/makedumpfile-1.6.5/Makefile ++++ b/makedumpfile-1.6.5/Makefile +@@ -8,11 +8,10 @@ ifeq ($(strip $CC),) + CC = gcc + endif + +-CFLAGS = -g -O2 -Wall -D_FILE_OFFSET_BITS=64 \ +- -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE \ +- -DVERSION='"$(VERSION)"' -DRELEASE_DATE='"$(DATE)"' +-CFLAGS_ARCH = -g -O2 -Wall -D_FILE_OFFSET_BITS=64 \ +- -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE ++CFLAGS_BASE := $(CFLAGS) -g -O2 -Wall -D_FILE_OFFSET_BITS=64 \ ++ -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE ++CFLAGS := $(CFLAGS_BASE) -DVERSION='"$(VERSION)"' -DRELEASE_DATE='"$(DATE)"' ++CFLAGS_ARCH := $(CFLAGS_BASE) + # LDFLAGS = -L/usr/local/lib -I/usr/local/include + + HOST_ARCH := $(shell uname -m) +-- +2.20.1 + diff --git a/SOURCES/kexec-tools-2.0.19-makedumpfiles-x86_64-Add-support-for-AMD-Secure-Memory-Encry.patch b/SOURCES/kexec-tools-2.0.19-makedumpfiles-x86_64-Add-support-for-AMD-Secure-Memory-Encry.patch new file mode 100644 index 0000000..662fd27 --- /dev/null +++ b/SOURCES/kexec-tools-2.0.19-makedumpfiles-x86_64-Add-support-for-AMD-Secure-Memory-Encry.patch @@ -0,0 +1,198 @@ +From d222b01e516bba73ef9fefee4146734a5f260fa1 Mon Sep 17 00:00:00 2001 +From: Lianbo Jiang <lijiang@redhat.com> +Date: Wed, 30 Jan 2019 10:48:53 +0800 +Subject: [PATCH] [PATCH] x86_64: Add support for AMD Secure Memory Encryption + +On AMD machine with Secure Memory Encryption (SME) feature, if SME is +enabled, page tables contain a specific attribute bit (C-bit) in their +entries to indicate whether a page is encrypted or unencrypted. + +So get NUMBER(sme_mask) from vmcoreinfo, which stores the value of +the C-bit position, and drop it to obtain the true physical address. + +Signed-off-by: Lianbo Jiang <lijiang@redhat.com> +--- + arch/x86_64.c | 30 +++++++++++++++++++----------- + makedumpfile.c | 4 ++++ + makedumpfile.h | 1 + + 3 files changed, 24 insertions(+), 11 deletions(-) + +diff --git a/arch/x86_64.c b/arch/x86_64.c +index 9db1f8139f28..46e93366f0be 100644 +--- a/makedumpfile-1.6.5/arch/x86_64.c ++++ b/makedumpfile-1.6.5/arch/x86_64.c +@@ -297,6 +297,7 @@ __vtop4_x86_64(unsigned long vaddr, unsigned long pagetable) + unsigned long page_dir, pgd, pud_paddr, pud_pte, pmd_paddr, pmd_pte; + unsigned long pte_paddr, pte; + unsigned long p4d_paddr, p4d_pte; ++ unsigned long entry_mask = ENTRY_MASK; + + /* + * Get PGD. +@@ -308,6 +309,9 @@ __vtop4_x86_64(unsigned long vaddr, unsigned long pagetable) + return NOT_PADDR; + } + ++ if (NUMBER(sme_mask) != NOT_FOUND_NUMBER) ++ entry_mask &= ~(NUMBER(sme_mask)); ++ + if (check_5level_paging()) { + page_dir += pgd5_index(vaddr) * sizeof(unsigned long); + if (!readmem(PADDR, page_dir, &pgd, sizeof pgd)) { +@@ -324,7 +328,7 @@ __vtop4_x86_64(unsigned long vaddr, unsigned long pagetable) + /* + * Get P4D. + */ +- p4d_paddr = pgd & ENTRY_MASK; ++ p4d_paddr = pgd & entry_mask; + p4d_paddr += p4d_index(vaddr) * sizeof(unsigned long); + if (!readmem(PADDR, p4d_paddr, &p4d_pte, sizeof p4d_pte)) { + ERRMSG("Can't get p4d_pte (p4d_paddr:%lx).\n", p4d_paddr); +@@ -337,7 +341,7 @@ __vtop4_x86_64(unsigned long vaddr, unsigned long pagetable) + ERRMSG("Can't get a valid p4d_pte.\n"); + return NOT_PADDR; + } +- pud_paddr = p4d_pte & ENTRY_MASK; ++ pud_paddr = p4d_pte & entry_mask; + }else { + page_dir += pgd_index(vaddr) * sizeof(unsigned long); + if (!readmem(PADDR, page_dir, &pgd, sizeof pgd)) { +@@ -351,7 +355,7 @@ __vtop4_x86_64(unsigned long vaddr, unsigned long pagetable) + ERRMSG("Can't get a valid pgd.\n"); + return NOT_PADDR; + } +- pud_paddr = pgd & ENTRY_MASK; ++ pud_paddr = pgd & entry_mask; + } + + /* +@@ -370,13 +374,13 @@ __vtop4_x86_64(unsigned long vaddr, unsigned long pagetable) + return NOT_PADDR; + } + if (pud_pte & _PAGE_PSE) /* 1GB pages */ +- return (pud_pte & ENTRY_MASK & PUD_MASK) + ++ return (pud_pte & entry_mask & PUD_MASK) + + (vaddr & ~PUD_MASK); + + /* + * Get PMD. + */ +- pmd_paddr = pud_pte & ENTRY_MASK; ++ pmd_paddr = pud_pte & entry_mask; + pmd_paddr += pmd_index(vaddr) * sizeof(unsigned long); + if (!readmem(PADDR, pmd_paddr, &pmd_pte, sizeof pmd_pte)) { + ERRMSG("Can't get pmd_pte (pmd_paddr:%lx).\n", pmd_paddr); +@@ -390,13 +394,13 @@ __vtop4_x86_64(unsigned long vaddr, unsigned long pagetable) + return NOT_PADDR; + } + if (pmd_pte & _PAGE_PSE) /* 2MB pages */ +- return (pmd_pte & ENTRY_MASK & PMD_MASK) + ++ return (pmd_pte & entry_mask & PMD_MASK) + + (vaddr & ~PMD_MASK); + + /* + * Get PTE. + */ +- pte_paddr = pmd_pte & ENTRY_MASK; ++ pte_paddr = pmd_pte & entry_mask; + pte_paddr += pte_index(vaddr) * sizeof(unsigned long); + if (!readmem(PADDR, pte_paddr, &pte, sizeof pte)) { + ERRMSG("Can't get pte (pte_paddr:%lx).\n", pte_paddr); +@@ -409,7 +413,7 @@ __vtop4_x86_64(unsigned long vaddr, unsigned long pagetable) + ERRMSG("Can't get a valid pte.\n"); + return NOT_PADDR; + } +- return (pte & ENTRY_MASK) + PAGEOFFSET(vaddr); ++ return (pte & entry_mask) + PAGEOFFSET(vaddr); + } + + unsigned long long +@@ -642,6 +646,7 @@ find_vmemmap_x86_64() + unsigned long pmd, tpfn; + unsigned long pvaddr = 0; + unsigned long data_addr = 0, last_data_addr = 0, start_data_addr = 0; ++ unsigned long pmask = PMASK; + /* + * data_addr is the paddr of the page holding the page structs. + * We keep lists of contiguous pages and the pfn's that their +@@ -662,6 +667,9 @@ find_vmemmap_x86_64() + return FAILED; + } + ++ if (NUMBER(sme_mask) != NOT_FOUND_NUMBER) ++ pmask &= ~(NUMBER(sme_mask)); ++ + pagestructsize = size_table.page; + hugepagesize = PTRS_PER_PMD * info->page_size; + vaddr_base = info->vmemmap_start; +@@ -692,7 +700,7 @@ find_vmemmap_x86_64() + } + + /* mask the pgd entry for the address of the pud page */ +- pud_addr &= PMASK; ++ pud_addr &= pmask; + if (pud_addr == 0) + continue; + /* read the entire pud page */ +@@ -705,7 +713,7 @@ find_vmemmap_x86_64() + /* pudp points to an entry in the pud page */ + for (pudp = (unsigned long *)pud_page, pudindex = 0; + pudindex < PTRS_PER_PUD; pudindex++, pudp++) { +- pmd_addr = *pudp & PMASK; ++ pmd_addr = *pudp & pmask; + /* read the entire pmd page */ + if (pmd_addr == 0) + continue; +@@ -747,7 +755,7 @@ find_vmemmap_x86_64() + * - we discontiguous page is a string of valids + */ + if (pmd) { +- data_addr = (pmd & PMASK); ++ data_addr = (pmd & pmask); + if (start_range) { + /* first-time kludge */ + start_data_addr = data_addr; +diff --git a/makedumpfile.c b/makedumpfile.c +index 7dfe70fb8792..590f759c84f1 100644 +--- a/makedumpfile-1.6.5/makedumpfile.c ++++ b/makedumpfile-1.6.5/makedumpfile.c +@@ -993,6 +993,8 @@ next_page: + read_size = MIN(info->page_size - PAGEOFFSET(paddr), size); + + pgaddr = PAGEBASE(paddr); ++ if (NUMBER(sme_mask) != NOT_FOUND_NUMBER) ++ pgaddr = pgaddr & ~(NUMBER(sme_mask)); + pgbuf = cache_search(pgaddr, read_size); + if (!pgbuf) { + ++cache_miss; +@@ -2292,6 +2294,7 @@ write_vmcoreinfo_data(void) + WRITE_NUMBER("NR_FREE_PAGES", NR_FREE_PAGES); + WRITE_NUMBER("N_ONLINE", N_ONLINE); + WRITE_NUMBER("pgtable_l5_enabled", pgtable_l5_enabled); ++ WRITE_NUMBER("sme_mask", sme_mask); + + WRITE_NUMBER("PG_lru", PG_lru); + WRITE_NUMBER("PG_private", PG_private); +@@ -2695,6 +2698,7 @@ read_vmcoreinfo(void) + READ_NUMBER("NR_FREE_PAGES", NR_FREE_PAGES); + READ_NUMBER("N_ONLINE", N_ONLINE); + READ_NUMBER("pgtable_l5_enabled", pgtable_l5_enabled); ++ READ_NUMBER("sme_mask", sme_mask); + + READ_NUMBER("PG_lru", PG_lru); + READ_NUMBER("PG_private", PG_private); +diff --git a/makedumpfile.h b/makedumpfile.h +index 2e73beca48c5..5ad38e9ae40c 100644 +--- a/makedumpfile-1.6.5/makedumpfile.h ++++ b/makedumpfile-1.6.5/makedumpfile.h +@@ -1913,6 +1913,7 @@ struct number_table { + long NR_FREE_PAGES; + long N_ONLINE; + long pgtable_l5_enabled; ++ long sme_mask; + + /* + * Page flags +-- +2.17.1 + diff --git a/SOURCES/kexec-tools-2.0.19-x86-Introduce-a-new-option-reuse-video-type.patch b/SOURCES/kexec-tools-2.0.19-x86-Introduce-a-new-option-reuse-video-type.patch new file mode 100644 index 0000000..90481a1 --- /dev/null +++ b/SOURCES/kexec-tools-2.0.19-x86-Introduce-a-new-option-reuse-video-type.patch @@ -0,0 +1,129 @@ +From fb5a8792e6e4ee7de7ae3e06d193ea5beaaececc Mon Sep 17 00:00:00 2001 +From: Kairui Song <kasong@redhat.com> +Date: Tue, 5 Mar 2019 19:34:33 +0800 +Subject: [PATCH] x86: Introduce a new option --reuse-video-type + +After commit 060eee58 "x86: use old screen_info if needed", kexec-tools +will force use old screen_info and vga type if failed to determine +current vga type. But it is not always a good idea. + +Currently kernel hanging is inspected on some hyper-v VMs after this +commit, because hyperv_fb will mimic EFI (or VESA) VGA on first boot +up, but after the real driver is loaded, it will switch to new mode +and no longer compatible with EFI/VESA VGA. Keep setting +orig_video_isVGA to EFI/VESA VGA flag will get wrong driver loaded and +try to manipulate the framebuffer in a wrong way. + +We can't ensure this won't happen on other framebuffer drivers, But +it's a helpful feature if the framebuffer drivers just work. So this +patch introduce a --reuse-video-type options to let user decide if the +old screen_info hould be used unconditional or not. + +Signed-off-by: Kairui Song <kasong@redhat.com> +Reviewed-by: Dave Young <dyoung@redhat.com> +Signed-off-by: Simon Horman <horms@verge.net.au> +--- + kexec/arch/i386/include/arch/options.h | 2 ++ + kexec/arch/i386/kexec-x86.h | 1 + + kexec/arch/i386/x86-linux-setup.c | 8 ++++++-- + kexec/arch/x86_64/kexec-x86_64.c | 5 +++++ + 4 files changed, 14 insertions(+), 2 deletions(-) + +diff --git a/kexec/arch/i386/include/arch/options.h b/kexec/arch/i386/include/arch/options.h +index c113a83..0e57951 100644 +--- a/kexec/arch/i386/include/arch/options.h ++++ b/kexec/arch/i386/include/arch/options.h +@@ -32,6 +32,7 @@ + #define OPT_ENTRY_32BIT (OPT_ARCH_MAX+10) + #define OPT_PASS_MEMMAP_CMDLINE (OPT_ARCH_MAX+11) + #define OPT_NOEFI (OPT_ARCH_MAX+12) ++#define OPT_REUSE_VIDEO_TYPE (OPT_ARCH_MAX+13) + + /* Options relevant to the architecture (excluding loader-specific ones): */ + #define KEXEC_ARCH_OPTIONS \ +@@ -45,6 +46,7 @@ + { "elf64-core-headers", 0, 0, OPT_ELF64_CORE }, \ + { "pass-memmap-cmdline", 0, 0, OPT_PASS_MEMMAP_CMDLINE }, \ + { "noefi", 0, 0, OPT_NOEFI}, \ ++ { "reuse-video-type", 0, 0, OPT_REUSE_VIDEO_TYPE }, \ + + #define KEXEC_ARCH_OPT_STR KEXEC_OPT_STR "" + +diff --git a/kexec/arch/i386/kexec-x86.h b/kexec/arch/i386/kexec-x86.h +index 51855f8..c2bcd37 100644 +--- a/kexec/arch/i386/kexec-x86.h ++++ b/kexec/arch/i386/kexec-x86.h +@@ -52,6 +52,7 @@ struct arch_options_t { + enum coretype core_header_type; + uint8_t pass_memmap_cmdline; + uint8_t noefi; ++ uint8_t reuse_video_type; + }; + + int multiboot_x86_probe(const char *buf, off_t len); +diff --git a/kexec/arch/i386/x86-linux-setup.c b/kexec/arch/i386/x86-linux-setup.c +index 1bd408b..8fad115 100644 +--- a/kexec/arch/i386/x86-linux-setup.c ++++ b/kexec/arch/i386/x86-linux-setup.c +@@ -144,7 +144,7 @@ static int setup_linux_vesafb(struct x86_linux_param_header *real_mode) + } else if (0 == strcmp(fix.id, "EFI VGA")) { + /* VIDEO_TYPE_EFI */ + real_mode->orig_video_isVGA = 0x70; +- } else { ++ } else if (arch_options.reuse_video_type) { + int err; + off_t offset = offsetof(typeof(*real_mode), orig_video_isVGA); + +@@ -152,6 +152,10 @@ static int setup_linux_vesafb(struct x86_linux_param_header *real_mode) + err = get_bootparam(&real_mode->orig_video_isVGA, offset, 1); + if (err) + goto out; ++ } else { ++ real_mode->orig_video_isVGA = 0; ++ close(fd); ++ return 0; + } + close(fd); + +@@ -844,7 +848,7 @@ void setup_linux_system_parameters(struct kexec_info *info, + setup_subarch(real_mode); + if (bzImage_support_efi_boot && !arch_options.noefi) + setup_efi_info(info, real_mode); +- ++ + /* Default screen size */ + real_mode->orig_x = 0; + real_mode->orig_y = 0; +diff --git a/kexec/arch/x86_64/kexec-x86_64.c b/kexec/arch/x86_64/kexec-x86_64.c +index 041b007..ccdc980 100644 +--- a/kexec/arch/x86_64/kexec-x86_64.c ++++ b/kexec/arch/x86_64/kexec-x86_64.c +@@ -55,6 +55,7 @@ void arch_usage(void) + " --console-serial Enable the serial console\n" + " --pass-memmap-cmdline Pass memory map via command line in kexec on panic case\n" + " --noefi Disable efi support\n" ++ " --reuse-video-type Reuse old boot time video type blindly\n" + ); + } + +@@ -67,6 +68,7 @@ struct arch_options_t arch_options = { + .core_header_type = CORE_TYPE_ELF64, + .pass_memmap_cmdline = 0, + .noefi = 0, ++ .reuse_video_type = 0, + }; + + int arch_process_options(int argc, char **argv) +@@ -136,6 +138,9 @@ int arch_process_options(int argc, char **argv) + case OPT_NOEFI: + arch_options.noefi = 1; + break; ++ case OPT_REUSE_VIDEO_TYPE: ++ arch_options.reuse_video_type = 1; ++ break; + } + } + /* Reset getopt for the next pass; called in other source modules */ +-- +2.20.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..e8529d6 --- /dev/null +++ b/SOURCES/mkdumprd @@ -0,0 +1,465 @@ +#!/bin/bash --norc +# New mkdumprd +# +# Copyright 2011 Red Hat, Inc. +# +# Written by Cong Wang <amwang@redhat.com> +# + +[[ $dracutbasedir ]] || dracutbasedir=/usr/lib/dracut +. $dracutbasedir/dracut-functions.sh +. /lib/kdump/kdump-lib.sh +export IN_KDUMP=1 + +conf_file="/etc/kdump.conf" +SSH_KEY_LOCATION="/root/.ssh/kdump_id_rsa" +SAVE_PATH=$(awk '/^path/ {print $2}' $conf_file) +[ -z "$SAVE_PATH" ] && SAVE_PATH=$DEFAULT_PATH +# strip the duplicated "/" +SAVE_PATH=$(echo $SAVE_PATH | tr -s /) + +is_wdt_addition_needed() { + local active + + is_wdt_mod_omitted + [[ $? -eq 0 ]] && return 1 + [[ -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 +} + +WDTCFG="" +is_wdt_addition_needed +[[ $? -eq 0 ]] && WDTCFG="-a watchdog" + +extra_modules="" +dracut_args=("--quiet" "--hostonly" "--hostonly-cmdline" "--hostonly-i18n" "--hostonly-mode" "strict" "-o" "plymouth dash resume ifcfg earlykdump" $WDTCFG) +OVERRIDE_RESETTABLE=0 + +add_dracut_arg() { + local arg qarg is_quoted=0 + while [ $# -gt 0 ]; + do + arg="${1//\'/\"}" + #Handle quoted substring properly for passing it to dracut_args array. + if [ $is_quoted -eq 0 ]; then + if [[ "$arg" == "\"" ]] || [[ $arg != ${arg#\"} ]]; then + is_quoted=1 + arg=${arg#\"} + fi + fi + if [ $is_quoted -eq 1 ]; then + qarg="$qarg $arg" + if [[ "$arg" == "\"" ]] || [[ $arg != ${arg%\"} ]]; then + is_quoted=0 + arg=${qarg%\"} + qarg="" + else + shift + continue + fi + fi + dracut_args+=("$arg") + shift + done +} + +add_dracut_module() { + add_dracut_arg "--add" "$1" +} + +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 _dev=$1 _source _target _fstype _options _mntopts _pdev + + _source=$(findmnt -k -f -n -r -o SOURCE $_dev) + _target=$(get_mntpoint_from_target $_dev) + # mount under /sysroot if dump to root disk or mount under + #/kdumproot/$_target in other cases in 2nd kernel. systemd + #will be in charge to umount it. + + if [ "$_target" = "/" ];then + _target="/sysroot" + else + _target="/kdumproot/$_target" + fi + + _fstype=$(findmnt -k -f -n -r -o FSTYPE $_dev) + [[ -e /etc/fstab ]] && _options=$(findmnt --fstab -f -n -r -o OPTIONS $_dev) + if [ -z "$_options" ]; then + _options=$(findmnt -k -f -n -r -o OPTIONS $_dev) + if [[ $_fstype == "nfs"* ]]; then + _options=$(echo $_options | sed 's/,addr=[^,]*//') + _options=$(echo $_options | sed 's/,proto=[^,]*//') + _options=$(echo $_options | sed 's/,clientaddr=[^,]*//') + fi + fi + #mount fs target as rw in 2nd kernel + _options=$(echo $_options | sed 's/\(^\|,\)ro\($\|,\)/\1rw\2/g') + # with 'noauto' in fstab nfs and non-root disk mount will fail in 2nd + # kernel, filter it out here. + _options=$(echo $_options | sed 's/\(^\|,\)noauto\($\|,\)/\1/g') + + _mntopts="$_target $_fstype $_options" + #for non-nfs _dev converting to use udev persistent name + if [ -b "$_source" ]; then + _pdev="$(get_persistent_dev $_source)" + if [ -z "$_pdev" ]; then + return 1 + fi + + else + _pdev=$_dev + fi + + echo "$_pdev $_mntopts" +} + +is_readonly_mount() { + local _mnt + _mnt=$(findmnt -k -f -n -r -o OPTIONS $1) + + #fs/proc_namespace.c: show_mountinfo(): + #seq_puts(m, mnt->mnt_flags & MNT_READONLY ? " ro" : " rw"); + [[ "$_mnt" =~ ^ro ]] +} + +#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 _opt _out _size + _opt="-i $SSH_KEY_LOCATION -o BatchMode=yes -o StrictHostKeyChecking=yes" + _out=$(ssh -q -n $_opt $1 "df -P $SAVE_PATH") + [ $? -ne 0 ] && { + perror_exit "checking remote ssh server available size failed." + } + + #ssh output removed the line break, so print field NF-2 + _size=$(echo -n $_out| awk '{avail=NF-2; print $avail}') + echo -n $_size +} + +#mkdir if save path does not exist on ssh dump target +#$1=ssh dump target +#caller should ensure write permission on $DUMP_TARGET:$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 2>&1 > /dev/null + _ret=$? + if [ $_ret -ne 0 ]; then + perror_exit "mkdir failed on $DUMP_TARGET:$SAVE_PATH" + fi + + #check whether user has write permission on $SAVE_PATH/$DUMP_TARGET + _dir=$(ssh -qn $_opt $1 mktemp -dqp $SAVE_PATH 2>/dev/null) + _ret=$? + if [ $_ret -ne 0 ]; then + perror_exit "Could not create temporary directory on $DUMP_TARGET:$SAVE_PATH. Make sure user has write permission on destination" + fi + ssh -qn $_opt $1 rmdir $_dir + + return 0 +} + +#Function: get_fs_size +#$1=dump target +get_fs_size() { + local _mnt=$(get_mntpoint_from_target $1) + echo -n $(df -P "${_mnt}/$SAVE_PATH"|tail -1|awk '{print $4}') +} + +#Function: get_raw_size +#$1=dump target +get_raw_size() { + echo -n $(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 + + if [ $? -ne 0 ]; then + perror_exit "Check dump target size failed" + fi + + if [ $avail -lt $memtotal ]; then + echo "Warning: There might not be enough space to save a vmcore." + echo " The size of $2 should be greater than $memtotal kilo bytes." + fi +} + +# $1: core_collector config value +verify_core_collector() { + if grep -q "^raw" $conf_file && [ "${1%% *}" != "makedumpfile" ]; then + echo "Warning: specifying a non-makedumpfile core collector, you will have to recover the vmcore manually." + fi + if is_ssh_dump_target || is_raw_dump_target; then + if [ "${1%% *}" = "makedumpfile" ]; then + ! strstr "$1" "-F" && { + perror_exit "The specified dump target needs makedumpfile \"-F\" option." + } + fi + fi +} + +add_mount() { + local _mnt=$(to_mount "$1") + + if [ $? -ne 0 ]; then + exit 1 + fi + + 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 + + _mntpoint=$(get_mntpoint_from_path $SAVE_PATH) + _target=$(get_target_from_path $SAVE_PATH) + + if is_atomic && is_bind_mount $_mntpoint; then + SAVE_PATH=${SAVE_PATH##"$_mntpoint"} + # the real dump path in the 2nd kernel, if the mount point is bind mounted. + SAVE_PATH=$(get_bind_mount_directory $_mntpoint)/$SAVE_PATH + _mntpoint=$(get_mntpoint_from_target $_target) + + # the absolute path in the 1st kernel + SAVE_PATH=$_mntpoint/$SAVE_PATH + fi + + SAVE_PATH=${SAVE_PATH##"$_mntpoint"} + add_mount "$_target" + check_size fs $_target +} + +get_override_resettable() +{ + local override_resettable + + override_resettable=$(grep "^override_resettable" $conf_file) + if [ -n "$override_resettable" ]; then + OVERRIDE_RESETTABLE=$(echo $override_resettable | cut -d' ' -f2) + if [ "$OVERRIDE_RESETTABLE" != "0" ] && [ "$OVERRIDE_RESETTABLE" != "1" ];then + perror_exit "override_resettable value $OVERRIDE_RESETTABLE is invalid" + fi + fi +} + + +# $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="/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" + local resettable=1 + + if [ -f "$path" ] + then + resettable="$(cat $path)" + [ $resettable -eq 0 -a "$OVERRIDE_RESETTABLE" -eq 0 ] && { + local device=$(udevadm info --query=all --path=/sys/dev/block/$1 | awk -F= '/DEVNAME/{print $2}') + echo "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 _ret _target + + get_override_resettable + + for_each_block_target is_unresettable + _ret=$? + + [ $_ret -eq 0 ] && return + + return 1 +} + +# $1: maj:min +is_crypt() +{ + local majmin=$1 dev line ID_FS_TYPE="" + + line=$(udevadm info --query=property --path=/sys/dev/block/$majmin \ + | grep "^ID_FS_TYPE") + eval "$line" + [[ "$ID_FS_TYPE" = "crypto_LUKS" ]] && { + dev=$(udevadm info --query=all --path=/sys/dev/block/$majmin | awk -F= '/DEVNAME/{print $2}') + echo "Device $dev is encrypted." + return 0 + } + return 1 +} + +check_crypt() +{ + local _ret _target + + for_each_block_target is_crypt + _ret=$? + + [ $_ret -eq 0 ] && return + + return 1 +} + +if ! check_resettable; then + exit 1 +fi + +if ! check_crypt; then + echo "Warning: Encrypted device is in dump path. User will prompted for password during second kernel boot." +fi + +# firstly get right SSH_KEY_LOCATION +keyfile=$(awk '/^sshkey/ {print $2}' $conf_file) +if [ -f "$keyfile" ]; then + # canonicalize the path + SSH_KEY_LOCATION=$(/usr/bin/readlink -m $keyfile) +fi + +if [ "$(uname -m)" = "s390x" ]; then + add_dracut_module "znet" +fi + +while read 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) + if ! findmnt $config_val >/dev/null; then + perror_exit "Dump target $config_val is probably not mounted." + fi + + _absolute_save_path=$(make_absolute_save_path $config_val) + _mntpoint=$(get_mntpoint_from_path $_absolute_save_path) + if is_atomic && is_bind_mount $_mntpoint; then + SAVE_PATH=${_absolute_save_path##"$_mntpoint"} + # the real dump path in the 2nd kernel, if the mount point is bind mounted. + SAVE_PATH=$(get_bind_mount_directory $_mntpoint)/$SAVE_PATH + fi + + add_mount "$config_val" + check_save_path_fs $_absolute_save_path + check_size fs $config_val + ;; + 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" 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 + check_size ssh $config_val + mkdir_save_path_ssh $config_val + add_dracut_module "ssh-client" + 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) + add_dracut_arg $config_val + ;; + *) + ;; + esac +done <<< "$(read_strip_comments $conf_file)" + +handle_default_dump_target + +if [ -n "$extra_modules" ] +then + add_dracut_arg "--add-drivers" "$extra_modules" +fi + +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 + +dracut "${dracut_args[@]}" "$@" +_rc=$? +sync +exit $_rc diff --git a/SOURCES/mkdumprd.8 b/SOURCES/mkdumprd.8 new file mode 100644 index 0000000..7faae57 --- /dev/null +++ b/SOURCES/mkdumprd.8 @@ -0,0 +1,33 @@ +.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. + +\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/rhonly-kexec-tools-2.0.18-makedumpfile-arm64-Add-support-for-ARMv8.2-LVA-52-bi.patch b/SOURCES/rhonly-kexec-tools-2.0.18-makedumpfile-arm64-Add-support-for-ARMv8.2-LVA-52-bi.patch new file mode 100644 index 0000000..014de57 --- /dev/null +++ b/SOURCES/rhonly-kexec-tools-2.0.18-makedumpfile-arm64-Add-support-for-ARMv8.2-LVA-52-bi.patch @@ -0,0 +1,235 @@ +From 54d6ee9d9d4ee807de32ad490040cbb9a3055a09 Mon Sep 17 00:00:00 2001 +From: Bhupesh Sharma <bhsharma@redhat.com> +Date: Wed, 6 Feb 2019 12:31:29 +0530 +Subject: [PATCH] makedumpfile/arm64: Add support for ARMv8.2-LVA (52-bit + user-space VA support) + +With ARMv8.2-LVA architecture extension availability, arm64 hardware +which supports this extension can support upto 52-bit virtual +addresses. It is specially useful for having a 52-bit user-space virtual +address space while the kernel can still retain 48-bit virtual +addresses. + +Since at the moment we enable the support of this extension in the +kernel via a CONFIG flag (CONFIG_ARM64_USER_VA_BITS_52), so there are +no clear mechanisms in user-space to determine this CONFIG +flag value and use it to determine the user-space VA address range +values. + +'makedumpfile' can instead use 'MAX_USER_VA_BITS' value to +determine the maximum virtual physical address supported by user-space. +If 'MAX_USER_VA_BITS' value is greater than 'VA_BITS' than we are +running a use-case where user-space is 52-bit and underlying kernel is +still 48-bit. The increased 'PTRS_PER_PGD' value for such cases can then +be calculated as is done by the underlying kernel (see kernel file +'arch/arm64/include/asm/pgtable-hwdef.h' for details): + + #define PTRS_PER_PGD (1 << (MAX_USER_VA_BITS - PGDIR_SHIFT)) + +I have sent a kernel patch upstream to add 'MAX_USER_VA_BITS' to +vmcoreinfo for arm64 (see [0]). + +This patch is in accordance with ARMv8 Architecture Reference Manual +version D.a + +[0]. +http://lists.infradead.org/pipermail/kexec/2019-February/022411.html + +Signed-off-by: Bhupesh Sharma <bhsharma@redhat.com> +--- + arch/arm64.c | 109 ++++++++++++++++++++++++++++++++++++++++++--------------- + makedumpfile.c | 2 ++ + makedumpfile.h | 1 + + 3 files changed, 83 insertions(+), 29 deletions(-) + +diff --git a/makedumpfile-1.6.5/arch/arm64.c b/makedumpfile-1.6.5/arch/arm64.c +index 053519359cbc..5fcf59d36fed 100644 +--- a/makedumpfile-1.6.5/arch/arm64.c ++++ b/makedumpfile-1.6.5/arch/arm64.c +@@ -41,6 +41,7 @@ typedef struct { + + static int pgtable_level; + static int va_bits; ++static int max_user_va_bits; + static unsigned long kimage_voffset; + + #define SZ_4K (4 * 1024) +@@ -61,7 +62,7 @@ static unsigned long kimage_voffset; + + #define PAGE_MASK (~(PAGESIZE() - 1)) + #define PGDIR_SHIFT ((PAGESHIFT() - 3) * pgtable_level + 3) +-#define PTRS_PER_PGD (1 << (va_bits - PGDIR_SHIFT)) ++#define PTRS_PER_PGD (1 << ((max_user_va_bits) - PGDIR_SHIFT)) + #define PUD_SHIFT get_pud_shift_arm64() + #define PUD_SIZE (1UL << PUD_SHIFT) + #define PUD_MASK (~(PUD_SIZE - 1)) +@@ -73,6 +74,10 @@ static unsigned long kimage_voffset; + #define PTRS_PER_PMD PTRS_PER_PTE + + #define PAGE_PRESENT (1 << 0) ++ ++/* ++ * Section address mask and size definitions. ++ */ + #define SECTIONS_SIZE_BITS 30 + /* Highest possible physical address supported */ + #define PHYS_MASK_SHIFT 48 +@@ -284,14 +289,83 @@ get_stext_symbol(void) + return(found ? kallsym : FALSE); + } + ++static int ++get_va_bits_from_stext_arm64(void) ++{ ++ ulong _stext; ++ ++ _stext = get_stext_symbol(); ++ if (!_stext) { ++ ERRMSG("Can't get the symbol of _stext.\n"); ++ return FALSE; ++ } ++ ++ /* Derive va_bits as per arch/arm64/Kconfig */ ++ if ((_stext & PAGE_OFFSET_36) == PAGE_OFFSET_36) { ++ va_bits = 36; ++ } else if ((_stext & PAGE_OFFSET_39) == PAGE_OFFSET_39) { ++ va_bits = 39; ++ } else if ((_stext & PAGE_OFFSET_42) == PAGE_OFFSET_42) { ++ va_bits = 42; ++ } else if ((_stext & PAGE_OFFSET_47) == PAGE_OFFSET_47) { ++ va_bits = 47; ++ } else if ((_stext & PAGE_OFFSET_48) == PAGE_OFFSET_48) { ++ va_bits = 48; ++ } else { ++ ERRMSG("Cannot find a proper _stext for calculating VA_BITS\n"); ++ return FALSE; ++ } ++ ++ DEBUG_MSG("va_bits : %d\n", va_bits); ++ ++ return TRUE; ++} ++ ++static void ++get_page_offset_arm64(void) ++{ ++ info->page_offset = (0xffffffffffffffffUL) << (va_bits - 1); ++ ++ DEBUG_MSG("page_offset : %lx\n", info->page_offset); ++} ++ + int + get_machdep_info_arm64(void) + { + /* Check if va_bits is still not initialized. If still 0, call + * get_versiondep_info() to initialize the same. + */ ++ if (NUMBER(VA_BITS) != NOT_FOUND_NUMBER) { ++ va_bits = NUMBER(VA_BITS); ++ DEBUG_MSG("va_bits : %d (vmcoreinfo)\n", ++ va_bits); ++ } ++ ++ /* Check if va_bits is still not initialized. If still 0, call ++ * get_versiondep_info() to initialize the same from _stext ++ * symbol. ++ */ + if (!va_bits) +- get_versiondep_info_arm64(); ++ if (get_va_bits_from_stext_arm64() == ERROR) ++ return ERROR; ++ ++ get_page_offset_arm64(); ++ ++ if (NUMBER(MAX_USER_VA_BITS) != NOT_FOUND_NUMBER) { ++ max_user_va_bits = NUMBER(MAX_USER_VA_BITS); ++ DEBUG_MSG("max_user_va_bits : %d (vmcoreinfo)\n", ++ max_user_va_bits); ++ } ++ ++ /* Check if max_user_va_bits is still not initialized. ++ * If still 0, its not available in vmcoreinfo and its ++ * safe to initialize it with va_bits. ++ */ ++ if (!max_user_va_bits) { ++ max_user_va_bits = va_bits; ++ DEBUG_MSG("max_user_va_bits : %d (default = va_bits)\n", ++ max_user_va_bits); ++ } + + if (!calculate_plat_config()) { + ERRMSG("Can't determine platform config values\n"); +@@ -330,34 +404,11 @@ get_xen_info_arm64(void) + int + get_versiondep_info_arm64(void) + { +- ulong _stext; +- +- _stext = get_stext_symbol(); +- if (!_stext) { +- ERRMSG("Can't get the symbol of _stext.\n"); +- return FALSE; +- } +- +- /* Derive va_bits as per arch/arm64/Kconfig */ +- if ((_stext & PAGE_OFFSET_36) == PAGE_OFFSET_36) { +- va_bits = 36; +- } else if ((_stext & PAGE_OFFSET_39) == PAGE_OFFSET_39) { +- va_bits = 39; +- } else if ((_stext & PAGE_OFFSET_42) == PAGE_OFFSET_42) { +- va_bits = 42; +- } else if ((_stext & PAGE_OFFSET_47) == PAGE_OFFSET_47) { +- va_bits = 47; +- } else if ((_stext & PAGE_OFFSET_48) == PAGE_OFFSET_48) { +- va_bits = 48; +- } else { +- ERRMSG("Cannot find a proper _stext for calculating VA_BITS\n"); +- return FALSE; +- } +- +- info->page_offset = (0xffffffffffffffffUL) << (va_bits - 1); ++ if (!va_bits) ++ if (get_va_bits_from_stext_arm64() == ERROR) ++ return ERROR; + +- DEBUG_MSG("va_bits : %d\n", va_bits); +- DEBUG_MSG("page_offset : %lx\n", info->page_offset); ++ get_page_offset_arm64(); + + return TRUE; + } +diff --git a/makedumpfile-1.6.5/makedumpfile.c b/makedumpfile-1.6.5/makedumpfile.c +index 590f759c84f1..b9085247375e 100644 +--- a/makedumpfile-1.6.5/makedumpfile.c ++++ b/makedumpfile-1.6.5/makedumpfile.c +@@ -2312,6 +2312,7 @@ write_vmcoreinfo_data(void) + + WRITE_NUMBER("HUGETLB_PAGE_DTOR", HUGETLB_PAGE_DTOR); + #ifdef __aarch64__ ++ WRITE_NUMBER("MAX_USER_VA_BITS", MAX_USER_VA_BITS); + WRITE_NUMBER("VA_BITS", VA_BITS); + WRITE_NUMBER_UNSIGNED("PHYS_OFFSET", PHYS_OFFSET); + WRITE_NUMBER_UNSIGNED("kimage_voffset", kimage_voffset); +@@ -2717,6 +2718,7 @@ read_vmcoreinfo(void) + READ_NUMBER("PAGE_OFFLINE_MAPCOUNT_VALUE", PAGE_OFFLINE_MAPCOUNT_VALUE); + READ_NUMBER("phys_base", phys_base); + #ifdef __aarch64__ ++ READ_NUMBER("MAX_USER_VA_BITS", MAX_USER_VA_BITS); + READ_NUMBER("VA_BITS", VA_BITS); + READ_NUMBER_UNSIGNED("PHYS_OFFSET", PHYS_OFFSET); + READ_NUMBER_UNSIGNED("kimage_voffset", kimage_voffset); +diff --git a/makedumpfile-1.6.5/makedumpfile.h b/makedumpfile-1.6.5/makedumpfile.h +index 5ad38e9ae40c..311ac05a28ab 100644 +--- a/makedumpfile-1.6.5/makedumpfile.h ++++ b/makedumpfile-1.6.5/makedumpfile.h +@@ -1935,6 +1935,7 @@ struct number_table { + long HUGETLB_PAGE_DTOR; + long phys_base; + #ifdef __aarch64__ ++ long MAX_USER_VA_BITS; + long VA_BITS; + unsigned long PHYS_OFFSET; + unsigned long kimage_voffset; +-- +2.7.4 + diff --git a/SOURCES/supported-kdump-targets.txt b/SOURCES/supported-kdump-targets.txt new file mode 100644 index 0000000..64b7f59 --- /dev/null +++ b/SOURCES/supported-kdump-targets.txt @@ -0,0 +1,110 @@ +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 (cciss, hpsa, megaraid_sas, mpt2sas, aacraid) + SCSI/SATA disks + iSCSI HBA (all offload) + +network: + Hardware using kernel modules: (tg3, igb, ixgbe, sfc, e1000e, bna, + cnic, netxen_nic, qlge, bnx2x, bnx, qlcnic, be2net, enic, + virtio-net, ixgbevf, igbvf) + protocol: ipv4 + bonding + vlan + bridge + team + vlan tagged bonding + bridge over bond/team/vlan + +hypervisor: + kvm + xen (Supported in select configurations only) + +filesystem: + ext[234] + xfs + nfs + +firmware: + BIOS + UEFI + +hypervisor: + VMWare ESXi 4.1 and 5.1 + Hyper-V 2012 R2 (RHEL Gen1 UP Guest only) + +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 + + +Useful Links +============ +[1] RHEL6: Enabling kdump for full-virt (HVM) Xen DomU + (https://access.redhat.com/knowledge/solutions/92943) diff --git a/SPECS/kexec-tools.spec b/SPECS/kexec-tools.spec new file mode 100644 index 0000000..c38bde7 --- /dev/null +++ b/SPECS/kexec-tools.spec @@ -0,0 +1,1872 @@ +Name: kexec-tools +Version: 2.0.19 +Release: 7%{?dist} +License: GPLv2 +Group: Applications/System +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: http://downloads.sourceforge.net/project/makedumpfile/makedumpfile/1.6.5/makedumpfile-1.6.5.tar.gz +Source10: kexec-kdump-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: eppic_050615.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: supported-kdump-targets.txt +Source29: kdump-udev-throttler +Source30: kdump.sysconfig.aarch64 + +####################################### +# These are sources for mkdumpramfs +# Which is currently in development +####################################### +Source100: dracut-kdump.sh +Source101: dracut-module-setup.sh +Source102: dracut-monitor_dd_progress +Source103: dracut-kdump-error-handler.sh +Source104: dracut-kdump-emergency.service +Source105: dracut-kdump-error-handler.service +Source106: dracut-kdump-capture.service +Source107: dracut-kdump-emergency.target +Source108: dracut-early-kdump.sh +Source109: dracut-early-kdump-module-setup.sh + +Requires(post): systemd-units +Requires(preun): systemd-units +Requires(postun): systemd-units +Requires(pre): coreutils sed zlib +Requires: dracut >= 049 +Requires: dracut-network >= 049 +Requires: dracut-squash >= 049 +Requires: ethtool +BuildRequires: zlib-devel zlib zlib-static elfutils-devel-static glib2-devel bzip2-devel ncurses-devel bison flex lzo-devel snappy-devel +BuildRequires: pkgconfig intltool gettext +BuildRequires: systemd-units +BuildRequires: automake autoconf libtool +%ifarch %{ix86} x86_64 ppc64 ppc s390x ppc64le +Obsoletes: diskdumputils netdump kexec-tools-eppic +%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 +# +Patch101: kexec-tools-2.0.19-x86-Introduce-a-new-option-reuse-video-type.patch +Patch102: kexec-tools-2.0.19-makedumpfiles-x86_64-Add-support-for-AMD-Secure-Memory-Encry.patch +# +# 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.16-koji-build-fail-workaround.patch +Patch603: kexec-tools-2.0.18-makedumpfiles-honor-the-CFLAGS-from-environment.patch +Patch604: kexec-tools-2.0.18-eppic-fix-issues-with-hardening-flags.patch +Patch605: kexec-tools-2.0.18-makedumpfiles-exclude-pages-that-are-logically-offline.patch +Patch606: rhonly-kexec-tools-2.0.18-makedumpfile-arm64-Add-support-for-ARMv8.2-LVA-52-bi.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} + +%patch101 -p1 +%patch601 -p1 +%patch603 -p1 +%patch604 -p1 +%patch605 -p1 +%patch606 -p1 +%patch102 -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=/sbin +rm -f kexec-tools.spec.in +# setup the docs +cp %{SOURCE10} . +cp %{SOURCE21} . +cp %{SOURCE26} . +cp %{SOURCE27} . +cp %{SOURCE28} . + +make +%ifarch %{ix86} x86_64 ppc64 s390x ppc64le aarch64 +make -C eppic/libeppic +make -C makedumpfile-1.6.5 LINKTYPE=dynamic USELZO=on USESNAPPY=on +make -C makedumpfile-1.6.5 LDFLAGS="$LDFLAGS -I../eppic/libeppic -L../eppic/libeppic" eppic_makedumpfile.so +%endif + +%install +mkdir -p -m755 $RPM_BUILD_ROOT/sbin +mkdir -p -m755 $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig +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 +install -m 755 %{SOURCE1} $RPM_BUILD_ROOT%{_bindir}/kdumpctl + +install -m 755 build/sbin/kexec $RPM_BUILD_ROOT/sbin/kexec +install -m 755 build/sbin/vmcore-dmesg $RPM_BUILD_ROOT/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/sbin/mkdumprd +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 +%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 +%ifnarch s390x +install -m 755 %{SOURCE29} $RPM_BUILD_ROOT%{_udevrulesdir}/../kdump-udev-throttler +%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 + +%ifarch %{ix86} x86_64 ppc64 s390x ppc64le aarch64 +install -m 755 makedumpfile-1.6.5/makedumpfile $RPM_BUILD_ROOT/sbin/makedumpfile +install -m 644 makedumpfile-1.6.5/makedumpfile.8.gz $RPM_BUILD_ROOT/%{_mandir}/man8/makedumpfile.8.gz +install -m 644 makedumpfile-1.6.5/makedumpfile.conf.5.gz $RPM_BUILD_ROOT/%{_mandir}/man5/makedumpfile.conf.5.gz +install -m 644 makedumpfile-1.6.5/makedumpfile.conf $RPM_BUILD_ROOT/%{_sysconfdir}/makedumpfile.conf.sample +install -m 755 makedumpfile-1.6.5/eppic_makedumpfile.so $RPM_BUILD_ROOT/%{_libdir}/eppic_makedumpfile.so +mkdir -p $RPM_BUILD_ROOT/usr/share/makedumpfile/eppic_scripts/ +install -m 644 makedumpfile-1.6.5/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') + +# 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 %{SOURCE103} $RPM_BUILD_ROOT/etc/kdump-adv-conf/kdump_dracut_modules/99kdumpbase/%{remove_dracut_prefix %{SOURCE103}} +cp %{SOURCE104} $RPM_BUILD_ROOT/etc/kdump-adv-conf/kdump_dracut_modules/99kdumpbase/%{remove_dracut_prefix %{SOURCE104}} +cp %{SOURCE105} $RPM_BUILD_ROOT/etc/kdump-adv-conf/kdump_dracut_modules/99kdumpbase/%{remove_dracut_prefix %{SOURCE105}} +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}} + + +%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/ + +%post +# Initial installation +%systemd_post kdump.service + +touch /etc/kdump.conf +# 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 +# Package removal, not upgrade +%systemd_preun kdump.service + +%triggerun -- kexec-tools < 2.0.2-3 +# Save the current service runlevel info +# User must manually run systemd-sysv-convert --apply kdump +# to migrate them to systemd targets +/usr/bin/systemd-sysv-convert --save kdump >/dev/null 2>&1 ||: + +# Run these because the SysV package being removed won't do them +/sbin/chkconfig --del kdump >/dev/null 2>&1 || : +/bin/systemctl try-restart kdump.service >/dev/null 2>&1 || : + + +%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 + +%files +/sbin/kexec +/sbin/makedumpfile +/sbin/mkdumprd +/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) %{_sysconfdir}/kdump.conf +%ifnarch s390x +%config %{_udevrulesdir} +%{_udevrulesdir}/../kdump-udev-throttler +%endif +%{dracutlibdir}/modules.d/* +%dir %{_localstatedir}/crash +%{_mandir}/man8/kdumpctl.8.gz +%{_mandir}/man8/kexec.8.gz +%{_mandir}/man8/makedumpfile.8.gz +%{_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 +%doc News +%license COPYING +%doc TODO +%doc kexec-kdump-howto.txt +%doc early-kdump-howto.txt +%doc supported-kdump-targets.txt +%doc kdump-in-cluster-environment.txt +%doc live-image-kdump-howto.txt +%ifarch %{ix86} x86_64 ppc64 s390x ppc64le aarch64 +%{_libdir}/eppic_makedumpfile.so +/usr/share/makedumpfile/ +%endif + +%changelog +* Mon Jun 17 2019 Kairui Song <kasong@redhat.com> - 2.0.19-7 +- dracut-kdump-capture.service: Use OnFailureJobMode instead of deprecated OnFailureIsolate + +* Wed Jun 12 2019 Pingfan Liu <piliu@redhat.com> - 2.0.19-6 +- kexec-kdump-howto.txt: Add notes about device dump +- Disable device dump by default + +* Mon Jun 10 2019 Pingfan Liu <piliu@redhat.com> - 2.0.19-5 +- kdumpctl: check for ssh path availability when rebuild +- kdumpctl: Check kdump.conf for error when rebuild is called +- makedumpfile: x86_64: Add support for AMD Secure Memory Encryption +- aarch64/kdump.sysconfig: Make config options similar to x86_64 + +* Mon May 27 2019 Pingfan Liu <piliu@redhat.com> - 2.0.19-4 +- kexec-kdump-howto.txt: Add document about encrypted targets +- kexec-kdump-howto.txt: Add document about initramfs rebiuld +- kexec-kdump-howto: Add note on setting correct value of kptr_restrict +- doc: fix dead links in the file kexec-kdump-howto.txt +- earlykdump: provide a prompt message after the rebuilding of kdump initramfs. +- Get rid of duplicated strip_comments when reading config +- mkdumprd: Improve the config reading logic +- kdumpctl: don't always rebuild when extra_modules is set +- kdumpctl: follow symlink when checking for modified files +- fadump: leverage kernel support to re-regisgter FADump + +* Wed May 15 2019 Pingfan Liu <piliu@redhat.com> - 2.0.19-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 +- earlykdump: warn when installed kernel version differs from dracut target +- earlykdump: add more sanity check when generating initramfs +- fadump: use the original initrd to rebuild fadump initrdfrom + +* Fri May 10 2019 Pingfan Liu <piliu@redhat.com> - 2.0.19-2 +- kdumpctl: Detect block device driver change for initramfs rebuild +- Revert "kdumpctl: Rebuild initramfs if loaded kernel modules changed" +- mkdumprd: allow spaces after 'path' config phrase with network dump setting +- kexec.rules: create dedicated udev rules for ppc64 +- Revert "rhel-only/kexec.rules: create dedicated udev rules for ppc64" +- rh-only makedumpfile/arm64: Add support for ARMv8.2-LVA (52-bit user-space VA support) + +* Mon Apr 22 2019 Pingfan Liu <piliu@redhat.com> - 2.0.19-1 +- kexec-tools: rebasing to 2.0.19 +- makedumpfile: upgrade to 1.6.5 +- kexec-tools: x86: Introduce a new option --reuse-video-type +- makedumpfile: exclude pages that are logically offline +- earlykdump: Fix failure when earlykdump is included by dracut +- Update man page for new kdumpctl command: reload / rebuild +- kdumpctl: add rebuild support +- rhel-only/kexec.rules: create dedicated udev rules for ppc64 + +* Mon Apr 15 2019 Pingfan Liu <piliu@redhat.com> - 2.0.17-30 +- Enable building with hardening flags + +* Fri Mar 15 2019 Pingfan Liu <piliu@redhat.com> - 2.0.17-29 +- add gating + +* Fri Feb 22 2019 Pingfan Liu <piliu@redhat.com> - 2.0.17-28 + +- makedumpfile/arm64: Add support for ARMv8.2-LVA (52-bit user-space VA support) +* Fri Feb 1 2019 Pingfan Liu <piliu@redhat.com> - 2.0.17-27 +- Revert "kdumpctl, earlykdump: Don't use kexec_file_load when secure boot is enabled" +- mkdumprd: refine regex on dropping mount options + +* Mon Jan 14 2019 Pingfan Liu <piliu@redhat.com> - 2.0.17-26 +- earlykdump: fix kexec fails to load the early kdump kernel +- makedumpfile/x86_64: fix an unnecessary message with --mem-usage option + +* Tue Jan 8 2019 Pingfan Liu <piliu@redhat.com> - 2.0.17-25 +- dracut-module-setup: Don't build squashed image if required modules are missing + +* Mon Jan 7 2019 Pingfan Liu <piliu@redhat.com> - 2.0.17-24 +- makedumpfile/arm64: Fix 'info->page_offset' calculation for both KASLR and non-KASLR cases +- makedumpfile: Prepare paddr_to_vaddr() for arch-specific p2v conversion + +* Sat Dec 29 2018 Pingfan Liu <piliu@redhat.com> - 2.0.17-23 +- kdumpctl, earlykdump: Don't use kexec_file_load when secure boot is enabled + +* Mon Dec 17 2018 Lianbo Jiang <lijiang@redhat.com> - 2.0.17-22 +- mkdumprd: drop some nfs mount options when reading from kernel + +* Fri Dec 14 2018 Pingfan Liu <piliu@redhat.com> - 2.0.17-21 +- makedumpfile: Support newer kernels +- kdump-lib-initramfs.sh: using -force option when poweroff +- kexec-tools/vmcore-dmesg: fix infinite loop if log buffer wraps around +- makedumpfile: sadump: fix failure of reading 640 KB backup region if at over 4GB location +- Make udev reload rules quiet during bootup + +* Thu Nov 22 2018 Pingfan Liu <piliu@redhat.com> - 2.0.17-20 +- makedumpfile: Fix failure of detection of SPARSEMEM EXTREME in case of -x VMLINUX +- makedumpfile: ppc64: increase MAX_PHYSMEM_BITS to 128TB +- kdumpctl: Rebuild initramfs if loaded kernel modules changed + +* Thu Nov 15 2018 Pingfan Liu <piliu@redhat.com> - 2.0.17-19 +- Add aarch64 specific kdump.sysconfig and use 'nr_cpus' instead of 'maxcpus' +- Add missing usage info +- Throttle kdump reload request triggered by udev event +- Rewrite kdump's udev rules +- kdumpctl: Add reload support + +* Tue Nov 6 2018 Pingfan Liu <piliu@redhat.com> - 2.0.17-18 +- arm64: If 'getrandom' syscall fails, don't error out - just warn and proceed + +* Mon Oct 29 2018 Pingfan Liu <piliu@redhat.com> - 2.0.17-17 +- Update help text to indicate --mem-usage is supported on archs other than x86_64 +- Fix 'makedumpfile --split' error ("Can't read the buffer of struct page") on x86_64 + +* Tue Oct 16 2018 Pingfan Liu <piliu@redhat.com> - 2.0.17-16 +- dracut-module-setup: Enable dracut squash module +- dracut-module-setup: Fix DRM module inclusion test for hyper-v + +* Sun Sep 30 2018 Pingfan Liu <piliu@redhat.com> +- kdumpctl: add showmem cmd +- makedumpfile: fix makedumpfile Not tainted in 2nd kernel + +* Thu Sep 20 2018 Kairui Song <kasong@redhat.com> - 2.0.17-14 +- Add support to supply 'kaslr-seed' to secondary kernel +- kexec-tools.spec: Drop kexec-tools-2.0.3-disable-kexec-test.patch + +* Mon Jul 30 2018 Florian Weimer <fweimer@redhat.com> - 2.0.17-9 +- Rebuild with fixed binutils + +* Sat Apr 28 2018 Dave Young <dyoung@redhat.com> - 2.0.17-1 +- 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