From fd10de1d06023644d29964037e16fb875f0ff5aa Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Jan 27 2021 04:10:20 +0000 Subject: import kexec-tools-2.0.20-45.el8 --- diff --git a/SOURCES/dracut-early-kdump-module-setup.sh b/SOURCES/dracut-early-kdump-module-setup.sh index 3b23383..b25d6b5 100755 --- a/SOURCES/dracut-early-kdump-module-setup.sh +++ b/SOURCES/dracut-early-kdump-module-setup.sh @@ -1,7 +1,6 @@ #!/bin/bash . /etc/sysconfig/kdump -. /lib/kdump/kdump-lib.sh KDUMP_KERNEL="" KDUMP_INITRD="" @@ -21,6 +20,8 @@ depends() { } prepare_kernel_initrd() { + . /lib/kdump/kdump-lib.sh + prepare_kdump_bootinfo # $kernel is a variable from dracut diff --git a/SOURCES/dracut-early-kdump.sh b/SOURCES/dracut-early-kdump.sh index a4e14a4..129841e 100755 --- a/SOURCES/dracut-early-kdump.sh +++ b/SOURCES/dracut-early-kdump.sh @@ -12,6 +12,7 @@ EARLY_KEXEC_ARGS="" . /etc/sysconfig/kdump . /lib/dracut-lib.sh . /lib/kdump-lib.sh +. /lib/kdump-logger.sh #initiate the kdump logger dlog_init diff --git a/SOURCES/dracut-kdump.sh b/SOURCES/dracut-kdump.sh index 370d217..2497218 100755 --- a/SOURCES/dracut-kdump.sh +++ b/SOURCES/dracut-kdump.sh @@ -111,6 +111,7 @@ dump_ssh() local _dir="$KDUMP_PATH/$HOST_IP-$DATEDIR" local _host=$2 local _vmcore="vmcore" + local _ipv6_addr="" _username="" dinfo "saving to $_host:$_dir" @@ -122,8 +123,17 @@ dump_ssh() dinfo "saving vmcore" + if is_ipv6_address "$_host"; then + _username=${_host%@*} + _ipv6_addr="[${_host#*@}]" + fi + if [ "${CORE_COLLECTOR%%[[:blank:]]*}" = "scp" ]; then - scp -q $_opt /proc/vmcore "$_host:$_dir/vmcore-incomplete" + if [ -n "$_username" ] && [ -n "$_ipv6_addr" ]; then + scp -q $_opt /proc/vmcore "$_username@$_ipv6_addr:$_dir/vmcore-incomplete" + else + scp -q $_opt /proc/vmcore "$_host:$_dir/vmcore-incomplete" + fi _exitcode=$? else $CORE_COLLECTOR /proc/vmcore | ssh $_opt $_host "dd bs=512 of=$_dir/vmcore-incomplete" @@ -143,8 +153,13 @@ dump_ssh() derror "saving vmcore failed, _exitcode:$_exitcode" fi + dinfo "saving the $KDUMP_LOG_FILE to $_host:$_dir/" save_log - scp -q $_opt $KDUMP_LOG_FILE "$_host:$_dir/" + if [ -n "$_username" ] && [ -n "$_ipv6_addr" ]; then + scp -q $_opt $KDUMP_LOG_FILE "$_username@$_ipv6_addr:$_dir/" + else + scp -q $_opt $KDUMP_LOG_FILE "$_host:$_dir/" + fi _ret=$? if [ $_ret -ne 0 ]; then derror "saving log file failed, _exitcode:$_ret" @@ -161,6 +176,7 @@ save_opalcore_ssh() { local _path=$1 local _opts="$2" local _location=$3 + local _user_name="" _ipv6addr="" ddebug "_path=$_path _opts=$_opts _location=$_location" @@ -173,8 +189,18 @@ save_opalcore_ssh() { fi fi + if is_ipv6_address "$_host"; then + _user_name=${_location%@*} + _ipv6addr="[${_location#*@}]" + fi + dinfo "saving opalcore:$OPALCORE to $_location:$_path" - scp $_opts $OPALCORE $_location:$_path/opalcore-incomplete + + if [ -n "$_user_name" ] && [ -n "$_ipv6addr" ]; then + scp $_opts $OPALCORE $_user_name@$_ipv6addr:$_path/opalcore-incomplete + else + scp $_opts $OPALCORE $_location:$_path/opalcore-incomplete + fi if [ $? -ne 0 ]; then derror "saving opalcore failed" return 1 diff --git a/SOURCES/dracut-module-setup.sh b/SOURCES/dracut-module-setup.sh index 24de381..917afed 100755 --- a/SOURCES/dracut-module-setup.sh +++ b/SOURCES/dracut-module-setup.sh @@ -1,11 +1,12 @@ #!/bin/bash -. $dracutfunctions -. /lib/kdump/kdump-lib.sh +kdump_module_init() { + if ! [[ -d "${initdir}/tmp" ]]; then + mkdir -p "${initdir}/tmp" + fi -if ! [[ -d "${initdir}/tmp" ]]; then - mkdir -p "${initdir}/tmp" -fi + . /lib/kdump/kdump-lib.sh +} check() { [[ $debug ]] && set -x @@ -20,6 +21,8 @@ check() { depends() { local _dep="base shutdown" + kdump_module_init + add_opt_module() { [[ " $omit_dracutmodules " != *\ $1\ * ]] && _dep="$_dep $1" } @@ -786,18 +789,17 @@ kdump_install_systemd_conf() { # Forward logs to console directly, and don't read Kmsg, this avoids # unneccessary memory consumption and make console output more useful. # Only do so for non fadump image. - if ! is_fadump_capable; then - mkdir -p ${initdir}/etc/systemd/journald.conf.d - echo "[Journal]" > ${initdir}/etc/systemd/journald.conf.d/kdump.conf - echo "Storage=volatile" >> ${initdir}/etc/systemd/journald.conf.d/kdump.conf - echo "ReadKMsg=no" >> ${initdir}/etc/systemd/journald.conf.d/kdump.conf - echo "ForwardToConsole=yes" >> ${initdir}/etc/systemd/journald.conf.d/kdump.conf - fi + mkdir -p ${initdir}/etc/systemd/journald.conf.d + echo "[Journal]" > ${initdir}/etc/systemd/journald.conf.d/kdump.conf + echo "Storage=volatile" >> ${initdir}/etc/systemd/journald.conf.d/kdump.conf + echo "ReadKMsg=no" >> ${initdir}/etc/systemd/journald.conf.d/kdump.conf + echo "ForwardToConsole=yes" >> ${initdir}/etc/systemd/journald.conf.d/kdump.conf } install() { local arch + kdump_module_init kdump_install_conf remove_sysctl_conf diff --git a/SOURCES/kdump-dep-generator.sh b/SOURCES/kdump-dep-generator.sh index b6fab2d..f48c8f6 100644 --- a/SOURCES/kdump-dep-generator.sh +++ b/SOURCES/kdump-dep-generator.sh @@ -4,6 +4,7 @@ # http://www.freedesktop.org/wiki/Software/systemd/Generators/ . /usr/lib/kdump/kdump-lib.sh +. /usr/lib/kdump/kdump-logger.sh # If invokded with no arguments for testing purpose, output to /tmp to # avoid overriding the existing. diff --git a/SOURCES/kdump-lib-initramfs.sh b/SOURCES/kdump-lib-initramfs.sh index 75a174b..a43c7dd 100755 --- a/SOURCES/kdump-lib-initramfs.sh +++ b/SOURCES/kdump-lib-initramfs.sh @@ -1,6 +1,7 @@ # These variables and functions are useful in 2nd kernel . /lib/kdump-lib.sh +. /lib/kdump-logger.sh KDUMP_PATH="/var/crash" KDUMP_LOG_FILE="/run/initramfs/kexec-dmesg.log" @@ -150,6 +151,7 @@ dump_fs() derror "saving vmcore failed, _exitcode:$_exitcode" fi + dinfo "saving the $KDUMP_LOG_FILE to $_mp/$KDUMP_PATH/$HOST_IP-$DATEDIR/" save_log mv $KDUMP_LOG_FILE $_mp/$KDUMP_PATH/$HOST_IP-$DATEDIR/ if [ $_exitcode -ne 0 ]; then diff --git a/SOURCES/kdump-lib.sh b/SOURCES/kdump-lib.sh index bd75d51..8ae8617 100755 --- a/SOURCES/kdump-lib.sh +++ b/SOURCES/kdump-lib.sh @@ -8,12 +8,6 @@ FENCE_KDUMP_CONFIG_FILE="/etc/sysconfig/fence_kdump" FENCE_KDUMP_SEND="/usr/libexec/fence_kdump_send" FADUMP_ENABLED_SYS_NODE="/sys/kernel/fadump_enabled" -if [ -f /lib/kdump/kdump-logger.sh ]; then - . /lib/kdump/kdump-logger.sh -elif [ -f /lib/kdump-logger.sh ]; then - . /lib/kdump-logger.sh -fi - is_fadump_capable() { # Check if firmware-assisted dump is enabled diff --git a/SOURCES/kdump.conf b/SOURCES/kdump.conf index cbffde2..a0af268 100644 --- a/SOURCES/kdump.conf +++ b/SOURCES/kdump.conf @@ -166,7 +166,9 @@ #ext4 LABEL=/boot #ext4 UUID=03138356-5e61-4ab3-b58e-27507ac41937 #nfs my.server.com:/export/tmp +#nfs [2001:db8::1:2:3:4]:/export/tmp #ssh user@my.server.com +#ssh user@2001:db8::1:2:3:4 #sshkey /root/.ssh/kdump_id_rsa path /var/crash core_collector makedumpfile -l --message-level 7 -d 31 diff --git a/SOURCES/kdumpctl b/SOURCES/kdumpctl index 9f58700..ef86571 100755 --- a/SOURCES/kdumpctl +++ b/SOURCES/kdumpctl @@ -34,6 +34,7 @@ fi [[ $dracutbasedir ]] || dracutbasedir=/usr/lib/dracut . $dracutbasedir/dracut-functions.sh . /lib/kdump/kdump-lib.sh +. /lib/kdump/kdump-logger.sh #initiate the kdump logger dlog_init diff --git a/SOURCES/mkdumprd b/SOURCES/mkdumprd index 291616b..6e923fe 100644 --- a/SOURCES/mkdumprd +++ b/SOURCES/mkdumprd @@ -13,6 +13,7 @@ fi [[ $dracutbasedir ]] || dracutbasedir=/usr/lib/dracut . $dracutbasedir/dracut-functions.sh . /lib/kdump/kdump-lib.sh +. /lib/kdump/kdump-logger.sh export IN_KDUMP=1 #initiate the kdump logger @@ -83,6 +84,9 @@ to_mount() { # 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') + # use both nofail and x-systemd.before to ensure systemd will try best to + # mount it before kdump starts, this is an attempt to improve robustness + _options="$_options,nofail,x-systemd.before=initrd-fs.target" echo "$_pdev $_new_mntpoint $_fstype $_options" } diff --git a/SPECS/kexec-tools.spec b/SPECS/kexec-tools.spec index 491422a..94aa05d 100644 --- a/SPECS/kexec-tools.spec +++ b/SPECS/kexec-tools.spec @@ -1,6 +1,6 @@ Name: kexec-tools Version: 2.0.20 -Release: 43%{?dist} +Release: 45%{?dist} License: GPLv2 Group: Applications/System Summary: The kexec/kdump userspace component @@ -378,6 +378,17 @@ done %endif %changelog +* Mon Jan 25 2021 Pingfan Liu - 2.0.20-45 +- origin/rhel-8.4.0) Revert "Revert "Append both nofail and x-systemd.before to kdump mount target"" +- kdump.conf: add ipv6 example for nfs and ssh dump +- fix kdump failure of saving vmcore with the scp + ipv6 method + +* Fri Jan 22 2021 Pingfan Liu - 2.0.20-44 +- module-setup.sh: don't polute the namespace unnecessarily +- module-setup.sh: don't source $dracutfunctions +- logger: source the logger file individually +- dracut-module-setup.sh: enable ForwardToConsole=yes in fadump mode + * Fri Jan 15 2021 Pingfan Liu - 2.0.20-43 - Always include watchdog-modules - mkdumprd: Ensure kdumpbase is added