Import from AlmaLinux stable repository
This commit is contained in:
parent
aaf62eb32a
commit
895132d62b
4
.gitignore
vendored
4
.gitignore
vendored
@ -1,3 +1,3 @@
|
|||||||
SOURCES/eppic-e8844d3.tar.gz
|
SOURCES/eppic-e8844d3.tar.gz
|
||||||
SOURCES/kexec-tools-2.0.25.tar.xz
|
SOURCES/kexec-tools-2.0.27.tar.xz
|
||||||
SOURCES/makedumpfile-1.7.2.tar.gz
|
SOURCES/makedumpfile-1.7.4.tar.gz
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
80ac3f5e77d3c79883edadf14428734db4720009 SOURCES/eppic-e8844d3.tar.gz
|
80ac3f5e77d3c79883edadf14428734db4720009 SOURCES/eppic-e8844d3.tar.gz
|
||||||
78d5d4f7e9d358ca234db9c84a551d9d411eb0b5 SOURCES/kexec-tools-2.0.25.tar.xz
|
ed15f191adee22ab0721ba62af1cae67eb981670 SOURCES/kexec-tools-2.0.27.tar.xz
|
||||||
24bce02cd42cdbb960ada4d9e733355582e35784 SOURCES/makedumpfile-1.7.2.tar.gz
|
98cae2b1062871905795918c32b6d46ccd115074 SOURCES/makedumpfile-1.7.4.tar.gz
|
||||||
|
@ -17,6 +17,6 @@ GOTO="kdump_reload_end"
|
|||||||
|
|
||||||
LABEL="kdump_reload_cpu"
|
LABEL="kdump_reload_cpu"
|
||||||
|
|
||||||
RUN+="/bin/sh -c '/usr/bin/systemctl is-active kdump.service || exit 0; ! test -f /sys/kernel/fadump_enabled || cat /sys/kernel/fadump_enabled | grep 0 || exit 0; /usr/bin/systemd-run --quiet --no-block /usr/lib/udev/kdump-udev-throttler'"
|
RUN+="/bin/sh -c '/usr/bin/systemctl is-active kdump.service || exit 0; ! test -f /sys/kernel/fadump/enabled || cat /sys/kernel/fadump/enabled | grep 0 || exit 0; /usr/bin/systemd-run --quiet --no-block /usr/lib/udev/kdump-udev-throttler'"
|
||||||
|
|
||||||
LABEL="kdump_reload_end"
|
LABEL="kdump_reload_end"
|
||||||
|
@ -38,7 +38,7 @@ early_kdump_load()
|
|||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if check_current_kdump_status; then
|
if is_kernel_loaded "kdump"; then
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -46,11 +46,6 @@ early_kdump_load()
|
|||||||
|
|
||||||
EARLY_KEXEC_ARGS=$(prepare_kexec_args "${KEXEC_ARGS}")
|
EARLY_KEXEC_ARGS=$(prepare_kexec_args "${KEXEC_ARGS}")
|
||||||
|
|
||||||
if is_secure_boot_enforced; then
|
|
||||||
dinfo "Secure Boot is enabled. Using kexec file based syscall."
|
|
||||||
EARLY_KEXEC_ARGS="$EARLY_KEXEC_ARGS -s"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Here, only output the messages, but do not save these messages
|
# Here, only output the messages, but do not save these messages
|
||||||
# to a file because the target disk may not be mounted yet, the
|
# to a file because the target disk may not be mounted yet, the
|
||||||
# earlykdump is too early.
|
# earlykdump is too early.
|
||||||
|
@ -491,6 +491,8 @@ wait_online_network()
|
|||||||
if _route=$(kdump_get_ip_route "$1" 2> /dev/null); then
|
if _route=$(kdump_get_ip_route "$1" 2> /dev/null); then
|
||||||
printf "%s" "$_route"
|
printf "%s" "$_route"
|
||||||
return
|
return
|
||||||
|
else
|
||||||
|
dwarn "Waiting for network to be ready (${_loop}s / 10min)"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
@ -315,7 +315,9 @@ clone_and_modify_nmconnection() {
|
|||||||
# connection profile based on MAC address
|
# connection profile based on MAC address
|
||||||
_match_nmconnection_by_mac "$_uuid" "$_dev"
|
_match_nmconnection_by_mac "$_uuid" "$_dev"
|
||||||
|
|
||||||
_cloned_nmconnection_file_path=$(nmcli --get-values UUID,FILENAME connection show | sed -n "s/^${_uuid}://p")
|
# If a value contain ":", nmcli by default escape it with "\:" because it
|
||||||
|
# also uses ":" as the delimiter to separate values. In our case, escaping is not needed.
|
||||||
|
_cloned_nmconnection_file_path=$(nmcli --escape no --get-values UUID,FILENAME connection show | sed -n "s/^${_uuid}://p")
|
||||||
_tmp_nmconnection_file_path=$_DRACUT_KDUMP_NM_TMP_DIR/$(basename "$_nmconnection_file_path")
|
_tmp_nmconnection_file_path=$_DRACUT_KDUMP_NM_TMP_DIR/$(basename "$_nmconnection_file_path")
|
||||||
cp "$_cloned_nmconnection_file_path" "$_tmp_nmconnection_file_path"
|
cp "$_cloned_nmconnection_file_path" "$_tmp_nmconnection_file_path"
|
||||||
# change uuid back to old value in case it's refered by other connection
|
# change uuid back to old value in case it's refered by other connection
|
||||||
@ -538,7 +540,12 @@ kdump_collect_netif_usage() {
|
|||||||
local _destaddr _srcaddr _route _netdev
|
local _destaddr _srcaddr _route _netdev
|
||||||
|
|
||||||
_destaddr=$(kdump_get_remote_ip "$1")
|
_destaddr=$(kdump_get_remote_ip "$1")
|
||||||
_route=$(kdump_get_ip_route "$_destaddr")
|
|
||||||
|
if ! _route=$(kdump_get_ip_route "$_destaddr"); then
|
||||||
|
derror "Bad kdump network destination: $_destaddr"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
_srcaddr=$(kdump_get_ip_route_field "$_route" "src")
|
_srcaddr=$(kdump_get_ip_route_field "$_route" "src")
|
||||||
_netdev=$(kdump_get_ip_route_field "$_route" "dev")
|
_netdev=$(kdump_get_ip_route_field "$_route" "dev")
|
||||||
|
|
||||||
@ -569,6 +576,33 @@ kdump_collect_netif_usage() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
kdump_install_resolv_conf() {
|
||||||
|
local _resolv_conf=/etc/resolv.conf _nm_conf_dir=/etc/NetworkManager/conf.d
|
||||||
|
|
||||||
|
# Some users may choose to manage /etc/resolve.conf manually [1]
|
||||||
|
# by setting dns=none or use a symbolic link resolve.conf [2].
|
||||||
|
# So resolve.conf should be installed to kdump initrd as well. To prevent
|
||||||
|
# NM frome overwritting the user-configured resolve.conf in kdump initrd,
|
||||||
|
# also set dns=none for NM.
|
||||||
|
#
|
||||||
|
# Note:
|
||||||
|
# 1. When resolv.conf is managed by systemd-resolved.service, it could also be a
|
||||||
|
# symbolic link. So exclude this case by teling if systemd-resolved is enabled.
|
||||||
|
#
|
||||||
|
# 2. It's harmless to blindly copy /etc/resolve.conf to the initrd because
|
||||||
|
# by default in initramfs this file will be overwritten by
|
||||||
|
# NetworkManager. If user manages it via a symbolic link, it's still
|
||||||
|
# preserved because NM won't touch a symbolic link file.
|
||||||
|
#
|
||||||
|
# [1] https://bugzilla.gnome.org/show_bug.cgi?id=690404
|
||||||
|
# [2] https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html/configuring_and_managing_networking/manually-configuring-the-etc-resolv-conf-file_configuring-and-managing-networking
|
||||||
|
systemctl -q is-enabled systemd-resolved 2> /dev/null && return 0
|
||||||
|
inst "$_resolv_conf"
|
||||||
|
if NetworkManager --print-config | grep -qs "^dns=none"; then
|
||||||
|
printf "[main]\ndns=none\n" > "${initdir}/${_nm_conf_dir}"/90-dns-none.conf
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
# Setup dracut to bring up network interface that enable
|
# Setup dracut to bring up network interface that enable
|
||||||
# initramfs accessing giving destination
|
# initramfs accessing giving destination
|
||||||
kdump_install_net() {
|
kdump_install_net() {
|
||||||
@ -581,6 +615,7 @@ kdump_install_net() {
|
|||||||
kdump_setup_znet
|
kdump_setup_znet
|
||||||
kdump_install_nm_netif_allowlist "$_netifs"
|
kdump_install_nm_netif_allowlist "$_netifs"
|
||||||
kdump_install_nic_driver "$_netifs"
|
kdump_install_nic_driver "$_netifs"
|
||||||
|
kdump_install_resolv_conf
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1065,6 +1100,15 @@ install() {
|
|||||||
's/\(^[[:space:]]*reserved_memory[[:space:]]*=\)[[:space:]]*[[:digit:]]*/\1 1024/' \
|
's/\(^[[:space:]]*reserved_memory[[:space:]]*=\)[[:space:]]*[[:digit:]]*/\1 1024/' \
|
||||||
"${initdir}/etc/lvm/lvm.conf" &> /dev/null
|
"${initdir}/etc/lvm/lvm.conf" &> /dev/null
|
||||||
|
|
||||||
|
# Skip initrd-cleanup.service and initrd-parse-etc.service becasue we don't
|
||||||
|
# need to switch root. Instead of removing them, we use ConditionPathExists
|
||||||
|
# to check if /proc/vmcore exists to determine if we are in kdump.
|
||||||
|
sed -i '/\[Unit\]/a ConditionPathExists=!\/proc\/vmcore' \
|
||||||
|
"${initdir}/${systemdsystemunitdir}/initrd-cleanup.service" &> /dev/null
|
||||||
|
|
||||||
|
sed -i '/\[Unit\]/a ConditionPathExists=!\/proc\/vmcore' \
|
||||||
|
"${initdir}/${systemdsystemunitdir}/initrd-parse-etc.service" &> /dev/null
|
||||||
|
|
||||||
# Save more memory by dropping switch root capability
|
# Save more memory by dropping switch root capability
|
||||||
dracut_no_switch_root
|
dracut_no_switch_root
|
||||||
}
|
}
|
||||||
|
@ -137,7 +137,7 @@ Then, start up kdump as well:
|
|||||||
# systemctl start kdump.service
|
# systemctl start kdump.service
|
||||||
|
|
||||||
This should turn on the firmware assisted functionality in kernel by
|
This should turn on the firmware assisted functionality in kernel by
|
||||||
echo'ing 1 to /sys/kernel/fadump_registered, leaving the system ready
|
echo'ing 1 to /sys/kernel/fadump/registered, leaving the system ready
|
||||||
to capture a vmcore upon crashing. For journaling filesystems like XFS an
|
to capture a vmcore upon crashing. For journaling filesystems like XFS an
|
||||||
additional step is required to ensure bootloader does not pick the
|
additional step is required to ensure bootloader does not pick the
|
||||||
older initrd (without vmcore capture scripts):
|
older initrd (without vmcore capture scripts):
|
||||||
|
@ -166,7 +166,6 @@ is_lvm2_thinp_device()
|
|||||||
kdump_get_ip_route()
|
kdump_get_ip_route()
|
||||||
{
|
{
|
||||||
if ! _route=$(/sbin/ip -o route get to "$1" 2>&1); then
|
if ! _route=$(/sbin/ip -o route get to "$1" 2>&1); then
|
||||||
derror "Bad kdump network destination: $1"
|
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
echo "$_route"
|
echo "$_route"
|
||||||
|
@ -5,7 +5,19 @@
|
|||||||
|
|
||||||
. /usr/lib/kdump/kdump-lib-initramfs.sh
|
. /usr/lib/kdump/kdump-lib-initramfs.sh
|
||||||
|
|
||||||
FADUMP_ENABLED_SYS_NODE="/sys/kernel/fadump_enabled"
|
FADUMP_ENABLED_SYS_NODE="/sys/kernel/fadump/enabled"
|
||||||
|
FADUMP_REGISTER_SYS_NODE="/sys/kernel/fadump/registered"
|
||||||
|
|
||||||
|
is_uki()
|
||||||
|
{
|
||||||
|
local img
|
||||||
|
|
||||||
|
img="$1"
|
||||||
|
|
||||||
|
[[ -f "$img" ]] || return
|
||||||
|
[[ "$(file -b --mime-type "$img")" == application/x-dosexec ]] || return
|
||||||
|
objdump -h -j .linux "$img" &> /dev/null
|
||||||
|
}
|
||||||
|
|
||||||
is_fadump_capable()
|
is_fadump_capable()
|
||||||
{
|
{
|
||||||
@ -18,14 +30,18 @@ is_fadump_capable()
|
|||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
is_sme_or_sev_active()
|
||||||
|
{
|
||||||
|
journalctl -q --dmesg --grep "^Memory Encryption Features active: AMD (SME|SEV)$" >/dev/null 2>&1
|
||||||
|
}
|
||||||
|
|
||||||
is_squash_available()
|
is_squash_available()
|
||||||
{
|
{
|
||||||
|
local _version kmodule
|
||||||
|
|
||||||
|
_version=$(_get_kdump_kernel_version)
|
||||||
for kmodule in squashfs overlay loop; do
|
for kmodule in squashfs overlay loop; do
|
||||||
if [[ -z $KDUMP_KERNELVER ]]; then
|
modprobe -S "$_version" --dry-run $kmodule &> /dev/null || return 1
|
||||||
modprobe --dry-run $kmodule &> /dev/null || return 1
|
|
||||||
else
|
|
||||||
modprobe -S "$KDUMP_KERNELVER" --dry-run $kmodule &> /dev/null || return 1
|
|
||||||
fi
|
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -468,11 +484,24 @@ is_mount_in_dracut_args()
|
|||||||
[[ " $(kdump_get_conf_val dracut_args)" =~ .*[[:space:]]--mount[=[:space:]].* ]]
|
[[ " $(kdump_get_conf_val dracut_args)" =~ .*[[:space:]]--mount[=[:space:]].* ]]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get_reserved_mem_size()
|
||||||
|
{
|
||||||
|
local reserved_mem_size=0
|
||||||
|
|
||||||
|
if is_fadump_capable; then
|
||||||
|
reserved_mem_size=$(< /sys/kernel/fadump/mem_reserved)
|
||||||
|
else
|
||||||
|
reserved_mem_size=$(< /sys/kernel/kexec_crash_size)
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "$reserved_mem_size"
|
||||||
|
}
|
||||||
|
|
||||||
check_crash_mem_reserved()
|
check_crash_mem_reserved()
|
||||||
{
|
{
|
||||||
local mem_reserved
|
local mem_reserved
|
||||||
|
|
||||||
mem_reserved=$(< /sys/kernel/kexec_crash_size)
|
mem_reserved=$(get_reserved_mem_size)
|
||||||
if [[ $mem_reserved -eq 0 ]]; then
|
if [[ $mem_reserved -eq 0 ]]; then
|
||||||
derror "No memory reserved for crash kernel"
|
derror "No memory reserved for crash kernel"
|
||||||
return 1
|
return 1
|
||||||
@ -491,37 +520,31 @@ check_kdump_feasibility()
|
|||||||
return $?
|
return $?
|
||||||
}
|
}
|
||||||
|
|
||||||
check_current_kdump_status()
|
is_kernel_loaded()
|
||||||
{
|
{
|
||||||
if [[ ! -f /sys/kernel/kexec_crash_loaded ]]; then
|
local _sysfs _mode
|
||||||
derror "Perhaps CONFIG_CRASH_DUMP is not enabled in kernel"
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
rc=$(< /sys/kernel/kexec_crash_loaded)
|
_mode=$1
|
||||||
if [[ $rc == 1 ]]; then
|
|
||||||
return 0
|
|
||||||
else
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
# remove_cmdline_param <kernel cmdline> <param1> [<param2>] ... [<paramN>]
|
case "$_mode" in
|
||||||
# Remove a list of kernel parameters from a given kernel cmdline and print the result.
|
kdump)
|
||||||
# For each "arg" in the removing params list, "arg" and "arg=xxx" will be removed if exists.
|
_sysfs="/sys/kernel/kexec_crash_loaded"
|
||||||
remove_cmdline_param()
|
;;
|
||||||
{
|
fadump)
|
||||||
local cmdline=$1
|
_sysfs="$FADUMP_REGISTER_SYS_NODE"
|
||||||
shift
|
;;
|
||||||
|
*)
|
||||||
|
derror "Unknown dump mode '$_mode' provided"
|
||||||
|
return 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
if [[ ! -f $_sysfs ]]; then
|
||||||
|
derror "$_mode is not supported on this kernel"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
for arg in "$@"; do
|
[[ $(< $_sysfs) -eq 1 ]]
|
||||||
cmdline=$(echo "$cmdline" |
|
|
||||||
sed -e "s/\b$arg=[^ ]*//g" \
|
|
||||||
-e "s/^$arg\b//g" \
|
|
||||||
-e "s/[[:space:]]$arg\b//g" \
|
|
||||||
-e "s/\s\+/ /g")
|
|
||||||
done
|
|
||||||
echo "$cmdline"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
@ -538,23 +561,6 @@ get_bootcpu_apicid()
|
|||||||
/proc/cpuinfo
|
/proc/cpuinfo
|
||||||
}
|
}
|
||||||
|
|
||||||
#
|
|
||||||
# append_cmdline <kernel cmdline> <parameter name> <parameter value>
|
|
||||||
# This function appends argument "$2=$3" to string ($1) if not already present.
|
|
||||||
#
|
|
||||||
append_cmdline()
|
|
||||||
{
|
|
||||||
local cmdline=$1
|
|
||||||
local newstr=${cmdline/$2/""}
|
|
||||||
|
|
||||||
# unchanged str implies argument wasn't there
|
|
||||||
if [[ $cmdline == "$newstr" ]]; then
|
|
||||||
cmdline="${cmdline} ${2}=${3}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "$cmdline"
|
|
||||||
}
|
|
||||||
|
|
||||||
# This function check iomem and determines if we have more than
|
# This function check iomem and determines if we have more than
|
||||||
# 4GB of ram available. Returns 1 if we do, 0 if we dont
|
# 4GB of ram available. Returns 1 if we do, 0 if we dont
|
||||||
need_64bit_headers()
|
need_64bit_headers()
|
||||||
@ -635,6 +641,15 @@ prepare_kexec_args()
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# For secureboot enabled machines, use new kexec file based syscall.
|
||||||
|
# Old syscall will always fail as it does not have capability to do
|
||||||
|
# kernel signature verification.
|
||||||
|
if is_secure_boot_enforced; then
|
||||||
|
dinfo "Secure Boot is enabled. Using kexec file based syscall."
|
||||||
|
kexec_args="$kexec_args -s"
|
||||||
|
fi
|
||||||
|
|
||||||
echo "$kexec_args"
|
echo "$kexec_args"
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -647,7 +662,9 @@ prepare_kdump_kernel()
|
|||||||
read -r machine_id < /etc/machine-id
|
read -r machine_id < /etc/machine-id
|
||||||
|
|
||||||
boot_dirlist=${KDUMP_BOOTDIR:-"/boot /boot/efi /efi /"}
|
boot_dirlist=${KDUMP_BOOTDIR:-"/boot /boot/efi /efi /"}
|
||||||
boot_imglist="$KDUMP_IMG-$kdump_kernelver$KDUMP_IMG_EXT $machine_id/$kdump_kernelver/$KDUMP_IMG"
|
boot_imglist="$KDUMP_IMG-$kdump_kernelver$KDUMP_IMG_EXT \
|
||||||
|
$machine_id/$kdump_kernelver/$KDUMP_IMG \
|
||||||
|
EFI/Linux/$machine_id-$kdump_kernelver.efi"
|
||||||
|
|
||||||
# The kernel of OSTree based systems is not in the standard locations.
|
# The kernel of OSTree based systems is not in the standard locations.
|
||||||
if is_ostree; then
|
if is_ostree; then
|
||||||
@ -671,6 +688,75 @@ prepare_kdump_kernel()
|
|||||||
echo "$kdump_kernel"
|
echo "$kdump_kernel"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_is_valid_kver()
|
||||||
|
{
|
||||||
|
[[ -f /usr/lib/modules/$1/modules.dep ]]
|
||||||
|
}
|
||||||
|
|
||||||
|
# This function is introduced since 64k variant may be installed on 4k or vice versa
|
||||||
|
# $1 the kernel path name.
|
||||||
|
parse_kver_from_path()
|
||||||
|
{
|
||||||
|
local _img _kver
|
||||||
|
|
||||||
|
[[ -z "$1" ]] && return
|
||||||
|
|
||||||
|
_img=$1
|
||||||
|
BLS_ENTRY_TOKEN=$(</etc/machine-id)
|
||||||
|
|
||||||
|
# Fedora standard installation, i.e. $BOOT/vmlinuz-<version>
|
||||||
|
_kver=${_img##*/vmlinuz-}
|
||||||
|
_kver=${_kver%"$KDUMP_IMG_EXT"}
|
||||||
|
if _is_valid_kver "$_kver"; then
|
||||||
|
echo "$_kver"
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
# BLS recommended image names, i.e. $BOOT/<token>/<version>/linux
|
||||||
|
_kver=${_img##*/"$BLS_ENTRY_TOKEN"/}
|
||||||
|
_kver=${_kver%%/*}
|
||||||
|
if _is_valid_kver "$_kver"; then
|
||||||
|
echo "$_kver"
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Fedora UKI installation, i.e. $BOOT/efi/EFI/Linux/<token>-<version>.efi
|
||||||
|
_kver=${_img##*/"$BLS_ENTRY_TOKEN"-}
|
||||||
|
_kver=${_kver%.efi}
|
||||||
|
if _is_valid_kver "$_kver"; then
|
||||||
|
echo "$_kver"
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
ddebug "Could not parse version from $_img"
|
||||||
|
}
|
||||||
|
|
||||||
|
_get_kdump_kernel_version()
|
||||||
|
{
|
||||||
|
local _version _version_nondebug
|
||||||
|
|
||||||
|
if [[ -n "$KDUMP_KERNELVER" ]]; then
|
||||||
|
echo "$KDUMP_KERNELVER"
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
_version=$(uname -r)
|
||||||
|
if [[ ! "$_version" =~ [+|-]debug$ ]]; then
|
||||||
|
echo "$_version"
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
_version_nondebug=${_version%+debug}
|
||||||
|
_version_nondebug=${_version_nondebug%-debug}
|
||||||
|
if [[ -f "$(prepare_kdump_kernel "$_version_nondebug")" ]]; then
|
||||||
|
dinfo "Use of debug kernel detected. Trying to use $_version_nondebug"
|
||||||
|
echo "$_version_nondebug"
|
||||||
|
else
|
||||||
|
dinfo "Use of debug kernel detected but cannot find $_version_nondebug. Falling back to $_version"
|
||||||
|
echo "$_version"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
# Detect initrd and kernel location, results are stored in global environmental variables:
|
# Detect initrd and kernel location, results are stored in global environmental variables:
|
||||||
# KDUMP_BOOTDIR, KDUMP_KERNELVER, KDUMP_KERNEL, DEFAULT_INITRD, and KDUMP_INITRD
|
# KDUMP_BOOTDIR, KDUMP_KERNELVER, KDUMP_KERNEL, DEFAULT_INITRD, and KDUMP_INITRD
|
||||||
@ -680,48 +766,27 @@ prepare_kdump_kernel()
|
|||||||
#
|
#
|
||||||
prepare_kdump_bootinfo()
|
prepare_kdump_bootinfo()
|
||||||
{
|
{
|
||||||
local boot_initrdlist nondebug_kernelver debug_kernelver
|
local boot_initrdlist default_initrd_base var_target_initrd_dir
|
||||||
local default_initrd_base var_target_initrd_dir
|
|
||||||
|
|
||||||
if [[ -z $KDUMP_KERNELVER ]]; then
|
|
||||||
KDUMP_KERNELVER=$(uname -r)
|
|
||||||
|
|
||||||
# Fadump uses the regular bootloader, unlike kdump. So, use the same version
|
|
||||||
# for default kernel and capture kernel unless specified explicitly with
|
|
||||||
# KDUMP_KERNELVER option.
|
|
||||||
if ! is_fadump_capable; then
|
|
||||||
nondebug_kernelver=$(sed -n -e 's/\(.*\)+debug$/\1/p' <<< "$KDUMP_KERNELVER")
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Use nondebug kernel if possible, because debug kernel will consume more memory and may oom.
|
|
||||||
if [[ -n $nondebug_kernelver ]]; then
|
|
||||||
dinfo "Trying to use $nondebug_kernelver."
|
|
||||||
debug_kernelver=$KDUMP_KERNELVER
|
|
||||||
KDUMP_KERNELVER=$nondebug_kernelver
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
KDUMP_KERNELVER=$(_get_kdump_kernel_version)
|
||||||
KDUMP_KERNEL=$(prepare_kdump_kernel "$KDUMP_KERNELVER")
|
KDUMP_KERNEL=$(prepare_kdump_kernel "$KDUMP_KERNELVER")
|
||||||
|
|
||||||
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
|
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
|
# For 64k variant, e.g. vmlinuz-5.14.0-327.el9.aarch64+64k-debug
|
||||||
|
if [[ "$KDUMP_KERNEL" == *"+debug" || "$KDUMP_KERNEL" == *"64k-debug" ]]; then
|
||||||
dwarn "Using debug kernel, you may need to set a larger crashkernel than the default value."
|
dwarn "Using debug kernel, you may need to set a larger crashkernel than the default value."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Set KDUMP_BOOTDIR to where kernel image is stored
|
# Set KDUMP_BOOTDIR to where kernel image is stored
|
||||||
KDUMP_BOOTDIR=$(dirname "$KDUMP_KERNEL")
|
if is_uki "$KDUMP_KERNEL"; then
|
||||||
|
KDUMP_BOOTDIR=/boot
|
||||||
|
else
|
||||||
|
KDUMP_BOOTDIR=$(dirname "$KDUMP_KERNEL")
|
||||||
|
fi
|
||||||
|
|
||||||
# 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"
|
||||||
@ -773,26 +838,46 @@ get_watchdog_drvs()
|
|||||||
echo "$_wdtdrvs"
|
echo "$_wdtdrvs"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_cmdline_parse()
|
||||||
|
{
|
||||||
|
local opt val
|
||||||
|
|
||||||
|
while read -r opt; do
|
||||||
|
if [[ $opt =~ = ]]; then
|
||||||
|
val=${opt#*=}
|
||||||
|
opt=${opt%%=*}
|
||||||
|
# ignore options like 'foo='
|
||||||
|
[[ -z $val ]] && continue
|
||||||
|
# xargs removes quotes, add them again
|
||||||
|
[[ $val =~ [[:space:]] ]] && val="\"$val\""
|
||||||
|
else
|
||||||
|
val=""
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "$opt $val"
|
||||||
|
done <<< "$(echo "$1" | xargs -n 1 echo)"
|
||||||
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
# prepare_cmdline <commandline> <commandline remove> <commandline append>
|
# prepare_cmdline <commandline> <commandline remove> <commandline append>
|
||||||
# This function performs a series of edits on the command line.
|
# This function performs a series of edits on the command line.
|
||||||
# Store the final result in global $KDUMP_COMMANDLINE.
|
# Store the final result in global $KDUMP_COMMANDLINE.
|
||||||
prepare_cmdline()
|
prepare_cmdline()
|
||||||
{
|
{
|
||||||
local cmdline id arg
|
local in out append opt val id drv
|
||||||
|
local -A remove
|
||||||
|
|
||||||
|
in=${1:-$(< /proc/cmdline)}
|
||||||
|
while read -r opt val; do
|
||||||
|
[[ -n "$opt" ]] || continue
|
||||||
|
remove[$opt]=1
|
||||||
|
done <<< "$(_cmdline_parse "$2")"
|
||||||
|
append=$3
|
||||||
|
|
||||||
if [[ -z $1 ]]; then
|
|
||||||
cmdline=$(< /proc/cmdline)
|
|
||||||
else
|
|
||||||
cmdline="$1"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# These params should always be removed
|
# These params should always be removed
|
||||||
cmdline=$(remove_cmdline_param "$cmdline" crashkernel panic_on_warn)
|
remove[crashkernel]=1
|
||||||
# These params can be removed configurably
|
remove[panic_on_warn]=1
|
||||||
while read -r arg; do
|
|
||||||
cmdline=$(remove_cmdline_param "$cmdline" "$arg")
|
|
||||||
done <<< "$(echo "$2" | xargs -n 1 echo)"
|
|
||||||
|
|
||||||
# Always remove "root=X", as we now explicitly generate all kinds
|
# Always remove "root=X", as we now explicitly generate all kinds
|
||||||
# of dump target mount information including root fs.
|
# of dump target mount information including root fs.
|
||||||
@ -800,39 +885,63 @@ prepare_cmdline()
|
|||||||
# We do this before KDUMP_COMMANDLINE_APPEND, if one really cares
|
# We do this before KDUMP_COMMANDLINE_APPEND, if one really cares
|
||||||
# about it(e.g. for debug purpose), then can pass "root=X" using
|
# about it(e.g. for debug purpose), then can pass "root=X" using
|
||||||
# KDUMP_COMMANDLINE_APPEND.
|
# KDUMP_COMMANDLINE_APPEND.
|
||||||
cmdline=$(remove_cmdline_param "$cmdline" root)
|
remove[root]=1
|
||||||
|
|
||||||
# With the help of "--hostonly-cmdline", we can avoid some interitage.
|
# With the help of "--hostonly-cmdline", we can avoid some interitage.
|
||||||
cmdline=$(remove_cmdline_param "$cmdline" rd.lvm.lv rd.luks.uuid rd.dm.uuid rd.md.uuid fcoe)
|
remove[rd.lvm.lv]=1
|
||||||
|
remove[rd.luks.uuid]=1
|
||||||
|
remove[rd.dm.uuid]=1
|
||||||
|
remove[rd.md.uuid]=1
|
||||||
|
remove[fcoe]=1
|
||||||
|
|
||||||
# Remove netroot, rd.iscsi.initiator and iscsi_initiator since
|
# Remove netroot, rd.iscsi.initiator and iscsi_initiator since
|
||||||
# we get duplicate entries for the same in case iscsi code adds
|
# we get duplicate entries for the same in case iscsi code adds
|
||||||
# it as well.
|
# it as well.
|
||||||
cmdline=$(remove_cmdline_param "$cmdline" netroot rd.iscsi.initiator iscsi_initiator)
|
remove[netroot]=1
|
||||||
|
remove[rd.iscsi.initiator]=1
|
||||||
|
remove[iscsi_initiator]=1
|
||||||
|
|
||||||
cmdline="${cmdline} $3"
|
while read -r opt val; do
|
||||||
|
[[ -n "$opt" ]] || continue
|
||||||
|
[[ -n "${remove[$opt]}" ]] && continue
|
||||||
|
|
||||||
|
if [[ -n "$val" ]]; then
|
||||||
|
out+="$opt=$val "
|
||||||
|
else
|
||||||
|
out+="$opt "
|
||||||
|
fi
|
||||||
|
done <<< "$(_cmdline_parse "$in")"
|
||||||
|
|
||||||
|
out+="$append "
|
||||||
|
|
||||||
id=$(get_bootcpu_apicid)
|
id=$(get_bootcpu_apicid)
|
||||||
if [[ -n ${id} ]]; then
|
if [[ -n "${id}" ]]; then
|
||||||
cmdline=$(append_cmdline "$cmdline" disable_cpu_apicid "$id")
|
out+="disable_cpu_apicid=$id "
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# If any watchdog is used, set it's pretimeout to 0. pretimeout let
|
# If any watchdog is used, set it's pretimeout to 0. pretimeout let
|
||||||
# watchdog panic the kernel first, and reset the system after the
|
# watchdog panic the kernel first, and reset the system after the
|
||||||
# panic. If the system is already in kdump, panic is not helpful
|
# panic. If the system is already in kdump, panic is not helpful
|
||||||
# and only increase the chance of watchdog failure.
|
# and only increase the chance of watchdog failure.
|
||||||
for i in $(get_watchdog_drvs); do
|
for drv in $(get_watchdog_drvs); do
|
||||||
cmdline+=" $i.pretimeout=0"
|
out+="$drv.pretimeout=0 "
|
||||||
|
|
||||||
if [[ $i == hpwdt ]]; then
|
if [[ $drv == hpwdt ]]; then
|
||||||
# hpwdt have a special parameter kdumptimeout, is's only suppose
|
# hpwdt have a special parameter kdumptimeout, it is
|
||||||
# to be set to non-zero in first kernel. In kdump, non-zero
|
# only supposed to be set to non-zero in first kernel.
|
||||||
# value could prevent the watchdog from resetting the system.
|
# In kdump, non-zero value could prevent the watchdog
|
||||||
cmdline+=" $i.kdumptimeout=0"
|
# from resetting the system.
|
||||||
|
out+="$drv.kdumptimeout=0 "
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
echo "$cmdline"
|
# Always disable gpt-auto-generator as it hangs during boot of the
|
||||||
|
# crash kernel. Furthermore we know which disk will be used for dumping
|
||||||
|
# (if at all) and add it explicitly.
|
||||||
|
is_uki "$KDUMP_KERNEL" && out+="rd.systemd.gpt_auto=no "
|
||||||
|
|
||||||
|
# Trim unnecessary whitespaces
|
||||||
|
echo "$out" | sed -e "s/^ *//g" -e "s/ *$//g" -e "s/ \+/ /g"
|
||||||
}
|
}
|
||||||
|
|
||||||
PROC_IOMEM=/proc/iomem
|
PROC_IOMEM=/proc/iomem
|
||||||
@ -879,11 +988,156 @@ get_recommend_size()
|
|||||||
echo "0M"
|
echo "0M"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
has_mlx5()
|
||||||
|
{
|
||||||
|
[[ -d /sys/bus/pci/drivers/mlx5_core ]]
|
||||||
|
}
|
||||||
|
|
||||||
|
has_aarch64_smmu()
|
||||||
|
{
|
||||||
|
ls /sys/devices/platform/arm-smmu-* 1> /dev/null 2>&1
|
||||||
|
}
|
||||||
|
|
||||||
|
is_memsize() { [[ "$1" =~ ^[+-]?[0-9]+[KkMmGgTtPbEe]?$ ]]; }
|
||||||
|
|
||||||
|
# range defined for crashkernel parameter
|
||||||
|
# i.e. <start>-[<end>]
|
||||||
|
is_memrange()
|
||||||
|
{
|
||||||
|
is_memsize "${1%-*}" || return 1
|
||||||
|
[[ -n ${1#*-} ]] || return 0
|
||||||
|
is_memsize "${1#*-}"
|
||||||
|
}
|
||||||
|
|
||||||
|
to_bytes()
|
||||||
|
{
|
||||||
|
local _s
|
||||||
|
|
||||||
|
_s="$1"
|
||||||
|
is_memsize "$_s" || return 1
|
||||||
|
|
||||||
|
case "${_s: -1}" in
|
||||||
|
K|k)
|
||||||
|
_s=${_s::-1}
|
||||||
|
_s="$((_s * 1024))"
|
||||||
|
;;
|
||||||
|
M|m)
|
||||||
|
_s=${_s::-1}
|
||||||
|
_s="$((_s * 1024 * 1024))"
|
||||||
|
;;
|
||||||
|
G|g)
|
||||||
|
_s=${_s::-1}
|
||||||
|
_s="$((_s * 1024 * 1024 * 1024))"
|
||||||
|
;;
|
||||||
|
T|t)
|
||||||
|
_s=${_s::-1}
|
||||||
|
_s="$((_s * 1024 * 1024 * 1024 * 1024))"
|
||||||
|
;;
|
||||||
|
P|p)
|
||||||
|
_s=${_s::-1}
|
||||||
|
_s="$((_s * 1024 * 1024 * 1024 * 1024 * 1024))"
|
||||||
|
;;
|
||||||
|
E|e)
|
||||||
|
_s=${_s::-1}
|
||||||
|
_s="$((_s * 1024 * 1024 * 1024 * 1024 * 1024 * 1024))"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
echo "$_s"
|
||||||
|
}
|
||||||
|
|
||||||
|
memsize_add()
|
||||||
|
{
|
||||||
|
local -a units=("" "K" "M" "G" "T" "P" "E")
|
||||||
|
local i a b
|
||||||
|
|
||||||
|
a=$(to_bytes "$1") || return 1
|
||||||
|
b=$(to_bytes "$2") || return 1
|
||||||
|
i=0
|
||||||
|
|
||||||
|
(( a += b ))
|
||||||
|
while :; do
|
||||||
|
[[ $(( a / 1024 )) -eq 0 ]] && break
|
||||||
|
[[ $(( a % 1024 )) -ne 0 ]] && break
|
||||||
|
[[ $(( ${#units[@]} - 1 )) -eq $i ]] && break
|
||||||
|
|
||||||
|
(( a /= 1024 ))
|
||||||
|
(( i += 1 ))
|
||||||
|
done
|
||||||
|
|
||||||
|
echo "${a}${units[$i]}"
|
||||||
|
}
|
||||||
|
|
||||||
|
_crashkernel_parse()
|
||||||
|
{
|
||||||
|
local ck entry
|
||||||
|
local range size offset
|
||||||
|
|
||||||
|
ck="$1"
|
||||||
|
|
||||||
|
if [[ "$ck" == *@* ]]; then
|
||||||
|
offset="@${ck##*@}"
|
||||||
|
ck=${ck%@*}
|
||||||
|
elif [[ "$ck" == *,high ]] || [[ "$ck" == *,low ]]; then
|
||||||
|
offset=",${ck##*,}"
|
||||||
|
ck=${ck%,*}
|
||||||
|
else
|
||||||
|
offset=''
|
||||||
|
fi
|
||||||
|
|
||||||
|
while read -d , -r entry; do
|
||||||
|
[[ -n "$entry" ]] || continue
|
||||||
|
if [[ "$entry" == *:* ]]; then
|
||||||
|
range=${entry%:*}
|
||||||
|
size=${entry#*:}
|
||||||
|
else
|
||||||
|
range=""
|
||||||
|
size=${entry}
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "$size;$range;"
|
||||||
|
done <<< "$ck,"
|
||||||
|
echo ";;$offset"
|
||||||
|
}
|
||||||
|
|
||||||
|
# $1 crashkernel command line parameter
|
||||||
|
# $2 size to be added
|
||||||
|
_crashkernel_add()
|
||||||
|
{
|
||||||
|
local ck delta ret
|
||||||
|
local range size offset
|
||||||
|
|
||||||
|
ck="$1"
|
||||||
|
delta="$2"
|
||||||
|
ret=""
|
||||||
|
|
||||||
|
while IFS=';' read -r size range offset; do
|
||||||
|
if [[ -n "$offset" ]]; then
|
||||||
|
ret="${ret%,}$offset"
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
|
||||||
|
[[ -n "$size" ]] || continue
|
||||||
|
if [[ -n "$range" ]]; then
|
||||||
|
is_memrange "$range" || return 1
|
||||||
|
ret+="$range:"
|
||||||
|
fi
|
||||||
|
|
||||||
|
size=$(memsize_add "$size" "$delta") || return 1
|
||||||
|
ret+="$size,"
|
||||||
|
done < <( _crashkernel_parse "$ck")
|
||||||
|
|
||||||
|
echo "${ret%,}"
|
||||||
|
}
|
||||||
|
|
||||||
# get default crashkernel
|
# get default crashkernel
|
||||||
# $1 dump mode, if not specified, dump_mode will be judged by is_fadump_capable
|
# $1 dump mode, if not specified, dump_mode will be judged by is_fadump_capable
|
||||||
|
# $2 kernel-release, if not specified, got by _get_kdump_kernel_version
|
||||||
kdump_get_arch_recommend_crashkernel()
|
kdump_get_arch_recommend_crashkernel()
|
||||||
{
|
{
|
||||||
local _arch _ck_cmdline _dump_mode
|
local _arch _ck_cmdline _dump_mode
|
||||||
|
local _delta=0
|
||||||
|
|
||||||
if [[ -z "$1" ]]; then
|
if [[ -z "$1" ]]; then
|
||||||
if is_fadump_capable; then
|
if is_fadump_capable; then
|
||||||
@ -899,9 +1153,32 @@ kdump_get_arch_recommend_crashkernel()
|
|||||||
|
|
||||||
if [[ $_arch == "x86_64" ]] || [[ $_arch == "s390x" ]]; then
|
if [[ $_arch == "x86_64" ]] || [[ $_arch == "s390x" ]]; then
|
||||||
_ck_cmdline="1G-4G:192M,4G-64G:256M,64G-:512M"
|
_ck_cmdline="1G-4G:192M,4G-64G:256M,64G-:512M"
|
||||||
|
is_sme_or_sev_active && ((_delta += 64))
|
||||||
elif [[ $_arch == "aarch64" ]]; then
|
elif [[ $_arch == "aarch64" ]]; then
|
||||||
# For 4KB page size, the formula is based on x86 plus extra = 64M
|
local _running_kernel
|
||||||
|
|
||||||
|
# Base line for 4K variant kernel. The formula is based on x86 plus extra = 64M
|
||||||
_ck_cmdline="1G-4G:256M,4G-64G:320M,64G-:576M"
|
_ck_cmdline="1G-4G:256M,4G-64G:320M,64G-:576M"
|
||||||
|
if [[ -z "$2" ]]; then
|
||||||
|
_running_kernel=$(_get_kdump_kernel_version)
|
||||||
|
else
|
||||||
|
_running_kernel=$2
|
||||||
|
fi
|
||||||
|
|
||||||
|
# the naming convention of 64k variant suffixes with +64k, e.g. "vmlinuz-5.14.0-312.el9.aarch64+64k"
|
||||||
|
if echo "$_running_kernel" | grep -q 64k; then
|
||||||
|
# Without smmu, the diff of MemFree between 4K and 64K measured on a high end aarch64 machine is 82M.
|
||||||
|
# Picking up 100M to cover this diff. And finally, we have "1G-4G:356M;4G-64G:420M;64G-:676M"
|
||||||
|
((_delta += 100))
|
||||||
|
# On a 64K system, the extra 384MB is calculated by: cmdq_num * 16 bytes + evtq_num * 32B + priq_num * 16B
|
||||||
|
# While on a 4K system, it is negligible
|
||||||
|
has_aarch64_smmu && ((_delta += 384))
|
||||||
|
#64k kernel, mlx5 consumes extra 188M memory, and choose 200M
|
||||||
|
has_mlx5 && ((_delta += 200))
|
||||||
|
else
|
||||||
|
#4k kernel, mlx5 consumes extra 124M memory, and choose 150M
|
||||||
|
has_mlx5 && ((_delta += 150))
|
||||||
|
fi
|
||||||
elif [[ $_arch == "ppc64le" ]]; then
|
elif [[ $_arch == "ppc64le" ]]; then
|
||||||
if [[ $_dump_mode == "fadump" ]]; then
|
if [[ $_dump_mode == "fadump" ]]; then
|
||||||
_ck_cmdline="4G-16G:768M,16G-64G:1G,64G-128G:2G,128G-1T:4G,1T-2T:6G,2T-4T:12G,4T-8T:20G,8T-16T:36G,16T-32T:64G,32T-64T:128G,64T-:180G"
|
_ck_cmdline="4G-16G:768M,16G-64G:1G,64G-128G:2G,128G-1T:4G,1T-2T:6G,2T-4T:12G,4T-8T:20G,8T-16T:36G,16T-32T:64G,32T-64T:128G,64T-:180G"
|
||||||
@ -910,7 +1187,7 @@ kdump_get_arch_recommend_crashkernel()
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo -n "$_ck_cmdline"
|
echo -n "$(_crashkernel_add "$_ck_cmdline" "${_delta}M")"
|
||||||
}
|
}
|
||||||
|
|
||||||
# return recommended size based on current system RAM size
|
# return recommended size based on current system RAM size
|
||||||
@ -969,75 +1246,3 @@ get_all_kdump_crypt_dev()
|
|||||||
get_luks_crypt_dev "$(kdump_get_maj_min "$_dev")"
|
get_luks_crypt_dev "$(kdump_get_maj_min "$_dev")"
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
check_vmlinux()
|
|
||||||
{
|
|
||||||
# Use readelf to check if it's a valid ELF
|
|
||||||
readelf -h "$1" &> /dev/null || return 1
|
|
||||||
}
|
|
||||||
|
|
||||||
get_vmlinux_size()
|
|
||||||
{
|
|
||||||
local size=0 _msize
|
|
||||||
|
|
||||||
while read -r _msize; do
|
|
||||||
size=$((size + _msize))
|
|
||||||
done <<< "$(readelf -l -W "$1" | awk '/^ LOAD/{print $6}' 2> /dev/stderr)"
|
|
||||||
|
|
||||||
echo $size
|
|
||||||
}
|
|
||||||
|
|
||||||
try_decompress()
|
|
||||||
{
|
|
||||||
# The obscure use of the "tr" filter is to work around older versions of
|
|
||||||
# "grep" that report the byte offset of the line instead of the pattern.
|
|
||||||
|
|
||||||
# Try to find the header ($1) and decompress from here
|
|
||||||
for pos in $(tr "$1\n$2" "\n$2=" < "$4" | grep -abo "^$2"); do
|
|
||||||
if ! type -P "$3" > /dev/null; then
|
|
||||||
ddebug "Signiature detected but '$3' is missing, skip this decompressor"
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
|
|
||||||
pos=${pos%%:*}
|
|
||||||
tail "-c+$pos" "$img" | $3 > "$5" 2> /dev/null
|
|
||||||
if check_vmlinux "$5"; then
|
|
||||||
ddebug "Kernel is extracted with '$3'"
|
|
||||||
return 0
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
return 1
|
|
||||||
}
|
|
||||||
|
|
||||||
# Borrowed from linux/scripts/extract-vmlinux
|
|
||||||
get_kernel_size()
|
|
||||||
{
|
|
||||||
# Prepare temp files:
|
|
||||||
local tmp img=$1
|
|
||||||
|
|
||||||
tmp=$(mktemp /tmp/vmlinux-XXX)
|
|
||||||
trap 'rm -f "$tmp"' 0
|
|
||||||
|
|
||||||
# Try to check if it's a vmlinux already
|
|
||||||
check_vmlinux "$img" && get_vmlinux_size "$img" && return 0
|
|
||||||
|
|
||||||
# That didn't work, so retry after decompression.
|
|
||||||
try_decompress '\037\213\010' xy gunzip "$img" "$tmp" ||
|
|
||||||
try_decompress '\3757zXZ\000' abcde unxz "$img" "$tmp" ||
|
|
||||||
try_decompress 'BZh' xy bunzip2 "$img" "$tmp" ||
|
|
||||||
try_decompress '\135\0\0\0' xxx unlzma "$img" "$tmp" ||
|
|
||||||
try_decompress '\211\114\132' xy 'lzop -d' "$img" "$tmp" ||
|
|
||||||
try_decompress '\002!L\030' xxx 'lz4 -d' "$img" "$tmp" ||
|
|
||||||
try_decompress '(\265/\375' xxx unzstd "$img" "$tmp"
|
|
||||||
|
|
||||||
# Finally check for uncompressed images or objects:
|
|
||||||
[[ $? -eq 0 ]] && get_vmlinux_size "$tmp" && return 0
|
|
||||||
|
|
||||||
# Fallback to use iomem
|
|
||||||
local _size=0 _seg
|
|
||||||
while read -r _seg; do
|
|
||||||
_size=$((_size + 0x${_seg#*-} - 0x${_seg%-*}))
|
|
||||||
done <<< "$(grep -E "Kernel (code|rodata|data|bss)" /proc/iomem | cut -d ":" -f 1)"
|
|
||||||
echo $_size
|
|
||||||
}
|
|
||||||
|
@ -28,9 +28,21 @@ understand how this configuration file affects the behavior of kdump.
|
|||||||
|
|
||||||
.B auto_reset_crashkernel <yes|no>
|
.B auto_reset_crashkernel <yes|no>
|
||||||
.RS
|
.RS
|
||||||
determine whether to reset kernel crashkernel to new default value
|
determine whether to reset kernel crashkernel parameter to the default value
|
||||||
or not when kexec-tools updates the default crashkernel value and
|
or not when kexec-tools is updated or a new kernel is installed. The default
|
||||||
existing kernels using the old default kernel crashkernel value
|
crashkernel values are different for different architectures and also take the
|
||||||
|
following factors into consideration,
|
||||||
|
- AMD Secure Memory Encryption (SME) and Secure Encrypted Virtualization (SEV)
|
||||||
|
- Mellanox 5th generation network driver
|
||||||
|
- aarch64 64k kernel
|
||||||
|
- Firmware-assisted dump (FADump)
|
||||||
|
|
||||||
|
Since the kernel crasherkernel parameter will be only reset when kexec-tools is
|
||||||
|
updated or a new kernel is installed, you need to call "kdumpctl
|
||||||
|
reset-crashkernel [--kernel=path_to_kernel]" if you want to use the default
|
||||||
|
value set after having enabled features like SME/SEV for a specific kernel. And
|
||||||
|
you should also reboot the system for the new crashkernel value to take effect.
|
||||||
|
Also see kdumpctl(8).
|
||||||
|
|
||||||
.B raw <partition>
|
.B raw <partition>
|
||||||
.RS
|
.RS
|
||||||
|
@ -11,6 +11,7 @@ ExecStop=/usr/bin/kdumpctl stop
|
|||||||
ExecReload=/usr/bin/kdumpctl reload
|
ExecReload=/usr/bin/kdumpctl reload
|
||||||
RemainAfterExit=yes
|
RemainAfterExit=yes
|
||||||
StartLimitInterval=0
|
StartLimitInterval=0
|
||||||
|
PrivateTmp=yes
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target
|
WantedBy=multi-user.target
|
||||||
|
@ -21,7 +21,7 @@ KDUMP_COMMANDLINE_REMOVE="hugepages hugepagesz slub_debug quiet log_buf_len swio
|
|||||||
|
|
||||||
# This variable lets us append arguments to the current kdump commandline
|
# This variable lets us append arguments to the current kdump commandline
|
||||||
# after processed by KDUMP_COMMANDLINE_REMOVE
|
# after processed by KDUMP_COMMANDLINE_REMOVE
|
||||||
KDUMP_COMMANDLINE_APPEND="irqpoll maxcpus=1 noirqdistrib reset_devices cgroup_disable=memory numa=off udev.children-max=2 ehea.use_mcs=0 panic=10 kvm_cma_resv_ratio=0 transparent_hugepage=never novmcoredd hugetlb_cma=0 srcutree.big_cpu_lim=0"
|
KDUMP_COMMANDLINE_APPEND="irqpoll maxcpus=1 noirqdistrib reset_devices cgroup_disable=memory numa=off udev.children-max=2 ehea.use_mcs=0 panic=10 kvm_cma_resv_ratio=0 transparent_hugepage=never novmcoredd hugetlb_cma=0"
|
||||||
|
|
||||||
# Any additional kexec arguments required. In most situations, this should
|
# Any additional kexec arguments required. In most situations, this should
|
||||||
# be left empty
|
# be left empty
|
||||||
|
@ -21,7 +21,7 @@ KDUMP_COMMANDLINE_REMOVE="hugepages hugepagesz slub_debug quiet log_buf_len swio
|
|||||||
|
|
||||||
# This variable lets us append arguments to the current kdump commandline
|
# This variable lets us append arguments to the current kdump commandline
|
||||||
# after processed by KDUMP_COMMANDLINE_REMOVE
|
# after processed by KDUMP_COMMANDLINE_REMOVE
|
||||||
KDUMP_COMMANDLINE_APPEND="irqpoll maxcpus=1 noirqdistrib reset_devices cgroup_disable=memory numa=off udev.children-max=2 ehea.use_mcs=0 panic=10 kvm_cma_resv_ratio=0 transparent_hugepage=never novmcoredd hugetlb_cma=0 srcutree.big_cpu_lim=0"
|
KDUMP_COMMANDLINE_APPEND="irqpoll maxcpus=1 noirqdistrib reset_devices cgroup_disable=memory numa=off udev.children-max=2 ehea.use_mcs=0 panic=10 kvm_cma_resv_ratio=0 transparent_hugepage=never novmcoredd hugetlb_cma=0"
|
||||||
|
|
||||||
# Any additional kexec arguments required. In most situations, this should
|
# Any additional kexec arguments required. In most situations, this should
|
||||||
# be left empty
|
# be left empty
|
||||||
|
@ -17,7 +17,7 @@ KDUMP_COMMANDLINE=""
|
|||||||
# This variable lets us remove arguments from the current kdump commandline
|
# This variable lets us remove arguments from the current kdump commandline
|
||||||
# as taken from either KDUMP_COMMANDLINE above, or from /proc/cmdline
|
# as taken from either KDUMP_COMMANDLINE above, or from /proc/cmdline
|
||||||
# NOTE: some arguments such as crashkernel will always be removed
|
# NOTE: some arguments such as crashkernel will always be removed
|
||||||
KDUMP_COMMANDLINE_REMOVE="hugepages hugepagesz slub_debug quiet log_buf_len swiotlb vmcp_cma cma hugetlb_cma prot_virt ignition.firstboot"
|
KDUMP_COMMANDLINE_REMOVE="hugepages hugepagesz slub_debug quiet log_buf_len swiotlb vmcp_cma cma hugetlb_cma prot_virt ignition.firstboot zfcp.allow_lun_scan"
|
||||||
|
|
||||||
# This variable lets us append arguments to the current kdump commandline
|
# This variable lets us append arguments to the current kdump commandline
|
||||||
# after processed by KDUMP_COMMANDLINE_REMOVE
|
# after processed by KDUMP_COMMANDLINE_REMOVE
|
||||||
|
298
SOURCES/kdumpctl
298
SOURCES/kdumpctl
@ -17,7 +17,6 @@ DEFAULT_INITRD_BAK=""
|
|||||||
INITRD_CHECKSUM_LOCATION=""
|
INITRD_CHECKSUM_LOCATION=""
|
||||||
KDUMP_INITRD=""
|
KDUMP_INITRD=""
|
||||||
TARGET_INITRD=""
|
TARGET_INITRD=""
|
||||||
FADUMP_REGISTER_SYS_NODE="/sys/kernel/fadump_registered"
|
|
||||||
#kdump shall be the default dump mode
|
#kdump shall be the default dump mode
|
||||||
DEFAULT_DUMP_MODE="kdump"
|
DEFAULT_DUMP_MODE="kdump"
|
||||||
image_time=0
|
image_time=0
|
||||||
@ -42,6 +41,13 @@ if ! dlog_init; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
KDUMP_TMPDIR=$(mktemp --tmpdir -d kdump.XXXX)
|
||||||
|
trap '
|
||||||
|
ret=$?;
|
||||||
|
rm -rf "$KDUMP_TMPDIR"
|
||||||
|
exit $ret;
|
||||||
|
' EXIT
|
||||||
|
|
||||||
single_instance_lock()
|
single_instance_lock()
|
||||||
{
|
{
|
||||||
local rc timeout=5 lockfile
|
local rc timeout=5 lockfile
|
||||||
@ -118,7 +124,6 @@ rebuild_fadump_initrd()
|
|||||||
check_earlykdump_is_enabled()
|
check_earlykdump_is_enabled()
|
||||||
{
|
{
|
||||||
grep -q -w "rd.earlykdump" /proc/cmdline
|
grep -q -w "rd.earlykdump" /proc/cmdline
|
||||||
return $?
|
|
||||||
}
|
}
|
||||||
|
|
||||||
rebuild_kdump_initrd()
|
rebuild_kdump_initrd()
|
||||||
@ -148,8 +153,6 @@ rebuild_initrd()
|
|||||||
else
|
else
|
||||||
rebuild_kdump_initrd
|
rebuild_kdump_initrd
|
||||||
fi
|
fi
|
||||||
|
|
||||||
return $?
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#$1: the files to be checked with IFS=' '
|
#$1: the files to be checked with IFS=' '
|
||||||
@ -529,28 +532,22 @@ check_fs_modified()
|
|||||||
check_system_modified()
|
check_system_modified()
|
||||||
{
|
{
|
||||||
local ret
|
local ret
|
||||||
|
local CONF_ERROR=2
|
||||||
|
local CONF_MODIFY=1
|
||||||
|
local CONF_NO_MODIFY=0
|
||||||
|
local conf_status=$CONF_NO_MODIFY
|
||||||
|
|
||||||
[[ -f $TARGET_INITRD ]] || return 1
|
[[ -f $TARGET_INITRD ]] || return 1
|
||||||
|
|
||||||
check_files_modified
|
for _func in check_files_modified check_fs_modified check_drivers_modified; do
|
||||||
ret=$?
|
$_func
|
||||||
if [[ $ret -ne 0 ]]; then
|
ret=$?
|
||||||
return $ret
|
# return immediately if an error occurred.
|
||||||
fi
|
[[ $ret -eq "$CONF_ERROR" ]] && return "$ret"
|
||||||
|
[[ $ret -eq "$CONF_MODIFY" ]] && { conf_status="$CONF_MODIFY"; }
|
||||||
|
done
|
||||||
|
|
||||||
check_fs_modified
|
return $conf_status
|
||||||
ret=$?
|
|
||||||
if [[ $ret -ne 0 ]]; then
|
|
||||||
return $ret
|
|
||||||
fi
|
|
||||||
|
|
||||||
check_drivers_modified
|
|
||||||
ret=$?
|
|
||||||
if [[ $ret -ne 0 ]]; then
|
|
||||||
return $ret
|
|
||||||
fi
|
|
||||||
|
|
||||||
return 0
|
|
||||||
}
|
}
|
||||||
|
|
||||||
check_rebuild()
|
check_rebuild()
|
||||||
@ -619,7 +616,6 @@ check_rebuild()
|
|||||||
|
|
||||||
dinfo "Rebuilding $TARGET_INITRD"
|
dinfo "Rebuilding $TARGET_INITRD"
|
||||||
rebuild_initrd
|
rebuild_initrd
|
||||||
return $?
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# On ppc64le LPARs, the keys trusted by firmware do not end up in
|
# On ppc64le LPARs, the keys trusted by firmware do not end up in
|
||||||
@ -635,19 +631,7 @@ function load_kdump_kernel_key()
|
|||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
KDUMP_KEY_ID=$(keyctl padd asymmetric kernelkey-$RANDOM %:.ima < "/usr/share/doc/kernel-keys/$KDUMP_KERNELVER/kernel-signing-ppc.cer")
|
keyctl padd asymmetric "" %:.ima < "/usr/share/doc/kernel-keys/$KDUMP_KERNELVER/kernel-signing-ppc.cer"
|
||||||
}
|
|
||||||
|
|
||||||
# remove a previously loaded key. There's no real security implication
|
|
||||||
# to leaving it around, we choose to do this because it makes it easier
|
|
||||||
# to be idempotent and so as to reduce the potential for confusion.
|
|
||||||
function remove_kdump_kernel_key()
|
|
||||||
{
|
|
||||||
if [[ -z $KDUMP_KEY_ID ]]; then
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
|
|
||||||
keyctl unlink "$KDUMP_KEY_ID" %:.ima
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Load the kdump kernel specified in /etc/sysconfig/kdump
|
# Load the kdump kernel specified in /etc/sysconfig/kdump
|
||||||
@ -655,18 +639,19 @@ function remove_kdump_kernel_key()
|
|||||||
# as the currently running kernel.
|
# as the currently running kernel.
|
||||||
load_kdump()
|
load_kdump()
|
||||||
{
|
{
|
||||||
local ret
|
local ret uki
|
||||||
|
|
||||||
KEXEC_ARGS=$(prepare_kexec_args "${KEXEC_ARGS}")
|
KEXEC_ARGS=$(prepare_kexec_args "${KEXEC_ARGS}")
|
||||||
KDUMP_COMMANDLINE=$(prepare_cmdline "${KDUMP_COMMANDLINE}" "${KDUMP_COMMANDLINE_REMOVE}" "${KDUMP_COMMANDLINE_APPEND}")
|
KDUMP_COMMANDLINE=$(prepare_cmdline "${KDUMP_COMMANDLINE}" "${KDUMP_COMMANDLINE_REMOVE}" "${KDUMP_COMMANDLINE_APPEND}")
|
||||||
|
|
||||||
# For secureboot enabled machines, use new kexec file based syscall.
|
if is_uki "$KDUMP_KERNEL"; then
|
||||||
# Old syscall will always fail as it does not have capability to
|
uki=$KDUMP_KERNEL
|
||||||
# to kernel signature verification.
|
KDUMP_KERNEL=$KDUMP_TMPDIR/vmlinuz
|
||||||
if is_secure_boot_enforced; then
|
objcopy -O binary --only-section .linux "$uki" "$KDUMP_KERNEL"
|
||||||
dinfo "Secure Boot is enabled. Using kexec file based syscall."
|
sync -f "$KDUMP_KERNEL"
|
||||||
KEXEC_ARGS="$KEXEC_ARGS -s"
|
# Make sure the temp file has the correct SELinux label.
|
||||||
load_kdump_kernel_key
|
# Otherwise starting the kdump.service will fail.
|
||||||
|
chcon -t boot_t "$KDUMP_KERNEL"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
ddebug "$KEXEC $KEXEC_ARGS $standard_kexec_args --command-line=$KDUMP_COMMANDLINE --initrd=$TARGET_INITRD $KDUMP_KERNEL"
|
ddebug "$KEXEC $KEXEC_ARGS $standard_kexec_args --command-line=$KDUMP_COMMANDLINE --initrd=$TARGET_INITRD $KDUMP_KERNEL"
|
||||||
@ -690,8 +675,6 @@ load_kdump()
|
|||||||
set +x
|
set +x
|
||||||
exec 2>&12 12>&-
|
exec 2>&12 12>&-
|
||||||
|
|
||||||
remove_kdump_kernel_key
|
|
||||||
|
|
||||||
if [[ $ret == 0 ]]; then
|
if [[ $ret == 0 ]]; then
|
||||||
dinfo "kexec: loaded kdump kernel"
|
dinfo "kexec: loaded kdump kernel"
|
||||||
return 0
|
return 0
|
||||||
@ -830,31 +813,12 @@ show_reserved_mem()
|
|||||||
local mem
|
local mem
|
||||||
local mem_mb
|
local mem_mb
|
||||||
|
|
||||||
mem=$(< /sys/kernel/kexec_crash_size)
|
mem=$(get_reserved_mem_size)
|
||||||
mem_mb=$((mem / 1024 / 1024))
|
mem_mb=$((mem / 1024 / 1024))
|
||||||
|
|
||||||
dinfo "Reserved ${mem_mb}MB memory for crash kernel"
|
dinfo "Reserved ${mem_mb}MB memory for crash kernel"
|
||||||
}
|
}
|
||||||
|
|
||||||
check_current_fadump_status()
|
|
||||||
{
|
|
||||||
# Check if firmware-assisted dump has been registered.
|
|
||||||
rc=$(< $FADUMP_REGISTER_SYS_NODE)
|
|
||||||
[[ $rc -eq 1 ]] && return 0
|
|
||||||
return 1
|
|
||||||
}
|
|
||||||
|
|
||||||
check_current_status()
|
|
||||||
{
|
|
||||||
if [[ $DEFAULT_DUMP_MODE == "fadump" ]]; then
|
|
||||||
check_current_fadump_status
|
|
||||||
else
|
|
||||||
check_current_kdump_status
|
|
||||||
fi
|
|
||||||
|
|
||||||
return $?
|
|
||||||
}
|
|
||||||
|
|
||||||
save_raw()
|
save_raw()
|
||||||
{
|
{
|
||||||
local kdump_dir
|
local kdump_dir
|
||||||
@ -981,13 +945,12 @@ check_dump_feasibility()
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
check_kdump_feasibility
|
check_kdump_feasibility
|
||||||
return $?
|
|
||||||
}
|
}
|
||||||
|
|
||||||
start_fadump()
|
start_fadump()
|
||||||
{
|
{
|
||||||
echo 1 > $FADUMP_REGISTER_SYS_NODE
|
echo 1 > "$FADUMP_REGISTER_SYS_NODE"
|
||||||
if ! check_current_fadump_status; then
|
if ! is_kernel_loaded "fadump"; then
|
||||||
derror "fadump: failed to register"
|
derror "fadump: failed to register"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
@ -998,13 +961,17 @@ start_fadump()
|
|||||||
|
|
||||||
start_dump()
|
start_dump()
|
||||||
{
|
{
|
||||||
|
# On secure boot enabled Power systems, load kernel signing key on .ima for signature
|
||||||
|
# verification using kexec file based syscall.
|
||||||
|
if [[ "$(uname -m)" == ppc64le ]] && is_secure_boot_enforced; then
|
||||||
|
load_kdump_kernel_key
|
||||||
|
fi
|
||||||
|
|
||||||
if [[ $DEFAULT_DUMP_MODE == "fadump" ]]; then
|
if [[ $DEFAULT_DUMP_MODE == "fadump" ]]; then
|
||||||
start_fadump
|
start_fadump
|
||||||
else
|
else
|
||||||
load_kdump
|
load_kdump
|
||||||
fi
|
fi
|
||||||
|
|
||||||
return $?
|
|
||||||
}
|
}
|
||||||
|
|
||||||
check_failure_action_config()
|
check_failure_action_config()
|
||||||
@ -1080,7 +1047,7 @@ start()
|
|||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ $DEFAULT_DUMP_MODE == "kdump" ]] && check_current_kdump_status; then
|
if [[ $DEFAULT_DUMP_MODE == "kdump" ]] && is_kernel_loaded "kdump"; then
|
||||||
dwarn "Kdump already running: [WARNING]"
|
dwarn "Kdump already running: [WARNING]"
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
@ -1107,13 +1074,13 @@ start()
|
|||||||
|
|
||||||
reload()
|
reload()
|
||||||
{
|
{
|
||||||
if ! check_current_status; then
|
if ! is_kernel_loaded "$DEFAULT_DUMP_MODE"; then
|
||||||
dwarn "Kdump was not running: [WARNING]"
|
dwarn "Kdump was not running: [WARNING]"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ $DEFAULT_DUMP_MODE == "fadump" ]]; then
|
if [[ $DEFAULT_DUMP_MODE == "fadump" ]]; then
|
||||||
reload_fadump
|
reload_fadump
|
||||||
return $?
|
return
|
||||||
else
|
else
|
||||||
if ! stop_kdump; then
|
if ! stop_kdump; then
|
||||||
derror "Stopping kdump: [FAILED]"
|
derror "Stopping kdump: [FAILED]"
|
||||||
@ -1138,8 +1105,8 @@ reload()
|
|||||||
|
|
||||||
stop_fadump()
|
stop_fadump()
|
||||||
{
|
{
|
||||||
echo 0 > $FADUMP_REGISTER_SYS_NODE
|
echo 0 > "$FADUMP_REGISTER_SYS_NODE"
|
||||||
if check_current_fadump_status; then
|
if is_kernel_loaded "fadump"; then
|
||||||
derror "fadump: failed to unregister"
|
derror "fadump: failed to unregister"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
@ -1168,7 +1135,7 @@ stop_kdump()
|
|||||||
|
|
||||||
reload_fadump()
|
reload_fadump()
|
||||||
{
|
{
|
||||||
if echo 1 > $FADUMP_REGISTER_SYS_NODE; then
|
if echo 1 > "$FADUMP_REGISTER_SYS_NODE"; then
|
||||||
dinfo "fadump: re-registered successfully"
|
dinfo "fadump: re-registered successfully"
|
||||||
return 0
|
return 0
|
||||||
else
|
else
|
||||||
@ -1177,7 +1144,7 @@ reload_fadump()
|
|||||||
# to handle such scenario.
|
# to handle such scenario.
|
||||||
if stop_fadump; then
|
if stop_fadump; then
|
||||||
start_fadump
|
start_fadump
|
||||||
return $?
|
return
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -1216,7 +1183,77 @@ rebuild()
|
|||||||
|
|
||||||
dinfo "Rebuilding $TARGET_INITRD"
|
dinfo "Rebuilding $TARGET_INITRD"
|
||||||
rebuild_initrd
|
rebuild_initrd
|
||||||
return $?
|
}
|
||||||
|
|
||||||
|
check_vmlinux()
|
||||||
|
{
|
||||||
|
# Use readelf to check if it's a valid ELF
|
||||||
|
readelf -h "$1" &> /dev/null || return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
get_vmlinux_size()
|
||||||
|
{
|
||||||
|
local size=0 _msize
|
||||||
|
|
||||||
|
while read -r _msize; do
|
||||||
|
size=$((size + _msize))
|
||||||
|
done <<< "$(readelf -l -W "$1" | awk '/^ LOAD/{print $6}' 2> /dev/stderr)"
|
||||||
|
|
||||||
|
echo $size
|
||||||
|
}
|
||||||
|
|
||||||
|
try_decompress()
|
||||||
|
{
|
||||||
|
# The obscure use of the "tr" filter is to work around older versions of
|
||||||
|
# "grep" that report the byte offset of the line instead of the pattern.
|
||||||
|
|
||||||
|
# Try to find the header ($1) and decompress from here
|
||||||
|
for pos in $(tr "$1\n$2" "\n$2=" < "$4" | grep -abo "^$2"); do
|
||||||
|
if ! type -P "$3" > /dev/null; then
|
||||||
|
ddebug "Signiature detected but '$3' is missing, skip this decompressor"
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
|
||||||
|
pos=${pos%%:*}
|
||||||
|
tail "-c+$pos" "$img" | $3 > "$5" 2> /dev/null
|
||||||
|
if check_vmlinux "$5"; then
|
||||||
|
ddebug "Kernel is extracted with '$3'"
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# Borrowed from linux/scripts/extract-vmlinux
|
||||||
|
get_kernel_size()
|
||||||
|
{
|
||||||
|
# Prepare temp files:
|
||||||
|
local tmp img=$1
|
||||||
|
|
||||||
|
tmp="$KDUMP_TMPDIR/vmlinux"
|
||||||
|
|
||||||
|
# Try to check if it's a vmlinux already
|
||||||
|
check_vmlinux "$img" && get_vmlinux_size "$img" && return 0
|
||||||
|
|
||||||
|
# That didn't work, so retry after decompression.
|
||||||
|
try_decompress '\037\213\010' xy gunzip "$img" "$tmp" ||
|
||||||
|
try_decompress '\3757zXZ\000' abcde unxz "$img" "$tmp" ||
|
||||||
|
try_decompress 'BZh' xy bunzip2 "$img" "$tmp" ||
|
||||||
|
try_decompress '\135\0\0\0' xxx unlzma "$img" "$tmp" ||
|
||||||
|
try_decompress '\211\114\132' xy 'lzop -d' "$img" "$tmp" ||
|
||||||
|
try_decompress '\002!L\030' xxx 'lz4 -d' "$img" "$tmp" ||
|
||||||
|
try_decompress '(\265/\375' xxx unzstd "$img" "$tmp"
|
||||||
|
|
||||||
|
# Finally check for uncompressed images or objects:
|
||||||
|
[[ $? -eq 0 ]] && get_vmlinux_size "$tmp" && return 0
|
||||||
|
|
||||||
|
# Fallback to use iomem
|
||||||
|
local _size=0 _seg
|
||||||
|
while read -r _seg; do
|
||||||
|
_size=$((_size + 0x${_seg#*-} - 0x${_seg%-*}))
|
||||||
|
done <<< "$(grep -E "Kernel (code|rodata|data|bss)" /proc/iomem | cut -d ":" -f 1)"
|
||||||
|
echo $_size
|
||||||
}
|
}
|
||||||
|
|
||||||
do_estimate()
|
do_estimate()
|
||||||
@ -1246,7 +1283,7 @@ do_estimate()
|
|||||||
# The default pre-reserved crashkernel value
|
# The default pre-reserved crashkernel value
|
||||||
baseline_size=$((baseline * size_mb))
|
baseline_size=$((baseline * size_mb))
|
||||||
# Current reserved crashkernel size
|
# Current reserved crashkernel size
|
||||||
reserved_size=$(< /sys/kernel/kexec_crash_size)
|
reserved_size=$(get_reserved_mem_size)
|
||||||
# A pre-estimated value for userspace usage and kernel
|
# A pre-estimated value for userspace usage and kernel
|
||||||
# runtime allocation, 64M should good for most cases
|
# runtime allocation, 64M should good for most cases
|
||||||
runtime_size=$((64 * size_mb))
|
runtime_size=$((64 * size_mb))
|
||||||
@ -1382,10 +1419,13 @@ _filter_grubby_kernel_str()
|
|||||||
_find_kernel_path_by_release()
|
_find_kernel_path_by_release()
|
||||||
{
|
{
|
||||||
local _release="$1" _grubby_kernel_str _kernel_path
|
local _release="$1" _grubby_kernel_str _kernel_path
|
||||||
_grubby_kernel_str=$(grubby --info ALL | grep "^kernel=.*$_release\"$")
|
|
||||||
|
# Insert '/' before '+' to cope with grep's EREs
|
||||||
|
_release=${_release//+/\\+}
|
||||||
|
_grubby_kernel_str=$(grubby --info ALL | grep -E "^kernel=.*$_release(\/\w+)?\"$")
|
||||||
_kernel_path=$(_filter_grubby_kernel_str "$_grubby_kernel_str")
|
_kernel_path=$(_filter_grubby_kernel_str "$_grubby_kernel_str")
|
||||||
if [[ -z $_kernel_path ]]; then
|
if [[ -z $_kernel_path ]]; then
|
||||||
derror "kernel $_release doesn't exist"
|
ddebug "kernel $_release doesn't exist"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
echo -n "$_kernel_path"
|
echo -n "$_kernel_path"
|
||||||
@ -1647,72 +1687,39 @@ _is_bootloader_installed()
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# update the crashkernel value in GRUB_ETC_DEFAULT if necessary
|
_update_crashkernel()
|
||||||
#
|
|
||||||
# called by reset_crashkernel_after_update and inherit its array variable
|
|
||||||
# _crashkernel_vals
|
|
||||||
update_crashkernel_in_grub_etc_default_after_update()
|
|
||||||
{
|
{
|
||||||
local _crashkernel _fadump_val
|
local _kernel _kver _dump_mode _old_default_crashkernel _new_default_crashkernel _fadump_val _msg
|
||||||
local _dump_mode _old_default_crashkernel _new_default_crashkernel
|
|
||||||
|
|
||||||
if [[ $(uname -m) == s390x ]]; then
|
_kernel=$1
|
||||||
return
|
_dump_mode=$(get_dump_mode_by_kernel "$_kernel")
|
||||||
fi
|
_old_default_crashkernel=$(get_grub_kernel_boot_parameter "$_kernel" crashkernel)
|
||||||
|
_kver=$(parse_kver_from_path "$_kernel")
|
||||||
_crashkernel=$(_read_kernel_arg_in_grub_etc_default crashkernel)
|
# The second argument is for the case of aarch64, where installing a 64k variant on a 4k kernel, or vice versa
|
||||||
|
_new_default_crashkernel=$(kdump_get_arch_recommend_crashkernel "$_dump_mode" "$_kver")
|
||||||
if [[ -z $_crashkernel ]]; then
|
if [[ $_old_default_crashkernel != "$_new_default_crashkernel" ]]; then
|
||||||
return
|
_fadump_val=$(get_grub_kernel_boot_parameter "$_kernel" fadump)
|
||||||
fi
|
if _update_kernel_cmdline "$_kernel" "$_new_default_crashkernel" "$_dump_mode" "$_fadump_val"; then
|
||||||
|
_msg="For kernel=$_kernel, crashkernel=$_new_default_crashkernel now. Please reboot the system for the change to take effet."
|
||||||
_fadump_val=$(_read_kernel_arg_in_grub_etc_default fadump)
|
_msg+=" Note if you don't want kexec-tools to manage the crashkernel kernel parameter, please set auto_reset_crashkernel=no in /etc/kdump.conf."
|
||||||
_dump_mode=$(get_dump_mode_by_fadump_val "$_fadump_val")
|
dinfo "$_msg"
|
||||||
|
fi
|
||||||
_old_default_crashkernel=${_crashkernel_vals[old_${_dump_mode}]}
|
|
||||||
_new_default_crashkernel=${_crashkernel_vals[new_${_dump_mode}]}
|
|
||||||
|
|
||||||
if [[ $_crashkernel == auto ]] ||
|
|
||||||
[[ $_crashkernel == "$_old_default_crashkernel" &&
|
|
||||||
$_new_default_crashkernel != "$_old_default_crashkernel" ]]; then
|
|
||||||
_update_kernel_arg_in_grub_etc_default crashkernel "$_new_default_crashkernel"
|
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
# shellcheck disable=SC2154 # false positive when dereferencing an array
|
# shellcheck disable=SC2154 # false positive when dereferencing an array
|
||||||
reset_crashkernel_after_update()
|
reset_crashkernel_after_update()
|
||||||
{
|
{
|
||||||
local _kernel _crashkernel _dump_mode _fadump_val _old_default_crashkernel _new_default_crashkernel
|
local _kernel
|
||||||
declare -A _crashkernel_vals
|
|
||||||
|
|
||||||
if ! _is_bootloader_installed; then
|
if ! _is_bootloader_installed; then
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
_crashkernel_vals[old_kdump]=$(cat /tmp/old_default_crashkernel 2> /dev/null)
|
|
||||||
_crashkernel_vals[old_fadump]=$(cat /tmp/old_default_crashkernel_fadump 2> /dev/null)
|
|
||||||
_crashkernel_vals[new_kdump]=$(get_default_crashkernel kdump)
|
|
||||||
_crashkernel_vals[new_fadump]=$(get_default_crashkernel fadump)
|
|
||||||
|
|
||||||
for _kernel in $(_get_all_kernels_from_grubby ALL); do
|
for _kernel in $(_get_all_kernels_from_grubby ALL); do
|
||||||
_crashkernel=$(get_grub_kernel_boot_parameter "$_kernel" crashkernel)
|
_update_crashkernel "$_kernel"
|
||||||
if [[ $_crashkernel == auto ]]; then
|
|
||||||
reset_crashkernel "--kernel=$_kernel"
|
|
||||||
elif [[ -n $_crashkernel ]]; then
|
|
||||||
_dump_mode=$(get_dump_mode_by_kernel "$_kernel")
|
|
||||||
_old_default_crashkernel=${_crashkernel_vals[old_${_dump_mode}]}
|
|
||||||
_new_default_crashkernel=${_crashkernel_vals[new_${_dump_mode}]}
|
|
||||||
if [[ $_crashkernel == "$_old_default_crashkernel" ]] &&
|
|
||||||
[[ $_new_default_crashkernel != "$_old_default_crashkernel" ]]; then
|
|
||||||
_fadump_val=$(get_grub_kernel_boot_parameter "$_kernel" fadump)
|
|
||||||
if _update_kernel_cmdline "$_kernel" "$_new_default_crashkernel" "$_dump_mode" "$_fadump_val"; then
|
|
||||||
echo "For kernel=$_kernel, crashkernel=$_new_default_crashkernel now."
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
done
|
done
|
||||||
|
|
||||||
update_crashkernel_in_grub_etc_default_after_update
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# read the value of an environ variable from given environ file path
|
# read the value of an environ variable from given environ file path
|
||||||
@ -1736,8 +1743,7 @@ _is_osbuild()
|
|||||||
|
|
||||||
reset_crashkernel_for_installed_kernel()
|
reset_crashkernel_for_installed_kernel()
|
||||||
{
|
{
|
||||||
local _installed_kernel _running_kernel _crashkernel _crashkernel_running
|
local _installed_kernel
|
||||||
local _dump_mode_running _fadump_val_running
|
|
||||||
|
|
||||||
# During package install, only try to reset crashkernel for osbuild
|
# During package install, only try to reset crashkernel for osbuild
|
||||||
# thus to avoid calling grubby when installing os via anaconda
|
# thus to avoid calling grubby when installing os via anaconda
|
||||||
@ -1756,23 +1762,7 @@ reset_crashkernel_for_installed_kernel()
|
|||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! _running_kernel=$(_get_current_running_kernel_path); then
|
_update_crashkernel "$_installed_kernel"
|
||||||
derror "Couldn't find current running kernel"
|
|
||||||
exit
|
|
||||||
fi
|
|
||||||
|
|
||||||
_crashkernel=$(get_grub_kernel_boot_parameter "$_installed_kernel" crashkernel)
|
|
||||||
_crashkernel_running=$(get_grub_kernel_boot_parameter "$_running_kernel" crashkernel)
|
|
||||||
_dump_mode_running=$(get_dump_mode_by_kernel "$_running_kernel")
|
|
||||||
_fadump_val_running=$(get_grub_kernel_boot_parameter "$_kernel" fadump)
|
|
||||||
|
|
||||||
if [[ $_crashkernel != "$_crashkernel_running" ]]; then
|
|
||||||
if _update_kernel_cmdline "$_installed_kernel" "$_crashkernel_running" "$_dump_mode_running" "$_fadump_val_running"; then
|
|
||||||
echo "kexec-tools has reset $_installed_kernel to use the new default crashkernel value $_crashkernel_running"
|
|
||||||
fi
|
|
||||||
elif [[ $_crashkernel == auto ]]; then
|
|
||||||
reset_crashkernel "--kernel=$_installed_kernel"
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if [[ ! -f $KDUMP_CONFIG_FILE ]]; then
|
if [[ ! -f $KDUMP_CONFIG_FILE ]]; then
|
||||||
@ -1799,7 +1789,7 @@ main()
|
|||||||
;;
|
;;
|
||||||
status)
|
status)
|
||||||
EXIT_CODE=0
|
EXIT_CODE=0
|
||||||
check_current_status
|
is_kernel_loaded "$DEFAULT_DUMP_MODE"
|
||||||
case "$?" in
|
case "$?" in
|
||||||
0)
|
0)
|
||||||
dinfo "Kdump is operational"
|
dinfo "Kdump is operational"
|
||||||
@ -1866,5 +1856,3 @@ single_instance_lock
|
|||||||
exec 9<&-
|
exec 9<&-
|
||||||
main "$@"
|
main "$@"
|
||||||
)
|
)
|
||||||
|
|
||||||
exit $?
|
|
||||||
|
@ -1,72 +0,0 @@
|
|||||||
From 58553ad03187f0cf208d6c4a0dc026c6338e5edd Mon Sep 17 00:00:00 2001
|
|
||||||
From: "Daisuke Hatayama (Fujitsu)" <d.hatayama@fujitsu.com>
|
|
||||||
Date: Wed, 29 Mar 2023 12:44:10 +0000
|
|
||||||
Subject: [PATCH] sadump: fix failure of reading memory when 5-level
|
|
||||||
paging is enabled
|
|
||||||
|
|
||||||
makedumpfile fails as follows for memory dumps collected by sadump
|
|
||||||
when 5-level paging is enabled on the corresponding systems:
|
|
||||||
|
|
||||||
# makedumpfile -l -d 31 -x ./vmlinux ./dump.sadump dump.sadump-ld31
|
|
||||||
__vtop4_x86_64: Can't get a valid pgd.
|
|
||||||
...snip...
|
|
||||||
__vtop4_x86_64: Can't get a valid pgd.
|
|
||||||
calc_kaslr_offset: failed to calculate kaslr_offset and phys_base; default to 0
|
|
||||||
__vtop4_x86_64: Can't get a valid pgd.
|
|
||||||
readmem: Can't convert a virtual address(ffffffff82fce960) to physical address.
|
|
||||||
readmem: type_addr: 0, addr:ffffffff82fce960, size:1024
|
|
||||||
cpu_online_mask_init: Can't read cpu_online_mask memory.
|
|
||||||
|
|
||||||
makedumpfile Failed.
|
|
||||||
|
|
||||||
This is because 5-level paging support has not been done yet for
|
|
||||||
sadump; the work of the 5-level paging support was done by the commit
|
|
||||||
30a3214a7193e94c551c0cebda5918a72a35c589 (PATCH 4/4 arch/x86_64: Add
|
|
||||||
5-level paging support) but that was focused on the core part only.
|
|
||||||
|
|
||||||
Having said that, most of things has already been finished in the
|
|
||||||
commit. What needs to be newly added for sadump is just how to check
|
|
||||||
if 5-level paging is enabled for a given memory dump.
|
|
||||||
|
|
||||||
For that purpose, let's refer to CR4.LA57, bit 12 of CR4, representing
|
|
||||||
whether 5-level paging is enabled or not. We can do this because
|
|
||||||
memory dumps collected by sadump have SMRAM as note information and
|
|
||||||
they include CR4 together with the other control registers.
|
|
||||||
|
|
||||||
Signed-off-by: HATAYAMA Daisuke <d.hatayama@fujitsu.com>
|
|
||||||
---
|
|
||||||
sadump_info.c | 4 ++++
|
|
||||||
1 file changed, 4 insertions(+)
|
|
||||||
|
|
||||||
diff --git a/makedumpfile-1.7.2/sadump_info.c b/makedumpfile-1.7.2/sadump_info.c
|
|
||||||
index adfa8dc..2c44068 100644
|
|
||||||
--- a/makedumpfile-1.7.2/sadump_info.c
|
|
||||||
+++ b/makedumpfile-1.7.2/sadump_info.c
|
|
||||||
@@ -1362,6 +1362,7 @@ static int linux_banner_sanity_check(ulong cr3)
|
|
||||||
#define PTI_USER_PGTABLE_BIT (info->page_shift)
|
|
||||||
#define PTI_USER_PGTABLE_MASK (1 << PTI_USER_PGTABLE_BIT)
|
|
||||||
#define CR3_PCID_MASK 0xFFFull
|
|
||||||
+#define CR4_LA57 (1 << 12)
|
|
||||||
int
|
|
||||||
calc_kaslr_offset(void)
|
|
||||||
{
|
|
||||||
@@ -1397,6 +1398,8 @@ calc_kaslr_offset(void)
|
|
||||||
else
|
|
||||||
cr3 = smram.Cr3 & ~CR3_PCID_MASK;
|
|
||||||
|
|
||||||
+ NUMBER(pgtable_l5_enabled) = !!(smram.Cr4 & CR4_LA57);
|
|
||||||
+
|
|
||||||
/* Convert virtual address of IDT table to physical address */
|
|
||||||
idtr_paddr = vtop4_x86_64_pagetable(idtr, cr3);
|
|
||||||
if (idtr_paddr == NOT_PADDR) {
|
|
||||||
@@ -1417,6 +1420,7 @@ calc_kaslr_offset(void)
|
|
||||||
|
|
||||||
DEBUG_MSG("sadump: idtr=%" PRIx64 "\n", idtr);
|
|
||||||
DEBUG_MSG("sadump: cr3=%" PRIx64 "\n", cr3);
|
|
||||||
+ DEBUG_MSG("sadump: cr4=%" PRIx32 "\n", smram.Cr4);
|
|
||||||
DEBUG_MSG("sadump: idtr(phys)=%" PRIx64 "\n", idtr_paddr);
|
|
||||||
DEBUG_MSG("sadump: devide_error(vmlinux)=%lx\n",
|
|
||||||
divide_error_vmlinux);
|
|
||||||
--
|
|
||||||
2.33.1
|
|
||||||
|
|
@ -1,37 +0,0 @@
|
|||||||
From 6b6187f546f0ddad8ea84d22c3f7ad72133dcfe3 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Sourabh Jain <sourabhjain@linux.ibm.com>
|
|
||||||
Date: Thu, 15 Sep 2022 14:12:40 +0530
|
|
||||||
Subject: [PATCH] ppc64: remove rma_top limit
|
|
||||||
|
|
||||||
Restricting kexec tool to allocate hole for kexec segments below 768MB
|
|
||||||
may not be relavent now since first memory block size can be 1024MB and
|
|
||||||
more.
|
|
||||||
|
|
||||||
Removing rma_top restriction will give more space to find holes for
|
|
||||||
kexec segments and existing in-place checks make sure that kexec segment
|
|
||||||
allocation doesn't cross the first memory block because every kexec segment
|
|
||||||
has to be within first memory block for kdump kernel to boot properly.
|
|
||||||
|
|
||||||
Signed-off-by: Sourabh Jain <sourabhjain@linux.ibm.com>
|
|
||||||
Acked-by: Hari Bathini <hbathini@linux.ibm.com>
|
|
||||||
Signed-off-by: Simon Horman <horms@kernel.org>
|
|
||||||
---
|
|
||||||
kexec/arch/ppc64/kexec-ppc64.c | 2 --
|
|
||||||
1 file changed, 2 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/kexec/arch/ppc64/kexec-ppc64.c b/kexec/arch/ppc64/kexec-ppc64.c
|
|
||||||
index 5b17740..611809f 100644
|
|
||||||
--- a/kexec/arch/ppc64/kexec-ppc64.c
|
|
||||||
+++ b/kexec/arch/ppc64/kexec-ppc64.c
|
|
||||||
@@ -717,8 +717,6 @@ static int get_devtree_details(unsigned long kexec_flags)
|
|
||||||
if (base < rma_base) {
|
|
||||||
rma_base = base;
|
|
||||||
rma_top = base + be64_to_cpu(((uint64_t *)buf)[1]);
|
|
||||||
- if (rma_top > 0x30000000UL)
|
|
||||||
- rma_top = 0x30000000UL;
|
|
||||||
}
|
|
||||||
|
|
||||||
fclose(file);
|
|
||||||
--
|
|
||||||
2.38.1
|
|
||||||
|
|
@ -0,0 +1,39 @@
|
|||||||
|
From bd0200c47c45dd420244b39ddabcecdab1fb9a8e Mon Sep 17 00:00:00 2001
|
||||||
|
From: Hari Bathini <hbathini@linux.ibm.com>
|
||||||
|
Date: Wed, 20 Sep 2023 17:29:27 +0530
|
||||||
|
Subject: [PATCH] kexec: update manpage with explicit mention of clean kexec
|
||||||
|
|
||||||
|
While the manpage does mention about kexec boot with a clean shutdown,
|
||||||
|
it is not explicit about it. Make it explicit.
|
||||||
|
|
||||||
|
Signed-off-by: Hari Bathini <hbathini@linux.ibm.com>
|
||||||
|
Signed-off-by: Simon Horman <horms@kernel.org>
|
||||||
|
---
|
||||||
|
kexec/kexec.8 | 11 +++++++++--
|
||||||
|
1 file changed, 9 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/kexec/kexec.8 b/kexec/kexec.8
|
||||||
|
index 3a344c5..179dcf2 100644
|
||||||
|
--- a/kexec/kexec.8
|
||||||
|
+++ b/kexec/kexec.8
|
||||||
|
@@ -95,8 +95,15 @@ then you would use the following command to load the kernel:
|
||||||
|
.RB "\-\-append=" "root=/dev/hda1" "\ \-\-initrd=" /boot/initrd
|
||||||
|
.RE
|
||||||
|
.PP
|
||||||
|
-After this kernel is loaded, it can be booted to at any time using the
|
||||||
|
-command:
|
||||||
|
+After this kernel is loaded, assuming the user-space supports kexec-based
|
||||||
|
+rebooting, it can be booted to, with a clean shutdown, using the command:
|
||||||
|
+
|
||||||
|
+.RS
|
||||||
|
+.BR reboot
|
||||||
|
+.RE
|
||||||
|
+.PP
|
||||||
|
+Alternatively, it can also be booted to, without calling shutdown(8), with
|
||||||
|
+the command:
|
||||||
|
|
||||||
|
.RS
|
||||||
|
.BR kexec \ \-e
|
||||||
|
--
|
||||||
|
2.41.0
|
||||||
|
|
@ -420,6 +420,15 @@ while read -r config_opt config_val; do
|
|||||||
verify_core_collector "$config_val"
|
verify_core_collector "$config_val"
|
||||||
;;
|
;;
|
||||||
dracut_args)
|
dracut_args)
|
||||||
|
|
||||||
|
# When users specify nfs dumping via dracut_args, kexec-tools won't
|
||||||
|
# mount nfs fs beforehand thus nfsv4-related drivers won't be installed
|
||||||
|
# because we call dracut with --hostonly-mode strict. So manually install
|
||||||
|
# nfsv4-related drivers.
|
||||||
|
if [[ $(get_dracut_args_fstype "$config_val") == nfs* ]]; then
|
||||||
|
add_dracut_arg "--add-drivers" nfs_layout_nfsv41_files
|
||||||
|
fi
|
||||||
|
|
||||||
while read -r dracut_arg; do
|
while read -r dracut_arg; do
|
||||||
add_dracut_arg "$dracut_arg"
|
add_dracut_arg "$dracut_arg"
|
||||||
done <<< "$(echo "$config_val" | xargs -n 1 echo)"
|
done <<< "$(echo "$config_val" | xargs -n 1 echo)"
|
||||||
@ -454,6 +463,10 @@ if ! is_fadump_capable; then
|
|||||||
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"
|
||||||
|
|
||||||
|
if fips-mode-setup --is-enabled 2> /dev/null; then
|
||||||
|
add_dracut_arg --add-device "$(findmnt -n -o SOURCE --target /boot)"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# This is RHEL-only to work around nvme problem, then real fix should go to dracut
|
# This is RHEL-only to work around nvme problem, then real fix should go to dracut
|
||||||
|
@ -35,7 +35,8 @@ updating lists accordingly.
|
|||||||
Supported Dump targets
|
Supported Dump targets
|
||||||
----------------------
|
----------------------
|
||||||
storage:
|
storage:
|
||||||
LVM volume (no thinp)
|
LVM volume
|
||||||
|
Thin provisioning volume
|
||||||
FC disks (qla2xxx, lpfc, bnx2fc, bfa)
|
FC disks (qla2xxx, lpfc, bnx2fc, bfa)
|
||||||
software initiator based iSCSI
|
software initiator based iSCSI
|
||||||
software RAID (mdraid)
|
software RAID (mdraid)
|
||||||
@ -82,7 +83,6 @@ Unsupported Dump targets
|
|||||||
------------------------
|
------------------------
|
||||||
storage:
|
storage:
|
||||||
BIOS RAID
|
BIOS RAID
|
||||||
Thin provisioning volume
|
|
||||||
Software iSCSI with iBFT (bnx2i, cxgb3i, cxgb4i)
|
Software iSCSI with iBFT (bnx2i, cxgb3i, cxgb4i)
|
||||||
Software iSCSI with hybrid (be2iscsi)
|
Software iSCSI with hybrid (be2iscsi)
|
||||||
FCoE
|
FCoE
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
%global eppic_ver e8844d3793471163ae4a56d8f95897be9e5bd554
|
%global eppic_ver e8844d3793471163ae4a56d8f95897be9e5bd554
|
||||||
%global eppic_shortver %(c=%{eppic_ver}; echo ${c:0:7})
|
%global eppic_shortver %(c=%{eppic_ver}; echo ${c:0:7})
|
||||||
%global mkdf_ver 1.7.2
|
%global mkdf_ver 1.7.4
|
||||||
%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.25
|
Version: 2.0.27
|
||||||
Release: 13%{?dist}.1
|
Release: 8%{?dist}
|
||||||
License: GPLv2
|
License: GPLv2
|
||||||
Summary: The kexec/kdump userspace component
|
Summary: The kexec/kdump userspace component
|
||||||
|
|
||||||
@ -72,6 +72,7 @@ Requires: dracut >= 050
|
|||||||
Requires: dracut-network >= 050
|
Requires: dracut-network >= 050
|
||||||
Requires: dracut-squash >= 050
|
Requires: dracut-squash >= 050
|
||||||
Requires: ethtool
|
Requires: ethtool
|
||||||
|
Requires: binutils
|
||||||
Recommends: grubby
|
Recommends: grubby
|
||||||
Recommends: hostname
|
Recommends: hostname
|
||||||
BuildRequires: make
|
BuildRequires: make
|
||||||
@ -100,7 +101,6 @@ Requires: systemd-udev%{?_isa}
|
|||||||
#
|
#
|
||||||
# Patches 301 through 400 are meant for ppc64 kexec-tools enablement
|
# Patches 301 through 400 are meant for ppc64 kexec-tools enablement
|
||||||
#
|
#
|
||||||
Patch301: kexec-tools-2.0.25-ppc64-ppc64-remove-rma_top-limit.patch
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Patches 401 through 500 are meant for s390 kexec-tools enablement
|
# Patches 401 through 500 are meant for s390 kexec-tools enablement
|
||||||
@ -113,7 +113,7 @@ Patch301: kexec-tools-2.0.25-ppc64-ppc64-remove-rma_top-limit.patch
|
|||||||
#
|
#
|
||||||
# Patches 601 onward are generic patches
|
# Patches 601 onward are generic patches
|
||||||
#
|
#
|
||||||
Patch601: kexec-tools-2.0.23-makedumpfile-1.7.2-sadump-fix-failure-of-reading-memory-when-5-le.patch
|
Patch601: kexec-update-manpage-with-explicit-mention-of-clean-.patch
|
||||||
|
|
||||||
%description
|
%description
|
||||||
kexec-tools provides /sbin/kexec binary that facilitates a new
|
kexec-tools provides /sbin/kexec binary that facilitates a new
|
||||||
@ -129,7 +129,6 @@ mkdir -p -m755 kcp
|
|||||||
tar -z -x -v -f %{SOURCE9}
|
tar -z -x -v -f %{SOURCE9}
|
||||||
tar -z -x -v -f %{SOURCE19}
|
tar -z -x -v -f %{SOURCE19}
|
||||||
|
|
||||||
%patch301 -p1
|
|
||||||
%patch601 -p1
|
%patch601 -p1
|
||||||
|
|
||||||
%ifarch ppc
|
%ifarch ppc
|
||||||
@ -273,21 +272,6 @@ chmod 755 $RPM_BUILD_ROOT/etc/kdump-adv-conf/kdump_dracut_modules/99zz-fadumpini
|
|||||||
mkdir -p $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/
|
mkdir -p $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/
|
||||||
mv $RPM_BUILD_ROOT/etc/kdump-adv-conf/kdump_dracut_modules/* $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/
|
mv $RPM_BUILD_ROOT/etc/kdump-adv-conf/kdump_dracut_modules/* $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/
|
||||||
|
|
||||||
%pre
|
|
||||||
# Save the old default crashkernel values to /tmp/ when upgrading the package
|
|
||||||
# so kdumpctl later can tell if it should update the kernel crashkernel
|
|
||||||
# parameter in the posttrans scriptlet. Note this feauture of auto-updating
|
|
||||||
# the kernel crashkernel parameter currently doesn't support ostree, so skip it
|
|
||||||
# for ostree.
|
|
||||||
if [ ! -f /run/ostree-booted ] && [ $1 == 2 ] && grep -q get-default-crashkernel /usr/bin/kdumpctl; then
|
|
||||||
kdumpctl get-default-crashkernel kdump > /tmp/old_default_crashkernel 2>/dev/null
|
|
||||||
%ifarch ppc64 ppc64le
|
|
||||||
kdumpctl get-default-crashkernel fadump > /tmp/old_default_crashkernel_fadump 2>/dev/null
|
|
||||||
%endif
|
|
||||||
fi
|
|
||||||
# don't block package update
|
|
||||||
:
|
|
||||||
|
|
||||||
%post
|
%post
|
||||||
# Initial installation
|
# Initial installation
|
||||||
%systemd_post kdump.service
|
%systemd_post kdump.service
|
||||||
@ -296,7 +280,7 @@ touch /etc/kdump.conf
|
|||||||
|
|
||||||
%ifarch ppc64 ppc64le
|
%ifarch ppc64 ppc64le
|
||||||
servicelog_notify --remove --command=/usr/lib/kdump/kdump-migrate-action.sh 2>/dev/null
|
servicelog_notify --remove --command=/usr/lib/kdump/kdump-migrate-action.sh 2>/dev/null
|
||||||
servicelog_notify --add --command=/usr/lib/kdump/kdump-migrate-action.sh --match='refcode="#MIGRATE" and serviceable=0' --type=EVENT --method=pairs_stdin
|
servicelog_notify --add --command=/usr/lib/kdump/kdump-migrate-action.sh --match='refcode="#MIGRATE" and serviceable=0' --type=EVENT --method=pairs_stdin >/dev/null
|
||||||
%endif
|
%endif
|
||||||
|
|
||||||
# This portion of the script is temporary. Its only here
|
# This portion of the script is temporary. Its only here
|
||||||
@ -327,7 +311,7 @@ fi
|
|||||||
|
|
||||||
%preun
|
%preun
|
||||||
%ifarch ppc64 ppc64le
|
%ifarch ppc64 ppc64le
|
||||||
servicelog_notify --remove --command=/usr/lib/kdump/kdump-migrate-action.sh
|
servicelog_notify --remove --command=/usr/lib/kdump/kdump-migrate-action.sh >/dev/null
|
||||||
%endif
|
%endif
|
||||||
%systemd_preun kdump.service
|
%systemd_preun kdump.service
|
||||||
|
|
||||||
@ -354,21 +338,15 @@ do
|
|||||||
done
|
done
|
||||||
|
|
||||||
%posttrans
|
%posttrans
|
||||||
# Try to reset kernel crashkernel value to new default value based on the old
|
# Try to reset kernel crashkernel value to new default value or set up
|
||||||
# default value or set up crasherkernel value for osbuild
|
# crasherkernel value for new install
|
||||||
#
|
#
|
||||||
# Note
|
# Note
|
||||||
# 1. Skip ostree systems as they are not supported.
|
# 1. Skip ostree systems as they are not supported.
|
||||||
# 2. "[ $1 == 1 ]" in posttrans scriptlet means both install and upgrade. The
|
# 2. For Fedora 36 and RHEL9, "[ $1 == 1 ]" in posttrans scriptlet means both install and upgrade;
|
||||||
# former case is used to set up crashkernel for osbuild
|
# For Fedora > 36, "[ $1 == 1 ]" only means install and "[ $1 == 2 ]" means upgrade
|
||||||
if [ ! -f /run/ostree-booted ] && [ $1 == 1 ]; then
|
if [ ! -f /run/ostree-booted ] && [ $1 == 1 -o $1 == 2 ]; then
|
||||||
kdumpctl _reset-crashkernel-after-update
|
kdumpctl _reset-crashkernel-after-update
|
||||||
rm /tmp/old_default_crashkernel 2>/dev/null
|
|
||||||
%ifarch ppc64 ppc64le
|
|
||||||
rm /tmp/old_default_crashkernel_fadump 2>/dev/null
|
|
||||||
%endif
|
|
||||||
# dnf would complain about the exit code not being 0. To keep it happy,
|
|
||||||
# always return 0
|
|
||||||
:
|
:
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -430,8 +408,82 @@ fi
|
|||||||
%endif
|
%endif
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
* Fri May 5 2023 Tao Liu <ltao@redhat.com> - 2.0.25-13.1
|
* Tue Jan 30 2024 Tao Liu <ltao@redhat.com> - 2.0.27-8
|
||||||
- makedumpfile: sadump: fix failure of reading memory when 5-level
|
- dracut-module-setup: Skip initrd-cleanup and initrd-parse-etc in kdump
|
||||||
|
|
||||||
|
* Wed Jan 3 2024 Tao Liu <ltao@redhat.com> - 2.0.27-7
|
||||||
|
- Explain the auto_reset_crashkernel option in more details
|
||||||
|
- Use the same /etc/resolve.conf in kdump initrd if it's managed manually
|
||||||
|
|
||||||
|
* Wed Dec 20 2023 Tao Liu <ltao@redhat.com> - 2.0.27-6
|
||||||
|
- Use the same /etc/resolve.conf in kdump initrd if it's managed manually
|
||||||
|
|
||||||
|
* Fri Nov 24 2023 Tao Liu <ltao@redhat.com> - 2.0.27-5
|
||||||
|
- kdumpctl: Only returns immediately after an error occurs in check_*_modified
|
||||||
|
|
||||||
|
* Thu Nov 16 2023 Tao Liu <ltao@redhat.com> - 2.0.27-4
|
||||||
|
- kdump-lib.sh: add extra 64M to default crashkernel if sme/sev is active
|
||||||
|
- Allow _crashkernel_add to address larger memory ranges
|
||||||
|
- kdump-lib: Harden _crashkernel_add
|
||||||
|
|
||||||
|
* Wed Nov 8 2023 Tao Liu <ltao@redhat.com> - 2.0.27-3
|
||||||
|
- Rebase makedumpfile to v1.7.4
|
||||||
|
- powerpc: update kdumpctl to load kernel signing key for fadump
|
||||||
|
- powerpc: update kdumpctl to remove deletion of kernel signing key once loaded
|
||||||
|
|
||||||
|
* Mon Nov 6 2023 Tao Liu <ltao@redhat.com> - 2.0.27-2
|
||||||
|
- kexec: update manpage with explicit mention of clean kexec
|
||||||
|
|
||||||
|
* Tue Sep 26 2023 Tao Liu <ltao@redhat.com> - 2.0.26-9
|
||||||
|
- Introduce a function to get reserved memory size
|
||||||
|
- powerpc: update fadump sysfs node path
|
||||||
|
- kdumpctl: merge check_current_{kdump,fadump}_status
|
||||||
|
- kdumpctl: remove unnecessary uses of $?
|
||||||
|
|
||||||
|
* Tue Jul 4 2023 Tao Liu <ltao@redhat.com> - 2.0.26-8
|
||||||
|
- spec: kdump/ppc64: make servicelog_notify silent when there are no errors
|
||||||
|
|
||||||
|
* Wed Jun 21 2023 Tao Liu <ltao@redhat.com> - 2.0.26-7
|
||||||
|
- kdumpctl: Fix temporary directory location
|
||||||
|
- kdump-lib: Match 64k debug kernel in prepare_kdump_bootinfo()
|
||||||
|
|
||||||
|
* Thu Jun 15 2023 Tao Liu <ltao@redhat.com> - 2.0.26-6
|
||||||
|
- kdumpctl: Fix the matching of plus symbol by grep's EREs
|
||||||
|
- kdump-lib: Evaluate the memory consumption by smmu and mlx5 separately
|
||||||
|
- kdump-lib: add support for 64K aarch64
|
||||||
|
- kdump-lib: Introduce parse_kver_from_path() to get kernel version from its path name
|
||||||
|
- kdump-lib: Introduce a help function _crashkernel_add()
|
||||||
|
- Simplify the management of the kernel parameter crashkernel
|
||||||
|
- kdump-lib: fix the matching pattern for debug-kernel
|
||||||
|
- kdump-lib: always specify version in is_squash_available
|
||||||
|
|
||||||
|
* Thu Jun 1 2023 Tao Liu <ltao@redhat.com> - 2.0.26-5
|
||||||
|
- Add lvm thin provision to kdump supported-kdump-targets.txt
|
||||||
|
- mkdumprd: Use the correct syntax to redirect the stderr to null
|
||||||
|
|
||||||
|
* Wed May 31 2023 Tao Liu <ltao@redhat.com> - 2.0.26-4
|
||||||
|
- kdumpctl: Add basic UKI support
|
||||||
|
- kdumpctl: Move temp file in get_kernel_size to global temp dir
|
||||||
|
- kdumpctl: Move get_kernel_size to kdumpctl
|
||||||
|
- kdump-lib: fix prepare_cmdline
|
||||||
|
- mkdumprd: call dracut with --add-device to install the drivers needed by /boot partition automatically for FIPS
|
||||||
|
|
||||||
|
* Tue May 9 2023 Tao Liu <ltao@redhat.com> - 2.0.26-3
|
||||||
|
- Rebase makedumpfile to v1.7.3
|
||||||
|
- kdumpctl: lower the log level in reset_crashkernel_for_installed_kernel
|
||||||
|
|
||||||
|
* Fri Apr 21 2023 Tao Liu <ltao@redhat.com> - 2.0.26-2
|
||||||
|
- Rebase makedumpfile to upstream latest(8e8b8814be1)
|
||||||
|
- Show how much time kdump has waited for the network to be ready
|
||||||
|
- Tell nmcli to not escape colon when getting the path of connection profile
|
||||||
|
|
||||||
|
* Fri Apr 7 2023 Tao Liu <ltao@redhat.com> - 2.0.26-1
|
||||||
|
- Rebase kexec-tools to v2.0.26
|
||||||
|
|
||||||
|
* Tue Mar 21 2023 Tao Liu <ltao@redhat.com> - 2.0.25-14
|
||||||
|
- Install nfsv4-related drivers when users specify nfs dumping via dracut_args
|
||||||
|
- Revert "ppc64: tackle SRCU hang issue"
|
||||||
|
- sysconfig: add zfcp.allow_lun_scan to KDUMP_COMMANDLINE_REMOVE on s390
|
||||||
|
|
||||||
* Fri Mar 10 2023 Tao Liu <ltao@redhat.com> - 2.0.25-13
|
* Fri Mar 10 2023 Tao Liu <ltao@redhat.com> - 2.0.25-13
|
||||||
- kdump-lib: Add the CoreOS kernel dir to the boot_dirlist
|
- kdump-lib: Add the CoreOS kernel dir to the boot_dirlist
|
||||||
|
Loading…
Reference in New Issue
Block a user