import kexec-tools-2.0.23-1.el9
This commit is contained in:
parent
7226be6b22
commit
3a88c262a8
4
.gitignore
vendored
4
.gitignore
vendored
@ -1,3 +1,3 @@
|
|||||||
SOURCES/eppic-d84c354.tar.gz
|
SOURCES/eppic-d84c354.tar.gz
|
||||||
SOURCES/kexec-tools-2.0.22.tar.xz
|
SOURCES/kexec-tools-2.0.23.tar.xz
|
||||||
SOURCES/makedumpfile-1.6.9.tar.gz
|
SOURCES/makedumpfile-1.7.0.tar.gz
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
b902add474c63fe34c4cdf2eba882d7f8675e04e SOURCES/eppic-d84c354.tar.gz
|
b902add474c63fe34c4cdf2eba882d7f8675e04e SOURCES/eppic-d84c354.tar.gz
|
||||||
d23d055fb98f7fa68a2888b52f11530ba3b3a206 SOURCES/kexec-tools-2.0.22.tar.xz
|
c9213672bbc9d08d25f6b1ea0cd9056d2e1c5e73 SOURCES/kexec-tools-2.0.23.tar.xz
|
||||||
f07e6ce86b1e2e20b27137c26f08cd15e5460aca SOURCES/makedumpfile-1.6.9.tar.gz
|
a931a40b80df204be1b02bfb502921cc618810fd SOURCES/makedumpfile-1.7.0.tar.gz
|
||||||
|
@ -120,8 +120,9 @@ add)
|
|||||||
if [[ "$boot_ck_cmdline" != "$inst_ck_default" ]] && [[ "$boot_ck_cmdline" == "$boot_ck_default" ]]; then
|
if [[ "$boot_ck_cmdline" != "$inst_ck_default" ]] && [[ "$boot_ck_cmdline" == "$boot_ck_default" ]]; then
|
||||||
set_kernel_ck "$KERNEL_VERSION" "$inst_ck_default"
|
set_kernel_ck "$KERNEL_VERSION" "$inst_ck_default"
|
||||||
fi
|
fi
|
||||||
;;
|
|
||||||
|
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
remove)
|
remove)
|
||||||
# If grub default value is upgraded when this kernel was installed, try downgrade it
|
# If grub default value is upgraded when this kernel was installed, try downgrade it
|
||||||
grub_etc_ck=$(get_grub_etc_ck)
|
grub_etc_ck=$(get_grub_etc_ck)
|
||||||
@ -139,5 +140,7 @@ remove)
|
|||||||
set_grub_ck "$highest_ck_default"
|
set_grub_ck "$highest_ck_default"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
exit 0
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
@ -6,9 +6,8 @@ KDUMP_KERNEL=""
|
|||||||
KDUMP_INITRD=""
|
KDUMP_INITRD=""
|
||||||
|
|
||||||
check() {
|
check() {
|
||||||
if [ ! -f /etc/sysconfig/kdump ] || [ ! -f /lib/kdump/kdump-lib.sh ]\
|
if [[ ! -f /etc/sysconfig/kdump ]] || [[ ! -f /lib/kdump/kdump-lib.sh ]] \
|
||||||
|| [ -n "${IN_KDUMP}" ]
|
|| [[ -n ${IN_KDUMP} ]]; then
|
||||||
then
|
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
return 255
|
return 255
|
||||||
@ -25,7 +24,7 @@ prepare_kernel_initrd() {
|
|||||||
prepare_kdump_bootinfo
|
prepare_kdump_bootinfo
|
||||||
|
|
||||||
# $kernel is a variable from dracut
|
# $kernel is a variable from dracut
|
||||||
if [ "$KDUMP_KERNELVER" != $kernel ]; then
|
if [[ $KDUMP_KERNELVER != "$kernel" ]]; then
|
||||||
dwarn "Using kernel version '$KDUMP_KERNELVER' for early kdump," \
|
dwarn "Using kernel version '$KDUMP_KERNELVER' for early kdump," \
|
||||||
"but the initramfs is generated for kernel version '$kernel'"
|
"but the initramfs is generated for kernel version '$kernel'"
|
||||||
fi
|
fi
|
||||||
@ -33,12 +32,12 @@ prepare_kernel_initrd() {
|
|||||||
|
|
||||||
install() {
|
install() {
|
||||||
prepare_kernel_initrd
|
prepare_kernel_initrd
|
||||||
if [ ! -f "$KDUMP_KERNEL" ]; then
|
if [[ ! -f $KDUMP_KERNEL ]]; then
|
||||||
derror "Could not find required kernel for earlykdump," \
|
derror "Could not find required kernel for earlykdump," \
|
||||||
"earlykdump will not work!"
|
"earlykdump will not work!"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
if [ ! -f "$KDUMP_INITRD" ]; then
|
if [[ ! -f $KDUMP_INITRD ]]; then
|
||||||
derror "Could not find required kdump initramfs for earlykdump," \
|
derror "Could not find required kdump initramfs for earlykdump," \
|
||||||
"please ensure kdump initramfs is generated first," \
|
"please ensure kdump initramfs is generated first," \
|
||||||
"earlykdump will not work!"
|
"earlykdump will not work!"
|
||||||
|
@ -14,9 +14,8 @@ EARLY_KEXEC_ARGS=""
|
|||||||
. /lib/kdump-lib.sh
|
. /lib/kdump-lib.sh
|
||||||
. /lib/kdump-logger.sh
|
. /lib/kdump-logger.sh
|
||||||
|
|
||||||
#initiate the kdump logger
|
# initiate the kdump logger
|
||||||
dlog_init
|
if ! dlog_init; then
|
||||||
if [ $? -ne 0 ]; then
|
|
||||||
echo "failed to initiate the kdump logger."
|
echo "failed to initiate the kdump logger."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
@ -30,8 +29,7 @@ prepare_parameters()
|
|||||||
|
|
||||||
early_kdump_load()
|
early_kdump_load()
|
||||||
{
|
{
|
||||||
check_kdump_feasibility
|
if ! check_kdump_feasibility; then
|
||||||
if [ $? -ne 0 ]; then
|
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -40,8 +38,7 @@ early_kdump_load()
|
|||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
check_current_kdump_status
|
if check_current_kdump_status; then
|
||||||
if [ $? == 0 ]; then
|
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -61,10 +58,9 @@ early_kdump_load()
|
|||||||
--command-line=$EARLY_KDUMP_CMDLINE --initrd=$EARLY_KDUMP_INITRD \
|
--command-line=$EARLY_KDUMP_CMDLINE --initrd=$EARLY_KDUMP_INITRD \
|
||||||
$EARLY_KDUMP_KERNEL"
|
$EARLY_KDUMP_KERNEL"
|
||||||
|
|
||||||
$KEXEC ${EARLY_KEXEC_ARGS} $standard_kexec_args \
|
if $KEXEC $EARLY_KEXEC_ARGS $standard_kexec_args \
|
||||||
--command-line="$EARLY_KDUMP_CMDLINE" \
|
--command-line="$EARLY_KDUMP_CMDLINE" \
|
||||||
--initrd=$EARLY_KDUMP_INITRD $EARLY_KDUMP_KERNEL
|
--initrd=$EARLY_KDUMP_INITRD $EARLY_KDUMP_KERNEL; then
|
||||||
if [ $? == 0 ]; then
|
|
||||||
dinfo "kexec: loaded early-kdump kernel"
|
dinfo "kexec: loaded early-kdump kernel"
|
||||||
return 0
|
return 0
|
||||||
else
|
else
|
||||||
|
@ -12,7 +12,7 @@ Environment=HOME=/
|
|||||||
Environment=DRACUT_SYSTEMD=1
|
Environment=DRACUT_SYSTEMD=1
|
||||||
Environment=NEWROOT=/sysroot
|
Environment=NEWROOT=/sysroot
|
||||||
WorkingDirectory=/
|
WorkingDirectory=/
|
||||||
ExecStart=/bin/kdump-error-handler.sh
|
ExecStart=/bin/kdump.sh --error-handler
|
||||||
ExecStopPost=-/bin/rm -f -- /.console_lock
|
ExecStopPost=-/bin/rm -f -- /.console_lock
|
||||||
Type=oneshot
|
Type=oneshot
|
||||||
StandardInput=tty-force
|
StandardInput=tty-force
|
||||||
|
@ -1,10 +0,0 @@
|
|||||||
#!/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
|
|
@ -1,324 +1,583 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
#
|
||||||
# continue here only if we have to save dump.
|
# The main kdump routine in capture kernel, bash may not be the
|
||||||
if [ -f /etc/fadump.initramfs ] && [ ! -f /proc/device-tree/rtas/ibm,kernel-dump ] && [ ! -f /proc/device-tree/ibm,opal/dump/mpipl-boot ]; then
|
# default shell. Any code added must be POSIX compliant.
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
. /lib/dracut-lib.sh
|
. /lib/dracut-lib.sh
|
||||||
|
. /lib/kdump-logger.sh
|
||||||
. /lib/kdump-lib-initramfs.sh
|
. /lib/kdump-lib-initramfs.sh
|
||||||
|
|
||||||
set -o pipefail
|
#initiate the kdump logger
|
||||||
|
if ! dlog_init; then
|
||||||
|
echo "failed to initiate the kdump logger."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
KDUMP_PATH="/var/crash"
|
||||||
|
KDUMP_LOG_FILE="/run/initramfs/kexec-dmesg.log"
|
||||||
|
CORE_COLLECTOR=""
|
||||||
|
DEFAULT_CORE_COLLECTOR="makedumpfile -l --message-level 7 -d 31"
|
||||||
|
DMESG_COLLECTOR="/sbin/vmcore-dmesg"
|
||||||
|
FAILURE_ACTION="systemctl reboot -f"
|
||||||
|
DATEDIR=$(date +%Y-%m-%d-%T)
|
||||||
|
HOST_IP='127.0.0.1'
|
||||||
|
DUMP_INSTRUCTION=""
|
||||||
|
SSH_KEY_LOCATION="/root/.ssh/kdump_id_rsa"
|
||||||
|
DD_BLKSIZE=512
|
||||||
|
FINAL_ACTION="systemctl reboot -f"
|
||||||
|
KDUMP_PRE=""
|
||||||
|
KDUMP_POST=""
|
||||||
|
NEWROOT="/sysroot"
|
||||||
|
OPALCORE="/sys/firmware/opal/mpipl/core"
|
||||||
|
KDUMP_CONF_PARSED="/tmp/kdump.conf.$$"
|
||||||
|
|
||||||
|
# POSIX doesn't have pipefail, only apply when using bash
|
||||||
|
# shellcheck disable=SC3040
|
||||||
|
[ -n "$BASH" ] && set -o pipefail
|
||||||
|
|
||||||
DUMP_RETVAL=0
|
DUMP_RETVAL=0
|
||||||
|
|
||||||
export PATH=$PATH:$KDUMP_SCRIPT_DIR
|
kdump_read_conf > $KDUMP_CONF_PARSED
|
||||||
|
|
||||||
|
get_kdump_confs()
|
||||||
|
{
|
||||||
|
while read -r config_opt config_val; do
|
||||||
|
# remove inline comments after the end of a directive.
|
||||||
|
case "$config_opt" in
|
||||||
|
path)
|
||||||
|
KDUMP_PATH="$config_val"
|
||||||
|
;;
|
||||||
|
core_collector)
|
||||||
|
[ -n "$config_val" ] && CORE_COLLECTOR="$config_val"
|
||||||
|
;;
|
||||||
|
sshkey)
|
||||||
|
if [ -f "$config_val" ]; then
|
||||||
|
SSH_KEY_LOCATION=$config_val
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
kdump_pre)
|
||||||
|
KDUMP_PRE="$config_val"
|
||||||
|
;;
|
||||||
|
kdump_post)
|
||||||
|
KDUMP_POST="$config_val"
|
||||||
|
;;
|
||||||
|
fence_kdump_args)
|
||||||
|
FENCE_KDUMP_ARGS="$config_val"
|
||||||
|
;;
|
||||||
|
fence_kdump_nodes)
|
||||||
|
FENCE_KDUMP_NODES="$config_val"
|
||||||
|
;;
|
||||||
|
failure_action | default)
|
||||||
|
case $config_val in
|
||||||
|
shell)
|
||||||
|
FAILURE_ACTION="kdump_emergency_shell"
|
||||||
|
;;
|
||||||
|
reboot)
|
||||||
|
FAILURE_ACTION="systemctl reboot -f && exit"
|
||||||
|
;;
|
||||||
|
halt)
|
||||||
|
FAILURE_ACTION="halt && exit"
|
||||||
|
;;
|
||||||
|
poweroff)
|
||||||
|
FAILURE_ACTION="systemctl poweroff -f && exit"
|
||||||
|
;;
|
||||||
|
dump_to_rootfs)
|
||||||
|
FAILURE_ACTION="dump_to_rootfs"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
;;
|
||||||
|
final_action)
|
||||||
|
case $config_val in
|
||||||
|
reboot)
|
||||||
|
FINAL_ACTION="systemctl reboot -f"
|
||||||
|
;;
|
||||||
|
halt)
|
||||||
|
FINAL_ACTION="halt"
|
||||||
|
;;
|
||||||
|
poweroff)
|
||||||
|
FINAL_ACTION="systemctl poweroff -f"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done < "$KDUMP_CONF_PARSED"
|
||||||
|
|
||||||
|
if [ -z "$CORE_COLLECTOR" ]; then
|
||||||
|
CORE_COLLECTOR="$DEFAULT_CORE_COLLECTOR"
|
||||||
|
if is_ssh_dump_target || is_raw_dump_target; then
|
||||||
|
CORE_COLLECTOR="$CORE_COLLECTOR -F"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# store the kexec kernel log to a file.
|
||||||
|
save_log()
|
||||||
|
{
|
||||||
|
dmesg -T > $KDUMP_LOG_FILE
|
||||||
|
|
||||||
|
if command -v journalctl > /dev/null; then
|
||||||
|
journalctl -ab >> $KDUMP_LOG_FILE
|
||||||
|
fi
|
||||||
|
chmod 600 $KDUMP_LOG_FILE
|
||||||
|
}
|
||||||
|
|
||||||
|
# $1: dump path, must be a mount point
|
||||||
|
dump_fs()
|
||||||
|
{
|
||||||
|
ddebug "dump_fs _mp=$1"
|
||||||
|
|
||||||
|
if ! is_mounted "$1"; then
|
||||||
|
dinfo "dump path '$1' is not mounted, trying to mount..."
|
||||||
|
if ! mount --target "$1"; then
|
||||||
|
derror "failed to dump to '$1', it's not a mount point!"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Remove -F in makedumpfile case. We don't want a flat format dump here.
|
||||||
|
case $CORE_COLLECTOR in
|
||||||
|
*makedumpfile*)
|
||||||
|
CORE_COLLECTOR=$(echo "$CORE_COLLECTOR" | sed -e "s/-F//g")
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
_dump_fs_path=$(echo "$1/$KDUMP_PATH/$HOST_IP-$DATEDIR/" | tr -s /)
|
||||||
|
dinfo "saving to $_dump_fs_path"
|
||||||
|
|
||||||
|
# Only remount to read-write mode if the dump target is mounted read-only.
|
||||||
|
_dump_mnt_op=$(get_mount_info OPTIONS target "$1" -f)
|
||||||
|
case $_dump_mnt_op in
|
||||||
|
ro*)
|
||||||
|
dinfo "Remounting the dump target in rw mode."
|
||||||
|
mount -o remount,rw "$1" || return 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
mkdir -p "$_dump_fs_path" || return 1
|
||||||
|
|
||||||
|
save_vmcore_dmesg_fs ${DMESG_COLLECTOR} "$_dump_fs_path"
|
||||||
|
save_opalcore_fs "$_dump_fs_path"
|
||||||
|
|
||||||
|
dinfo "saving vmcore"
|
||||||
|
$CORE_COLLECTOR /proc/vmcore "$_dump_fs_path/vmcore-incomplete"
|
||||||
|
_dump_exitcode=$?
|
||||||
|
if [ $_dump_exitcode -eq 0 ]; then
|
||||||
|
mv "$_dump_fs_path/vmcore-incomplete" "$_dump_fs_path/vmcore"
|
||||||
|
sync
|
||||||
|
dinfo "saving vmcore complete"
|
||||||
|
else
|
||||||
|
derror "saving vmcore failed, exitcode:$_dump_exitcode"
|
||||||
|
fi
|
||||||
|
|
||||||
|
dinfo "saving the $KDUMP_LOG_FILE to $_dump_fs_path/"
|
||||||
|
save_log
|
||||||
|
mv "$KDUMP_LOG_FILE" "$_dump_fs_path/"
|
||||||
|
if [ $_dump_exitcode -ne 0 ]; then
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# improper kernel cmdline can cause the failure of echo, we can ignore this kind of failure
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
# $1: dmesg collector
|
||||||
|
# $2: dump path
|
||||||
|
save_vmcore_dmesg_fs()
|
||||||
|
{
|
||||||
|
dinfo "saving vmcore-dmesg.txt to $2"
|
||||||
|
if $1 /proc/vmcore > "$2/vmcore-dmesg-incomplete.txt"; then
|
||||||
|
mv "$2/vmcore-dmesg-incomplete.txt" "$2/vmcore-dmesg.txt"
|
||||||
|
chmod 600 "$2/vmcore-dmesg.txt"
|
||||||
|
|
||||||
|
# Make sure file is on disk. There have been instances where later
|
||||||
|
# saving vmcore failed and system rebooted without sync and there
|
||||||
|
# was no vmcore-dmesg.txt available.
|
||||||
|
sync
|
||||||
|
dinfo "saving vmcore-dmesg.txt complete"
|
||||||
|
else
|
||||||
|
if [ -f "$2/vmcore-dmesg-incomplete.txt" ]; then
|
||||||
|
chmod 600 "$2/vmcore-dmesg-incomplete.txt"
|
||||||
|
fi
|
||||||
|
derror "saving vmcore-dmesg.txt failed"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# $1: dump path
|
||||||
|
save_opalcore_fs()
|
||||||
|
{
|
||||||
|
if [ ! -f $OPALCORE ]; then
|
||||||
|
# Check if we are on an old kernel that uses a different path
|
||||||
|
if [ -f /sys/firmware/opal/core ]; then
|
||||||
|
OPALCORE="/sys/firmware/opal/core"
|
||||||
|
else
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
dinfo "saving opalcore:$OPALCORE to $1/opalcore"
|
||||||
|
if ! cp $OPALCORE "$1/opalcore"; then
|
||||||
|
derror "saving opalcore failed"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
sync
|
||||||
|
dinfo "saving opalcore complete"
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
dump_to_rootfs()
|
||||||
|
{
|
||||||
|
|
||||||
|
if [ "$(systemctl status dracut-initqueue | sed -n "s/^\s*Active: \(\S*\)\s.*$/\1/p")" = "inactive" ]; then
|
||||||
|
dinfo "Trying to bring up initqueue for rootfs mount"
|
||||||
|
systemctl start dracut-initqueue
|
||||||
|
fi
|
||||||
|
|
||||||
|
dinfo "Clean up dead systemd services"
|
||||||
|
systemctl cancel
|
||||||
|
dinfo "Waiting for rootfs mount, will timeout after 90 seconds"
|
||||||
|
systemctl start --no-block sysroot.mount
|
||||||
|
|
||||||
|
_loop=0
|
||||||
|
while [ $_loop -lt 90 ] && ! is_mounted /sysroot; do
|
||||||
|
sleep 1
|
||||||
|
_loop=$((_loop + 1))
|
||||||
|
done
|
||||||
|
|
||||||
|
if ! is_mounted /sysroot; then
|
||||||
|
derror "Failed to mount rootfs"
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
ddebug "NEWROOT=$NEWROOT"
|
||||||
|
dump_fs $NEWROOT
|
||||||
|
}
|
||||||
|
|
||||||
|
kdump_emergency_shell()
|
||||||
|
{
|
||||||
|
ddebug "Switching to kdump emergency shell..."
|
||||||
|
|
||||||
|
[ -f /etc/profile ] && . /etc/profile
|
||||||
|
export PS1='kdump:${PWD}# '
|
||||||
|
|
||||||
|
. /lib/dracut-lib.sh
|
||||||
|
if [ -f /dracut-state.sh ]; then
|
||||||
|
. /dracut-state.sh 2> /dev/null
|
||||||
|
fi
|
||||||
|
|
||||||
|
source_conf /etc/conf.d
|
||||||
|
|
||||||
|
type plymouth > /dev/null 2>&1 && plymouth quit
|
||||||
|
|
||||||
|
source_hook "emergency"
|
||||||
|
while read -r _tty rest; do
|
||||||
|
(
|
||||||
|
echo
|
||||||
|
echo
|
||||||
|
echo 'Entering kdump emergency mode.'
|
||||||
|
echo 'Type "journalctl" to view system logs.'
|
||||||
|
echo 'Type "rdsosreport" to generate a sosreport, you can then'
|
||||||
|
echo 'save it elsewhere and attach it to a bug report.'
|
||||||
|
echo
|
||||||
|
echo
|
||||||
|
) > "/dev/$_tty"
|
||||||
|
done < /proc/consoles
|
||||||
|
sh -i -l
|
||||||
|
/bin/rm -f -- /.console_lock
|
||||||
|
}
|
||||||
|
|
||||||
|
do_failure_action()
|
||||||
|
{
|
||||||
|
dinfo "Executing failure action $FAILURE_ACTION"
|
||||||
|
eval $FAILURE_ACTION
|
||||||
|
}
|
||||||
|
|
||||||
|
do_final_action()
|
||||||
|
{
|
||||||
|
dinfo "Executing final action $FINAL_ACTION"
|
||||||
|
eval $FINAL_ACTION
|
||||||
|
}
|
||||||
|
|
||||||
do_dump()
|
do_dump()
|
||||||
{
|
{
|
||||||
local _ret
|
eval $DUMP_INSTRUCTION
|
||||||
|
_ret=$?
|
||||||
|
|
||||||
eval $DUMP_INSTRUCTION
|
if [ $_ret -ne 0 ]; then
|
||||||
_ret=$?
|
derror "saving vmcore failed"
|
||||||
|
fi
|
||||||
|
|
||||||
if [ $_ret -ne 0 ]; then
|
return $_ret
|
||||||
derror "saving vmcore failed"
|
|
||||||
fi
|
|
||||||
|
|
||||||
return $_ret
|
|
||||||
}
|
}
|
||||||
|
|
||||||
do_kdump_pre()
|
do_kdump_pre()
|
||||||
{
|
{
|
||||||
local _ret
|
if [ -n "$KDUMP_PRE" ]; then
|
||||||
|
"$KDUMP_PRE"
|
||||||
|
_ret=$?
|
||||||
|
if [ $_ret -ne 0 ]; then
|
||||||
|
derror "$KDUMP_PRE exited with $_ret status"
|
||||||
|
return $_ret
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
if [ -n "$KDUMP_PRE" ]; then
|
# if any script fails, it just raises warning and continues
|
||||||
"$KDUMP_PRE"
|
if [ -d /etc/kdump/pre.d ]; then
|
||||||
_ret=$?
|
for file in /etc/kdump/pre.d/*; do
|
||||||
if [ $_ret -ne 0 ]; then
|
"$file"
|
||||||
derror "$KDUMP_PRE exited with $_ret status"
|
_ret=$?
|
||||||
return $_ret
|
if [ $_ret -ne 0 ]; then
|
||||||
fi
|
derror "$file exited with $_ret status"
|
||||||
fi
|
fi
|
||||||
|
done
|
||||||
# if any script fails, it just raises warning and continues
|
fi
|
||||||
if [ -d /etc/kdump/pre.d ]; then
|
return 0
|
||||||
for file in /etc/kdump/pre.d/*; do
|
|
||||||
"$file"
|
|
||||||
_ret=$?
|
|
||||||
if [ $_ret -ne 0 ]; then
|
|
||||||
derror "$file exited with $_ret status"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
return 0
|
|
||||||
}
|
}
|
||||||
|
|
||||||
do_kdump_post()
|
do_kdump_post()
|
||||||
{
|
{
|
||||||
local _ret
|
if [ -d /etc/kdump/post.d ]; then
|
||||||
|
for file in /etc/kdump/post.d/*; do
|
||||||
|
"$file" "$1"
|
||||||
|
_ret=$?
|
||||||
|
if [ $_ret -ne 0 ]; then
|
||||||
|
derror "$file exited with $_ret status"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
if [ -d /etc/kdump/post.d ]; then
|
if [ -n "$KDUMP_POST" ]; then
|
||||||
for file in /etc/kdump/post.d/*; do
|
"$KDUMP_POST" "$1"
|
||||||
"$file" "$1"
|
_ret=$?
|
||||||
_ret=$?
|
if [ $_ret -ne 0 ]; then
|
||||||
if [ $_ret -ne 0 ]; then
|
derror "$KDUMP_POST exited with $_ret status"
|
||||||
derror "$file exited with $_ret status"
|
fi
|
||||||
fi
|
fi
|
||||||
done
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -n "$KDUMP_POST" ]; then
|
|
||||||
"$KDUMP_POST" "$1"
|
|
||||||
_ret=$?
|
|
||||||
if [ $_ret -ne 0 ]; then
|
|
||||||
derror "$KDUMP_POST exited with $_ret status"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
add_dump_code()
|
|
||||||
{
|
|
||||||
DUMP_INSTRUCTION=$1
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# $1: block target, eg. /dev/sda
|
||||||
dump_raw()
|
dump_raw()
|
||||||
{
|
{
|
||||||
local _raw=$1
|
[ -b "$1" ] || return 1
|
||||||
|
|
||||||
[ -b "$_raw" ] || return 1
|
dinfo "saving to raw disk $1"
|
||||||
|
|
||||||
dinfo "saving to raw disk $_raw"
|
if ! echo "$CORE_COLLECTOR" | grep -q makedumpfile; then
|
||||||
|
_src_size=$(stat --format %s /proc/vmcore)
|
||||||
|
_src_size_mb=$((_src_size / 1048576))
|
||||||
|
/kdumpscripts/monitor_dd_progress $_src_size_mb &
|
||||||
|
fi
|
||||||
|
|
||||||
if ! $(echo -n $CORE_COLLECTOR|grep -q makedumpfile); then
|
dinfo "saving vmcore"
|
||||||
_src_size=`ls -l /proc/vmcore | cut -d' ' -f5`
|
$CORE_COLLECTOR /proc/vmcore | dd of="$1" bs=$DD_BLKSIZE >> /tmp/dd_progress_file 2>&1 || return 1
|
||||||
_src_size_mb=$(($_src_size / 1048576))
|
sync
|
||||||
monitor_dd_progress $_src_size_mb &
|
|
||||||
fi
|
|
||||||
|
|
||||||
dinfo "saving vmcore"
|
dinfo "saving vmcore complete"
|
||||||
$CORE_COLLECTOR /proc/vmcore | dd of=$_raw bs=$DD_BLKSIZE >> /tmp/dd_progress_file 2>&1 || return 1
|
return 0
|
||||||
sync
|
|
||||||
|
|
||||||
dinfo "saving vmcore complete"
|
|
||||||
return 0
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# $1: ssh key file
|
||||||
|
# $2: ssh address in <user>@<host> format
|
||||||
dump_ssh()
|
dump_ssh()
|
||||||
{
|
{
|
||||||
local _ret=0
|
_ret=0
|
||||||
local _exitcode=0 _exitcode2=0
|
_ssh_opt="-i $1 -o BatchMode=yes -o StrictHostKeyChecking=yes"
|
||||||
local _opt="-i $1 -o BatchMode=yes -o StrictHostKeyChecking=yes"
|
_ssh_dir="$KDUMP_PATH/$HOST_IP-$DATEDIR"
|
||||||
local _dir="$KDUMP_PATH/$HOST_IP-$DATEDIR"
|
if is_ipv6_address "$2"; then
|
||||||
local _host=$2
|
_scp_address=${2%@*}@"[${2#*@}]"
|
||||||
local _vmcore="vmcore"
|
else
|
||||||
local _ipv6_addr="" _username=""
|
_scp_address=$2
|
||||||
|
fi
|
||||||
|
|
||||||
dinfo "saving to $_host:$_dir"
|
dinfo "saving to $2:$_ssh_dir"
|
||||||
|
|
||||||
cat /var/lib/random-seed > /dev/urandom
|
cat /var/lib/random-seed > /dev/urandom
|
||||||
ssh -q $_opt $_host mkdir -p $_dir || return 1
|
ssh -q $_ssh_opt "$2" mkdir -p "$_ssh_dir" || return 1
|
||||||
|
|
||||||
save_vmcore_dmesg_ssh ${DMESG_COLLECTOR} ${_dir} "${_opt}" $_host
|
save_vmcore_dmesg_ssh "$DMESG_COLLECTOR" "$_ssh_dir" "$_ssh_opt" "$2"
|
||||||
save_opalcore_ssh ${_dir} "${_opt}" $_host
|
dinfo "saving vmcore"
|
||||||
|
|
||||||
dinfo "saving vmcore"
|
save_opalcore_ssh "$_ssh_dir" "$_ssh_opt" "$2" "$_scp_address"
|
||||||
|
|
||||||
if is_ipv6_address "$_host"; then
|
if [ "${CORE_COLLECTOR%%[[:blank:]]*}" = "scp" ]; then
|
||||||
_username=${_host%@*}
|
scp -q $_ssh_opt /proc/vmcore "$_scp_address:$_ssh_dir/vmcore-incomplete"
|
||||||
_ipv6_addr="[${_host#*@}]"
|
_ret=$?
|
||||||
fi
|
_vmcore="vmcore"
|
||||||
|
else
|
||||||
|
$CORE_COLLECTOR /proc/vmcore | ssh $_ssh_opt "$2" "umask 0077 && dd bs=512 of='$_ssh_dir/vmcore-incomplete'"
|
||||||
|
_ret=$?
|
||||||
|
_vmcore="vmcore.flat"
|
||||||
|
fi
|
||||||
|
|
||||||
if [ "${CORE_COLLECTOR%%[[:blank:]]*}" = "scp" ]; then
|
if [ $_ret -eq 0 ]; then
|
||||||
if [ -n "$_username" ] && [ -n "$_ipv6_addr" ]; then
|
ssh $_ssh_opt "$2" "mv '$_ssh_dir/vmcore-incomplete' '$_ssh_dir/$_vmcore'"
|
||||||
scp -q $_opt /proc/vmcore "$_username@$_ipv6_addr:$_dir/vmcore-incomplete"
|
_ret=$?
|
||||||
else
|
if [ $_ret -ne 0 ]; then
|
||||||
scp -q $_opt /proc/vmcore "$_host:$_dir/vmcore-incomplete"
|
derror "moving vmcore failed, exitcode:$_ret"
|
||||||
fi
|
else
|
||||||
_exitcode=$?
|
dinfo "saving vmcore complete"
|
||||||
else
|
fi
|
||||||
$CORE_COLLECTOR /proc/vmcore | ssh $_opt $_host "umask 0077 && dd bs=512 of=$_dir/vmcore-incomplete"
|
else
|
||||||
_exitcode=$?
|
derror "saving vmcore failed, exitcode:$_ret"
|
||||||
_vmcore="vmcore.flat"
|
fi
|
||||||
fi
|
|
||||||
|
|
||||||
if [ $_exitcode -eq 0 ]; then
|
dinfo "saving the $KDUMP_LOG_FILE to $2:$_ssh_dir/"
|
||||||
ssh $_opt $_host "mv $_dir/vmcore-incomplete $_dir/$_vmcore"
|
save_log
|
||||||
_exitcode2=$?
|
if ! scp -q $_ssh_opt $KDUMP_LOG_FILE "$_scp_address:$_ssh_dir/"; then
|
||||||
if [ $_exitcode2 -ne 0 ]; then
|
derror "saving log file failed, _exitcode:$_ret"
|
||||||
derror "moving vmcore failed, _exitcode:$_exitcode2"
|
fi
|
||||||
else
|
|
||||||
dinfo "saving vmcore complete"
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
derror "saving vmcore failed, _exitcode:$_exitcode"
|
|
||||||
fi
|
|
||||||
|
|
||||||
dinfo "saving the $KDUMP_LOG_FILE to $_host:$_dir/"
|
return $_ret
|
||||||
save_log
|
|
||||||
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"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ $_exitcode -ne 0 ] || [ $_exitcode2 -ne 0 ];then
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
return 0
|
|
||||||
}
|
}
|
||||||
|
|
||||||
save_opalcore_ssh() {
|
# $1: dump path
|
||||||
local _path=$1
|
# $2: ssh opts
|
||||||
local _opts="$2"
|
# $3: ssh address in <user>@<host> format
|
||||||
local _location=$3
|
# $4: scp address, similar with ssh address but IPv6 addresses are quoted
|
||||||
local _user_name="" _ipv6addr=""
|
save_opalcore_ssh()
|
||||||
|
{
|
||||||
|
if [ ! -f $OPALCORE ]; then
|
||||||
|
# Check if we are on an old kernel that uses a different path
|
||||||
|
if [ -f /sys/firmware/opal/core ]; then
|
||||||
|
OPALCORE="/sys/firmware/opal/core"
|
||||||
|
else
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
ddebug "_path=$_path _opts=$_opts _location=$_location"
|
dinfo "saving opalcore:$OPALCORE to $3:$1"
|
||||||
|
|
||||||
if [ ! -f $OPALCORE ]; then
|
if ! scp $2 $OPALCORE "$4:$1/opalcore-incomplete"; then
|
||||||
# Check if we are on an old kernel that uses a different path
|
derror "saving opalcore failed"
|
||||||
if [ -f /sys/firmware/opal/core ]; then
|
return 1
|
||||||
OPALCORE="/sys/firmware/opal/core"
|
fi
|
||||||
else
|
|
||||||
return 0
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
if is_ipv6_address "$_host"; then
|
ssh $2 "$3" mv "$1/opalcore-incomplete" "$1/opalcore"
|
||||||
_user_name=${_location%@*}
|
dinfo "saving opalcore complete"
|
||||||
_ipv6addr="[${_location#*@}]"
|
return 0
|
||||||
fi
|
|
||||||
|
|
||||||
dinfo "saving opalcore:$OPALCORE to $_location:$_path"
|
|
||||||
|
|
||||||
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
|
|
||||||
fi
|
|
||||||
|
|
||||||
ssh $_opts $_location mv $_path/opalcore-incomplete $_path/opalcore
|
|
||||||
dinfo "saving opalcore complete"
|
|
||||||
return 0
|
|
||||||
}
|
}
|
||||||
|
|
||||||
save_vmcore_dmesg_ssh() {
|
# $1: dmesg collector
|
||||||
local _dmesg_collector=$1
|
# $2: dump path
|
||||||
local _path=$2
|
# $3: ssh opts
|
||||||
local _opts="$3"
|
# $4: ssh address in <user>@<host> format
|
||||||
local _location=$4
|
save_vmcore_dmesg_ssh()
|
||||||
|
{
|
||||||
dinfo "saving vmcore-dmesg.txt to $_location:$_path"
|
dinfo "saving vmcore-dmesg.txt to $4:$2"
|
||||||
$_dmesg_collector /proc/vmcore | ssh $_opts $_location "umask 0077 && dd of=$_path/vmcore-dmesg-incomplete.txt"
|
if $1 /proc/vmcore | ssh $3 "$4" "umask 0077 && dd of='$2/vmcore-dmesg-incomplete.txt'"; then
|
||||||
_exitcode=$?
|
ssh -q $3 "$4" mv "$2/vmcore-dmesg-incomplete.txt" "$2/vmcore-dmesg.txt"
|
||||||
|
dinfo "saving vmcore-dmesg.txt complete"
|
||||||
if [ $_exitcode -eq 0 ]; then
|
else
|
||||||
ssh -q $_opts $_location mv $_path/vmcore-dmesg-incomplete.txt $_path/vmcore-dmesg.txt
|
derror "saving vmcore-dmesg.txt failed"
|
||||||
dinfo "saving vmcore-dmesg.txt complete"
|
fi
|
||||||
else
|
|
||||||
derror "saving vmcore-dmesg.txt failed"
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
get_host_ip()
|
get_host_ip()
|
||||||
{
|
{
|
||||||
local _host
|
if is_nfs_dump_target || is_ssh_dump_target; then
|
||||||
if is_nfs_dump_target || is_ssh_dump_target
|
kdumpnic=$(getarg kdumpnic=)
|
||||||
then
|
if [ -z "$kdumpnic" ]; then
|
||||||
kdumpnic=$(getarg kdumpnic=)
|
derror "failed to get kdumpnic!"
|
||||||
[ -z "$kdumpnic" ] && derror "failed to get kdumpnic!" && return 1
|
return 1
|
||||||
_host=`ip addr show dev $kdumpnic|grep '[ ]*inet'`
|
fi
|
||||||
[ $? -ne 0 ] && derror "wrong kdumpnic: $kdumpnic" && return 1
|
if ! kdumphost=$(ip addr show dev "$kdumpnic" | grep '[ ]*inet'); then
|
||||||
_host=`echo $_host | head -n 1 | cut -d' ' -f2`
|
derror "wrong kdumpnic: $kdumpnic"
|
||||||
_host="${_host%%/*}"
|
return 1
|
||||||
[ -z "$_host" ] && derror "wrong kdumpnic: $kdumpnic" && return 1
|
fi
|
||||||
HOST_IP=$_host
|
kdumphost=$(echo "$kdumphost" | head -n 1 | awk '{print $2}')
|
||||||
fi
|
kdumphost="${kdumphost%%/*}"
|
||||||
return 0
|
if [ -z "$kdumphost" ]; then
|
||||||
|
derror "wrong kdumpnic: $kdumpnic"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
HOST_IP=$kdumphost
|
||||||
|
fi
|
||||||
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
read_kdump_conf()
|
read_kdump_confs()
|
||||||
{
|
{
|
||||||
if [ ! -f "$KDUMP_CONF" ]; then
|
if [ ! -f "$KDUMP_CONFIG_FILE" ]; then
|
||||||
derror "$KDUMP_CONF not found"
|
derror "$KDUMP_CONFIG_FILE not found"
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
get_kdump_confs
|
get_kdump_confs
|
||||||
|
|
||||||
# rescan for add code for dump target
|
# rescan for add code for dump target
|
||||||
while read config_opt config_val;
|
while read -r config_opt config_val; do
|
||||||
do
|
# remove inline comments after the end of a directive.
|
||||||
# remove inline comments after the end of a directive.
|
case "$config_opt" in
|
||||||
case "$config_opt" in
|
dracut_args)
|
||||||
dracut_args)
|
config_val=$(get_dracut_args_target "$config_val")
|
||||||
config_val=$(get_dracut_args_target "$config_val")
|
if [ -n "$config_val" ]; then
|
||||||
if [ -n "$config_val" ]; then
|
config_val=$(get_mntpoint_from_target "$config_val")
|
||||||
config_val=$(get_mntpoint_from_target "$config_val")
|
DUMP_INSTRUCTION="dump_fs $config_val"
|
||||||
add_dump_code "dump_fs $config_val"
|
fi
|
||||||
fi
|
;;
|
||||||
;;
|
ext[234] | xfs | btrfs | minix | nfs)
|
||||||
ext[234]|xfs|btrfs|minix|nfs)
|
config_val=$(get_mntpoint_from_target "$config_val")
|
||||||
config_val=$(get_mntpoint_from_target "$config_val")
|
DUMP_INSTRUCTION="dump_fs $config_val"
|
||||||
add_dump_code "dump_fs $config_val"
|
;;
|
||||||
;;
|
raw)
|
||||||
raw)
|
DUMP_INSTRUCTION="dump_raw $config_val"
|
||||||
add_dump_code "dump_raw $config_val"
|
;;
|
||||||
;;
|
ssh)
|
||||||
ssh)
|
DUMP_INSTRUCTION="dump_ssh $SSH_KEY_LOCATION $config_val"
|
||||||
add_dump_code "dump_ssh $SSH_KEY_LOCATION $config_val"
|
;;
|
||||||
;;
|
esac
|
||||||
esac
|
done < "$KDUMP_CONF_PARSED"
|
||||||
done <<< "$(read_strip_comments $KDUMP_CONF)"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fence_kdump_notify()
|
fence_kdump_notify()
|
||||||
{
|
{
|
||||||
if [ -n "$FENCE_KDUMP_NODES" ]; then
|
if [ -n "$FENCE_KDUMP_NODES" ]; then
|
||||||
$FENCE_KDUMP_SEND $FENCE_KDUMP_ARGS $FENCE_KDUMP_NODES &
|
# shellcheck disable=SC2086
|
||||||
fi
|
$FENCE_KDUMP_SEND $FENCE_KDUMP_ARGS $FENCE_KDUMP_NODES &
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
read_kdump_conf
|
if [ "$1" = "--error-handler" ]; then
|
||||||
|
get_kdump_confs
|
||||||
|
do_failure_action
|
||||||
|
do_final_action
|
||||||
|
|
||||||
|
exit $?
|
||||||
|
fi
|
||||||
|
|
||||||
|
# continue here only if we have to save dump.
|
||||||
|
if [ -f /etc/fadump.initramfs ] && [ ! -f /proc/device-tree/rtas/ibm,kernel-dump ] && [ ! -f /proc/device-tree/ibm,opal/dump/mpipl-boot ]; then
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
read_kdump_confs
|
||||||
fence_kdump_notify
|
fence_kdump_notify
|
||||||
|
|
||||||
get_host_ip
|
if ! get_host_ip; then
|
||||||
if [ $? -ne 0 ]; then
|
derror "get_host_ip exited with non-zero status!"
|
||||||
derror "get_host_ip exited with non-zero status!"
|
exit 1
|
||||||
exit 1
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -z "$DUMP_INSTRUCTION" ]; then
|
if [ -z "$DUMP_INSTRUCTION" ]; then
|
||||||
add_dump_code "dump_fs $NEWROOT"
|
DUMP_INSTRUCTION="dump_fs $NEWROOT"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
do_kdump_pre
|
if ! do_kdump_pre; then
|
||||||
if [ $? -ne 0 ]; then
|
derror "kdump_pre script exited with non-zero status!"
|
||||||
derror "kdump_pre script exited with non-zero status!"
|
do_final_action
|
||||||
do_final_action
|
# During systemd service to reboot the machine, stop this shell script running
|
||||||
# During systemd service to reboot the machine, stop this shell script running
|
exit 1
|
||||||
exit 1
|
|
||||||
fi
|
fi
|
||||||
make_trace_mem "kdump saving vmcore" '1:shortmem' '2+:mem' '3+:slab'
|
make_trace_mem "kdump saving vmcore" '1:shortmem' '2+:mem' '3+:slab'
|
||||||
do_dump
|
do_dump
|
||||||
DUMP_RETVAL=$?
|
DUMP_RETVAL=$?
|
||||||
|
|
||||||
do_kdump_post $DUMP_RETVAL
|
if ! do_kdump_post $DUMP_RETVAL; then
|
||||||
if [ $? -ne 0 ]; then
|
derror "kdump_post script exited with non-zero status!"
|
||||||
derror "kdump_post script exited with non-zero status!"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ $DUMP_RETVAL -ne 0 ]; then
|
if [ $DUMP_RETVAL -ne 0 ]; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
do_final_action
|
do_final_action
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -1,293 +1,130 @@
|
|||||||
# These variables and functions are useful in 2nd kernel
|
#!/bin/sh
|
||||||
|
#
|
||||||
|
# The code in this file will be used in initramfs environment, bash may
|
||||||
|
# not be the default shell. Any code added must be POSIX compliant.
|
||||||
|
|
||||||
. /lib/kdump-lib.sh
|
DEFAULT_PATH="/var/crash/"
|
||||||
. /lib/kdump-logger.sh
|
KDUMP_CONFIG_FILE="/etc/kdump.conf"
|
||||||
|
|
||||||
KDUMP_PATH="/var/crash"
|
# Read kdump config in well formated style
|
||||||
KDUMP_LOG_FILE="/run/initramfs/kexec-dmesg.log"
|
kdump_read_conf()
|
||||||
CORE_COLLECTOR=""
|
|
||||||
DEFAULT_CORE_COLLECTOR="makedumpfile -l --message-level 7 -d 31"
|
|
||||||
DMESG_COLLECTOR="/sbin/vmcore-dmesg"
|
|
||||||
FAILURE_ACTION="systemctl reboot -f"
|
|
||||||
DATEDIR=`date +%Y-%m-%d-%T`
|
|
||||||
HOST_IP='127.0.0.1'
|
|
||||||
DUMP_INSTRUCTION=""
|
|
||||||
SSH_KEY_LOCATION="/root/.ssh/kdump_id_rsa"
|
|
||||||
KDUMP_SCRIPT_DIR="/kdumpscripts"
|
|
||||||
DD_BLKSIZE=512
|
|
||||||
FINAL_ACTION="systemctl reboot -f"
|
|
||||||
KDUMP_CONF="/etc/kdump.conf"
|
|
||||||
KDUMP_PRE=""
|
|
||||||
KDUMP_POST=""
|
|
||||||
NEWROOT="/sysroot"
|
|
||||||
OPALCORE="/sys/firmware/opal/mpipl/core"
|
|
||||||
|
|
||||||
#initiate the kdump logger
|
|
||||||
dlog_init
|
|
||||||
if [ $? -ne 0 ]; then
|
|
||||||
echo "failed to initiate the kdump logger."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
get_kdump_confs()
|
|
||||||
{
|
{
|
||||||
local config_opt config_val
|
# Following steps are applied in order: strip trailing comment, strip trailing space,
|
||||||
|
# strip heading space, match non-empty line, remove duplicated spaces between conf name and value
|
||||||
while read config_opt config_val;
|
[ -f "$KDUMP_CONFIG_FILE" ] && sed -n -e "s/#.*//;s/\s*$//;s/^\s*//;s/\(\S\+\)\s*\(.*\)/\1 \2/p" $KDUMP_CONFIG_FILE
|
||||||
do
|
|
||||||
# remove inline comments after the end of a directive.
|
|
||||||
case "$config_opt" in
|
|
||||||
path)
|
|
||||||
KDUMP_PATH="$config_val"
|
|
||||||
;;
|
|
||||||
core_collector)
|
|
||||||
[ -n "$config_val" ] && CORE_COLLECTOR="$config_val"
|
|
||||||
;;
|
|
||||||
sshkey)
|
|
||||||
if [ -f "$config_val" ]; then
|
|
||||||
SSH_KEY_LOCATION=$config_val
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
kdump_pre)
|
|
||||||
KDUMP_PRE="$config_val"
|
|
||||||
;;
|
|
||||||
kdump_post)
|
|
||||||
KDUMP_POST="$config_val"
|
|
||||||
;;
|
|
||||||
fence_kdump_args)
|
|
||||||
FENCE_KDUMP_ARGS="$config_val"
|
|
||||||
;;
|
|
||||||
fence_kdump_nodes)
|
|
||||||
FENCE_KDUMP_NODES="$config_val"
|
|
||||||
;;
|
|
||||||
failure_action|default)
|
|
||||||
case $config_val in
|
|
||||||
shell)
|
|
||||||
FAILURE_ACTION="kdump_emergency_shell"
|
|
||||||
;;
|
|
||||||
reboot)
|
|
||||||
FAILURE_ACTION="systemctl reboot -f && exit"
|
|
||||||
;;
|
|
||||||
halt)
|
|
||||||
FAILURE_ACTION="halt && exit"
|
|
||||||
;;
|
|
||||||
poweroff)
|
|
||||||
FAILURE_ACTION="systemctl poweroff -f && exit"
|
|
||||||
;;
|
|
||||||
dump_to_rootfs)
|
|
||||||
FAILURE_ACTION="dump_to_rootfs"
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
;;
|
|
||||||
final_action)
|
|
||||||
case $config_val in
|
|
||||||
reboot)
|
|
||||||
FINAL_ACTION="systemctl reboot -f"
|
|
||||||
;;
|
|
||||||
halt)
|
|
||||||
FINAL_ACTION="halt"
|
|
||||||
;;
|
|
||||||
poweroff)
|
|
||||||
FINAL_ACTION="systemctl poweroff -f"
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
done <<< "$(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
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# store the kexec kernel log to a file.
|
# Retrieves config value defined in kdump.conf
|
||||||
save_log()
|
# $1: config name, sed regexp compatible
|
||||||
|
kdump_get_conf_val()
|
||||||
{
|
{
|
||||||
dmesg -T > $KDUMP_LOG_FILE
|
# For lines matching "^\s*$1\s+", remove matched part (config name including space),
|
||||||
|
# remove tailing comment, space, then store in hold space. Print out the hold buffer on last line.
|
||||||
if command -v journalctl > /dev/null; then
|
[ -f "$KDUMP_CONFIG_FILE" ] &&
|
||||||
journalctl -ab >> $KDUMP_LOG_FILE
|
sed -n -e "/^\s*\($1\)\s\+/{s/^\s*\($1\)\s\+//;s/#.*//;s/\s*$//;h};\${x;p}" $KDUMP_CONFIG_FILE
|
||||||
fi
|
|
||||||
chmod 600 $KDUMP_LOG_FILE
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# dump_fs <mount point>
|
is_mounted()
|
||||||
dump_fs()
|
|
||||||
{
|
{
|
||||||
local _exitcode
|
findmnt -k -n "$1" > /dev/null 2>&1
|
||||||
local _mp=$1
|
|
||||||
local _op=$(get_mount_info OPTIONS target $_mp -f)
|
|
||||||
ddebug "dump_fs _mp=$_mp _opts=$_op"
|
|
||||||
|
|
||||||
if ! is_mounted "$_mp"; then
|
|
||||||
dinfo "dump path \"$_mp\" is not mounted, trying to mount..."
|
|
||||||
mount --target $_mp
|
|
||||||
if [ $? -ne 0 ]; then
|
|
||||||
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.
|
|
||||||
[[ $CORE_COLLECTOR = *makedumpfile* ]] && CORE_COLLECTOR=`echo $CORE_COLLECTOR | sed -e "s/-F//g"`
|
|
||||||
|
|
||||||
local _dump_path=$(echo "$_mp/$KDUMP_PATH/$HOST_IP-$DATEDIR/" | tr -s /)
|
|
||||||
|
|
||||||
dinfo "saving to $_dump_path"
|
|
||||||
|
|
||||||
# Only remount to read-write mode if the dump target is mounted read-only.
|
|
||||||
if [[ "$_op" = "ro"* ]]; then
|
|
||||||
dinfo "Remounting the dump target in rw mode."
|
|
||||||
mount -o remount,rw $_mp || return 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
mkdir -p $_dump_path || return 1
|
|
||||||
|
|
||||||
save_vmcore_dmesg_fs ${DMESG_COLLECTOR} "$_dump_path"
|
|
||||||
save_opalcore_fs "$_dump_path"
|
|
||||||
|
|
||||||
dinfo "saving vmcore"
|
|
||||||
$CORE_COLLECTOR /proc/vmcore $_dump_path/vmcore-incomplete
|
|
||||||
_exitcode=$?
|
|
||||||
if [ $_exitcode -eq 0 ]; then
|
|
||||||
mv $_dump_path/vmcore-incomplete $_dump_path/vmcore
|
|
||||||
sync
|
|
||||||
dinfo "saving vmcore complete"
|
|
||||||
else
|
|
||||||
derror "saving vmcore failed, _exitcode:$_exitcode"
|
|
||||||
fi
|
|
||||||
|
|
||||||
dinfo "saving the $KDUMP_LOG_FILE to $_dump_path/"
|
|
||||||
save_log
|
|
||||||
mv $KDUMP_LOG_FILE $_dump_path/
|
|
||||||
if [ $_exitcode -ne 0 ]; then
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# improper kernel cmdline can cause the failure of echo, we can ignore this kind of failure
|
|
||||||
return 0
|
|
||||||
}
|
}
|
||||||
|
|
||||||
save_vmcore_dmesg_fs() {
|
# $1: info type
|
||||||
local _dmesg_collector=$1
|
# $2: mount source type
|
||||||
local _path=$2
|
# $3: mount source
|
||||||
|
# $4: extra args
|
||||||
dinfo "saving vmcore-dmesg.txt to ${_path}"
|
get_mount_info()
|
||||||
$_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
|
|
||||||
chmod 600 ${_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
|
|
||||||
dinfo "saving vmcore-dmesg.txt complete"
|
|
||||||
else
|
|
||||||
if [ -f ${_path}/vmcore-dmesg-incomplete.txt ]; then
|
|
||||||
chmod 600 ${_path}/vmcore-dmesg-incomplete.txt
|
|
||||||
fi
|
|
||||||
derror "saving vmcore-dmesg.txt failed"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
save_opalcore_fs() {
|
|
||||||
local _path=$1
|
|
||||||
|
|
||||||
if [ ! -f $OPALCORE ]; then
|
|
||||||
# Check if we are on an old kernel that uses a different path
|
|
||||||
if [ -f /sys/firmware/opal/core ]; then
|
|
||||||
OPALCORE="/sys/firmware/opal/core"
|
|
||||||
else
|
|
||||||
return 0
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
dinfo "saving opalcore:$OPALCORE to ${_path}/opalcore"
|
|
||||||
cp $OPALCORE ${_path}/opalcore
|
|
||||||
if [ $? -ne 0 ]; then
|
|
||||||
derror "saving opalcore failed"
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
sync
|
|
||||||
dinfo "saving opalcore complete"
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
dump_to_rootfs()
|
|
||||||
{
|
{
|
||||||
|
__kdump_mnt=$(findmnt -k -n -r -o "$1" "--$2" "$3" $4)
|
||||||
|
|
||||||
if [[ $(systemctl status dracut-initqueue | sed -n "s/^\s*Active: \(\S*\)\s.*$/\1/p") == "inactive" ]]; then
|
[ -z "$__kdump_mnt" ] && [ -e "/etc/fstab" ] && __kdump_mnt=$(findmnt -s -n -r -o "$1" "--$2" "$3" $4)
|
||||||
dinfo "Trying to bring up initqueue for rootfs mount"
|
|
||||||
systemctl start dracut-initqueue
|
|
||||||
fi
|
|
||||||
|
|
||||||
dinfo "Clean up dead systemd services"
|
echo "$__kdump_mnt"
|
||||||
systemctl cancel
|
|
||||||
dinfo "Waiting for rootfs mount, will timeout after 90 seconds"
|
|
||||||
systemctl start --no-block sysroot.mount
|
|
||||||
|
|
||||||
_loop=0
|
|
||||||
while [ $_loop -lt 90 ] && ! is_mounted /sysroot; do
|
|
||||||
sleep 1
|
|
||||||
_loop=$((_loop + 1))
|
|
||||||
done
|
|
||||||
|
|
||||||
if ! is_mounted /sysroot; then
|
|
||||||
derror "Failed to mount rootfs"
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
|
|
||||||
ddebug "NEWROOT=$NEWROOT"
|
|
||||||
dump_fs $NEWROOT
|
|
||||||
}
|
}
|
||||||
|
|
||||||
kdump_emergency_shell()
|
is_ipv6_address()
|
||||||
{
|
{
|
||||||
ddebug "Switching to kdump emergency shell..."
|
echo "$1" | grep -q ":"
|
||||||
|
|
||||||
[ -f /etc/profile ] && . /etc/profile
|
|
||||||
export PS1='kdump:${PWD}# '
|
|
||||||
|
|
||||||
. /lib/dracut-lib.sh
|
|
||||||
if [ -f /dracut-state.sh ]; then
|
|
||||||
. /dracut-state.sh 2>/dev/null
|
|
||||||
fi
|
|
||||||
|
|
||||||
source_conf /etc/conf.d
|
|
||||||
|
|
||||||
type plymouth >/dev/null 2>&1 && plymouth quit
|
|
||||||
|
|
||||||
source_hook "emergency"
|
|
||||||
while read _tty rest; do
|
|
||||||
(
|
|
||||||
echo
|
|
||||||
echo
|
|
||||||
echo 'Entering kdump emergency mode.'
|
|
||||||
echo 'Type "journalctl" to view system logs.'
|
|
||||||
echo 'Type "rdsosreport" to generate a sosreport, you can then'
|
|
||||||
echo 'save it elsewhere and attach it to a bug report.'
|
|
||||||
echo
|
|
||||||
echo
|
|
||||||
) > /dev/$_tty
|
|
||||||
done < /proc/consoles
|
|
||||||
sh -i -l
|
|
||||||
/bin/rm -f -- /.console_lock
|
|
||||||
}
|
}
|
||||||
|
|
||||||
do_failure_action()
|
is_fs_type_nfs()
|
||||||
{
|
{
|
||||||
dinfo "Executing failure action $FAILURE_ACTION"
|
[ "$1" = "nfs" ] || [ "$1" = "nfs4" ]
|
||||||
eval $FAILURE_ACTION
|
|
||||||
}
|
}
|
||||||
|
|
||||||
do_final_action()
|
# If $1 contains dracut_args "--mount", return <filesystem type>
|
||||||
|
get_dracut_args_fstype()
|
||||||
{
|
{
|
||||||
dinfo "Executing final action $FINAL_ACTION"
|
echo $1 | grep "\-\-mount" | sed "s/.*--mount .\(.*\)/\1/" | cut -d' ' -f3
|
||||||
eval $FINAL_ACTION
|
}
|
||||||
|
|
||||||
|
# If $1 contains dracut_args "--mount", return <device>
|
||||||
|
get_dracut_args_target()
|
||||||
|
{
|
||||||
|
echo $1 | grep "\-\-mount" | sed "s/.*--mount .\(.*\)/\1/" | cut -d' ' -f1
|
||||||
|
}
|
||||||
|
|
||||||
|
get_save_path()
|
||||||
|
{
|
||||||
|
__kdump_path=$(kdump_get_conf_val path)
|
||||||
|
[ -z "$__kdump_path" ] && __kdump_path=$DEFAULT_PATH
|
||||||
|
|
||||||
|
# strip the duplicated "/"
|
||||||
|
echo "$__kdump_path" | tr -s /
|
||||||
|
}
|
||||||
|
|
||||||
|
get_root_fs_device()
|
||||||
|
{
|
||||||
|
findmnt -k -f -n -o SOURCE /
|
||||||
|
}
|
||||||
|
|
||||||
|
# Return the current underlying device of a path, ignore bind mounts
|
||||||
|
get_target_from_path()
|
||||||
|
{
|
||||||
|
__kdump_target=$(df "$1" 2> /dev/null | tail -1 | awk '{print $1}')
|
||||||
|
[ "$__kdump_target" = "/dev/root" ] && [ ! -e /dev/root ] && __kdump_target=$(get_root_fs_device)
|
||||||
|
echo "$__kdump_target"
|
||||||
|
}
|
||||||
|
|
||||||
|
get_fs_type_from_target()
|
||||||
|
{
|
||||||
|
get_mount_info FSTYPE source "$1" -f
|
||||||
|
}
|
||||||
|
|
||||||
|
get_mntpoint_from_target()
|
||||||
|
{
|
||||||
|
# --source is applied to ensure non-bind mount is returned
|
||||||
|
get_mount_info TARGET source "$1" -f
|
||||||
|
}
|
||||||
|
|
||||||
|
is_ssh_dump_target()
|
||||||
|
{
|
||||||
|
kdump_get_conf_val ssh | grep -q @
|
||||||
|
}
|
||||||
|
|
||||||
|
is_raw_dump_target()
|
||||||
|
{
|
||||||
|
[ -n "$(kdump_get_conf_val raw)" ]
|
||||||
|
}
|
||||||
|
|
||||||
|
is_nfs_dump_target()
|
||||||
|
{
|
||||||
|
if [ -n "$(kdump_get_conf_val nfs)" ]; then
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
if is_fs_type_nfs "$(get_dracut_args_fstype "$(kdump_get_conf_val dracut_args)")"; then
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
if is_fs_type_nfs "$(get_fs_type_from_target "$(get_target_from_path "$(get_save_path)")")"; then
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
is_fs_dump_target()
|
||||||
|
{
|
||||||
|
[ -n "$(kdump_get_conf_val "ext[234]\|xfs\|btrfs\|minix")" ]
|
||||||
}
|
}
|
||||||
|
1252
SOURCES/kdump-lib.sh
1252
SOURCES/kdump-lib.sh
File diff suppressed because it is too large
Load Diff
@ -1,4 +1,4 @@
|
|||||||
#!/bin/bash
|
#!/bin/sh
|
||||||
#
|
#
|
||||||
# This comes from the dracut-logger.sh
|
# This comes from the dracut-logger.sh
|
||||||
#
|
#
|
||||||
@ -34,6 +34,8 @@
|
|||||||
# First of all you have to start with dlog_init() function which initializes
|
# First of all you have to start with dlog_init() function which initializes
|
||||||
# required variables. Don't call any other logging function before that one!
|
# required variables. Don't call any other logging function before that one!
|
||||||
#
|
#
|
||||||
|
# The code in this file might be run in an environment without bash.
|
||||||
|
# Any code added must be POSIX compliant.
|
||||||
|
|
||||||
# Define vairables for the log levels in this module.
|
# Define vairables for the log levels in this module.
|
||||||
kdump_stdloglvl=""
|
kdump_stdloglvl=""
|
||||||
@ -53,11 +55,12 @@ fi
|
|||||||
#
|
#
|
||||||
get_kdump_loglvl()
|
get_kdump_loglvl()
|
||||||
{
|
{
|
||||||
(type -p getarg) && kdump_sysloglvl=$(getarg rd.kdumploglvl)
|
[ -f /lib/dracut-lib.sh ] && kdump_sysloglvl=$(getarg rd.kdumploglvl)
|
||||||
[ -z "$kdump_sysloglvl" ] && return 1;
|
[ -z "$kdump_sysloglvl" ] && return 1;
|
||||||
|
|
||||||
(type -p isdigit) && isdigit $kdump_sysloglvl
|
if [ -f /lib/dracut-lib.sh ] && ! isdigit "$kdump_sysloglvl"; then
|
||||||
[ $? -ne 0 ] && return 1;
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
@ -83,11 +86,10 @@ check_loglvl()
|
|||||||
# @retval 0 on success.
|
# @retval 0 on success.
|
||||||
#
|
#
|
||||||
dlog_init() {
|
dlog_init() {
|
||||||
local ret=0; local errmsg
|
ret=0
|
||||||
|
|
||||||
if [ -s /proc/vmcore ];then
|
if [ -s /proc/vmcore ];then
|
||||||
get_kdump_loglvl
|
if ! get_kdump_loglvl; then
|
||||||
if [ $? -ne 0 ];then
|
|
||||||
logger -t "kdump[$$]" -p warn -- "Kdump is using the default log level(3)."
|
logger -t "kdump[$$]" -p warn -- "Kdump is using the default log level(3)."
|
||||||
kdump_sysloglvl=3
|
kdump_sysloglvl=3
|
||||||
fi
|
fi
|
||||||
@ -104,8 +106,7 @@ dlog_init() {
|
|||||||
[ -z "$kdump_kmsgloglvl" ] && kdump_kmsgloglvl=0
|
[ -z "$kdump_kmsgloglvl" ] && kdump_kmsgloglvl=0
|
||||||
|
|
||||||
for loglvl in "$kdump_stdloglvl" "$kdump_kmsgloglvl" "$kdump_sysloglvl"; do
|
for loglvl in "$kdump_stdloglvl" "$kdump_kmsgloglvl" "$kdump_sysloglvl"; do
|
||||||
check_loglvl "$loglvl"
|
if ! check_loglvl "$loglvl"; then
|
||||||
if [ $? -ne 0 ]; then
|
|
||||||
echo "Illegal log level: $kdump_stdloglvl $kdump_kmsgloglvl $kdump_sysloglvl"
|
echo "Illegal log level: $kdump_stdloglvl $kdump_kmsgloglvl $kdump_sysloglvl"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
@ -114,21 +115,21 @@ dlog_init() {
|
|||||||
# Skip initialization if it's already done.
|
# Skip initialization if it's already done.
|
||||||
[ -n "$kdump_maxloglvl" ] && return 0
|
[ -n "$kdump_maxloglvl" ] && return 0
|
||||||
|
|
||||||
if [[ $UID -ne 0 ]]; then
|
if [ "$UID" -ne 0 ]; then
|
||||||
kdump_kmsgloglvl=0
|
kdump_kmsgloglvl=0
|
||||||
kdump_sysloglvl=0
|
kdump_sysloglvl=0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ $kdump_sysloglvl -gt 0 ]]; then
|
if [ "$kdump_sysloglvl" -gt 0 ]; then
|
||||||
if [[ -d /run/systemd/journal ]] \
|
if [ -d /run/systemd/journal ] \
|
||||||
&& type -P systemd-cat &>/dev/null \
|
&& systemd-cat --version 1>/dev/null 2>&1 \
|
||||||
&& systemctl --quiet is-active systemd-journald.socket &>/dev/null; then
|
&& systemctl --quiet is-active systemd-journald.socket 1>/dev/null 2>&1; then
|
||||||
readonly _systemdcatfile="/var/tmp/systemd-cat"
|
readonly _systemdcatfile="/var/tmp/systemd-cat"
|
||||||
mkfifo "$_systemdcatfile" &>/dev/null
|
mkfifo "$_systemdcatfile" 1>/dev/null 2>&1
|
||||||
readonly _dlogfd=15
|
readonly _dlogfd=15
|
||||||
systemd-cat -t 'kdump' --level-prefix=true <"$_systemdcatfile" &
|
systemd-cat -t 'kdump' --level-prefix=true <"$_systemdcatfile" &
|
||||||
exec 15>"$_systemdcatfile"
|
exec 15>"$_systemdcatfile"
|
||||||
elif ! [ -S /dev/log -a -w /dev/log ] || ! command -v logger >/dev/null; then
|
elif ! [ -S /dev/log ] && [ -w /dev/log ] || ! command -v logger >/dev/null; then
|
||||||
# We cannot log to syslog, so turn this facility off.
|
# We cannot log to syslog, so turn this facility off.
|
||||||
kdump_kmsgloglvl=$kdump_sysloglvl
|
kdump_kmsgloglvl=$kdump_sysloglvl
|
||||||
kdump_sysloglvl=0
|
kdump_sysloglvl=0
|
||||||
@ -137,31 +138,31 @@ dlog_init() {
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
local lvl; local maxloglvl_l=0
|
kdump_maxloglvl=0
|
||||||
for lvl in $kdump_stdloglvl $kdump_sysloglvl $kdump_kmsgloglvl; do
|
for _dlog_lvl in $kdump_stdloglvl $kdump_sysloglvl $kdump_kmsgloglvl; do
|
||||||
[[ $lvl -gt $maxloglvl_l ]] && maxloglvl_l=$lvl
|
[ $_dlog_lvl -gt $kdump_maxloglvl ] && kdump_maxloglvl=$_dlog_lvl
|
||||||
done
|
done
|
||||||
readonly kdump_maxloglvl=$maxloglvl_l
|
readonly kdump_maxloglvl
|
||||||
export kdump_maxloglvl
|
export kdump_maxloglvl
|
||||||
|
|
||||||
if [[ $kdump_stdloglvl -lt 4 ]] && [[ $kdump_kmsgloglvl -lt 4 ]] && [[ $kdump_sysloglvl -lt 4 ]]; then
|
if [ $kdump_stdloglvl -lt 4 ] && [ $kdump_kmsgloglvl -lt 4 ] && [ $kdump_sysloglvl -lt 4 ]; then
|
||||||
unset ddebug
|
unset ddebug
|
||||||
ddebug() { :; };
|
ddebug() { :; };
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ $kdump_stdloglvl -lt 3 ]] && [[ $kdump_kmsgloglvl -lt 3 ]] && [[ $kdump_sysloglvl -lt 3 ]]; then
|
if [ $kdump_stdloglvl -lt 3 ] && [ $kdump_kmsgloglvl -lt 3 ] && [ $kdump_sysloglvl -lt 3 ]; then
|
||||||
unset dinfo
|
unset dinfo
|
||||||
dinfo() { :; };
|
dinfo() { :; };
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ $kdump_stdloglvl -lt 2 ]] && [[ $kdump_kmsgloglvl -lt 2 ]] && [[ $kdump_sysloglvl -lt 2 ]]; then
|
if [ $kdump_stdloglvl -lt 2 ] && [ $kdump_kmsgloglvl -lt 2 ] && [ $kdump_sysloglvl -lt 2 ]; then
|
||||||
unset dwarn
|
unset dwarn
|
||||||
dwarn() { :; };
|
dwarn() { :; };
|
||||||
unset dwarning
|
unset dwarning
|
||||||
dwarning() { :; };
|
dwarning() { :; };
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ $kdump_stdloglvl -lt 1 ]] && [[ $kdump_kmsgloglvl -lt 1 ]] && [[ $kdump_sysloglvl -lt 1 ]]; then
|
if [ $kdump_stdloglvl -lt 1 ] && [ $kdump_kmsgloglvl -lt 1 ] && [ $kdump_sysloglvl -lt 1 ]; then
|
||||||
unset derror
|
unset derror
|
||||||
derror() { :; };
|
derror() { :; };
|
||||||
fi
|
fi
|
||||||
@ -173,7 +174,7 @@ dlog_init() {
|
|||||||
|
|
||||||
## @brief Converts numeric level to logger priority defined by POSIX.2.
|
## @brief Converts numeric level to logger priority defined by POSIX.2.
|
||||||
#
|
#
|
||||||
# @param lvl Numeric logging level in range from 1 to 4.
|
# @param $1: Numeric logging level in range from 1 to 4.
|
||||||
# @retval 1 if @a lvl is out of range.
|
# @retval 1 if @a lvl is out of range.
|
||||||
# @retval 0 if @a lvl is correct.
|
# @retval 0 if @a lvl is correct.
|
||||||
# @result Echoes logger priority.
|
# @result Echoes logger priority.
|
||||||
@ -189,7 +190,7 @@ _lvl2syspri() {
|
|||||||
|
|
||||||
## @brief Converts logger numeric level to syslog log level
|
## @brief Converts logger numeric level to syslog log level
|
||||||
#
|
#
|
||||||
# @param lvl Numeric logging level in range from 1 to 4.
|
# @param $1: Numeric logging level in range from 1 to 4.
|
||||||
# @retval 1 if @a lvl is out of range.
|
# @retval 1 if @a lvl is out of range.
|
||||||
# @retval 0 if @a lvl is correct.
|
# @retval 0 if @a lvl is correct.
|
||||||
# @result Echoes kernel console numeric log level
|
# @result Echoes kernel console numeric log level
|
||||||
@ -209,27 +210,25 @@ _lvl2syspri() {
|
|||||||
#
|
#
|
||||||
# @see /usr/include/sys/syslog.h
|
# @see /usr/include/sys/syslog.h
|
||||||
_dlvl2syslvl() {
|
_dlvl2syslvl() {
|
||||||
local lvl
|
|
||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
1) lvl=3;;
|
1) set -- 3;;
|
||||||
2) lvl=4;;
|
2) set -- 4;;
|
||||||
3) lvl=6;;
|
3) set -- 6;;
|
||||||
4) lvl=7;;
|
4) set -- 7;;
|
||||||
*) return 1;;
|
*) return 1;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# The number is constructed by multiplying the facility by 8 and then
|
# The number is constructed by multiplying the facility by 8 and then
|
||||||
# adding the level.
|
# adding the level.
|
||||||
# About The Syslog Protocol, please refer to the RFC5424 for more details.
|
# About The Syslog Protocol, please refer to the RFC5424 for more details.
|
||||||
echo $((24+$lvl))
|
echo $((24 + $1))
|
||||||
}
|
}
|
||||||
|
|
||||||
## @brief Prints to stderr, to syslog and/or /dev/kmsg given message with
|
## @brief Prints to stderr, to syslog and/or /dev/kmsg given message with
|
||||||
# given level (priority).
|
# given level (priority).
|
||||||
#
|
#
|
||||||
# @param lvl Numeric logging level.
|
# @param $1: Numeric logging level.
|
||||||
# @param msg Message.
|
# @param $2: Message.
|
||||||
# @retval 0 It's always returned, even if logging failed.
|
# @retval 0 It's always returned, even if logging failed.
|
||||||
#
|
#
|
||||||
# @note This function is not supposed to be called manually. Please use
|
# @note This function is not supposed to be called manually. Please use
|
||||||
@ -251,27 +250,24 @@ _dlvl2syslvl() {
|
|||||||
# - @c INFO to @c info
|
# - @c INFO to @c info
|
||||||
# - @c DEBUG to @c debug
|
# - @c DEBUG to @c debug
|
||||||
_do_dlog() {
|
_do_dlog() {
|
||||||
local lvl="$1"; shift
|
[ "$1" -le $kdump_stdloglvl ] && printf -- 'kdump: %s\n' "$2" >&2
|
||||||
local msg="$*"
|
|
||||||
|
|
||||||
[[ $lvl -le $kdump_stdloglvl ]] && printf -- 'kdump: %s\n' "$msg" >&2
|
if [ "$1" -le $kdump_sysloglvl ]; then
|
||||||
|
if [ "$_dlogfd" ]; then
|
||||||
if [[ $lvl -le $kdump_sysloglvl ]]; then
|
printf -- "<%s>%s\n" "$(($(_dlvl2syslvl "$1") & 7))" "$2" 1>&$_dlogfd
|
||||||
if [[ "$_dlogfd" ]]; then
|
|
||||||
printf -- "<%s>%s\n" "$(($(_dlvl2syslvl $lvl) & 7))" "$msg" >&$_dlogfd
|
|
||||||
else
|
else
|
||||||
logger -t "kdump[$$]" -p $(_lvl2syspri $lvl) -- "$msg"
|
logger -t "kdump[$$]" -p "$(_lvl2syspri "$1")" -- "$2"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
[[ $lvl -le $kdump_kmsgloglvl ]] && \
|
[ "$1" -le $kdump_kmsgloglvl ] && \
|
||||||
echo "<$(_dlvl2syslvl $lvl)>kdump[$$] $msg" >/dev/kmsg
|
echo "<$(_dlvl2syslvl "$1")>kdump[$$] $2" >/dev/kmsg
|
||||||
}
|
}
|
||||||
|
|
||||||
## @brief Internal helper function for _do_dlog()
|
## @brief Internal helper function for _do_dlog()
|
||||||
#
|
#
|
||||||
# @param lvl Numeric logging level.
|
# @param $1: Numeric logging level.
|
||||||
# @param msg Message.
|
# @param $2 [...]: Message.
|
||||||
# @retval 0 It's always returned, even if logging failed.
|
# @retval 0 It's always returned, even if logging failed.
|
||||||
#
|
#
|
||||||
# @note This function is not supposed to be called manually. Please use
|
# @note This function is not supposed to be called manually. Please use
|
||||||
@ -286,12 +282,13 @@ _do_dlog() {
|
|||||||
# echo "This is a warning" | dwarn
|
# echo "This is a warning" | dwarn
|
||||||
dlog() {
|
dlog() {
|
||||||
[ -z "$kdump_maxloglvl" ] && return 0
|
[ -z "$kdump_maxloglvl" ] && return 0
|
||||||
[[ $1 -le $kdump_maxloglvl ]] || return 0
|
[ "$1" -le "$kdump_maxloglvl" ] || return 0
|
||||||
|
|
||||||
if [[ $# -gt 1 ]]; then
|
if [ $# -gt 1 ]; then
|
||||||
_do_dlog "$@"
|
_dlog_lvl=$1; shift
|
||||||
|
_do_dlog "$_dlog_lvl" "$*"
|
||||||
else
|
else
|
||||||
while read line || [ -n "$line" ]; do
|
while read -r line || [ -n "$line" ]; do
|
||||||
_do_dlog "$1" "$line"
|
_do_dlog "$1" "$line"
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
@ -304,7 +301,9 @@ dlog() {
|
|||||||
ddebug() {
|
ddebug() {
|
||||||
set +x
|
set +x
|
||||||
dlog 4 "$@"
|
dlog 4 "$@"
|
||||||
[ -n "$debug" ] && set -x || :
|
if [ -n "$debug" ]; then
|
||||||
|
set -x
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
## @brief Logs message at INFO level (3)
|
## @brief Logs message at INFO level (3)
|
||||||
@ -314,7 +313,9 @@ ddebug() {
|
|||||||
dinfo() {
|
dinfo() {
|
||||||
set +x
|
set +x
|
||||||
dlog 3 "$@"
|
dlog 3 "$@"
|
||||||
[ -n "$debug" ] && set -x || :
|
if [ -n "$debug" ]; then
|
||||||
|
set -x
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
## @brief Logs message at WARN level (2)
|
## @brief Logs message at WARN level (2)
|
||||||
@ -324,7 +325,9 @@ dinfo() {
|
|||||||
dwarn() {
|
dwarn() {
|
||||||
set +x
|
set +x
|
||||||
dlog 2 "$@"
|
dlog 2 "$@"
|
||||||
[ -n "$debug" ] && set -x || :
|
if [ -n "$debug" ]; then
|
||||||
|
set -x
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
## @brief It's an alias to dwarn() function.
|
## @brief It's an alias to dwarn() function.
|
||||||
@ -334,7 +337,9 @@ dwarn() {
|
|||||||
dwarning() {
|
dwarning() {
|
||||||
set +x
|
set +x
|
||||||
dwarn "$@"
|
dwarn "$@"
|
||||||
[ -n "$debug" ] && set -x || :
|
if [ -n "$debug" ]; then
|
||||||
|
set -x
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
## @brief Logs message at ERROR level (1)
|
## @brief Logs message at ERROR level (1)
|
||||||
@ -344,5 +349,7 @@ dwarning() {
|
|||||||
derror() {
|
derror() {
|
||||||
set +x
|
set +x
|
||||||
dlog 1 "$@"
|
dlog 1 "$@"
|
||||||
[ -n "$debug" ] && set -x || :
|
if [ -n "$debug" ]; then
|
||||||
|
set -x
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
587
SOURCES/kdumpctl
587
SOURCES/kdumpctl
File diff suppressed because it is too large
Load Diff
@ -1,42 +0,0 @@
|
|||||||
From 646456862df8926ba10dd7330abf3bf0f887e1b6 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Kazuhito Hagio <k-hagio-ab@nec.com>
|
|
||||||
Date: Wed, 26 May 2021 14:31:26 +0900
|
|
||||||
Subject: [PATCH] Increase SECTION_MAP_LAST_BIT to 5
|
|
||||||
|
|
||||||
* Required for kernel 5.12
|
|
||||||
|
|
||||||
Kernel commit 1f90a3477df3 ("mm: teach pfn_to_online_page() about
|
|
||||||
ZONE_DEVICE section collisions") added a section flag
|
|
||||||
(SECTION_TAINT_ZONE_DEVICE) and causes makedumpfile an error on
|
|
||||||
some machines like this:
|
|
||||||
|
|
||||||
__vtop4_x86_64: Can't get a valid pmd_pte.
|
|
||||||
readmem: Can't convert a virtual address(ffffe2bdc2000000) to physical address.
|
|
||||||
readmem: type_addr: 0, addr:ffffe2bdc2000000, size:32768
|
|
||||||
__exclude_unnecessary_pages: Can't read the buffer of struct page.
|
|
||||||
create_2nd_bitmap: Can't exclude unnecessary pages.
|
|
||||||
|
|
||||||
Increase SECTION_MAP_LAST_BIT to 5 to fix this. The bit had not
|
|
||||||
been used until the change, so we can just increase the value.
|
|
||||||
|
|
||||||
Signed-off-by: Kazuhito Hagio <k-hagio-ab@nec.com>
|
|
||||||
---
|
|
||||||
makedumpfile.h | 2 +-
|
|
||||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
||||||
|
|
||||||
diff --git a/makedumpfile-1.6.9/makedumpfile.h b/makedumpfile-1.6.9/makedumpfile.h
|
|
||||||
index 93aa774..79046f2 100644
|
|
||||||
--- a/makedumpfile-1.6.9/makedumpfile.h
|
|
||||||
+++ b/makedumpfile-1.6.9/makedumpfile.h
|
|
||||||
@@ -195,7 +195,7 @@ isAnon(unsigned long mapping)
|
|
||||||
* 2. it has been verified that (1UL<<2) was never set, so it is
|
|
||||||
* safe to mask that bit off even in old kernels.
|
|
||||||
*/
|
|
||||||
-#define SECTION_MAP_LAST_BIT (1UL<<4)
|
|
||||||
+#define SECTION_MAP_LAST_BIT (1UL<<5)
|
|
||||||
#define SECTION_MAP_MASK (~(SECTION_MAP_LAST_BIT-1))
|
|
||||||
#define NR_SECTION_ROOTS() divideup(num_section, SECTIONS_PER_ROOT())
|
|
||||||
#define SECTION_NR_TO_PFN(sec) ((sec) << PFN_SECTION_SHIFT())
|
|
||||||
--
|
|
||||||
2.29.2
|
|
||||||
|
|
@ -1,43 +0,0 @@
|
|||||||
From 9a6f589d99dcef114c89fde992157f5467028c8f Mon Sep 17 00:00:00 2001
|
|
||||||
From: Tao Liu <ltao@redhat.com>
|
|
||||||
Date: Fri, 18 Jun 2021 18:28:04 +0800
|
|
||||||
Subject: [PATCH] check for invalid physical address of /proc/kcore
|
|
||||||
when making ELF dumpfile
|
|
||||||
|
|
||||||
Previously when executing makedumpfile with -E option against
|
|
||||||
/proc/kcore, makedumpfile will fail:
|
|
||||||
|
|
||||||
# makedumpfile -E -d 31 /proc/kcore kcore.dump
|
|
||||||
...
|
|
||||||
write_elf_load_segment: Can't convert physaddr(ffffffffffffffff) to an offset.
|
|
||||||
|
|
||||||
makedumpfile Failed.
|
|
||||||
|
|
||||||
It's because /proc/kcore contains PT_LOAD program headers which have
|
|
||||||
physaddr (0xffffffffffffffff). With -E option, makedumpfile will
|
|
||||||
try to convert the physaddr to an offset and fails.
|
|
||||||
|
|
||||||
Skip the PT_LOAD program headers which have such physaddr.
|
|
||||||
|
|
||||||
Signed-off-by: Tao Liu <ltao@redhat.com>
|
|
||||||
Signed-off-by: Kazuhito Hagio <k-hagio-ab@nec.com>
|
|
||||||
---
|
|
||||||
makedumpfile.c | 2 +-
|
|
||||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
||||||
|
|
||||||
diff --git a/makedumpfile-1.6.9/makedumpfile.c b/makedumpfile-1.6.9/makedumpfile.c
|
|
||||||
index 894c88e..fcb571f 100644
|
|
||||||
--- a/makedumpfile-1.6.9/makedumpfile.c
|
|
||||||
+++ b/makedumpfile-1.6.9/makedumpfile.c
|
|
||||||
@@ -7764,7 +7764,7 @@ write_elf_pages_cyclic(struct cache_data *cd_header, struct cache_data *cd_page)
|
|
||||||
if (!get_phdr_memory(i, &load))
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
- if (load.p_type != PT_LOAD)
|
|
||||||
+ if (load.p_type != PT_LOAD || load.p_paddr == NOT_PADDR)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
off_memory= load.p_offset;
|
|
||||||
--
|
|
||||||
2.29.2
|
|
||||||
|
|
559
SOURCES/mkdumprd
559
SOURCES/mkdumprd
@ -6,7 +6,7 @@
|
|||||||
# Written by Cong Wang <amwang@redhat.com>
|
# Written by Cong Wang <amwang@redhat.com>
|
||||||
#
|
#
|
||||||
|
|
||||||
if [ -f /etc/sysconfig/kdump ]; then
|
if [[ -f /etc/sysconfig/kdump ]]; then
|
||||||
. /etc/sysconfig/kdump
|
. /etc/sysconfig/kdump
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -17,23 +17,21 @@ fi
|
|||||||
export IN_KDUMP=1
|
export IN_KDUMP=1
|
||||||
|
|
||||||
#initiate the kdump logger
|
#initiate the kdump logger
|
||||||
dlog_init
|
if ! dlog_init; then
|
||||||
if [ $? -ne 0 ]; then
|
|
||||||
echo "failed to initiate the kdump logger."
|
echo "failed to initiate the kdump logger."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
conf_file="/etc/kdump.conf"
|
|
||||||
SSH_KEY_LOCATION="/root/.ssh/kdump_id_rsa"
|
SSH_KEY_LOCATION="/root/.ssh/kdump_id_rsa"
|
||||||
SAVE_PATH=$(get_save_path)
|
SAVE_PATH=$(get_save_path)
|
||||||
OVERRIDE_RESETTABLE=0
|
OVERRIDE_RESETTABLE=0
|
||||||
|
|
||||||
extra_modules=""
|
extra_modules=""
|
||||||
dracut_args="--add kdumpbase --quiet --hostonly --hostonly-cmdline --hostonly-i18n --hostonly-mode strict -o \"plymouth dash resume ifcfg earlykdump\""
|
dracut_args=(--add kdumpbase --quiet --hostonly --hostonly-cmdline --hostonly-i18n --hostonly-mode strict -o "plymouth resume ifcfg earlykdump")
|
||||||
|
|
||||||
readonly MKDUMPRD_TMPDIR="$(mktemp -d -t mkdumprd.XXXXXX)"
|
MKDUMPRD_TMPDIR="$(mktemp -d -t mkdumprd.XXXXXX)"
|
||||||
[ -d "$MKDUMPRD_TMPDIR" ] || perror_exit "dracut: mktemp -p -d -t dracut.XXXXXX failed."
|
[ -d "$MKDUMPRD_TMPDIR" ] || perror_exit "dracut: mktemp -p -d -t dracut.XXXXXX failed."
|
||||||
readonly MKDUMPRD_TMPMNT="$MKDUMPRD_TMPDIR/target"
|
MKDUMPRD_TMPMNT="$MKDUMPRD_TMPDIR/target"
|
||||||
|
|
||||||
trap '
|
trap '
|
||||||
ret=$?;
|
ret=$?;
|
||||||
@ -45,66 +43,71 @@ trap '
|
|||||||
# clean up after ourselves no matter how we die.
|
# clean up after ourselves no matter how we die.
|
||||||
trap 'exit 1;' SIGINT
|
trap 'exit 1;' SIGINT
|
||||||
|
|
||||||
add_dracut_arg() {
|
add_dracut_arg()
|
||||||
dracut_args="$dracut_args $@"
|
{
|
||||||
|
dracut_args+=("$@")
|
||||||
}
|
}
|
||||||
|
|
||||||
add_dracut_mount() {
|
add_dracut_mount()
|
||||||
add_dracut_arg "--mount" "\"$1\""
|
{
|
||||||
|
add_dracut_arg "--mount" "$1"
|
||||||
}
|
}
|
||||||
|
|
||||||
add_dracut_sshkey() {
|
add_dracut_sshkey()
|
||||||
add_dracut_arg "--sshkey" "\"$1\""
|
{
|
||||||
|
add_dracut_arg "--sshkey" "$1"
|
||||||
}
|
}
|
||||||
|
|
||||||
# caller should ensure $1 is valid and mounted in 1st kernel
|
# caller should ensure $1 is valid and mounted in 1st kernel
|
||||||
to_mount() {
|
to_mount()
|
||||||
local _target=$1 _fstype=$2 _options=$3 _new_mntpoint _pdev
|
{
|
||||||
|
local _target=$1 _fstype=$2 _options=$3 _sed_cmd _new_mntpoint _pdev
|
||||||
|
|
||||||
_new_mntpoint=$(get_kdump_mntpoint_from_target $_target)
|
_new_mntpoint=$(get_kdump_mntpoint_from_target "$_target")
|
||||||
_fstype="${_fstype:-$(get_fs_type_from_target $_target)}"
|
_fstype="${_fstype:-$(get_fs_type_from_target "$_target")}"
|
||||||
_options="${_options:-$(get_mntopt_from_target $_target)}"
|
_options="${_options:-$(get_mntopt_from_target "$_target")}"
|
||||||
_options="${_options:-defaults}"
|
_options="${_options:-defaults}"
|
||||||
|
|
||||||
if [[ "$_fstype" == "nfs"* ]]; then
|
if [[ $_fstype == "nfs"* ]]; then
|
||||||
_pdev=$_target
|
_pdev=$_target
|
||||||
_options=$(echo $_options | sed 's/,addr=[^,]*//')
|
_sed_cmd+='s/,\(mount\)\?addr=[^,]*//g;'
|
||||||
_options=$(echo $_options | sed 's/,proto=[^,]*//')
|
_sed_cmd+='s/,\(mount\)\?proto=[^,]*//g;'
|
||||||
_options=$(echo $_options | sed 's/,clientaddr=[^,]*//')
|
_sed_cmd+='s/,clientaddr=[^,]*//;'
|
||||||
else
|
else
|
||||||
# for non-nfs _target converting to use udev persistent name
|
# for non-nfs _target converting to use udev persistent name
|
||||||
_pdev="$(kdump_get_persistent_dev $_target)"
|
_pdev="$(kdump_get_persistent_dev "$_target")"
|
||||||
if [ -z "$_pdev" ]; then
|
if [[ -z $_pdev ]]; then
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# mount fs target as rw in 2nd kernel
|
# mount fs target as rw in 2nd kernel
|
||||||
_options=$(echo $_options | sed 's/\(^\|,\)ro\($\|,\)/\1rw\2/g')
|
_sed_cmd+='s/\(^\|,\)ro\($\|,\)/\1rw\2/g;'
|
||||||
# with 'noauto' in fstab nfs and non-root disk mount will fail in 2nd
|
# with 'noauto' in fstab nfs and non-root disk mount will fail in 2nd
|
||||||
# kernel, filter it out here.
|
# kernel, filter it out here.
|
||||||
_options=$(echo $_options | sed 's/\(^\|,\)noauto\($\|,\)/\1/g')
|
_sed_cmd+='s/\(^\|,\)noauto\($\|,\)/\1/g;'
|
||||||
# drop nofail or nobootwait
|
# drop nofail or nobootwait
|
||||||
_options=$(echo $_options | sed 's/\(^\|,\)nofail\($\|,\)/\1/g')
|
_sed_cmd+='s/\(^\|,\)nofail\($\|,\)/\1/g;'
|
||||||
_options=$(echo $_options | sed 's/\(^\|,\)nobootwait\($\|,\)/\1/g')
|
_sed_cmd+='s/\(^\|,\)nobootwait\($\|,\)/\1/g;'
|
||||||
|
|
||||||
echo "$_pdev $_new_mntpoint $_fstype $_options"
|
_options=$(echo "$_options" | sed "$_sed_cmd")
|
||||||
|
|
||||||
|
echo "$_pdev $_new_mntpoint $_fstype $_options"
|
||||||
}
|
}
|
||||||
|
|
||||||
#Function: get_ssh_size
|
#Function: get_ssh_size
|
||||||
#$1=dump target
|
#$1=dump target
|
||||||
#called from while loop and shouldn't read from stdin, so we're using "ssh -n"
|
#called from while loop and shouldn't read from stdin, so we're using "ssh -n"
|
||||||
get_ssh_size() {
|
get_ssh_size()
|
||||||
local _opt _out _size
|
{
|
||||||
_opt="-i $SSH_KEY_LOCATION -o BatchMode=yes -o StrictHostKeyChecking=yes"
|
local _out
|
||||||
_out=$(ssh -q -n $_opt $1 "df -P $SAVE_PATH")
|
local _opt=("-i" "$SSH_KEY_LOCATION" "-o" "BatchMode=yes" "-o" "StrictHostKeyChecking=yes")
|
||||||
[ $? -ne 0 ] && {
|
|
||||||
perror_exit "checking remote ssh server available size failed."
|
|
||||||
}
|
|
||||||
|
|
||||||
#ssh output removed the line break, so print field NF-2
|
if ! _out=$(ssh -q -n "${_opt[@]}" "$1" "df" "--output=avail" "$SAVE_PATH"); then
|
||||||
_size=$(echo -n $_out| awk '{avail=NF-2; print $avail}')
|
perror_exit "checking remote ssh server available size failed."
|
||||||
echo -n $_size
|
fi
|
||||||
|
|
||||||
|
echo -n "$_out" | tail -1
|
||||||
}
|
}
|
||||||
|
|
||||||
#mkdir if save path does not exist on ssh dump target
|
#mkdir if save path does not exist on ssh dump target
|
||||||
@ -113,323 +116,323 @@ get_ssh_size() {
|
|||||||
#called from while loop and shouldn't read from stdin, so we're using "ssh -n"
|
#called from while loop and shouldn't read from stdin, so we're using "ssh -n"
|
||||||
mkdir_save_path_ssh()
|
mkdir_save_path_ssh()
|
||||||
{
|
{
|
||||||
local _opt _dir
|
local _opt _dir
|
||||||
_opt="-i $SSH_KEY_LOCATION -o BatchMode=yes -o StrictHostKeyChecking=yes"
|
_opt=(-i "$SSH_KEY_LOCATION" -o BatchMode=yes -o StrictHostKeyChecking=yes)
|
||||||
ssh -qn $_opt $1 mkdir -p $SAVE_PATH 2>&1 > /dev/null
|
ssh -qn "${_opt[@]}" "$1" mkdir -p "$SAVE_PATH" &> /dev/null ||
|
||||||
_ret=$?
|
perror_exit "mkdir failed on $1:$SAVE_PATH"
|
||||||
if [ $_ret -ne 0 ]; then
|
|
||||||
perror_exit "mkdir failed on $1:$SAVE_PATH"
|
|
||||||
fi
|
|
||||||
|
|
||||||
#check whether user has write permission on $1:$SAVE_PATH
|
# check whether user has write permission on $1:$SAVE_PATH
|
||||||
_dir=$(ssh -qn $_opt $1 mktemp -dqp $SAVE_PATH 2>/dev/null)
|
_dir=$(ssh -qn "${_opt[@]}" "$1" mktemp -dqp "$SAVE_PATH" 2> /dev/null) ||
|
||||||
_ret=$?
|
perror_exit "Could not create temporary directory on $1:$SAVE_PATH. Make sure user has write permission on destination"
|
||||||
if [ $_ret -ne 0 ]; then
|
ssh -qn "${_opt[@]}" "$1" rmdir "$_dir"
|
||||||
perror_exit "Could not create temporary directory on $1:$SAVE_PATH. Make sure user has write permission on destination"
|
|
||||||
fi
|
|
||||||
ssh -qn $_opt $1 rmdir $_dir
|
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
#Function: get_fs_size
|
#Function: get_fs_size
|
||||||
#$1=dump target
|
#$1=dump target
|
||||||
get_fs_size() {
|
get_fs_size()
|
||||||
local _mnt=$(get_mntpoint_from_target $1)
|
{
|
||||||
echo -n $(df -P "${_mnt}/$SAVE_PATH"|tail -1|awk '{print $4}')
|
df --output=avail "$(get_mntpoint_from_target "$1")/$SAVE_PATH" | tail -1
|
||||||
}
|
}
|
||||||
|
|
||||||
#Function: get_raw_size
|
#Function: get_raw_size
|
||||||
#$1=dump target
|
#$1=dump target
|
||||||
get_raw_size() {
|
get_raw_size()
|
||||||
echo -n $(fdisk -s "$1")
|
{
|
||||||
|
fdisk -s "$1"
|
||||||
}
|
}
|
||||||
|
|
||||||
#Function: check_size
|
#Function: check_size
|
||||||
#$1: dump type string ('raw', 'fs', 'ssh')
|
#$1: dump type string ('raw', 'fs', 'ssh')
|
||||||
#$2: dump target
|
#$2: dump target
|
||||||
check_size() {
|
check_size()
|
||||||
local avail memtotal
|
{
|
||||||
|
local avail memtotal
|
||||||
|
|
||||||
memtotal=$(awk '/MemTotal/{print $2}' /proc/meminfo)
|
memtotal=$(awk '/MemTotal/{print $2}' /proc/meminfo)
|
||||||
case "$1" in
|
case "$1" in
|
||||||
raw)
|
raw)
|
||||||
avail=$(get_raw_size "$2")
|
avail=$(get_raw_size "$2")
|
||||||
;;
|
;;
|
||||||
ssh)
|
ssh)
|
||||||
avail=$(get_ssh_size "$2")
|
avail=$(get_ssh_size "$2")
|
||||||
;;
|
;;
|
||||||
fs)
|
fs)
|
||||||
avail=$(get_fs_size "$2")
|
avail=$(get_fs_size "$2")
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
return
|
return
|
||||||
esac
|
;;
|
||||||
|
esac || perror_exit "Check dump target size failed"
|
||||||
|
|
||||||
if [ $? -ne 0 ]; then
|
if [[ $avail -lt $memtotal ]]; then
|
||||||
perror_exit "Check dump target size failed"
|
dwarn "Warning: There might not be enough space to save a vmcore."
|
||||||
fi
|
dwarn " The size of $2 should be greater than $memtotal kilo bytes."
|
||||||
|
fi
|
||||||
if [ $avail -lt $memtotal ]; then
|
|
||||||
dwarn "Warning: There might not be enough space to save a vmcore."
|
|
||||||
dwarn " The size of $2 should be greater than $memtotal kilo bytes."
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
check_save_path_fs()
|
check_save_path_fs()
|
||||||
{
|
{
|
||||||
local _path=$1
|
local _path=$1
|
||||||
|
|
||||||
if [ ! -d $_path ]; then
|
if [[ ! -d $_path ]]; then
|
||||||
perror_exit "Dump path $_path does not exist."
|
perror_exit "Dump path $_path does not exist."
|
||||||
fi
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
mount_failure()
|
||||||
|
{
|
||||||
|
local _target=$1
|
||||||
|
local _mnt=$2
|
||||||
|
local _fstype=$3
|
||||||
|
local msg="Failed to mount $_target"
|
||||||
|
|
||||||
|
if [[ -n $_mnt ]]; then
|
||||||
|
msg="$msg on $_mnt"
|
||||||
|
fi
|
||||||
|
|
||||||
|
msg="$msg for kdump preflight check."
|
||||||
|
|
||||||
|
if [[ $_fstype == "nfs" ]]; then
|
||||||
|
msg="$msg Please make sure nfs-utils has been installed."
|
||||||
|
fi
|
||||||
|
|
||||||
|
perror_exit "$msg"
|
||||||
}
|
}
|
||||||
|
|
||||||
check_user_configured_target()
|
check_user_configured_target()
|
||||||
{
|
{
|
||||||
local _target=$1 _cfg_fs_type=$2 _mounted
|
local _target=$1 _cfg_fs_type=$2 _mounted
|
||||||
local _mnt=$(get_mntpoint_from_target $_target)
|
local _mnt _opt _fstype
|
||||||
local _opt=$(get_mntopt_from_target $_target)
|
|
||||||
local _fstype=$(get_fs_type_from_target $_target)
|
|
||||||
|
|
||||||
if [ -n "$_fstype" ]; then
|
_mnt=$(get_mntpoint_from_target "$_target")
|
||||||
# In case of nfs4, nfs should be used instead, nfs* options is deprecated in kdump.conf
|
_opt=$(get_mntopt_from_target "$_target")
|
||||||
[[ $_fstype = "nfs"* ]] && _fstype=nfs
|
_fstype=$(get_fs_type_from_target "$_target")
|
||||||
|
|
||||||
if [ -n "$_cfg_fs_type" ] && [ "$_fstype" != "$_cfg_fs_type" ]; then
|
if [[ -n $_fstype ]]; then
|
||||||
perror_exit "\"$_target\" have a wrong type config \"$_cfg_fs_type\", expected \"$_fstype\""
|
# In case of nfs4, nfs should be used instead, nfs* options is deprecated in kdump.conf
|
||||||
fi
|
[[ $_fstype == "nfs"* ]] && _fstype=nfs
|
||||||
else
|
|
||||||
_fstype="$_cfg_fs_type"
|
|
||||||
_fstype="$_cfg_fs_type"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# For noauto mount, mount it inplace with default value.
|
if [[ -n $_cfg_fs_type ]] && [[ $_fstype != "$_cfg_fs_type" ]]; then
|
||||||
# Else use the temporary target directory
|
perror_exit "\"$_target\" have a wrong type config \"$_cfg_fs_type\", expected \"$_fstype\""
|
||||||
if [ -n "$_mnt" ]; then
|
fi
|
||||||
if ! is_mounted "$_mnt"; then
|
else
|
||||||
if [[ $_opt = *",noauto"* ]]; then
|
_fstype="$_cfg_fs_type"
|
||||||
mount $_mnt
|
_fstype="$_cfg_fs_type"
|
||||||
[ $? -ne 0 ] && perror_exit "Failed to mount $_target on $_mnt for kdump preflight check."
|
fi
|
||||||
_mounted=$_mnt
|
|
||||||
else
|
|
||||||
perror_exit "Dump target \"$_target\" is neither mounted nor configured as \"noauto\""
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
_mnt=$MKDUMPRD_TMPMNT
|
|
||||||
mkdir -p $_mnt
|
|
||||||
mount $_target $_mnt -t $_fstype -o defaults
|
|
||||||
[ $? -ne 0 ] && perror_exit "Failed to mount $_target for kdump preflight check."
|
|
||||||
_mounted=$_mnt
|
|
||||||
fi
|
|
||||||
|
|
||||||
# For user configured target, use $SAVE_PATH as the dump path within the target
|
# For noauto mount, mount it inplace with default value.
|
||||||
if [ ! -d "$_mnt/$SAVE_PATH" ]; then
|
# Else use the temporary target directory
|
||||||
perror_exit "Dump path \"$SAVE_PATH\" does not exist in dump target \"$_target\""
|
if [[ -n $_mnt ]]; then
|
||||||
fi
|
if ! is_mounted "$_mnt"; then
|
||||||
|
if [[ $_opt == *",noauto"* ]]; then
|
||||||
|
mount "$_mnt" || mount_failure "$_target" "$_mnt" "$_fstype"
|
||||||
|
_mounted=$_mnt
|
||||||
|
else
|
||||||
|
perror_exit "Dump target \"$_target\" is neither mounted nor configured as \"noauto\""
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
_mnt=$MKDUMPRD_TMPMNT
|
||||||
|
mkdir -p "$_mnt"
|
||||||
|
mount "$_target" "$_mnt" -t "$_fstype" -o defaults || mount_failure "$_target" "" "$_fstype"
|
||||||
|
_mounted=$_mnt
|
||||||
|
fi
|
||||||
|
|
||||||
check_size fs "$_target"
|
# For user configured target, use $SAVE_PATH as the dump path within the target
|
||||||
|
if [[ ! -d "$_mnt/$SAVE_PATH" ]]; then
|
||||||
|
perror_exit "Dump path \"$_mnt/$SAVE_PATH\" does not exist in dump target \"$_target\""
|
||||||
|
fi
|
||||||
|
|
||||||
# Unmount it early, if function is interrupted and didn't reach here, the shell trap will clear it up anyway
|
check_size fs "$_target"
|
||||||
if [ -n "$_mounted" ]; then
|
|
||||||
umount -f -- $_mounted
|
# Unmount it early, if function is interrupted and didn't reach here, the shell trap will clear it up anyway
|
||||||
fi
|
if [[ -n $_mounted ]]; then
|
||||||
|
umount -f -- "$_mounted"
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# $1: core_collector config value
|
# $1: core_collector config value
|
||||||
verify_core_collector() {
|
verify_core_collector()
|
||||||
local _cmd="${1%% *}"
|
{
|
||||||
local _params="${1#* }"
|
local _cmd="${1%% *}"
|
||||||
|
local _params="${1#* }"
|
||||||
|
|
||||||
if [ "$_cmd" != "makedumpfile" ]; then
|
if [[ $_cmd != "makedumpfile" ]]; then
|
||||||
if is_raw_dump_target; then
|
if is_raw_dump_target; then
|
||||||
dwarn "Warning: specifying a non-makedumpfile core collector, you will have to recover the vmcore manually."
|
dwarn "Warning: specifying a non-makedumpfile core collector, you will have to recover the vmcore manually."
|
||||||
fi
|
fi
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if is_ssh_dump_target || is_raw_dump_target; then
|
if is_ssh_dump_target || is_raw_dump_target; then
|
||||||
if ! strstr "$_params" "-F"; then
|
if ! strstr "$_params" "-F"; then
|
||||||
perror_exit "The specified dump target needs makedumpfile \"-F\" option."
|
perror_exit 'The specified dump target needs makedumpfile "-F" option.'
|
||||||
fi
|
fi
|
||||||
_params="$_params vmcore"
|
_params="$_params vmcore"
|
||||||
else
|
else
|
||||||
_params="$_params vmcore dumpfile"
|
_params="$_params vmcore dumpfile"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! $_cmd --check-params $_params; then
|
# shellcheck disable=SC2086
|
||||||
perror_exit "makedumpfile parameter check failed."
|
if ! $_cmd --check-params $_params; then
|
||||||
fi
|
perror_exit "makedumpfile parameter check failed."
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
add_mount() {
|
add_mount()
|
||||||
local _mnt=$(to_mount $@)
|
{
|
||||||
|
local _mnt
|
||||||
|
|
||||||
if [ $? -ne 0 ]; then
|
_mnt=$(to_mount "$@") || exit 1
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
add_dracut_mount "$_mnt"
|
add_dracut_mount "$_mnt"
|
||||||
}
|
}
|
||||||
|
|
||||||
#handle the case user does not specify the dump target explicitly
|
#handle the case user does not specify the dump target explicitly
|
||||||
handle_default_dump_target()
|
handle_default_dump_target()
|
||||||
{
|
{
|
||||||
local _target
|
local _target
|
||||||
local _mntpoint
|
local _mntpoint
|
||||||
|
|
||||||
is_user_configured_dump_target && return
|
is_user_configured_dump_target && return
|
||||||
|
|
||||||
check_save_path_fs $SAVE_PATH
|
check_save_path_fs "$SAVE_PATH"
|
||||||
|
|
||||||
_save_path=$(get_bind_mount_source $SAVE_PATH)
|
_save_path=$(get_bind_mount_source "$SAVE_PATH")
|
||||||
_target=$(get_target_from_path $_save_path)
|
_target=$(get_target_from_path "$_save_path")
|
||||||
_mntpoint=$(get_mntpoint_from_target $_target)
|
_mntpoint=$(get_mntpoint_from_target "$_target")
|
||||||
|
|
||||||
SAVE_PATH=${_save_path##"$_mntpoint"}
|
SAVE_PATH=${_save_path##"$_mntpoint"}
|
||||||
add_mount "$_target"
|
add_mount "$_target"
|
||||||
check_size fs $_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
|
# $1: function name
|
||||||
for_each_block_target()
|
for_each_block_target()
|
||||||
{
|
{
|
||||||
local dev majmin
|
local dev majmin
|
||||||
|
|
||||||
for dev in $(get_kdump_targets); do
|
for dev in $(get_kdump_targets); do
|
||||||
[ -b "$dev" ] || continue
|
[[ -b $dev ]] || continue
|
||||||
majmin=$(get_maj_min $dev)
|
majmin=$(get_maj_min "$dev")
|
||||||
check_block_and_slaves $1 $majmin && return 1
|
check_block_and_slaves "$1" "$majmin" && return 1
|
||||||
done
|
done
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
#judge if a specific device with $1 is unresettable
|
#judge if a specific device with $1 is unresettable
|
||||||
#return false if unresettable.
|
#return false if unresettable.
|
||||||
is_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 path device resettable=1
|
||||||
local resettable=1
|
|
||||||
|
|
||||||
if [ -f "$path" ]
|
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"
|
||||||
then
|
if [[ -f $path ]]; then
|
||||||
resettable="$(cat $path)"
|
resettable="$(< "$path")"
|
||||||
[ $resettable -eq 0 -a "$OVERRIDE_RESETTABLE" -eq 0 ] && {
|
[[ $resettable -eq 0 ]] && [[ $OVERRIDE_RESETTABLE -eq 0 ]] && {
|
||||||
local device=$(udevadm info --query=all --path=/sys/dev/block/$1 | awk -F= '/DEVNAME/{print $2}')
|
device=$(udevadm info --query=all --path="/sys/dev/block/$1" | awk -F= '/DEVNAME/{print $2}')
|
||||||
derror "Error: Can not save vmcore because device $device is unresettable"
|
derror "Error: Can not save vmcore because device $device is unresettable"
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
#check if machine is resettable.
|
#check if machine is resettable.
|
||||||
#return true if resettable
|
#return true if resettable
|
||||||
check_resettable()
|
check_resettable()
|
||||||
{
|
{
|
||||||
local _ret _target
|
local _target _override_resettable
|
||||||
|
|
||||||
get_override_resettable
|
_override_resettable=$(kdump_get_conf_val override_resettable)
|
||||||
|
OVERRIDE_RESETTABLE=${_override_resettable:-$OVERRIDE_RESETTABLE}
|
||||||
|
if [ "$OVERRIDE_RESETTABLE" != "0" ] && [ "$OVERRIDE_RESETTABLE" != "1" ]; then
|
||||||
|
perror_exit "override_resettable value '$OVERRIDE_RESETTABLE' is invalid"
|
||||||
|
fi
|
||||||
|
|
||||||
for_each_block_target is_unresettable
|
for_each_block_target is_unresettable && return
|
||||||
_ret=$?
|
|
||||||
|
|
||||||
[ $_ret -eq 0 ] && return
|
return 1
|
||||||
|
|
||||||
return 1
|
|
||||||
}
|
}
|
||||||
|
|
||||||
check_crypt()
|
check_crypt()
|
||||||
{
|
{
|
||||||
local _dev
|
local _dev
|
||||||
|
|
||||||
for _dev in $(get_kdump_targets); do
|
for _dev in $(get_kdump_targets); do
|
||||||
if [[ -n $(get_luks_crypt_dev "$(get_maj_min "$_dev")") ]]; then
|
if [[ -n $(get_luks_crypt_dev "$(get_maj_min "$_dev")") ]]; then
|
||||||
derror "Device $_dev is encrypted." && return 1
|
derror "Device $_dev is encrypted." && return 1
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
if ! check_resettable; then
|
if ! check_resettable; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! check_crypt; then
|
if ! check_crypt; then
|
||||||
dwarn "Warning: Encrypted device is in dump path, which is not recommended, see kexec-kdump-howto.txt for more details."
|
dwarn "Warning: Encrypted device is in dump path, which is not recommended, see kexec-kdump-howto.txt for more details."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# firstly get right SSH_KEY_LOCATION
|
# firstly get right SSH_KEY_LOCATION
|
||||||
keyfile=$(awk '/^sshkey/ {print $2}' $conf_file)
|
keyfile=$(kdump_get_conf_val sshkey)
|
||||||
if [ -f "$keyfile" ]; then
|
if [[ -f $keyfile ]]; then
|
||||||
# canonicalize the path
|
# canonicalize the path
|
||||||
SSH_KEY_LOCATION=$(/usr/bin/readlink -m $keyfile)
|
SSH_KEY_LOCATION=$(/usr/bin/readlink -m "$keyfile")
|
||||||
fi
|
fi
|
||||||
|
|
||||||
while read config_opt config_val;
|
while read -r config_opt config_val; do
|
||||||
do
|
# remove inline comments after the end of a directive.
|
||||||
# remove inline comments after the end of a directive.
|
case "$config_opt" in
|
||||||
case "$config_opt" in
|
extra_modules)
|
||||||
extra_modules)
|
extra_modules="$extra_modules $config_val"
|
||||||
extra_modules="$extra_modules $config_val"
|
;;
|
||||||
;;
|
ext[234] | xfs | btrfs | minix | nfs)
|
||||||
ext[234]|xfs|btrfs|minix|nfs)
|
check_user_configured_target "$config_val" "$config_opt"
|
||||||
check_user_configured_target "$config_val" "$config_opt"
|
add_mount "$config_val" "$config_opt"
|
||||||
add_mount "$config_val" "$config_opt"
|
;;
|
||||||
;;
|
raw)
|
||||||
raw)
|
# checking raw disk writable
|
||||||
# checking raw disk writable
|
dd if="$config_val" count=1 of=/dev/null > /dev/null 2>&1 || {
|
||||||
dd if=$config_val count=1 of=/dev/null > /dev/null 2>&1 || {
|
perror_exit "Bad raw disk $config_val"
|
||||||
perror_exit "Bad raw disk $config_val"
|
}
|
||||||
}
|
_praw=$(persistent_policy="by-id" kdump_get_persistent_dev "$config_val")
|
||||||
_praw=$(persistent_policy="by-id" kdump_get_persistent_dev $config_val)
|
if [[ -z $_praw ]]; then
|
||||||
if [ -z "$_praw" ]; then
|
exit 1
|
||||||
exit 1
|
fi
|
||||||
fi
|
add_dracut_arg "--device" "$_praw"
|
||||||
add_dracut_arg "--device" "$_praw"
|
check_size raw "$config_val"
|
||||||
check_size raw $config_val
|
;;
|
||||||
;;
|
ssh)
|
||||||
ssh)
|
if strstr "$config_val" "@"; then
|
||||||
if strstr "$config_val" "@";
|
mkdir_save_path_ssh "$config_val"
|
||||||
then
|
check_size ssh "$config_val"
|
||||||
mkdir_save_path_ssh $config_val
|
add_dracut_sshkey "$SSH_KEY_LOCATION"
|
||||||
check_size ssh $config_val
|
else
|
||||||
add_dracut_sshkey "$SSH_KEY_LOCATION"
|
perror_exit "Bad ssh dump target $config_val"
|
||||||
else
|
fi
|
||||||
perror_exit "Bad ssh dump target $config_val"
|
;;
|
||||||
fi
|
core_collector)
|
||||||
;;
|
verify_core_collector "$config_val"
|
||||||
core_collector)
|
;;
|
||||||
verify_core_collector "$config_val"
|
dracut_args)
|
||||||
;;
|
while read -r dracut_arg; do
|
||||||
dracut_args)
|
add_dracut_arg "$dracut_arg"
|
||||||
add_dracut_arg $config_val
|
done <<< "$(echo "$config_val" | xargs -n 1 echo)"
|
||||||
;;
|
;;
|
||||||
*)
|
*) ;;
|
||||||
;;
|
|
||||||
esac
|
esac
|
||||||
done <<< "$(read_strip_comments $conf_file)"
|
done <<< "$(kdump_read_conf)"
|
||||||
|
|
||||||
handle_default_dump_target
|
handle_default_dump_target
|
||||||
|
|
||||||
if [ -n "$extra_modules" ]
|
if [[ -n $extra_modules ]]; then
|
||||||
then
|
add_dracut_arg "--add-drivers" "$extra_modules"
|
||||||
add_dracut_arg "--add-drivers" \"$extra_modules\"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# TODO: The below check is not needed anymore with the introduction of
|
# TODO: The below check is not needed anymore with the introduction of
|
||||||
@ -438,14 +441,14 @@ fi
|
|||||||
# parameter available in fadump case. So, find a way to fix that first
|
# parameter available in fadump case. So, find a way to fix that first
|
||||||
# before removing this check.
|
# before removing this check.
|
||||||
if ! is_fadump_capable; then
|
if ! is_fadump_capable; then
|
||||||
# The 2nd rootfs mount stays behind the normal dump target mount,
|
# The 2nd rootfs mount stays behind the normal dump target mount,
|
||||||
# so it doesn't affect the logic of check_dump_fs_modified().
|
# 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))"
|
is_dump_to_rootfs && add_mount "$(to_dev_name "$(get_root_fs_device)")"
|
||||||
|
|
||||||
add_dracut_arg "--no-hostonly-default-device"
|
add_dracut_arg "--no-hostonly-default-device"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "$dracut_args $@" | xargs dracut
|
dracut "${dracut_args[@]}" "$@"
|
||||||
|
|
||||||
_rc=$?
|
_rc=$?
|
||||||
sync
|
sync
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
# Generate an initramfs image that isolates dump capture capability within
|
# Generate an initramfs image that isolates dump capture capability within
|
||||||
# the default initramfs using zz-fadumpinit dracut module.
|
# the default initramfs using zz-fadumpinit dracut module.
|
||||||
|
|
||||||
if [ -f /etc/sysconfig/kdump ]; then
|
if [[ -f /etc/sysconfig/kdump ]]; then
|
||||||
. /etc/sysconfig/kdump
|
. /etc/sysconfig/kdump
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -17,7 +17,7 @@ if ! dlog_init; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
readonly MKFADUMPRD_TMPDIR="$(mktemp -d -t mkfadumprd.XXXXXX)"
|
MKFADUMPRD_TMPDIR="$(mktemp -d -t mkfadumprd.XXXXXX)"
|
||||||
[ -d "$MKFADUMPRD_TMPDIR" ] || perror_exit "mkfadumprd: mktemp -d -t mkfadumprd.XXXXXX failed."
|
[ -d "$MKFADUMPRD_TMPDIR" ] || perror_exit "mkfadumprd: mktemp -d -t mkfadumprd.XXXXXX failed."
|
||||||
trap '
|
trap '
|
||||||
ret=$?;
|
ret=$?;
|
||||||
@ -44,21 +44,24 @@ fi
|
|||||||
|
|
||||||
### Unpack the initramfs having dump capture capability
|
### Unpack the initramfs having dump capture capability
|
||||||
mkdir -p "$MKFADUMPRD_TMPDIR/fadumproot"
|
mkdir -p "$MKFADUMPRD_TMPDIR/fadumproot"
|
||||||
if ! (pushd "$MKFADUMPRD_TMPDIR/fadumproot" > /dev/null && lsinitrd --unpack "$FADUMP_INITRD" && \
|
if ! (pushd "$MKFADUMPRD_TMPDIR/fadumproot" > /dev/null && lsinitrd --unpack "$FADUMP_INITRD" &&
|
||||||
popd > /dev/null); then
|
popd > /dev/null); then
|
||||||
derror "mkfadumprd: failed to unpack '$MKFADUMPRD_TMPDIR'"
|
derror "mkfadumprd: failed to unpack '$MKFADUMPRD_TMPDIR'"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
### Pack it into the normal boot initramfs with zz-fadumpinit module
|
### Pack it into the normal boot initramfs with zz-fadumpinit module
|
||||||
_dracut_isolate_args="--rebuild $REBUILD_INITRD --add zz-fadumpinit \
|
_dracut_isolate_args=(
|
||||||
-i $MKFADUMPRD_TMPDIR/fadumproot /fadumproot \
|
--rebuild "$REBUILD_INITRD" --add zz-fadumpinit
|
||||||
-i $MKFADUMPRD_TMPDIR/fadumproot/usr/lib/dracut/hostonly-kernel-modules.txt
|
-i "$MKFADUMPRD_TMPDIR/fadumproot" /fadumproot
|
||||||
/usr/lib/dracut/fadump-kernel-modules.txt"
|
-i "$MKFADUMPRD_TMPDIR/fadumproot/usr/lib/dracut/hostonly-kernel-modules.txt"
|
||||||
|
/usr/lib/dracut/fadump-kernel-modules.txt
|
||||||
|
)
|
||||||
|
|
||||||
if is_squash_available; then
|
if is_squash_available; then
|
||||||
_dracut_isolate_args="$_dracut_isolate_args --add squash"
|
_dracut_isolate_args+=(--add squash)
|
||||||
fi
|
fi
|
||||||
if ! dracut --force --quiet $_dracut_isolate_args $@ "$TARGET_INITRD"; then
|
|
||||||
|
if ! dracut --force --quiet "${_dracut_isolate_args[@]}" "$@" "$TARGET_INITRD"; then
|
||||||
perror_exit "mkfadumprd: failed to setup '$TARGET_INITRD' with dump capture capability"
|
perror_exit "mkfadumprd: failed to setup '$TARGET_INITRD' with dump capture capability"
|
||||||
fi
|
fi
|
||||||
|
128
SOURCES/supported-kdump-targets.txt
Normal file
128
SOURCES/supported-kdump-targets.txt
Normal file
@ -0,0 +1,128 @@
|
|||||||
|
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)
|
||||||
|
hardware FCoE (qla2xxx, lpfc)
|
||||||
|
software FCoE (bnx2fc) (Extra configuration required,
|
||||||
|
please read "Note on FCoE" section below)
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
|
||||||
|
Note on FCoE
|
||||||
|
=====================
|
||||||
|
If you are trying to dump to a software FCoE target, you may encounter OOM
|
||||||
|
issue, because some software FCoE requires more memory to work. In such case,
|
||||||
|
you may need to increase the kdump reserved memory size in "crashkernel="
|
||||||
|
kernel parameter.
|
||||||
|
|
||||||
|
By default, RHEL systems have "crashkernel=auto" in kernel boot arguments.
|
||||||
|
The auto reserved memory size is designed to balance the coverage of use cases
|
||||||
|
and an acceptable memory overhead, so not every use case could fit in, software
|
||||||
|
FCoE is one of the case.
|
||||||
|
|
||||||
|
For hardware FCoE, kdump should work naturally as firmware will do the
|
||||||
|
initialization job. The capture kernel and kdump tools will run just fine.
|
||||||
|
|
||||||
|
Useful Links
|
||||||
|
============
|
||||||
|
[1] RHEL6: Enabling kdump for full-virt (HVM) Xen DomU
|
||||||
|
(https://access.redhat.com/knowledge/solutions/92943)
|
@ -1,11 +1,11 @@
|
|||||||
%global eppic_ver d84c3541035d95077aa8571f5d5c3e07c6ef510b
|
%global eppic_ver d84c3541035d95077aa8571f5d5c3e07c6ef510b
|
||||||
%global eppic_shortver %(c=%{eppic_ver}; echo ${c:0:7})
|
%global eppic_shortver %(c=%{eppic_ver}; echo ${c:0:7})
|
||||||
%global mkdf_ver 1.6.9
|
%global mkdf_ver 1.7.0
|
||||||
%global mkdf_shortver %(c=%{mkdf_ver}; echo ${c:0:7})
|
%global mkdf_shortver %(c=%{mkdf_ver}; echo ${c:0:7})
|
||||||
|
|
||||||
Name: kexec-tools
|
Name: kexec-tools
|
||||||
Version: 2.0.22
|
Version: 2.0.23
|
||||||
Release: 14%{?dist}
|
Release: 1%{?dist}
|
||||||
License: GPLv2
|
License: GPLv2
|
||||||
Summary: The kexec/kdump userspace component
|
Summary: The kexec/kdump userspace component
|
||||||
|
|
||||||
@ -42,6 +42,7 @@ Source31: kdump-logger.sh
|
|||||||
Source32: mkfadumprd
|
Source32: mkfadumprd
|
||||||
Source33: 92-crashkernel.install
|
Source33: 92-crashkernel.install
|
||||||
Source34: crashkernel-howto.txt
|
Source34: crashkernel-howto.txt
|
||||||
|
Source35: supported-kdump-targets.txt
|
||||||
|
|
||||||
#######################################
|
#######################################
|
||||||
# These are sources for mkdumpramfs
|
# These are sources for mkdumpramfs
|
||||||
@ -50,7 +51,6 @@ Source34: crashkernel-howto.txt
|
|||||||
Source100: dracut-kdump.sh
|
Source100: dracut-kdump.sh
|
||||||
Source101: dracut-module-setup.sh
|
Source101: dracut-module-setup.sh
|
||||||
Source102: dracut-monitor_dd_progress
|
Source102: dracut-monitor_dd_progress
|
||||||
Source103: dracut-kdump-error-handler.sh
|
|
||||||
Source104: dracut-kdump-emergency.service
|
Source104: dracut-kdump-emergency.service
|
||||||
Source106: dracut-kdump-capture.service
|
Source106: dracut-kdump-capture.service
|
||||||
Source107: dracut-kdump-emergency.target
|
Source107: dracut-kdump-emergency.target
|
||||||
@ -68,9 +68,9 @@ Requires: dracut >= 050
|
|||||||
Requires: dracut-network >= 050
|
Requires: dracut-network >= 050
|
||||||
Requires: dracut-squash >= 050
|
Requires: dracut-squash >= 050
|
||||||
Requires: ethtool
|
Requires: ethtool
|
||||||
Requires: grubby
|
Recommends: grubby
|
||||||
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 libzstd-devel
|
||||||
BuildRequires: pkgconfig intltool gettext
|
BuildRequires: pkgconfig intltool gettext
|
||||||
BuildRequires: systemd-units
|
BuildRequires: systemd-units
|
||||||
BuildRequires: automake autoconf libtool
|
BuildRequires: automake autoconf libtool
|
||||||
@ -107,8 +107,6 @@ Requires: systemd-udev%{?_isa}
|
|||||||
# Patches 601 onward are generic patches
|
# Patches 601 onward are generic patches
|
||||||
#
|
#
|
||||||
Patch601: ./kexec-tools-2.0.20-eppic-Remove-duplicated-variable-declaration.patch
|
Patch601: ./kexec-tools-2.0.20-eppic-Remove-duplicated-variable-declaration.patch
|
||||||
Patch602: ./kexec-tools-2.0.22-makedumpfile-Increase-SECTION_MAP_LAST_BIT-to-5.patch
|
|
||||||
Patch603: ./kexec-tools-2.0.22-makedumpfile-check-for-invalid-physical-address-proc-kcore-when-making-ELF-dumpfile.patch
|
|
||||||
|
|
||||||
%description
|
%description
|
||||||
kexec-tools provides /sbin/kexec binary that facilitates a new
|
kexec-tools provides /sbin/kexec binary that facilitates a new
|
||||||
@ -125,8 +123,6 @@ tar -z -x -v -f %{SOURCE9}
|
|||||||
tar -z -x -v -f %{SOURCE19}
|
tar -z -x -v -f %{SOURCE19}
|
||||||
|
|
||||||
%patch601 -p1
|
%patch601 -p1
|
||||||
%patch602 -p1
|
|
||||||
%patch603 -p1
|
|
||||||
|
|
||||||
%ifarch ppc
|
%ifarch ppc
|
||||||
%define archdef ARCH=ppc
|
%define archdef ARCH=ppc
|
||||||
@ -152,11 +148,12 @@ cp %{SOURCE21} .
|
|||||||
cp %{SOURCE26} .
|
cp %{SOURCE26} .
|
||||||
cp %{SOURCE27} .
|
cp %{SOURCE27} .
|
||||||
cp %{SOURCE34} .
|
cp %{SOURCE34} .
|
||||||
|
cp %{SOURCE35} .
|
||||||
|
|
||||||
make
|
make
|
||||||
%ifarch %{ix86} x86_64 ppc64 s390x ppc64le aarch64
|
%ifarch %{ix86} x86_64 ppc64 s390x ppc64le aarch64
|
||||||
make -C eppic-%{eppic_ver}/libeppic
|
make -C eppic-%{eppic_ver}/libeppic
|
||||||
make -C makedumpfile-%{mkdf_ver} LINKTYPE=dynamic USELZO=on USESNAPPY=on
|
make -C makedumpfile-%{mkdf_ver} LINKTYPE=dynamic USELZO=on USESNAPPY=on USEZSTD=on
|
||||||
make -C makedumpfile-%{mkdf_ver} LDFLAGS="$LDFLAGS -I../eppic-%{eppic_ver}/libeppic -L../eppic-%{eppic_ver}/libeppic" eppic_makedumpfile.so
|
make -C makedumpfile-%{mkdf_ver} LDFLAGS="$LDFLAGS -I../eppic-%{eppic_ver}/libeppic -L../eppic-%{eppic_ver}/libeppic" eppic_makedumpfile.so
|
||||||
%endif
|
%endif
|
||||||
|
|
||||||
@ -234,7 +231,6 @@ mkdir -p -m755 $RPM_BUILD_ROOT/etc/kdump-adv-conf/kdump_dracut_modules/99kdumpba
|
|||||||
cp %{SOURCE100} $RPM_BUILD_ROOT/etc/kdump-adv-conf/kdump_dracut_modules/99kdumpbase/%{remove_dracut_prefix %{SOURCE100}}
|
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 %{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 %{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 %{SOURCE104} $RPM_BUILD_ROOT/etc/kdump-adv-conf/kdump_dracut_modules/99kdumpbase/%{remove_dracut_prefix %{SOURCE104}}
|
||||||
cp %{SOURCE106} $RPM_BUILD_ROOT/etc/kdump-adv-conf/kdump_dracut_modules/99kdumpbase/%{remove_dracut_prefix %{SOURCE106}}
|
cp %{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}}
|
cp %{SOURCE107} $RPM_BUILD_ROOT/etc/kdump-adv-conf/kdump_dracut_modules/99kdumpbase/%{remove_dracut_prefix %{SOURCE107}}
|
||||||
@ -374,12 +370,86 @@ done
|
|||||||
%doc kdump-in-cluster-environment.txt
|
%doc kdump-in-cluster-environment.txt
|
||||||
%doc live-image-kdump-howto.txt
|
%doc live-image-kdump-howto.txt
|
||||||
%doc crashkernel-howto.txt
|
%doc crashkernel-howto.txt
|
||||||
|
%doc supported-kdump-targets.txt
|
||||||
%ifarch %{ix86} x86_64 ppc64 s390x ppc64le aarch64
|
%ifarch %{ix86} x86_64 ppc64 s390x ppc64le aarch64
|
||||||
%{_libdir}/eppic_makedumpfile.so
|
%{_libdir}/eppic_makedumpfile.so
|
||||||
/usr/share/makedumpfile/
|
/usr/share/makedumpfile/
|
||||||
%endif
|
%endif
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Thu Nov 11 2021 Tao Liu <ltao@redhat.com> - 2.0.23-1
|
||||||
|
- Enable zstd compression for makedumpfile in kexec-tools.spec
|
||||||
|
- Update makedumpfile to 1.7.0
|
||||||
|
|
||||||
|
* Wed Nov 10 2021 Tao Liu <ltao@redhat.com> - 2.0.22-16
|
||||||
|
- fix broken extra_bins when installing multiple binaries
|
||||||
|
- mkdumprd: drop mountaddr/mountproto nfs mount options
|
||||||
|
- 92-crashkernel.install: fix exit code
|
||||||
|
- dracut-early-kdump.sh: make it POSIX compatible
|
||||||
|
- Add header comment for POSIX compliant scripts
|
||||||
|
- mkdumprd: allow using dash
|
||||||
|
- kdump-logger.sh: make it POSIX compatible
|
||||||
|
- kdump-lib.sh: reformat with shfmt
|
||||||
|
- kdump-lib.sh: declare and assign separately
|
||||||
|
- kdump-lib.sh: fix variable quoting issue
|
||||||
|
- Remove trace_buf_size and trace_event from the kernel bootparameters of the kdump kernel
|
||||||
|
- kdump-lib.sh: fix a few ambiguous or redundant code
|
||||||
|
- kdump-lib.sh: fix arithmetic operation syntax
|
||||||
|
- kdump-lib.sh: remove useless echo and cat
|
||||||
|
- kdump-lib.sh: rework nmcli related functions
|
||||||
|
- kdump-lib.sh: replace '[ ]' with '[[ ]]' and get rid of legacy ``
|
||||||
|
- kdump-lib-initramfs.sh: make it POSIX compatible
|
||||||
|
- dracut-kdump.sh: reformat with shfmt
|
||||||
|
- dracut-kdump.sh: make it POSIX compatible
|
||||||
|
- dracut-kdump.sh: POSIX doesn't support pipefail
|
||||||
|
- dracut-kdump.sh: Use stat instead of ls to get vmcore size
|
||||||
|
- dracut-kdump.sh: simplify dump_ssh
|
||||||
|
- dracut-kdump.sh: remove add_dump_code
|
||||||
|
- dracut-kdump.sh: don't put KDUMP_SCRIPT_DIR in PATH
|
||||||
|
- kdump-lib-initramfs.sh: move dump related functions to kdump.sh
|
||||||
|
- Merge kdump-error-handler.sh into kdump.sh
|
||||||
|
- kdump-lib-initramfs.sh: prepare to be a POSIX compatible lib
|
||||||
|
- bash scripts: reformat with shfmt
|
||||||
|
- bash scripts: declare and assign separately
|
||||||
|
- bash scripts: fix redundant exit code check
|
||||||
|
- bash scripts: fix variable quoting issue
|
||||||
|
- Don't use die in dracut-module-setup.sh
|
||||||
|
- bash scripts: replace '[ ]' with '[[ ]]' for bash scripts
|
||||||
|
- mkdumprd: display the absolute path of dump location in the check_user_configured_target()
|
||||||
|
- Don't iterate the whole /sys/devices just to find drm device
|
||||||
|
- mkdumprd: prompt the user to install nfs-utils when mounting NFS fs failed
|
||||||
|
- bash scripts: use $(...) notation instead of legacy `...`
|
||||||
|
- bash scripts: always use "read -r"
|
||||||
|
- bash scripts: get rid of unnecessary sed calls
|
||||||
|
- bash scripts: get rid of expr and let
|
||||||
|
- bash scripts: remove useless cat
|
||||||
|
- dracut-module-setup.sh: remove surrounding $() for subshell
|
||||||
|
- dracut-module-setup.sh: make iscsi check fail early if cd failed
|
||||||
|
- dracut-module-setup.sh: fix a loop over ls issue
|
||||||
|
- dracut-module-setup.sh: fix a ambiguous variable reference
|
||||||
|
- dracut-module-setup.sh: use "*" to expend array as string
|
||||||
|
- dracut-module-setup.sh: fix _bondoptions wrong references
|
||||||
|
- dracut-module-setup.sh: remove an unused variable
|
||||||
|
- dracut-module-setup.sh: rework kdump_get_ip_route_field
|
||||||
|
- mkfadumprd: make _dracut_isolate_args an array
|
||||||
|
- mkdumprd: use array to store ssh arguments in mkdir_save_path_ssh
|
||||||
|
- mkdumprd: remove an awk call in get_fs_size
|
||||||
|
- mkdumprd: fix multiple issues with get_ssh_size
|
||||||
|
- mkdumprd: remove some redundant echo
|
||||||
|
- mkdumprd: make dracut_args an array again
|
||||||
|
- mkdumprd: use kdump_get_conf_val to read config values
|
||||||
|
- kdumpctl: refine grep usage
|
||||||
|
- kdumpctl: fix fragile loops over find output
|
||||||
|
- kdumpctl: use kdump_get_conf_val to read config values
|
||||||
|
- kdump-lib.sh: use kdump_get_conf_val to read config values
|
||||||
|
- kdump-lib.sh: add a config value retrive helper
|
||||||
|
- kdump-lib.sh: add a config format and read helper
|
||||||
|
- Add a .editorconfig file
|
||||||
|
- Remove hard requirement on grubby
|
||||||
|
|
||||||
|
* Wed Sep 8 2021 Tao Liu <ltao@redhat.com> - 2.0.22-15
|
||||||
|
- Add file supported-kdump-targets.txt to kexec-tools
|
||||||
|
|
||||||
* Mon Aug 09 2021 Mohan Boddu <mboddu@redhat.com> - 2.0.22-14
|
* Mon Aug 09 2021 Mohan Boddu <mboddu@redhat.com> - 2.0.22-14
|
||||||
- Rebuilt for IMA sigs, glibc 2.34, aarch64 flags
|
- Rebuilt for IMA sigs, glibc 2.34, aarch64 flags
|
||||||
Related: rhbz#1991688
|
Related: rhbz#1991688
|
||||||
|
Loading…
Reference in New Issue
Block a user