import kexec-tools-2.0.24-5.el8
This commit is contained in:
parent
b73de62460
commit
92157e37f5
@ -692,6 +692,34 @@ prepare_kexec_args()
|
|||||||
echo $kexec_args
|
echo $kexec_args
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# prepare_kdump_kernel <kdump_kernelver>
|
||||||
|
# This function return kdump_kernel given a kernel version.
|
||||||
|
prepare_kdump_kernel()
|
||||||
|
{
|
||||||
|
local kdump_kernelver=$1
|
||||||
|
local dir img boot_dirlist boot_imglist kdump_kernel machine_id
|
||||||
|
read -r machine_id < /etc/machine-id
|
||||||
|
|
||||||
|
boot_dirlist=${KDUMP_BOOTDIR:-"/boot /boot/efi /efi /"}
|
||||||
|
boot_imglist="$KDUMP_IMG-$kdump_kernelver$KDUMP_IMG_EXT $machine_id/$kdump_kernelver/$KDUMP_IMG"
|
||||||
|
|
||||||
|
# Use BOOT_IMAGE as reference if possible, strip the GRUB root device prefix in (hd0,gpt1) format
|
||||||
|
boot_img="$(sed "s/^BOOT_IMAGE=\((\S*)\)\?\(\S*\) .*/\2/" /proc/cmdline)"
|
||||||
|
if [[ "$boot_img" == *"$kdump_kernelver" ]]; then
|
||||||
|
boot_imglist="$boot_img $boot_imglist"
|
||||||
|
fi
|
||||||
|
|
||||||
|
for dir in $boot_dirlist; do
|
||||||
|
for img in $boot_imglist; do
|
||||||
|
if [[ -f "$dir/$img" ]]; then
|
||||||
|
kdump_kernel=$(echo "$dir/$img" | tr -s '/')
|
||||||
|
break 2
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
done
|
||||||
|
echo "$kdump_kernel"
|
||||||
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
# Detect initrd and kernel location, results are stored in global enviromental variables:
|
# Detect initrd and kernel location, results are stored in global enviromental variables:
|
||||||
# KDUMP_BOOTDIR, KDUMP_KERNELVER, KDUMP_KERNEL, DEFAULT_INITRD, and KDUMP_INITRD
|
# KDUMP_BOOTDIR, KDUMP_KERNELVER, KDUMP_KERNEL, DEFAULT_INITRD, and KDUMP_INITRD
|
||||||
@ -701,46 +729,49 @@ prepare_kexec_args()
|
|||||||
#
|
#
|
||||||
prepare_kdump_bootinfo()
|
prepare_kdump_bootinfo()
|
||||||
{
|
{
|
||||||
local boot_imglist boot_dirlist boot_initrdlist curr_kver="$(uname -r)"
|
local boot_initrdlist nondebug_kernelver debug_kernelver
|
||||||
local machine_id
|
local default_initrd_base var_target_initrd_dir
|
||||||
|
|
||||||
if [ -z "$KDUMP_KERNELVER" ]; then
|
if [[ -z $KDUMP_KERNELVER ]]; then
|
||||||
KDUMP_KERNELVER="$(uname -r)"
|
KDUMP_KERNELVER=$(uname -r)
|
||||||
|
nondebug_kernelver=$(sed -n -e 's/\(.*\)+debug$/\1/p' <<< "$KDUMP_KERNELVER")
|
||||||
fi
|
fi
|
||||||
|
|
||||||
read machine_id < /etc/machine-id
|
# Use nondebug kernel if possible, because debug kernel will consume more memory and may oom.
|
||||||
boot_dirlist=${KDUMP_BOOTDIR:-"/boot /boot/efi /efi /"}
|
if [[ -n $nondebug_kernelver ]]; then
|
||||||
boot_imglist="$KDUMP_IMG-$KDUMP_KERNELVER$KDUMP_IMG_EXT $machine_id/$KDUMP_KERNELVER/$KDUMP_IMG"
|
dinfo "Trying to use $nondebug_kernelver."
|
||||||
|
debug_kernelver=$KDUMP_KERNELVER
|
||||||
# Use BOOT_IMAGE as reference if possible, strip the GRUB root device prefix in (hd0,gpt1) format
|
KDUMP_KERNELVER=$nondebug_kernelver
|
||||||
local boot_img="$(cat /proc/cmdline | sed "s/^BOOT_IMAGE=\((\S*)\)\?\(\S*\) .*/\2/")"
|
|
||||||
if [ -n "$boot_img" ]; then
|
|
||||||
boot_imglist="$boot_img $boot_imglist"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
for dir in $boot_dirlist; do
|
KDUMP_KERNEL=$(prepare_kdump_kernel "$KDUMP_KERNELVER")
|
||||||
for img in $boot_imglist; do
|
|
||||||
if [ -f "$dir/$img" ]; then
|
|
||||||
KDUMP_KERNEL=$(echo $dir/$img | tr -s '/')
|
|
||||||
break 2
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
done
|
|
||||||
|
|
||||||
if ! [ -e "$KDUMP_KERNEL" ]; then
|
if ! [[ -e $KDUMP_KERNEL ]]; then
|
||||||
|
if [[ -n $debug_kernelver ]]; then
|
||||||
|
dinfo "Fallback to using debug kernel"
|
||||||
|
KDUMP_KERNELVER=$debug_kernelver
|
||||||
|
KDUMP_KERNEL=$(prepare_kdump_kernel "$KDUMP_KERNELVER")
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! [[ -e $KDUMP_KERNEL ]]; then
|
||||||
derror "Failed to detect kdump kernel location"
|
derror "Failed to detect kdump kernel location"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [[ "$KDUMP_KERNEL" == *"+debug" ]]; then
|
||||||
|
dwarn "Using debug kernel, you may need to set a larger crashkernel than the default value."
|
||||||
|
fi
|
||||||
|
|
||||||
# Set KDUMP_BOOTDIR to where kernel image is stored
|
# Set KDUMP_BOOTDIR to where kernel image is stored
|
||||||
KDUMP_BOOTDIR=$(dirname $KDUMP_KERNEL)
|
KDUMP_BOOTDIR=$(dirname "$KDUMP_KERNEL")
|
||||||
|
|
||||||
# Default initrd should just stay aside of kernel image, try to find it in KDUMP_BOOTDIR
|
# Default initrd should just stay aside of kernel image, try to find it in KDUMP_BOOTDIR
|
||||||
boot_initrdlist="initramfs-$KDUMP_KERNELVER.img initrd"
|
boot_initrdlist="initramfs-$KDUMP_KERNELVER.img initrd"
|
||||||
for initrd in $boot_initrdlist; do
|
for initrd in $boot_initrdlist; do
|
||||||
if [ -f "$KDUMP_BOOTDIR/$initrd" ]; then
|
if [[ -f "$KDUMP_BOOTDIR/$initrd" ]]; then
|
||||||
defaut_initrd_base="$initrd"
|
default_initrd_base="$initrd"
|
||||||
DEFAULT_INITRD="$KDUMP_BOOTDIR/$defaut_initrd_base"
|
DEFAULT_INITRD="$KDUMP_BOOTDIR/$default_initrd_base"
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
@ -748,16 +779,16 @@ prepare_kdump_bootinfo()
|
|||||||
# Create kdump initrd basename from default initrd basename
|
# Create kdump initrd basename from default initrd basename
|
||||||
# initramfs-5.7.9-200.fc32.x86_64.img => initramfs-5.7.9-200.fc32.x86_64kdump.img
|
# initramfs-5.7.9-200.fc32.x86_64.img => initramfs-5.7.9-200.fc32.x86_64kdump.img
|
||||||
# initrd => initrdkdump
|
# initrd => initrdkdump
|
||||||
if [[ -z "$defaut_initrd_base" ]]; then
|
if [[ -z $default_initrd_base ]]; then
|
||||||
kdump_initrd_base=initramfs-${KDUMP_KERNELVER}kdump.img
|
kdump_initrd_base=initramfs-${KDUMP_KERNELVER}kdump.img
|
||||||
elif [[ $defaut_initrd_base == *.* ]]; then
|
elif [[ $default_initrd_base == *.* ]]; then
|
||||||
kdump_initrd_base=${defaut_initrd_base%.*}kdump.${DEFAULT_INITRD##*.}
|
kdump_initrd_base=${default_initrd_base%.*}kdump.${DEFAULT_INITRD##*.}
|
||||||
else
|
else
|
||||||
kdump_initrd_base=${defaut_initrd_base}kdump
|
kdump_initrd_base=${default_initrd_base}kdump
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Place kdump initrd in `/var/lib/kdump` if `KDUMP_BOOTDIR` not writable
|
# Place kdump initrd in $(/var/lib/kdump) if $(KDUMP_BOOTDIR) not writable
|
||||||
if [[ ! -w "$KDUMP_BOOTDIR" ]];then
|
if [[ ! -w $KDUMP_BOOTDIR ]]; then
|
||||||
var_target_initrd_dir="/var/lib/kdump"
|
var_target_initrd_dir="/var/lib/kdump"
|
||||||
mkdir -p "$var_target_initrd_dir"
|
mkdir -p "$var_target_initrd_dir"
|
||||||
KDUMP_INITRD="$var_target_initrd_dir/$kdump_initrd_base"
|
KDUMP_INITRD="$var_target_initrd_dir/$kdump_initrd_base"
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
Name: kexec-tools
|
Name: kexec-tools
|
||||||
Version: 2.0.24
|
Version: 2.0.24
|
||||||
Release: 4%{?dist}
|
Release: 5%{?dist}
|
||||||
License: GPLv2
|
License: GPLv2
|
||||||
Group: Applications/System
|
Group: Applications/System
|
||||||
Summary: The kexec/kdump userspace component
|
Summary: The kexec/kdump userspace component
|
||||||
@ -393,6 +393,9 @@ done
|
|||||||
%endif
|
%endif
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Mon Jul 4 2022 Pingfan Liu <piliu@redhat.com> - 2.0.24-5
|
||||||
|
- kdump-lib: use non-debug kernels first
|
||||||
|
|
||||||
* Tue Jun 21 2022 Pingfan Liu <piliu@redhat.com> - 2.0.24-4
|
* Tue Jun 21 2022 Pingfan Liu <piliu@redhat.com> - 2.0.24-4
|
||||||
- kdump-lib.sh: Check the output of blkid with sed instead of eval
|
- kdump-lib.sh: Check the output of blkid with sed instead of eval
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user