Merged update from upstream sources

This is an automated DistroBaker update from upstream sources.
If you do not know what this is about or would like to opt out,
contact the OSCI team.

Source: https://src.fedoraproject.org/rpms/kexec-tools.git#33108ef524ff033295711f888ce2c67d457951aa
This commit is contained in:
DistroBaker 2021-01-22 08:12:00 +00:00
parent 6333173003
commit 624a6443ca
13 changed files with 168 additions and 53 deletions

View File

@ -1,7 +1,6 @@
#!/bin/bash #!/bin/bash
. /etc/sysconfig/kdump . /etc/sysconfig/kdump
. /lib/kdump/kdump-lib.sh
KDUMP_KERNEL="" KDUMP_KERNEL=""
KDUMP_INITRD="" KDUMP_INITRD=""
@ -21,6 +20,8 @@ depends() {
} }
prepare_kernel_initrd() { prepare_kernel_initrd() {
. /lib/kdump/kdump-lib.sh
prepare_kdump_bootinfo prepare_kdump_bootinfo
# $kernel is a variable from dracut # $kernel is a variable from dracut

View File

@ -12,6 +12,7 @@ EARLY_KEXEC_ARGS=""
. /etc/sysconfig/kdump . /etc/sysconfig/kdump
. /lib/dracut-lib.sh . /lib/dracut-lib.sh
. /lib/kdump-lib.sh . /lib/kdump-lib.sh
. /lib/kdump-logger.sh
#initiate the kdump logger #initiate the kdump logger
dlog_init dlog_init

View File

@ -111,6 +111,7 @@ dump_ssh()
local _dir="$KDUMP_PATH/$HOST_IP-$DATEDIR" local _dir="$KDUMP_PATH/$HOST_IP-$DATEDIR"
local _host=$2 local _host=$2
local _vmcore="vmcore" local _vmcore="vmcore"
local _ipv6_addr="" _username=""
dinfo "saving to $_host:$_dir" dinfo "saving to $_host:$_dir"
@ -122,8 +123,17 @@ dump_ssh()
dinfo "saving vmcore" dinfo "saving vmcore"
if is_ipv6_address "$_host"; then
_username=${_host%@*}
_ipv6_addr="[${_host#*@}]"
fi
if [ "${CORE_COLLECTOR%%[[:blank:]]*}" = "scp" ]; then 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=$? _exitcode=$?
else else
$CORE_COLLECTOR /proc/vmcore | ssh $_opt $_host "dd bs=512 of=$_dir/vmcore-incomplete" $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" derror "saving vmcore failed, _exitcode:$_exitcode"
fi fi
dinfo "saving the $KDUMP_LOG_FILE to $_host:$_dir/"
save_log 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=$? _ret=$?
if [ $_ret -ne 0 ]; then if [ $_ret -ne 0 ]; then
derror "saving log file failed, _exitcode:$_ret" derror "saving log file failed, _exitcode:$_ret"
@ -161,6 +176,7 @@ save_opalcore_ssh() {
local _path=$1 local _path=$1
local _opts="$2" local _opts="$2"
local _location=$3 local _location=$3
local _user_name="" _ipv6addr=""
ddebug "_path=$_path _opts=$_opts _location=$_location" ddebug "_path=$_path _opts=$_opts _location=$_location"
@ -173,8 +189,18 @@ save_opalcore_ssh() {
fi fi
fi fi
if is_ipv6_address "$_host"; then
_user_name=${_location%@*}
_ipv6addr="[${_location#*@}]"
fi
dinfo "saving opalcore:$OPALCORE to $_location:$_path" 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 if [ $? -ne 0 ]; then
derror "saving opalcore failed" derror "saving opalcore failed"
return 1 return 1

View File

@ -1,11 +1,12 @@
#!/bin/bash #!/bin/bash
. $dracutfunctions kdump_module_init() {
. /lib/kdump/kdump-lib.sh if ! [[ -d "${initdir}/tmp" ]]; then
mkdir -p "${initdir}/tmp"
fi
if ! [[ -d "${initdir}/tmp" ]]; then . /lib/kdump/kdump-lib.sh
mkdir -p "${initdir}/tmp" }
fi
check() { check() {
[[ $debug ]] && set -x [[ $debug ]] && set -x
@ -20,6 +21,8 @@ check() {
depends() { depends() {
local _dep="base shutdown" local _dep="base shutdown"
kdump_module_init
add_opt_module() { add_opt_module() {
[[ " $omit_dracutmodules " != *\ $1\ * ]] && _dep="$_dep $1" [[ " $omit_dracutmodules " != *\ $1\ * ]] && _dep="$_dep $1"
} }
@ -32,6 +35,9 @@ depends() {
modprobe -S $KDUMP_KERNELVER --dry-run $kmodule &>/dev/null || return 1 modprobe -S $KDUMP_KERNELVER --dry-run $kmodule &>/dev/null || return 1
fi fi
done done
# check that the dracut squash module is available
[ -d "$(dracut_module_path squash)" ] || return 1
} }
if is_squash_available && ! is_fadump_capable; then if is_squash_available && ! is_fadump_capable; then
@ -813,16 +819,15 @@ kdump_install_systemd_conf() {
# Forward logs to console directly, and don't read Kmsg, this avoids # Forward logs to console directly, and don't read Kmsg, this avoids
# unneccessary memory consumption and make console output more useful. # unneccessary memory consumption and make console output more useful.
# Only do so for non fadump image. # Only do so for non fadump image.
if ! is_fadump_capable; then mkdir -p ${initdir}/etc/systemd/journald.conf.d
mkdir -p ${initdir}/etc/systemd/journald.conf.d echo "[Journal]" > ${initdir}/etc/systemd/journald.conf.d/kdump.conf
echo "[Journal]" > ${initdir}/etc/systemd/journald.conf.d/kdump.conf echo "Storage=volatile" >> ${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 "ReadKMsg=no" >> ${initdir}/etc/systemd/journald.conf.d/kdump.conf echo "ForwardToConsole=yes" >> ${initdir}/etc/systemd/journald.conf.d/kdump.conf
echo "ForwardToConsole=yes" >> ${initdir}/etc/systemd/journald.conf.d/kdump.conf
fi
} }
install() { install() {
kdump_module_init
kdump_install_conf kdump_install_conf
overwrite_sysctl_conf overwrite_sysctl_conf

View File

@ -4,6 +4,7 @@
# http://www.freedesktop.org/wiki/Software/systemd/Generators/ # http://www.freedesktop.org/wiki/Software/systemd/Generators/
. /usr/lib/kdump/kdump-lib.sh . /usr/lib/kdump/kdump-lib.sh
. /usr/lib/kdump/kdump-logger.sh
# If invokded with no arguments for testing purpose, output to /tmp to # If invokded with no arguments for testing purpose, output to /tmp to
# avoid overriding the existing. # avoid overriding the existing.

View File

@ -1,6 +1,7 @@
# These variables and functions are useful in 2nd kernel # These variables and functions are useful in 2nd kernel
. /lib/kdump-lib.sh . /lib/kdump-lib.sh
. /lib/kdump-logger.sh
KDUMP_PATH="/var/crash" KDUMP_PATH="/var/crash"
KDUMP_LOG_FILE="/run/initramfs/kexec-dmesg.log" KDUMP_LOG_FILE="/run/initramfs/kexec-dmesg.log"
@ -117,26 +118,15 @@ dump_fs()
{ {
local _exitcode local _exitcode
local _mp=$1 local _mp=$1
local _dev=$(get_mount_info SOURCE target $_mp -f) ddebug "dump_fs _mp=$_mp"
local _op=$(get_mount_info OPTIONS target $_mp -f)
ddebug "_mp=$_mp _dev=$_dev _op=$_op" if ! is_mounted "$_mp"; then
dinfo "dump path \"$_mp\" is not mounted, trying to mount..."
# If dump path have a corresponding device entry but not mounted, mount it. mount --target $_mp
if [ -n "$_dev" ] && [ "$_dev" != "rootfs" ]; then if [ $? -ne 0 ]; then
if ! is_mounted "$_mp"; then derror "failed to dump to \"$_mp\", it's not a mount point!"
dinfo "dump target $_dev is not mounted, trying to mount..." return 1
mkdir -p $_mp
mount -o $_op $_dev $_mp
if [ $? -ne 0 ]; then
derror "mounting failed (mount point: $_mp, option: $_op)"
return 1
fi
fi fi
else
derror "failed to dump to \"$_mp\", it's not a mount point!"
return 1
fi fi
# Remove -F in makedumpfile case. We don't want a flat format dump here. # Remove -F in makedumpfile case. We don't want a flat format dump here.
@ -168,6 +158,7 @@ dump_fs()
derror "saving vmcore failed, _exitcode:$_exitcode" derror "saving vmcore failed, _exitcode:$_exitcode"
fi fi
dinfo "saving the $KDUMP_LOG_FILE to $_dump_path/"
save_log save_log
mv $KDUMP_LOG_FILE $_dump_path/ mv $KDUMP_LOG_FILE $_dump_path/
if [ $_exitcode -ne 0 ]; then if [ $_exitcode -ne 0 ]; then
@ -226,8 +217,7 @@ dump_to_rootfs()
{ {
dinfo "Trying to bring up rootfs device" dinfo "Trying to bring up rootfs device"
systemctl is-failed dracut-initqueue || systemctl start dracut-initqueue systemctl start dracut-initqueue
dinfo "Waiting for rootfs mount, will timeout after 90 seconds" dinfo "Waiting for rootfs mount, will timeout after 90 seconds"
systemctl start sysroot.mount systemctl start sysroot.mount

View File

@ -8,12 +8,6 @@ FENCE_KDUMP_CONFIG_FILE="/etc/sysconfig/fence_kdump"
FENCE_KDUMP_SEND="/usr/libexec/fence_kdump_send" FENCE_KDUMP_SEND="/usr/libexec/fence_kdump_send"
FADUMP_ENABLED_SYS_NODE="/sys/kernel/fadump_enabled" 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() is_fadump_capable()
{ {
# Check if firmware-assisted dump is enabled # Check if firmware-assisted dump is enabled

View File

@ -21,7 +21,7 @@
# <mnt>/<path>/%HOST-%DATE/, supports DNS. # <mnt>/<path>/%HOST-%DATE/, supports DNS.
# #
# ssh <user@server> # ssh <user@server>
# - Will scp /proc/vmcore to <user@server>:<path>/%HOST-%DATE/, # - Will save /proc/vmcore to <user@server>:<path>/%HOST-%DATE/,
# supports DNS. # supports DNS.
# NOTE: make sure the user has write permissions on the server. # NOTE: make sure the user has write permissions on the server.
# #
@ -166,7 +166,9 @@
#ext4 LABEL=/boot #ext4 LABEL=/boot
#ext4 UUID=03138356-5e61-4ab3-b58e-27507ac41937 #ext4 UUID=03138356-5e61-4ab3-b58e-27507ac41937
#nfs my.server.com:/export/tmp #nfs my.server.com:/export/tmp
#nfs [2001:db8::1:2:3:4]:/export/tmp
#ssh user@my.server.com #ssh user@my.server.com
#ssh user@2001:db8::1:2:3:4
#sshkey /root/.ssh/kdump_id_rsa #sshkey /root/.ssh/kdump_id_rsa
path /var/crash path /var/crash
core_collector makedumpfile -l --message-level 7 -d 31 core_collector makedumpfile -l --message-level 7 -d 31

View File

@ -98,6 +98,11 @@ vmcore.flat, you will need to use "makedumpfile -R" to rearrange the
dump data from standard input to a normal dumpfile (readable with analysis dump data from standard input to a normal dumpfile (readable with analysis
tools). tools).
ie. "makedumpfile -R vmcore < vmcore.flat" ie. "makedumpfile -R vmcore < vmcore.flat"
.PP
Note 3: If specified core_collector simply copy the vmcore file to the
dump target (eg: cp, scp), the vmcore could be significantly large.
Please make sure the dump target has enough space, at leaset larger
than the system's RAM.
.RE .RE

View File

@ -34,6 +34,7 @@ fi
[[ $dracutbasedir ]] || dracutbasedir=/usr/lib/dracut [[ $dracutbasedir ]] || dracutbasedir=/usr/lib/dracut
. $dracutbasedir/dracut-functions.sh . $dracutbasedir/dracut-functions.sh
. /lib/kdump/kdump-lib.sh . /lib/kdump/kdump-lib.sh
. /lib/kdump/kdump-logger.sh
#initiate the kdump logger #initiate the kdump logger
dlog_init dlog_init

View File

@ -524,17 +524,91 @@ to send over the necessary ssh key file. Restart the kdump service via
Advanced Setups Advanced Setups
=============== ===============
Kdump boot directory About /etc/sysconfig/kdump
-------------------- ------------------------------
Currently, there are a few options in /etc/sysconfig/kdump, which are
usually used to control the behavior of kdump kernel. Basically, all of
these options have default values, usually we do not need to change them,
but sometimes, we may modify them in order to better control the behavior
of kdump kernel such as debug, etc.
-KDUMP_BOOTDIR
Usually kdump kernel is the same as 1st kernel. So kdump will try to find 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 kdump kernel under /boot according to /proc/cmdline. E.g we execute below
command and get an output: command and get an output:
cat /proc/cmdline cat /proc/cmdline
BOOT_IMAGE=/xxx/vmlinuz-3.yyy.zzz root=xxxx ..... 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 Then kdump kernel will be /boot/xxx/vmlinuz-3.yyy.zzz. However, this option
user if kdump kernel is put in a different directory. is provided to user if kdump kernel is put in a different directory.
-KDUMP_IMG
This represents the image type used for kdump. The default value is "vmlinuz".
-KDUMP_IMG_EXT
This represents the images extension. Relocatable kernels don't have one.
Currently, it is a null string by default.
-KEXEC_ARGS
Any additional kexec arguments required. For example:
KEXEC_ARGS="--elf32-core-headers".
In most situations, this should be left empty. But, sometimes we hope to get
additional kexec loading debugging information, we can add the '-d' option
for the debugging.
-KDUMP_KERNELVER
This is a kernel version string for the kdump kernel. If the version is not
specified, the init script will try to find a kdump kernel with the same
version number as the running kernel.
-KDUMP_COMMANDLINE
The value of 'KDUMP_COMMANDLINE' will be passed to kdump kernel as command
line parameters, this will likely match the contents of the grub kernel line.
In general, if a command line is not specified, which means that it is a null
string such as KDUMP_COMMANDLINE="", the default will be taken automatically
from the '/proc/cmdline'.
-KDUMP_COMMANDLINE_REMOVE
This option allows us to remove arguments from the current kdump command line.
If we don't specify any parameters for the KDUMP_COMMANDLINE, it will inherit
all values from the '/proc/cmdline', which is not expected. As you know, some
default kernel parameters could affect kdump, furthermore, that could cause
the failure of kdump kernel boot.
In addition, the option is also helpful to debug the kdump kernel, we can use
this option to change kdump kernel command line.
For more kernel parameters, please refer to kernel document.
-KDUMP_COMMANDLINE_APPEND
This option allows us to append arguments to the current kdump command line
after processed by the KDUMP_COMMANDLINE_REMOVE. For kdump kernel, some
specific modules require to be disabled like the mce, cgroup, numa, hest_disable,
etc. Those modules may waste memory or kdump kernel doesn't need them,
furthermore, there may affect kdump kernel boot.
Just like above option, it can be used to disable or enable some kernel
modules so that we can exclude any errors for kdump kernel, this is very
meaningful for debugging.
-KDUMP_STDLOGLVL | KDUMP_SYSLOGLVL | KDUMP_KMSGLOGLVL
These variables are used to control the kdump log level in the first kernel.
In the second kernel, kdump will use the rd.kdumploglvl option to set the log
level in the above KDUMP_COMMANDLINE_APPEND.
Logging levels: no logging(0), error(1), warn(2), info(3), debug(4)
Kdump Post-Capture Executable Kdump Post-Capture Executable
----------------------------- -----------------------------

View File

@ -5,7 +5,7 @@
Name: kexec-tools Name: kexec-tools
Version: 2.0.21 Version: 2.0.21
Release: 2%{?dist} Release: 4%{?dist}
License: GPLv2 License: GPLv2
Summary: The kexec/kdump userspace component Summary: The kexec/kdump userspace component
@ -61,7 +61,7 @@ Requires(postun): systemd-units
Requires(pre): coreutils sed zlib Requires(pre): coreutils sed zlib
Requires: dracut >= 050 Requires: dracut >= 050
Requires: dracut-network >= 050 Requires: dracut-network >= 050
Requires: dracut-squash >= 050 Recommends: dracut-squash >= 050
Requires: ethtool Requires: ethtool
BuildRequires: make BuildRequires: make
BuildRequires: zlib-devel elfutils-devel glib2-devel bzip2-devel ncurses-devel bison flex lzo-devel snappy-devel BuildRequires: zlib-devel elfutils-devel glib2-devel bzip2-devel ncurses-devel bison flex lzo-devel snappy-devel
@ -361,6 +361,23 @@ done
%endif %endif
%changelog %changelog
* Fri Jan 22 2021 Kairui Song <kasong@redhat.com> - 2.0.21-4
- dracut-module-setup.sh: enable ForwardToConsole=yes in fadump mode
- kdump.conf: add ipv6 example for nfs and ssh dump
- fix kdump failure of saving vmcore with the scp + ipv6 method
* Wed Jan 20 2021 Kairui Song <kasong@redhat.com> - 2.0.21-3
- module-setup.sh: don't polute the namespace unnecessarily
- module-setup.sh: don't source $dracutfunctions
- logger: source the logger file individually
- Fix dump_fs mount point detection and fallback mount
- Revert "Don's try to restart dracut-initqueue if it's already failed"
- Revert "Append both nofail and x-systemd.before to kdump mount target"
- Doc: Improve the kdump sysconfig document
- kdump.conf: Update doc about core_collector for ssh target
- Merge #4 `Make dracut-squash a weak dep`
- Fix a date error in the change log
* Fri Jan 08 2021 Kairui Song <kasong@redhat.com> - 2.0.21-2 * Fri Jan 08 2021 Kairui Song <kasong@redhat.com> - 2.0.21-2
- makedumpfile: make use of 'uts_namespace.name' offset in VMCOREINFO - makedumpfile: make use of 'uts_namespace.name' offset in VMCOREINFO
- kdumpctl: fix a variable expansion in check_fence_kdump_config() - kdumpctl: fix a variable expansion in check_fence_kdump_config()

View File

@ -13,6 +13,7 @@ fi
[[ $dracutbasedir ]] || dracutbasedir=/usr/lib/dracut [[ $dracutbasedir ]] || dracutbasedir=/usr/lib/dracut
. $dracutbasedir/dracut-functions.sh . $dracutbasedir/dracut-functions.sh
. /lib/kdump/kdump-lib.sh . /lib/kdump/kdump-lib.sh
. /lib/kdump/kdump-logger.sh
export IN_KDUMP=1 export IN_KDUMP=1
#initiate the kdump logger #initiate the kdump logger
@ -86,9 +87,6 @@ to_mount() {
# drop nofail or nobootwait # drop nofail or nobootwait
_options=$(echo $_options | sed 's/\(^\|,\)nofail\($\|,\)/\1/g') _options=$(echo $_options | sed 's/\(^\|,\)nofail\($\|,\)/\1/g')
_options=$(echo $_options | sed 's/\(^\|,\)nobootwait\($\|,\)/\1/g') _options=$(echo $_options | sed 's/\(^\|,\)nobootwait\($\|,\)/\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" echo "$_pdev $_new_mntpoint $_fstype $_options"
} }