Compare commits
No commits in common. "rawhide" and "f33" have entirely different histories.
73 changed files with 8822 additions and 1557 deletions
|
|
@ -1,32 +0,0 @@
|
|||
# EditorConfig configuration for kexec-tools
|
||||
# http://EditorConfig.org
|
||||
|
||||
# Top-most EditorConfig file
|
||||
root = true
|
||||
|
||||
# Default code style for kexec-tools scripts
|
||||
[*]
|
||||
end_of_line = lf
|
||||
shell_variant = posix
|
||||
insert_final_newline = true
|
||||
trim_trailing_whitespace = true
|
||||
indent_style = tab
|
||||
indent_size = 1
|
||||
switch_case_indent = false
|
||||
function_next_line = true
|
||||
binary_next_line = false
|
||||
space_redirects = true
|
||||
|
||||
# Some scripts will only run with bash
|
||||
[{mkfadumprd,mkdumprd,kdumpctl,kdump-lib.sh}]
|
||||
shell_variant = bash
|
||||
|
||||
# Use dracut code style for *-module-setup.sh
|
||||
[*-module-setup.sh,dracut-early-kdump.sh]
|
||||
shell_variant = bash
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
switch_case_indent = true
|
||||
function_next_line = false
|
||||
binary_next_line = true
|
||||
space_redirects = true
|
||||
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -21,4 +21,3 @@
|
|||
/kexec-tools-2.0.11.tar.xz
|
||||
/makedumpfile-1.5.9.tar.gz
|
||||
/kexec-tools-2.0.12.tar.xz
|
||||
coverage/
|
||||
|
|
|
|||
36
.packit.yaml
36
.packit.yaml
|
|
@ -1,36 +0,0 @@
|
|||
# See the documentation for more information:
|
||||
# https://packit.dev/docs/configuration/
|
||||
|
||||
upstream_project_url: https://github.com/horms/kexec-tools.git
|
||||
|
||||
specfile_path: kexec-tools.spec
|
||||
|
||||
# add or remove files that should be synced
|
||||
files_to_sync:
|
||||
- kexec-tools.spec
|
||||
- .packit.yaml
|
||||
|
||||
# name in upstream package repository or registry (e.g. in PyPI)
|
||||
upstream_package_name: kexec-tools
|
||||
# downstream (Fedora) RPM package name
|
||||
downstream_package_name: kexec-tools
|
||||
|
||||
upstream_tag_template: v{version}
|
||||
|
||||
jobs:
|
||||
- job: pull_from_upstream
|
||||
trigger: release
|
||||
dist_git_branches:
|
||||
- fedora-all
|
||||
|
||||
- job: koji_build
|
||||
trigger: commit
|
||||
allowed_pr_authors: ["all_committers", "packit"]
|
||||
dist_git_branches:
|
||||
- fedora-all
|
||||
|
||||
- job: bodhi_update
|
||||
trigger: commit
|
||||
allowed_builders: ["all_committers", "packit"]
|
||||
dist_git_branches:
|
||||
- fedora-all
|
||||
30
60-kdump.install
Executable file
30
60-kdump.install
Executable file
|
|
@ -0,0 +1,30 @@
|
|||
#!/usr/bin/bash
|
||||
|
||||
COMMAND="$1"
|
||||
KERNEL_VERSION="$2"
|
||||
BOOT_DIR_ABS="$3"
|
||||
KERNEL_IMAGE="$4"
|
||||
|
||||
if ! [[ ${KERNEL_INSTALL_MACHINE_ID-x} ]]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [[ -d "$BOOT_DIR_ABS" ]]; then
|
||||
KDUMP_INITRD="initrdkdump"
|
||||
else
|
||||
BOOT_DIR_ABS="/boot"
|
||||
KDUMP_INITRD="initramfs-${KERNEL_VERSION}kdump.img"
|
||||
fi
|
||||
|
||||
ret=0
|
||||
case "$COMMAND" in
|
||||
add)
|
||||
# Do nothing, kdump initramfs is strictly host only
|
||||
# and managed by kdump service
|
||||
;;
|
||||
remove)
|
||||
rm -f -- "$BOOT_DIR_ABS/$KDUMP_INITRD"
|
||||
ret=$?
|
||||
;;
|
||||
esac
|
||||
exit $ret
|
||||
16
98-kexec.rules
Normal file
16
98-kexec.rules
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
SUBSYSTEM=="cpu", ACTION=="add", GOTO="kdump_reload"
|
||||
SUBSYSTEM=="cpu", ACTION=="remove", GOTO="kdump_reload"
|
||||
SUBSYSTEM=="memory", ACTION=="online", GOTO="kdump_reload"
|
||||
SUBSYSTEM=="memory", ACTION=="offline", GOTO="kdump_reload"
|
||||
|
||||
GOTO="kdump_reload_end"
|
||||
|
||||
LABEL="kdump_reload"
|
||||
|
||||
# If kdump is not loaded, calling kdump-udev-throttle will end up
|
||||
# doing nothing, but systemd-run will always generate extra logs for
|
||||
# each call, so trigger the kdump-udev-throttler only if kdump
|
||||
# service is active to avoid unnecessary logs
|
||||
RUN+="/bin/sh -c '/usr/bin/systemctl is-active kdump.service || exit 0; /usr/bin/systemd-run --quiet --no-block /usr/lib/udev/kdump-udev-throttler'"
|
||||
|
||||
LABEL="kdump_reload_end"
|
||||
15
98-kexec.rules.ppc64
Normal file
15
98-kexec.rules.ppc64
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
SUBSYSTEM=="cpu", ACTION=="online", GOTO="kdump_reload"
|
||||
SUBSYSTEM=="memory", ACTION=="online", GOTO="kdump_reload"
|
||||
SUBSYSTEM=="memory", ACTION=="offline", GOTO="kdump_reload"
|
||||
|
||||
GOTO="kdump_reload_end"
|
||||
|
||||
LABEL="kdump_reload"
|
||||
|
||||
# If kdump is not loaded, calling kdump-udev-throttle will end up
|
||||
# doing nothing, but systemd-run will always generate extra logs for
|
||||
# each call, so trigger the kdump-udev-throttler only if kdump
|
||||
# service is active to avoid unnecessary logs
|
||||
RUN+="/bin/sh -c '/usr/bin/systemctl is-active kdump.service || exit 0; /usr/bin/systemd-run --quiet --no-block /usr/lib/udev/kdump-udev-throttler'"
|
||||
|
||||
LABEL="kdump_reload_end"
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
This repository is maintained by packit.
|
||||
https://packit.dev/
|
||||
The file was generated using packit 1.11.0.post1.dev7+gfdcdf3a32.
|
||||
64
dracut-early-kdump-module-setup.sh
Executable file
64
dracut-early-kdump-module-setup.sh
Executable file
|
|
@ -0,0 +1,64 @@
|
|||
#!/bin/bash
|
||||
|
||||
. /etc/sysconfig/kdump
|
||||
|
||||
KDUMP_KERNEL=""
|
||||
KDUMP_INITRD=""
|
||||
|
||||
check() {
|
||||
if [ ! -f /etc/sysconfig/kdump ] || [ ! -f /lib/kdump/kdump-lib.sh ]\
|
||||
|| [ -n "${IN_KDUMP}" ]
|
||||
then
|
||||
return 1
|
||||
fi
|
||||
return 255
|
||||
}
|
||||
|
||||
depends() {
|
||||
echo "base shutdown"
|
||||
return 0
|
||||
}
|
||||
|
||||
prepare_kernel_initrd() {
|
||||
. /lib/kdump/kdump-lib.sh
|
||||
|
||||
prepare_kdump_bootinfo
|
||||
|
||||
# $kernel is a variable from dracut
|
||||
if [ "$KDUMP_KERNELVER" != $kernel ]; then
|
||||
dwarn "Using kernel version '$KDUMP_KERNELVER' for early kdump," \
|
||||
"but the initramfs is generated for kernel version '$kernel'"
|
||||
fi
|
||||
}
|
||||
|
||||
install() {
|
||||
prepare_kernel_initrd
|
||||
if [ ! -f "$KDUMP_KERNEL" ]; then
|
||||
derror "Could not find required kernel for earlykdump," \
|
||||
"earlykdump will not work!"
|
||||
return 1
|
||||
fi
|
||||
if [ ! -f "$KDUMP_INITRD" ]; then
|
||||
derror "Could not find required kdump initramfs for earlykdump," \
|
||||
"please ensure kdump initramfs is generated first," \
|
||||
"earlykdump will not work!"
|
||||
return 1
|
||||
fi
|
||||
|
||||
inst_multiple tail find cut dirname hexdump
|
||||
inst_simple "/etc/sysconfig/kdump"
|
||||
inst_binary "/usr/sbin/kexec"
|
||||
inst_binary "/usr/bin/gawk" "/usr/bin/awk"
|
||||
inst_binary "/usr/bin/logger" "/usr/bin/logger"
|
||||
inst_binary "/usr/bin/printf" "/usr/bin/printf"
|
||||
inst_script "/lib/kdump/kdump-lib.sh" "/lib/kdump-lib.sh"
|
||||
inst_script "/lib/kdump/kdump-logger.sh" "/lib/kdump-logger.sh"
|
||||
inst_hook cmdline 00 "$moddir/early-kdump.sh"
|
||||
inst_binary "$KDUMP_KERNEL"
|
||||
inst_binary "$KDUMP_INITRD"
|
||||
|
||||
ln_r "$KDUMP_KERNEL" "/boot/kernel-earlykdump"
|
||||
ln_r "$KDUMP_INITRD" "/boot/initramfs-earlykdump"
|
||||
|
||||
chmod -x "${initdir}/$KDUMP_KERNEL"
|
||||
}
|
||||
88
dracut-early-kdump.sh
Executable file
88
dracut-early-kdump.sh
Executable file
|
|
@ -0,0 +1,88 @@
|
|||
#! /bin/sh
|
||||
|
||||
KEXEC=/sbin/kexec
|
||||
standard_kexec_args="-p"
|
||||
|
||||
EARLY_KDUMP_INITRD=""
|
||||
EARLY_KDUMP_KERNEL=""
|
||||
EARLY_KDUMP_CMDLINE=""
|
||||
EARLY_KDUMP_KERNELVER=""
|
||||
EARLY_KEXEC_ARGS=""
|
||||
|
||||
. /etc/sysconfig/kdump
|
||||
. /lib/dracut-lib.sh
|
||||
. /lib/kdump-lib.sh
|
||||
. /lib/kdump-logger.sh
|
||||
|
||||
#initiate the kdump logger
|
||||
dlog_init
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "failed to initiate the kdump logger."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
prepare_parameters()
|
||||
{
|
||||
EARLY_KDUMP_CMDLINE=$(prepare_cmdline "${KDUMP_COMMANDLINE}" "${KDUMP_COMMANDLINE_REMOVE}" "${KDUMP_COMMANDLINE_APPEND}")
|
||||
EARLY_KDUMP_KERNEL="/boot/kernel-earlykdump"
|
||||
EARLY_KDUMP_INITRD="/boot/initramfs-earlykdump"
|
||||
}
|
||||
|
||||
early_kdump_load()
|
||||
{
|
||||
check_kdump_feasibility
|
||||
if [ $? -ne 0 ]; then
|
||||
return 1
|
||||
fi
|
||||
|
||||
if is_fadump_capable; then
|
||||
dwarn "WARNING: early kdump doesn't support fadump."
|
||||
return 1
|
||||
fi
|
||||
|
||||
check_current_kdump_status
|
||||
if [ $? == 0 ]; then
|
||||
return 1
|
||||
fi
|
||||
|
||||
prepare_parameters
|
||||
|
||||
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
|
||||
# to a file because the target disk may not be mounted yet, the
|
||||
# earlykdump is too early.
|
||||
ddebug "earlykdump: $KEXEC ${EARLY_KEXEC_ARGS} $standard_kexec_args \
|
||||
--command-line=$EARLY_KDUMP_CMDLINE --initrd=$EARLY_KDUMP_INITRD \
|
||||
$EARLY_KDUMP_KERNEL"
|
||||
|
||||
$KEXEC ${EARLY_KEXEC_ARGS} $standard_kexec_args \
|
||||
--command-line="$EARLY_KDUMP_CMDLINE" \
|
||||
--initrd=$EARLY_KDUMP_INITRD $EARLY_KDUMP_KERNEL
|
||||
if [ $? == 0 ]; then
|
||||
dinfo "kexec: loaded early-kdump kernel"
|
||||
return 0
|
||||
else
|
||||
derror "kexec: failed to load early-kdump kernel"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
set_early_kdump()
|
||||
{
|
||||
if getargbool 0 rd.earlykdump; then
|
||||
dinfo "early-kdump is enabled."
|
||||
early_kdump_load
|
||||
else
|
||||
dinfo "early-kdump is disabled."
|
||||
fi
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
set_early_kdump
|
||||
30
dracut-kdump-capture.service
Normal file
30
dracut-kdump-capture.service
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
# This file is part of systemd.
|
||||
#
|
||||
# systemd is free software; you can redistribute it and/or modify it
|
||||
# under the terms of the GNU Lesser General Public License as published by
|
||||
# the Free Software Foundation; either version 2.1 of the License, or
|
||||
# (at your option) any later version.
|
||||
|
||||
[Unit]
|
||||
Description=Kdump Vmcore Save Service
|
||||
After=initrd.target initrd-parse-etc.service sysroot.mount
|
||||
After=dracut-initqueue.service dracut-pre-mount.service dracut-mount.service dracut-pre-pivot.service
|
||||
Before=initrd-cleanup.service
|
||||
ConditionPathExists=/etc/initrd-release
|
||||
OnFailure=emergency.target
|
||||
OnFailureJobMode=isolate
|
||||
|
||||
[Service]
|
||||
Environment=DRACUT_SYSTEMD=1
|
||||
Environment=NEWROOT=/sysroot
|
||||
Type=oneshot
|
||||
ExecStart=/bin/kdump.sh
|
||||
StandardInput=null
|
||||
StandardOutput=syslog
|
||||
StandardError=syslog+console
|
||||
KillMode=process
|
||||
RemainAfterExit=yes
|
||||
|
||||
# Bash ignores SIGTERM, so we send SIGHUP instead, to ensure that bash
|
||||
# terminates cleanly.
|
||||
KillSignal=SIGHUP
|
||||
28
dracut-kdump-emergency.service
Normal file
28
dracut-kdump-emergency.service
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
# This file is part of systemd.
|
||||
#
|
||||
# systemd is free software; you can redistribute it and/or modify it
|
||||
# under the terms of the GNU Lesser General Public License as published by
|
||||
# the Free Software Foundation; either version 2.1 of the License, or
|
||||
# (at your option) any later version.
|
||||
|
||||
# This service will be placed in kdump initramfs and replace both the systemd
|
||||
# emergency service and dracut emergency shell. IOW, any emergency will be
|
||||
# kick this service and in turn isolating to kdump error handler.
|
||||
|
||||
[Unit]
|
||||
Description=Kdump Emergency
|
||||
DefaultDependencies=no
|
||||
IgnoreOnIsolate=yes
|
||||
|
||||
[Service]
|
||||
ExecStart=/usr/bin/systemctl --no-block isolate kdump-error-handler.service
|
||||
Type=oneshot
|
||||
StandardInput=tty-force
|
||||
StandardOutput=inherit
|
||||
StandardError=inherit
|
||||
KillMode=process
|
||||
IgnoreSIGPIPE=no
|
||||
|
||||
# Bash ignores SIGTERM, so we send SIGHUP instead, to ensure that bash
|
||||
# terminates cleanly.
|
||||
KillSignal=SIGHUP
|
||||
14
dracut-kdump-emergency.target
Normal file
14
dracut-kdump-emergency.target
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
# This file is part of systemd.
|
||||
#
|
||||
# systemd is free software; you can redistribute it and/or modify it
|
||||
# under the terms of the GNU Lesser General Public License as published by
|
||||
# the Free Software Foundation; either version 2.1 of the License, or
|
||||
# (at your option) any later version.
|
||||
|
||||
[Unit]
|
||||
Description=Emergency Mode
|
||||
Documentation=man:systemd.special(7)
|
||||
Requires=emergency.service
|
||||
After=emergency.service
|
||||
AllowIsolate=yes
|
||||
IgnoreOnIsolate=yes
|
||||
33
dracut-kdump-error-handler.service
Normal file
33
dracut-kdump-error-handler.service
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
# This file is part of systemd.
|
||||
#
|
||||
# systemd is free software; you can redistribute it and/or modify it
|
||||
# under the terms of the GNU Lesser General Public License as published by
|
||||
# the Free Software Foundation; either version 2.1 of the License, or
|
||||
# (at your option) any later version.
|
||||
|
||||
# This service will run the real kdump error handler code. Executing the
|
||||
# failure action configured in kdump.conf
|
||||
|
||||
[Unit]
|
||||
Description=Kdump Error Handler
|
||||
DefaultDependencies=no
|
||||
After=systemd-vconsole-setup.service
|
||||
Wants=systemd-vconsole-setup.service
|
||||
AllowIsolate=yes
|
||||
|
||||
[Service]
|
||||
Environment=HOME=/
|
||||
Environment=DRACUT_SYSTEMD=1
|
||||
Environment=NEWROOT=/sysroot
|
||||
WorkingDirectory=/
|
||||
ExecStart=/bin/kdump-error-handler.sh
|
||||
Type=oneshot
|
||||
StandardInput=tty-force
|
||||
StandardOutput=inherit
|
||||
StandardError=inherit
|
||||
KillMode=process
|
||||
IgnoreSIGPIPE=no
|
||||
|
||||
# Bash ignores SIGTERM, so we send SIGHUP instead, to ensure that bash
|
||||
# terminates cleanly.
|
||||
KillSignal=SIGHUP
|
||||
10
dracut-kdump-error-handler.sh
Executable file
10
dracut-kdump-error-handler.sh
Executable file
|
|
@ -0,0 +1,10 @@
|
|||
#!/bin/sh
|
||||
|
||||
. /lib/kdump-lib-initramfs.sh
|
||||
|
||||
set -o pipefail
|
||||
export PATH=$PATH:$KDUMP_SCRIPT_DIR
|
||||
|
||||
get_kdump_confs
|
||||
do_failure_action
|
||||
do_final_action
|
||||
324
dracut-kdump.sh
Executable file
324
dracut-kdump.sh
Executable file
|
|
@ -0,0 +1,324 @@
|
|||
#!/bin/sh
|
||||
|
||||
# continue here only if we have to save dump.
|
||||
if [ -f /etc/fadump.initramfs ] && [ ! -f /proc/device-tree/rtas/ibm,kernel-dump ] && [ ! -f /proc/device-tree/ibm,opal/dump/mpipl-boot ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
. /lib/dracut-lib.sh
|
||||
. /lib/kdump-lib-initramfs.sh
|
||||
|
||||
set -o pipefail
|
||||
DUMP_RETVAL=0
|
||||
|
||||
export PATH=$PATH:$KDUMP_SCRIPT_DIR
|
||||
|
||||
do_dump()
|
||||
{
|
||||
local _ret
|
||||
|
||||
eval $DUMP_INSTRUCTION
|
||||
_ret=$?
|
||||
|
||||
if [ $_ret -ne 0 ]; then
|
||||
derror "saving vmcore failed"
|
||||
fi
|
||||
|
||||
return $_ret
|
||||
}
|
||||
|
||||
do_kdump_pre()
|
||||
{
|
||||
local _ret
|
||||
|
||||
if [ -n "$KDUMP_PRE" ]; then
|
||||
"$KDUMP_PRE"
|
||||
_ret=$?
|
||||
if [ $_ret -ne 0 ]; then
|
||||
derror "$KDUMP_PRE exited with $_ret status"
|
||||
return $_ret
|
||||
fi
|
||||
fi
|
||||
|
||||
# if any script fails, it just raises warning and continues
|
||||
if [ -d /etc/kdump/pre.d ]; then
|
||||
for file in /etc/kdump/pre.d/*; do
|
||||
"$file"
|
||||
_ret=$?
|
||||
if [ $_ret -ne 0 ]; then
|
||||
derror "$file exited with $_ret status"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
|
||||
do_kdump_post()
|
||||
{
|
||||
local _ret
|
||||
|
||||
if [ -d /etc/kdump/post.d ]; then
|
||||
for file in /etc/kdump/post.d/*; do
|
||||
"$file" "$1"
|
||||
_ret=$?
|
||||
if [ $_ret -ne 0 ]; then
|
||||
derror "$file exited with $_ret status"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
if [ -n "$KDUMP_POST" ]; then
|
||||
"$KDUMP_POST" "$1"
|
||||
_ret=$?
|
||||
if [ $_ret -ne 0 ]; then
|
||||
derror "$KDUMP_POST exited with $_ret status"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
add_dump_code()
|
||||
{
|
||||
DUMP_INSTRUCTION=$1
|
||||
}
|
||||
|
||||
dump_raw()
|
||||
{
|
||||
local _raw=$1
|
||||
|
||||
[ -b "$_raw" ] || return 1
|
||||
|
||||
dinfo "saving to raw disk $_raw"
|
||||
|
||||
if ! $(echo -n $CORE_COLLECTOR|grep -q makedumpfile); then
|
||||
_src_size=`ls -l /proc/vmcore | cut -d' ' -f5`
|
||||
_src_size_mb=$(($_src_size / 1048576))
|
||||
monitor_dd_progress $_src_size_mb &
|
||||
fi
|
||||
|
||||
dinfo "saving vmcore"
|
||||
$CORE_COLLECTOR /proc/vmcore | dd of=$_raw bs=$DD_BLKSIZE >> /tmp/dd_progress_file 2>&1 || return 1
|
||||
sync
|
||||
|
||||
dinfo "saving vmcore complete"
|
||||
return 0
|
||||
}
|
||||
|
||||
dump_ssh()
|
||||
{
|
||||
local _ret=0
|
||||
local _exitcode=0 _exitcode2=0
|
||||
local _opt="-i $1 -o BatchMode=yes -o StrictHostKeyChecking=yes"
|
||||
local _dir="$KDUMP_PATH/$HOST_IP-$DATEDIR"
|
||||
local _host=$2
|
||||
local _vmcore="vmcore"
|
||||
local _ipv6_addr="" _username=""
|
||||
|
||||
dinfo "saving to $_host:$_dir"
|
||||
|
||||
cat /var/lib/random-seed > /dev/urandom
|
||||
ssh -q $_opt $_host mkdir -p $_dir || return 1
|
||||
|
||||
save_vmcore_dmesg_ssh ${DMESG_COLLECTOR} ${_dir} "${_opt}" $_host
|
||||
save_opalcore_ssh ${_dir} "${_opt}" $_host
|
||||
|
||||
dinfo "saving vmcore"
|
||||
|
||||
if is_ipv6_address "$_host"; then
|
||||
_username=${_host%@*}
|
||||
_ipv6_addr="[${_host#*@}]"
|
||||
fi
|
||||
|
||||
if [ "${CORE_COLLECTOR%%[[:blank:]]*}" = "scp" ]; then
|
||||
if [ -n "$_username" ] && [ -n "$_ipv6_addr" ]; then
|
||||
scp -q $_opt /proc/vmcore "$_username@$_ipv6_addr:$_dir/vmcore-incomplete"
|
||||
else
|
||||
scp -q $_opt /proc/vmcore "$_host:$_dir/vmcore-incomplete"
|
||||
fi
|
||||
_exitcode=$?
|
||||
else
|
||||
$CORE_COLLECTOR /proc/vmcore | ssh $_opt $_host "dd bs=512 of=$_dir/vmcore-incomplete"
|
||||
_exitcode=$?
|
||||
_vmcore="vmcore.flat"
|
||||
fi
|
||||
|
||||
if [ $_exitcode -eq 0 ]; then
|
||||
ssh $_opt $_host "mv $_dir/vmcore-incomplete $_dir/$_vmcore"
|
||||
_exitcode2=$?
|
||||
if [ $_exitcode2 -ne 0 ]; then
|
||||
derror "moving vmcore failed, _exitcode:$_exitcode2"
|
||||
else
|
||||
dinfo "saving vmcore complete"
|
||||
fi
|
||||
else
|
||||
derror "saving vmcore failed, _exitcode:$_exitcode"
|
||||
fi
|
||||
|
||||
dinfo "saving the $KDUMP_LOG_FILE to $_host:$_dir/"
|
||||
save_log
|
||||
if [ -n "$_username" ] && [ -n "$_ipv6_addr" ]; then
|
||||
scp -q $_opt $KDUMP_LOG_FILE "$_username@$_ipv6_addr:$_dir/"
|
||||
else
|
||||
scp -q $_opt $KDUMP_LOG_FILE "$_host:$_dir/"
|
||||
fi
|
||||
_ret=$?
|
||||
if [ $_ret -ne 0 ]; then
|
||||
derror "saving log file failed, _exitcode:$_ret"
|
||||
fi
|
||||
|
||||
if [ $_exitcode -ne 0 ] || [ $_exitcode2 -ne 0 ];then
|
||||
return 1
|
||||
fi
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
save_opalcore_ssh() {
|
||||
local _path=$1
|
||||
local _opts="$2"
|
||||
local _location=$3
|
||||
local _user_name="" _ipv6addr=""
|
||||
|
||||
ddebug "_path=$_path _opts=$_opts _location=$_location"
|
||||
|
||||
if [ ! -f $OPALCORE ]; then
|
||||
# Check if we are on an old kernel that uses a different path
|
||||
if [ -f /sys/firmware/opal/core ]; then
|
||||
OPALCORE="/sys/firmware/opal/core"
|
||||
else
|
||||
return 0
|
||||
fi
|
||||
fi
|
||||
|
||||
if is_ipv6_address "$_host"; then
|
||||
_user_name=${_location%@*}
|
||||
_ipv6addr="[${_location#*@}]"
|
||||
fi
|
||||
|
||||
dinfo "saving opalcore:$OPALCORE to $_location:$_path"
|
||||
|
||||
if [ -n "$_user_name" ] && [ -n "$_ipv6addr" ]; then
|
||||
scp $_opts $OPALCORE $_user_name@$_ipv6addr:$_path/opalcore-incomplete
|
||||
else
|
||||
scp $_opts $OPALCORE $_location:$_path/opalcore-incomplete
|
||||
fi
|
||||
if [ $? -ne 0 ]; then
|
||||
derror "saving opalcore failed"
|
||||
return 1
|
||||
fi
|
||||
|
||||
ssh $_opts $_location mv $_path/opalcore-incomplete $_path/opalcore
|
||||
dinfo "saving opalcore complete"
|
||||
return 0
|
||||
}
|
||||
|
||||
save_vmcore_dmesg_ssh() {
|
||||
local _dmesg_collector=$1
|
||||
local _path=$2
|
||||
local _opts="$3"
|
||||
local _location=$4
|
||||
|
||||
dinfo "saving vmcore-dmesg.txt to $_location:$_path"
|
||||
$_dmesg_collector /proc/vmcore | ssh $_opts $_location "dd of=$_path/vmcore-dmesg-incomplete.txt"
|
||||
_exitcode=$?
|
||||
|
||||
if [ $_exitcode -eq 0 ]; then
|
||||
ssh -q $_opts $_location mv $_path/vmcore-dmesg-incomplete.txt $_path/vmcore-dmesg.txt
|
||||
dinfo "saving vmcore-dmesg.txt complete"
|
||||
else
|
||||
derror "saving vmcore-dmesg.txt failed"
|
||||
fi
|
||||
}
|
||||
|
||||
get_host_ip()
|
||||
{
|
||||
local _host
|
||||
if is_nfs_dump_target || is_ssh_dump_target
|
||||
then
|
||||
kdumpnic=$(getarg kdumpnic=)
|
||||
[ -z "$kdumpnic" ] && derror "failed to get kdumpnic!" && return 1
|
||||
_host=`ip addr show dev $kdumpnic|grep '[ ]*inet'`
|
||||
[ $? -ne 0 ] && derror "wrong kdumpnic: $kdumpnic" && return 1
|
||||
_host=`echo $_host | head -n 1 | cut -d' ' -f2`
|
||||
_host="${_host%%/*}"
|
||||
[ -z "$_host" ] && derror "wrong kdumpnic: $kdumpnic" && return 1
|
||||
HOST_IP=$_host
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
|
||||
read_kdump_conf()
|
||||
{
|
||||
if [ ! -f "$KDUMP_CONF" ]; then
|
||||
derror "$KDUMP_CONF not found"
|
||||
return
|
||||
fi
|
||||
|
||||
get_kdump_confs
|
||||
|
||||
# rescan for add code for dump target
|
||||
while read config_opt config_val;
|
||||
do
|
||||
# remove inline comments after the end of a directive.
|
||||
case "$config_opt" in
|
||||
dracut_args)
|
||||
config_val=$(get_dracut_args_target "$config_val")
|
||||
if [ -n "$config_val" ]; then
|
||||
config_val=$(get_mntpoint_from_target "$config_val")
|
||||
add_dump_code "dump_fs $config_val"
|
||||
fi
|
||||
;;
|
||||
ext[234]|xfs|btrfs|minix|nfs)
|
||||
config_val=$(get_mntpoint_from_target "$config_val")
|
||||
add_dump_code "dump_fs $config_val"
|
||||
;;
|
||||
raw)
|
||||
add_dump_code "dump_raw $config_val"
|
||||
;;
|
||||
ssh)
|
||||
add_dump_code "dump_ssh $SSH_KEY_LOCATION $config_val"
|
||||
;;
|
||||
esac
|
||||
done <<< "$(read_strip_comments $KDUMP_CONF)"
|
||||
}
|
||||
|
||||
fence_kdump_notify()
|
||||
{
|
||||
if [ -n "$FENCE_KDUMP_NODES" ]; then
|
||||
$FENCE_KDUMP_SEND $FENCE_KDUMP_ARGS $FENCE_KDUMP_NODES &
|
||||
fi
|
||||
}
|
||||
|
||||
read_kdump_conf
|
||||
fence_kdump_notify
|
||||
|
||||
get_host_ip
|
||||
if [ $? -ne 0 ]; then
|
||||
derror "get_host_ip exited with non-zero status!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -z "$DUMP_INSTRUCTION" ]; then
|
||||
add_dump_code "dump_fs $NEWROOT"
|
||||
fi
|
||||
|
||||
do_kdump_pre
|
||||
if [ $? -ne 0 ]; then
|
||||
derror "kdump_pre script exited with non-zero status!"
|
||||
do_final_action
|
||||
# During systemd service to reboot the machine, stop this shell script running
|
||||
exit 1
|
||||
fi
|
||||
make_trace_mem "kdump saving vmcore" '1:shortmem' '2+:mem' '3+:slab'
|
||||
do_dump
|
||||
DUMP_RETVAL=$?
|
||||
|
||||
do_kdump_post $DUMP_RETVAL
|
||||
if [ $? -ne 0 ]; then
|
||||
derror "kdump_post script exited with non-zero status!"
|
||||
fi
|
||||
|
||||
if [ $DUMP_RETVAL -ne 0 ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
do_final_action
|
||||
891
dracut-module-setup.sh
Executable file
891
dracut-module-setup.sh
Executable file
|
|
@ -0,0 +1,891 @@
|
|||
#!/bin/bash
|
||||
|
||||
kdump_module_init() {
|
||||
if ! [[ -d "${initdir}/tmp" ]]; then
|
||||
mkdir -p "${initdir}/tmp"
|
||||
fi
|
||||
|
||||
. /lib/kdump/kdump-lib.sh
|
||||
}
|
||||
|
||||
check() {
|
||||
[[ $debug ]] && set -x
|
||||
#kdumpctl sets this explicitly
|
||||
if [ -z "$IN_KDUMP" ] || [ ! -f /etc/kdump.conf ]
|
||||
then
|
||||
return 1
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
|
||||
depends() {
|
||||
local _dep="base shutdown"
|
||||
|
||||
kdump_module_init
|
||||
|
||||
add_opt_module() {
|
||||
[[ " $omit_dracutmodules " != *\ $1\ * ]] && _dep="$_dep $1"
|
||||
}
|
||||
|
||||
is_squash_available() {
|
||||
for kmodule in squashfs overlay loop; do
|
||||
if [ -z "$KDUMP_KERNELVER" ]; then
|
||||
modprobe --dry-run $kmodule &>/dev/null || return 1
|
||||
else
|
||||
modprobe -S $KDUMP_KERNELVER --dry-run $kmodule &>/dev/null || return 1
|
||||
fi
|
||||
done
|
||||
|
||||
# check that the dracut squash module is available
|
||||
[ -d "$(dracut_module_path squash)" ] || return 1
|
||||
}
|
||||
|
||||
if is_squash_available && ! is_fadump_capable; then
|
||||
add_opt_module squash
|
||||
else
|
||||
dwarning "Required modules to build a squashed kdump image is missing!"
|
||||
fi
|
||||
|
||||
if is_wdt_active; then
|
||||
add_opt_module watchdog
|
||||
fi
|
||||
|
||||
if is_ssh_dump_target; then
|
||||
_dep="$_dep ssh-client"
|
||||
fi
|
||||
|
||||
if [ "$(uname -m)" = "s390x" ]; then
|
||||
_dep="$_dep znet"
|
||||
fi
|
||||
|
||||
if [ -n "$( find /sys/devices -name drm )" ] || [ -d /sys/module/hyperv_fb ]; then
|
||||
add_opt_module drm
|
||||
fi
|
||||
|
||||
if is_generic_fence_kdump || is_pcs_fence_kdump; then
|
||||
_dep="$_dep network"
|
||||
fi
|
||||
|
||||
echo $_dep
|
||||
}
|
||||
|
||||
kdump_is_bridge() {
|
||||
[ -d /sys/class/net/"$1"/bridge ]
|
||||
}
|
||||
|
||||
kdump_is_bond() {
|
||||
[ -d /sys/class/net/"$1"/bonding ]
|
||||
}
|
||||
|
||||
kdump_is_team() {
|
||||
[ -f /usr/bin/teamnl ] && teamnl $1 ports &> /dev/null
|
||||
}
|
||||
|
||||
kdump_is_vlan() {
|
||||
[ -f /proc/net/vlan/"$1" ]
|
||||
}
|
||||
|
||||
# $1: netdev name
|
||||
source_ifcfg_file() {
|
||||
local ifcfg_file
|
||||
|
||||
ifcfg_file=$(get_ifcfg_filename $1)
|
||||
if [ -f "${ifcfg_file}" ]; then
|
||||
. ${ifcfg_file}
|
||||
else
|
||||
dwarning "The ifcfg file of $1 is not found!"
|
||||
fi
|
||||
}
|
||||
|
||||
# $1: netdev name
|
||||
kdump_setup_dns() {
|
||||
local _nameserver _dns
|
||||
local _dnsfile=${initdir}/etc/cmdline.d/42dns.conf
|
||||
|
||||
source_ifcfg_file $1
|
||||
|
||||
[ -n "$DNS1" ] && echo "nameserver=$DNS1" > "$_dnsfile"
|
||||
[ -n "$DNS2" ] && echo "nameserver=$DNS2" >> "$_dnsfile"
|
||||
|
||||
while read content;
|
||||
do
|
||||
_nameserver=$(echo $content | grep ^nameserver)
|
||||
[ -z "$_nameserver" ] && continue
|
||||
|
||||
_dns=$(echo $_nameserver | cut -d' ' -f2)
|
||||
[ -z "$_dns" ] && continue
|
||||
|
||||
if [ ! -f $_dnsfile ] || [ ! $(cat $_dnsfile | grep -q $_dns) ]; then
|
||||
echo "nameserver=$_dns" >> "$_dnsfile"
|
||||
fi
|
||||
done < "/etc/resolv.conf"
|
||||
}
|
||||
|
||||
#$1: netdev name
|
||||
#$2: srcaddr
|
||||
#if it use static ip echo it, or echo null
|
||||
kdump_static_ip() {
|
||||
local _netdev="$1" _srcaddr="$2" _ipv6_flag
|
||||
local _netmask _gateway _ipaddr _target _nexthop
|
||||
|
||||
_ipaddr=$(ip addr show dev $_netdev permanent | awk "/ $_srcaddr\/.* /{print \$2}")
|
||||
|
||||
if is_ipv6_address $_srcaddr; then
|
||||
_ipv6_flag="-6"
|
||||
fi
|
||||
|
||||
if [ -n "$_ipaddr" ]; then
|
||||
_gateway=$(ip $_ipv6_flag route list dev $_netdev | \
|
||||
awk '/^default /{print $3}' | head -n 1)
|
||||
|
||||
if [ "x" != "x"$_ipv6_flag ]; then
|
||||
# _ipaddr="2002::56ff:feb6:56d5/64", _netmask is the number after "/"
|
||||
_netmask=${_ipaddr#*\/}
|
||||
_srcaddr="[$_srcaddr]"
|
||||
_gateway="[$_gateway]"
|
||||
else
|
||||
_netmask=$(ipcalc -m $_ipaddr | cut -d'=' -f2)
|
||||
fi
|
||||
echo -n "${_srcaddr}::${_gateway}:${_netmask}::"
|
||||
fi
|
||||
|
||||
/sbin/ip $_ipv6_flag route show | grep -v default |\
|
||||
grep ".*via.* $_netdev " | grep -v "^[[:space:]]*nexthop" |\
|
||||
while read _route; do
|
||||
_target=`echo $_route | cut -d ' ' -f1`
|
||||
_nexthop=`echo $_route | cut -d ' ' -f3`
|
||||
if [ "x" != "x"$_ipv6_flag ]; then
|
||||
_target="[$_target]"
|
||||
_nexthop="[$_nexthop]"
|
||||
fi
|
||||
echo "rd.route=$_target:$_nexthop:$_netdev"
|
||||
done >> ${initdir}/etc/cmdline.d/45route-static.conf
|
||||
|
||||
kdump_handle_mulitpath_route $_netdev $_srcaddr
|
||||
}
|
||||
|
||||
kdump_handle_mulitpath_route() {
|
||||
local _netdev="$1" _srcaddr="$2" _ipv6_flag
|
||||
local _target _nexthop _route _weight _max_weight _rule
|
||||
|
||||
if is_ipv6_address $_srcaddr; then
|
||||
_ipv6_flag="-6"
|
||||
fi
|
||||
|
||||
while IFS="" read _route; do
|
||||
if [[ "$_route" =~ [[:space:]]+nexthop ]]; then
|
||||
_route=$(echo "$_route" | sed -e 's/^[[:space:]]*//')
|
||||
# Parse multipath route, using previous _target
|
||||
[[ "$_target" == 'default' ]] && continue
|
||||
[[ "$_route" =~ .*via.*\ $_netdev ]] || continue
|
||||
|
||||
_weight=`echo "$_route" | cut -d ' ' -f7`
|
||||
if [[ "$_weight" -gt "$_max_weight" ]]; then
|
||||
_nexthop=`echo "$_route" | cut -d ' ' -f3`
|
||||
_max_weight=$_weight
|
||||
if [ "x" != "x"$_ipv6_flag ]; then
|
||||
_rule="rd.route=[$_target]:[$_nexthop]:$_netdev"
|
||||
else
|
||||
_rule="rd.route=$_target:$_nexthop:$_netdev"
|
||||
fi
|
||||
fi
|
||||
else
|
||||
[[ -n "$_rule" ]] && echo "$_rule"
|
||||
_target=`echo "$_route" | cut -d ' ' -f1`
|
||||
_rule="" _max_weight=0 _weight=0
|
||||
fi
|
||||
done >> ${initdir}/etc/cmdline.d/45route-static.conf\
|
||||
<<< "$(/sbin/ip $_ipv6_flag route show)"
|
||||
|
||||
[[ -n $_rule ]] && echo $_rule >> ${initdir}/etc/cmdline.d/45route-static.conf
|
||||
}
|
||||
|
||||
kdump_get_mac_addr() {
|
||||
cat /sys/class/net/$1/address
|
||||
}
|
||||
|
||||
#Bonding or team master modifies the mac address
|
||||
#of its slaves, we should use perm address
|
||||
kdump_get_perm_addr() {
|
||||
local addr=$(ethtool -P $1 | sed -e 's/Permanent address: //')
|
||||
if [ -z "$addr" ] || [ "$addr" = "00:00:00:00:00:00" ]
|
||||
then
|
||||
derror "Can't get the permanent address of $1"
|
||||
else
|
||||
echo "$addr"
|
||||
fi
|
||||
}
|
||||
|
||||
# Prefix kernel assigned names with "kdump-". EX: eth0 -> kdump-eth0
|
||||
# Because kernel assigned names are not persistent between 1st and 2nd
|
||||
# kernel. We could probably end up with eth0 being eth1, eth0 being
|
||||
# eth1, and naming conflict happens.
|
||||
kdump_setup_ifname() {
|
||||
local _ifname
|
||||
|
||||
# If ifname already has 'kdump-' prefix, we must be switching from
|
||||
# fadump to kdump. Skip prefixing 'kdump-' in this case as adding
|
||||
# another prefix may truncate the ifname. Since an ifname with
|
||||
# 'kdump-' is already persistent, this should be fine.
|
||||
if [[ $1 =~ eth* ]] && [[ ! $1 =~ ^kdump-* ]]; then
|
||||
_ifname="kdump-$1"
|
||||
else
|
||||
_ifname="$1"
|
||||
fi
|
||||
|
||||
echo "$_ifname"
|
||||
}
|
||||
|
||||
kdump_setup_bridge() {
|
||||
local _netdev=$1
|
||||
local _brif _dev _mac _kdumpdev
|
||||
for _dev in `ls /sys/class/net/$_netdev/brif/`; do
|
||||
_kdumpdev=$_dev
|
||||
if kdump_is_bond "$_dev"; then
|
||||
kdump_setup_bond "$_dev"
|
||||
elif kdump_is_team "$_dev"; then
|
||||
kdump_setup_team "$_dev"
|
||||
elif kdump_is_vlan "$_dev"; then
|
||||
kdump_setup_vlan "$_dev"
|
||||
else
|
||||
_mac=$(kdump_get_mac_addr $_dev)
|
||||
_kdumpdev=$(kdump_setup_ifname $_dev)
|
||||
echo -n " ifname=$_kdumpdev:$_mac" >> ${initdir}/etc/cmdline.d/41bridge.conf
|
||||
fi
|
||||
_brif+="$_kdumpdev,"
|
||||
done
|
||||
echo " bridge=$_netdev:$(echo $_brif | sed -e 's/,$//')" >> ${initdir}/etc/cmdline.d/41bridge.conf
|
||||
}
|
||||
|
||||
kdump_setup_bond() {
|
||||
local _netdev=$1
|
||||
local _dev _mac _slaves _kdumpdev
|
||||
for _dev in `cat /sys/class/net/$_netdev/bonding/slaves`; do
|
||||
_mac=$(kdump_get_perm_addr $_dev)
|
||||
_kdumpdev=$(kdump_setup_ifname $_dev)
|
||||
echo -n " ifname=$_kdumpdev:$_mac" >> ${initdir}/etc/cmdline.d/42bond.conf
|
||||
_slaves+="$_kdumpdev,"
|
||||
done
|
||||
echo -n " bond=$_netdev:$(echo $_slaves | sed 's/,$//')" >> ${initdir}/etc/cmdline.d/42bond.conf
|
||||
# Get bond options specified in ifcfg
|
||||
|
||||
source_ifcfg_file $_netdev
|
||||
|
||||
bondoptions=":$(echo $BONDING_OPTS | xargs echo | tr " " ",")"
|
||||
echo "$bondoptions" >> ${initdir}/etc/cmdline.d/42bond.conf
|
||||
}
|
||||
|
||||
kdump_setup_team() {
|
||||
local _netdev=$1
|
||||
local _dev _mac _slaves _kdumpdev
|
||||
for _dev in `teamnl $_netdev ports | awk -F':' '{print $2}'`; do
|
||||
_mac=$(kdump_get_perm_addr $_dev)
|
||||
_kdumpdev=$(kdump_setup_ifname $_dev)
|
||||
echo -n " ifname=$_kdumpdev:$_mac" >> ${initdir}/etc/cmdline.d/44team.conf
|
||||
_slaves+="$_kdumpdev,"
|
||||
done
|
||||
echo " team=$_netdev:$(echo $_slaves | sed -e 's/,$//')" >> ${initdir}/etc/cmdline.d/44team.conf
|
||||
#Buggy version teamdctl outputs to stderr!
|
||||
#Try to use the latest version of teamd.
|
||||
teamdctl "$_netdev" config dump > ${initdir}/tmp/$$-$_netdev.conf
|
||||
if [ $? -ne 0 ]
|
||||
then
|
||||
derror "teamdctl failed."
|
||||
exit 1
|
||||
fi
|
||||
inst_dir /etc/teamd
|
||||
inst_simple ${initdir}/tmp/$$-$_netdev.conf "/etc/teamd/$_netdev.conf"
|
||||
rm -f ${initdir}/tmp/$$-$_netdev.conf
|
||||
}
|
||||
|
||||
kdump_setup_vlan() {
|
||||
local _netdev=$1
|
||||
local _phydev="$(awk '/^Device:/{print $2}' /proc/net/vlan/"$_netdev")"
|
||||
local _netmac="$(kdump_get_mac_addr $_phydev)"
|
||||
local _kdumpdev
|
||||
|
||||
#Just support vlan over bond and team
|
||||
if kdump_is_bridge "$_phydev"; then
|
||||
derror "Vlan over bridge is not supported!"
|
||||
exit 1
|
||||
elif kdump_is_bond "$_phydev"; then
|
||||
kdump_setup_bond "$_phydev"
|
||||
echo " vlan=$(kdump_setup_ifname $_netdev):$_phydev" > ${initdir}/etc/cmdline.d/43vlan.conf
|
||||
else
|
||||
_kdumpdev="$(kdump_setup_ifname $_phydev)"
|
||||
echo " vlan=$(kdump_setup_ifname $_netdev):$_kdumpdev ifname=$_kdumpdev:$_netmac" > ${initdir}/etc/cmdline.d/43vlan.conf
|
||||
fi
|
||||
}
|
||||
|
||||
# setup s390 znet cmdline
|
||||
# $1: netdev name
|
||||
kdump_setup_znet() {
|
||||
local _options=""
|
||||
local _netdev=$1
|
||||
|
||||
source_ifcfg_file $_netdev
|
||||
|
||||
for i in $OPTIONS; do
|
||||
_options=${_options},$i
|
||||
done
|
||||
echo rd.znet=${NETTYPE},${SUBCHANNELS}${_options} rd.znet_ifname=$_netdev:${SUBCHANNELS} > ${initdir}/etc/cmdline.d/30znet.conf
|
||||
}
|
||||
|
||||
kdump_get_ip_route()
|
||||
{
|
||||
local _route=$(/sbin/ip -o route get to $1 2>&1)
|
||||
[ $? != 0 ] && die "Bad kdump network destination: $1"
|
||||
echo $_route
|
||||
}
|
||||
|
||||
kdump_get_ip_route_field()
|
||||
{
|
||||
if `echo $1 | grep -q $2`; then
|
||||
echo ${1##*$2} | cut -d ' ' -f1
|
||||
fi
|
||||
}
|
||||
|
||||
kdump_get_remote_ip()
|
||||
{
|
||||
local _remote=$(get_remote_host $1) _remote_temp
|
||||
if is_hostname $_remote; then
|
||||
_remote_temp=`getent ahosts $_remote | grep -v : | head -n 1`
|
||||
if [ -z "$_remote_temp" ]; then
|
||||
_remote_temp=`getent ahosts $_remote | head -n 1`
|
||||
fi
|
||||
_remote=`echo $_remote_temp | cut -d' ' -f1`
|
||||
fi
|
||||
echo $_remote
|
||||
}
|
||||
|
||||
# Setup dracut to bring up network interface that enable
|
||||
# initramfs accessing giving destination
|
||||
# $1: destination host
|
||||
kdump_install_net() {
|
||||
local _destaddr _srcaddr _route _netdev
|
||||
local _static _proto _ip_conf _ip_opts _ifname_opts
|
||||
|
||||
_destaddr=$(kdump_get_remote_ip $1)
|
||||
_route=$(kdump_get_ip_route $_destaddr)
|
||||
_srcaddr=$(kdump_get_ip_route_field "$_route" "src")
|
||||
_netdev=$(kdump_get_ip_route_field "$_route" "dev")
|
||||
_netmac=$(kdump_get_mac_addr $_netdev)
|
||||
|
||||
if [ "$(uname -m)" = "s390x" ]; then
|
||||
kdump_setup_znet $_netdev
|
||||
fi
|
||||
|
||||
_static=$(kdump_static_ip $_netdev $_srcaddr)
|
||||
if [ -n "$_static" ]; then
|
||||
_proto=none
|
||||
elif is_ipv6_address $_srcaddr; then
|
||||
_proto=auto6
|
||||
else
|
||||
_proto=dhcp
|
||||
fi
|
||||
|
||||
_ip_conf="${initdir}/etc/cmdline.d/40ip.conf"
|
||||
_ip_opts=" ip=${_static}$(kdump_setup_ifname $_netdev):${_proto}"
|
||||
|
||||
# dracut doesn't allow duplicated configuration for same NIC, even they're exactly the same.
|
||||
# so we have to avoid adding duplicates
|
||||
# We should also check /proc/cmdline for existing ip=xx arg.
|
||||
# For example, iscsi boot will specify ip=xxx arg in cmdline.
|
||||
if [ ! -f $_ip_conf ] || ! grep -q $_ip_opts $_ip_conf &&\
|
||||
! grep -q "ip=[^[:space:]]*$_netdev" /proc/cmdline; then
|
||||
echo "$_ip_opts" >> $_ip_conf
|
||||
fi
|
||||
|
||||
if kdump_is_bridge "$_netdev"; then
|
||||
kdump_setup_bridge "$_netdev"
|
||||
elif kdump_is_bond "$_netdev"; then
|
||||
kdump_setup_bond "$_netdev"
|
||||
elif kdump_is_team "$_netdev"; then
|
||||
kdump_setup_team "$_netdev"
|
||||
elif kdump_is_vlan "$_netdev"; then
|
||||
kdump_setup_vlan "$_netdev"
|
||||
else
|
||||
_ifname_opts=" ifname=$(kdump_setup_ifname $_netdev):$_netmac"
|
||||
echo "$_ifname_opts" >> $_ip_conf
|
||||
fi
|
||||
|
||||
kdump_setup_dns "$_netdev"
|
||||
|
||||
if [ ! -f ${initdir}/etc/cmdline.d/50neednet.conf ]; then
|
||||
# network-manager module needs this parameter
|
||||
echo "rd.neednet" >> ${initdir}/etc/cmdline.d/50neednet.conf
|
||||
fi
|
||||
|
||||
# Save netdev used for kdump as cmdline
|
||||
# Whoever calling kdump_install_net() is setting up the default gateway,
|
||||
# ie. bootdev/kdumpnic. So don't override the setting if calling
|
||||
# kdump_install_net() for another time. For example, after setting eth0 as
|
||||
# the default gate way for network dump, eth1 in the fence kdump path will
|
||||
# call kdump_install_net again and we don't want eth1 to be the default
|
||||
# gateway.
|
||||
if [ ! -f ${initdir}/etc/cmdline.d/60kdumpnic.conf ] &&
|
||||
[ ! -f ${initdir}/etc/cmdline.d/70bootdev.conf ]; then
|
||||
echo "kdumpnic=$(kdump_setup_ifname $_netdev)" > ${initdir}/etc/cmdline.d/60kdumpnic.conf
|
||||
echo "bootdev=$(kdump_setup_ifname $_netdev)" > ${initdir}/etc/cmdline.d/70bootdev.conf
|
||||
fi
|
||||
}
|
||||
|
||||
# install etc/kdump/pre.d and /etc/kdump/post.d
|
||||
kdump_install_pre_post_conf() {
|
||||
if [ -d /etc/kdump/pre.d ]; then
|
||||
for file in /etc/kdump/pre.d/*; do
|
||||
if [ -x "$file" ]; then
|
||||
dracut_install $file
|
||||
elif [ $file != "/etc/kdump/pre.d/*" ]; then
|
||||
echo "$file is not executable"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
if [ -d /etc/kdump/post.d ]; then
|
||||
for file in /etc/kdump/post.d/*; do
|
||||
if [ -x "$file" ]; then
|
||||
dracut_install $file
|
||||
elif [ $file != "/etc/kdump/post.d/*" ]; then
|
||||
echo "$file is not executable"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
}
|
||||
|
||||
default_dump_target_install_conf()
|
||||
{
|
||||
local _target _fstype
|
||||
local _mntpoint _save_path
|
||||
|
||||
is_user_configured_dump_target && return
|
||||
|
||||
_save_path=$(get_bind_mount_source $(get_save_path))
|
||||
_target=$(get_target_from_path $_save_path)
|
||||
_mntpoint=$(get_mntpoint_from_target $_target)
|
||||
|
||||
_fstype=$(get_fs_type_from_target $_target)
|
||||
if is_fs_type_nfs $_fstype; then
|
||||
kdump_install_net "$_target"
|
||||
_fstype="nfs"
|
||||
else
|
||||
_target=$(kdump_get_persistent_dev $_target)
|
||||
fi
|
||||
|
||||
echo "$_fstype $_target" >> ${initdir}/tmp/$$-kdump.conf
|
||||
|
||||
# don't touch the path under root mount
|
||||
if [ "$_mntpoint" != "/" ]; then
|
||||
_save_path=${_save_path##"$_mntpoint"}
|
||||
fi
|
||||
|
||||
#erase the old path line, then insert the parsed path
|
||||
sed -i "/^path/d" ${initdir}/tmp/$$-kdump.conf
|
||||
echo "path $_save_path" >> ${initdir}/tmp/$$-kdump.conf
|
||||
}
|
||||
|
||||
#install kdump.conf and what user specifies in kdump.conf
|
||||
kdump_install_conf() {
|
||||
local _opt _val _pdev
|
||||
(read_strip_comments /etc/kdump.conf) > ${initdir}/tmp/$$-kdump.conf
|
||||
|
||||
while read _opt _val;
|
||||
do
|
||||
# remove inline comments after the end of a directive.
|
||||
case "$_opt" in
|
||||
raw)
|
||||
_pdev=$(persistent_policy="by-id" kdump_get_persistent_dev $_val)
|
||||
sed -i -e "s#^$_opt[[:space:]]\+$_val#$_opt $_pdev#" ${initdir}/tmp/$$-kdump.conf
|
||||
;;
|
||||
ext[234]|xfs|btrfs|minix)
|
||||
_pdev=$(kdump_get_persistent_dev $_val)
|
||||
sed -i -e "s#^$_opt[[:space:]]\+$_val#$_opt $_pdev#" ${initdir}/tmp/$$-kdump.conf
|
||||
;;
|
||||
ssh|nfs)
|
||||
kdump_install_net "$_val"
|
||||
;;
|
||||
dracut_args)
|
||||
if [[ $(get_dracut_args_fstype "$_val") = nfs* ]] ; then
|
||||
kdump_install_net "$(get_dracut_args_target "$_val")"
|
||||
fi
|
||||
;;
|
||||
kdump_pre|kdump_post|extra_bins)
|
||||
dracut_install $_val
|
||||
;;
|
||||
core_collector)
|
||||
dracut_install "${_val%%[[:blank:]]*}"
|
||||
;;
|
||||
esac
|
||||
done <<< "$(read_strip_comments /etc/kdump.conf)"
|
||||
|
||||
kdump_install_pre_post_conf
|
||||
|
||||
default_dump_target_install_conf
|
||||
|
||||
kdump_configure_fence_kdump "${initdir}/tmp/$$-kdump.conf"
|
||||
inst "${initdir}/tmp/$$-kdump.conf" "/etc/kdump.conf"
|
||||
rm -f ${initdir}/tmp/$$-kdump.conf
|
||||
}
|
||||
|
||||
# Remove user custom configurations sysctl.conf & sysctl.d/*
|
||||
# and apply some optimization for kdump
|
||||
overwrite_sysctl_conf() {
|
||||
# As custom configurations like vm.min_free_kbytes can lead
|
||||
# to OOM issues in kdump kernel, avoid them
|
||||
rm -f "${initdir}/etc/sysctl.conf"
|
||||
rm -rf "${initdir}/etc/sysctl.d"
|
||||
rm -rf "${initdir}/run/sysctl.d"
|
||||
rm -rf "${initdir}/usr/lib/sysctl.d"
|
||||
|
||||
mkdir -p "${initdir}/etc/sysctl.d"
|
||||
echo "vm.zone_reclaim_mode = 3" > "${initdir}/etc/sysctl.d/99-zone-reclaim.conf"
|
||||
}
|
||||
|
||||
kdump_iscsi_get_rec_val() {
|
||||
|
||||
local result
|
||||
|
||||
# The open-iscsi 742 release changed to using flat files in
|
||||
# /var/lib/iscsi.
|
||||
|
||||
result=$(/sbin/iscsiadm --show -m session -r ${1} | grep "^${2} = ")
|
||||
result=${result##* = }
|
||||
echo $result
|
||||
}
|
||||
|
||||
kdump_get_iscsi_initiator() {
|
||||
local _initiator
|
||||
local initiator_conf="/etc/iscsi/initiatorname.iscsi"
|
||||
|
||||
[ -f "$initiator_conf" ] || return 1
|
||||
|
||||
while read _initiator; do
|
||||
[ -z "${_initiator%%#*}" ] && continue # Skip comment lines
|
||||
|
||||
case $_initiator in
|
||||
InitiatorName=*)
|
||||
initiator=${_initiator#InitiatorName=}
|
||||
echo "rd.iscsi.initiator=${initiator}"
|
||||
return 0;;
|
||||
*) ;;
|
||||
esac
|
||||
done < ${initiator_conf}
|
||||
|
||||
return 1
|
||||
}
|
||||
|
||||
# Figure out iBFT session according to session type
|
||||
is_ibft() {
|
||||
[ "$(kdump_iscsi_get_rec_val $1 "node.discovery_type")" = fw ]
|
||||
}
|
||||
|
||||
kdump_setup_iscsi_device() {
|
||||
local path=$1
|
||||
local tgt_name; local tgt_ipaddr;
|
||||
local username; local password; local userpwd_str;
|
||||
local username_in; local password_in; local userpwd_in_str;
|
||||
local netroot_str ; local initiator_str;
|
||||
local netroot_conf="${initdir}/etc/cmdline.d/50iscsi.conf"
|
||||
local initiator_conf="/etc/iscsi/initiatorname.iscsi"
|
||||
|
||||
dinfo "Found iscsi component $1"
|
||||
|
||||
# Check once before getting explicit values, so we can bail out early,
|
||||
# e.g. in case of pure-hardware(all-offload) iscsi.
|
||||
if ! /sbin/iscsiadm -m session -r ${path} &>/dev/null ; then
|
||||
return 1
|
||||
fi
|
||||
|
||||
if is_ibft ${path}; then
|
||||
return
|
||||
fi
|
||||
|
||||
# Remove software iscsi cmdline generated by 95iscsi,
|
||||
# and let kdump regenerate here.
|
||||
rm -f ${initdir}/etc/cmdline.d/95iscsi.conf
|
||||
|
||||
tgt_name=$(kdump_iscsi_get_rec_val ${path} "node.name")
|
||||
tgt_ipaddr=$(kdump_iscsi_get_rec_val ${path} "node.conn\[0\].address")
|
||||
|
||||
# get and set username and password details
|
||||
username=$(kdump_iscsi_get_rec_val ${path} "node.session.auth.username")
|
||||
[ "$username" == "<empty>" ] && username=""
|
||||
password=$(kdump_iscsi_get_rec_val ${path} "node.session.auth.password")
|
||||
[ "$password" == "<empty>" ] && password=""
|
||||
username_in=$(kdump_iscsi_get_rec_val ${path} "node.session.auth.username_in")
|
||||
[ -n "$username" ] && userpwd_str="$username:$password"
|
||||
|
||||
# get and set incoming username and password details
|
||||
[ "$username_in" == "<empty>" ] && username_in=""
|
||||
password_in=$(kdump_iscsi_get_rec_val ${path} "node.session.auth.password_in")
|
||||
[ "$password_in" == "<empty>" ] && password_in=""
|
||||
|
||||
[ -n "$username_in" ] && userpwd_in_str=":$username_in:$password_in"
|
||||
|
||||
kdump_install_net "$tgt_ipaddr"
|
||||
|
||||
# prepare netroot= command line
|
||||
# FIXME: Do we need to parse and set other parameters like protocol, port
|
||||
# iscsi_iface_name, netdev_name, LUN etc.
|
||||
|
||||
if is_ipv6_address $tgt_ipaddr; then
|
||||
tgt_ipaddr="[$tgt_ipaddr]"
|
||||
fi
|
||||
netroot_str="netroot=iscsi:${userpwd_str}${userpwd_in_str}@$tgt_ipaddr::::$tgt_name"
|
||||
|
||||
[[ -f $netroot_conf ]] || touch $netroot_conf
|
||||
|
||||
# If netroot target does not exist already, append.
|
||||
if ! grep -q $netroot_str $netroot_conf; then
|
||||
echo $netroot_str >> $netroot_conf
|
||||
dinfo "Appended $netroot_str to $netroot_conf"
|
||||
fi
|
||||
|
||||
# Setup initator
|
||||
initiator_str=$(kdump_get_iscsi_initiator)
|
||||
[ $? -ne "0" ] && derror "Failed to get initiator name" && return 1
|
||||
|
||||
# If initiator details do not exist already, append.
|
||||
if ! grep -q "$initiator_str" $netroot_conf; then
|
||||
echo "$initiator_str" >> $netroot_conf
|
||||
dinfo "Appended "$initiator_str" to $netroot_conf"
|
||||
fi
|
||||
}
|
||||
|
||||
kdump_check_iscsi_targets () {
|
||||
# If our prerequisites are not met, fail anyways.
|
||||
type -P iscsistart >/dev/null || return 1
|
||||
|
||||
kdump_check_setup_iscsi() (
|
||||
local _dev
|
||||
_dev=$1
|
||||
|
||||
[[ -L /sys/dev/block/$_dev ]] || return
|
||||
cd "$(readlink -f /sys/dev/block/$_dev)"
|
||||
until [[ -d sys || -d iscsi_session ]]; do
|
||||
cd ..
|
||||
done
|
||||
[[ -d iscsi_session ]] && kdump_setup_iscsi_device "$PWD"
|
||||
)
|
||||
|
||||
[[ $hostonly ]] || [[ $mount_needs ]] && {
|
||||
for_each_host_dev_and_slaves_all kdump_check_setup_iscsi
|
||||
}
|
||||
}
|
||||
|
||||
# hostname -a is deprecated, do it by ourself
|
||||
get_alias() {
|
||||
local ips
|
||||
local entries
|
||||
local alias_set
|
||||
|
||||
ips=$(hostname -I)
|
||||
for ip in $ips
|
||||
do
|
||||
# in /etc/hosts, alias can come at the 2nd column
|
||||
entries=$(grep $ip /etc/hosts | awk '{ $1=""; print $0 }')
|
||||
if [ $? -eq 0 ]; then
|
||||
alias_set="$alias_set $entries"
|
||||
fi
|
||||
done
|
||||
|
||||
echo $alias_set
|
||||
}
|
||||
|
||||
is_localhost() {
|
||||
local hostnames=$(hostname -A)
|
||||
local shortnames=$(hostname -A -s)
|
||||
local aliasname=$(get_alias)
|
||||
local nodename=$1
|
||||
|
||||
hostnames="$hostnames $shortnames $aliasname"
|
||||
|
||||
for name in ${hostnames}; do
|
||||
if [ "$name" == "$nodename" ]; then
|
||||
return 0
|
||||
fi
|
||||
done
|
||||
return 1
|
||||
}
|
||||
|
||||
# retrieves fence_kdump nodes from Pacemaker cluster configuration
|
||||
get_pcs_fence_kdump_nodes() {
|
||||
local nodes
|
||||
|
||||
pcs cluster sync > /dev/null 2>&1 && pcs cluster cib-upgrade > /dev/null 2>&1
|
||||
# get cluster nodes from cluster cib, get interface and ip address
|
||||
nodelist=`pcs cluster cib | xmllint --xpath "/cib/status/node_state/@uname" -`
|
||||
|
||||
# nodelist is formed as 'uname="node1" uname="node2" ... uname="nodeX"'
|
||||
# we need to convert each to node1, node2 ... nodeX in each iteration
|
||||
for node in ${nodelist}; do
|
||||
# convert $node from 'uname="nodeX"' to 'nodeX'
|
||||
eval $node
|
||||
nodename=$uname
|
||||
# Skip its own node name
|
||||
if is_localhost $nodename; then
|
||||
continue
|
||||
fi
|
||||
nodes="$nodes $nodename"
|
||||
done
|
||||
|
||||
echo $nodes
|
||||
}
|
||||
|
||||
# retrieves fence_kdump args from config file
|
||||
get_pcs_fence_kdump_args() {
|
||||
if [ -f $FENCE_KDUMP_CONFIG_FILE ]; then
|
||||
. $FENCE_KDUMP_CONFIG_FILE
|
||||
echo $FENCE_KDUMP_OPTS
|
||||
fi
|
||||
}
|
||||
|
||||
get_generic_fence_kdump_nodes() {
|
||||
local filtered
|
||||
local nodes
|
||||
|
||||
nodes=$(get_option_value "fence_kdump_nodes")
|
||||
for node in ${nodes}; do
|
||||
# Skip its own node name
|
||||
if is_localhost $node; then
|
||||
continue
|
||||
fi
|
||||
filtered="$filtered $node"
|
||||
done
|
||||
echo $filtered
|
||||
}
|
||||
|
||||
# setup fence_kdump in cluster
|
||||
# setup proper network and install needed files
|
||||
kdump_configure_fence_kdump () {
|
||||
local kdump_cfg_file=$1
|
||||
local nodes
|
||||
local args
|
||||
|
||||
if is_generic_fence_kdump; then
|
||||
nodes=$(get_generic_fence_kdump_nodes)
|
||||
|
||||
elif is_pcs_fence_kdump; then
|
||||
nodes=$(get_pcs_fence_kdump_nodes)
|
||||
|
||||
# set appropriate options in kdump.conf
|
||||
echo "fence_kdump_nodes $nodes" >> ${kdump_cfg_file}
|
||||
|
||||
args=$(get_pcs_fence_kdump_args)
|
||||
if [ -n "$args" ]; then
|
||||
echo "fence_kdump_args $args" >> ${kdump_cfg_file}
|
||||
fi
|
||||
|
||||
else
|
||||
# fence_kdump not configured
|
||||
return 1
|
||||
fi
|
||||
|
||||
# setup network for each node
|
||||
for node in ${nodes}; do
|
||||
kdump_install_net $node
|
||||
done
|
||||
|
||||
dracut_install /etc/hosts
|
||||
dracut_install /etc/nsswitch.conf
|
||||
dracut_install $FENCE_KDUMP_SEND
|
||||
}
|
||||
|
||||
# Install a random seed used to feed /dev/urandom
|
||||
# By the time kdump service starts, /dev/uramdom is already fed by systemd
|
||||
kdump_install_random_seed() {
|
||||
local poolsize=`cat /proc/sys/kernel/random/poolsize`
|
||||
|
||||
if [ ! -d ${initdir}/var/lib/ ]; then
|
||||
mkdir -p ${initdir}/var/lib/
|
||||
fi
|
||||
|
||||
dd if=/dev/urandom of=${initdir}/var/lib/random-seed \
|
||||
bs=$poolsize count=1 2> /dev/null
|
||||
}
|
||||
|
||||
kdump_install_systemd_conf() {
|
||||
local failure_action=$(get_option_value "failure_action")
|
||||
|
||||
# Kdump turns out to require longer default systemd mount timeout
|
||||
# than 1st kernel(90s by default), we use default 300s for kdump.
|
||||
grep -r "^[[:space:]]*DefaultTimeoutStartSec=" ${initdir}/etc/systemd/system.conf* &>/dev/null
|
||||
if [ $? -ne 0 ]; then
|
||||
mkdir -p ${initdir}/etc/systemd/system.conf.d
|
||||
echo "[Manager]" > ${initdir}/etc/systemd/system.conf.d/kdump.conf
|
||||
echo "DefaultTimeoutStartSec=300s" >> ${initdir}/etc/systemd/system.conf.d/kdump.conf
|
||||
fi
|
||||
|
||||
# Forward logs to console directly, and don't read Kmsg, this avoids
|
||||
# unneccessary memory consumption and make console output more useful.
|
||||
# Only do so for non fadump image.
|
||||
mkdir -p ${initdir}/etc/systemd/journald.conf.d
|
||||
echo "[Journal]" > ${initdir}/etc/systemd/journald.conf.d/kdump.conf
|
||||
echo "Storage=volatile" >> ${initdir}/etc/systemd/journald.conf.d/kdump.conf
|
||||
echo "ReadKMsg=no" >> ${initdir}/etc/systemd/journald.conf.d/kdump.conf
|
||||
echo "ForwardToConsole=yes" >> ${initdir}/etc/systemd/journald.conf.d/kdump.conf
|
||||
}
|
||||
|
||||
install() {
|
||||
kdump_module_init
|
||||
kdump_install_conf
|
||||
overwrite_sysctl_conf
|
||||
|
||||
if is_ssh_dump_target; then
|
||||
kdump_install_random_seed
|
||||
fi
|
||||
dracut_install -o /etc/adjtime /etc/localtime
|
||||
inst "$moddir/monitor_dd_progress" "/kdumpscripts/monitor_dd_progress"
|
||||
chmod +x ${initdir}/kdumpscripts/monitor_dd_progress
|
||||
inst "/bin/dd" "/bin/dd"
|
||||
inst "/bin/tail" "/bin/tail"
|
||||
inst "/bin/date" "/bin/date"
|
||||
inst "/bin/sync" "/bin/sync"
|
||||
inst "/bin/cut" "/bin/cut"
|
||||
inst "/bin/head" "/bin/head"
|
||||
inst "/bin/awk" "/bin/awk"
|
||||
inst "/bin/sed" "/bin/sed"
|
||||
inst "/sbin/makedumpfile" "/sbin/makedumpfile"
|
||||
inst "/sbin/vmcore-dmesg" "/sbin/vmcore-dmesg"
|
||||
inst "/usr/bin/printf" "/sbin/printf"
|
||||
inst "/usr/bin/logger" "/sbin/logger"
|
||||
inst "/lib/kdump/kdump-lib.sh" "/lib/kdump-lib.sh"
|
||||
inst "/lib/kdump/kdump-lib-initramfs.sh" "/lib/kdump-lib-initramfs.sh"
|
||||
inst "/lib/kdump/kdump-logger.sh" "/lib/kdump-logger.sh"
|
||||
inst "$moddir/kdump.sh" "/usr/bin/kdump.sh"
|
||||
inst "$moddir/kdump-capture.service" "$systemdsystemunitdir/kdump-capture.service"
|
||||
systemctl -q --root "$initdir" add-wants initrd.target kdump-capture.service
|
||||
inst "$moddir/kdump-error-handler.sh" "/usr/bin/kdump-error-handler.sh"
|
||||
inst "$moddir/kdump-error-handler.service" "$systemdsystemunitdir/kdump-error-handler.service"
|
||||
# Replace existing emergency service and emergency target
|
||||
cp "$moddir/kdump-emergency.service" "$initdir/$systemdsystemunitdir/emergency.service"
|
||||
cp "$moddir/kdump-emergency.target" "$initdir/$systemdsystemunitdir/emergency.target"
|
||||
# Also redirect dracut-emergency to kdump error handler
|
||||
ln_r "$systemdsystemunitdir/emergency.service" "$systemdsystemunitdir/dracut-emergency.service"
|
||||
|
||||
# Check for all the devices and if any device is iscsi, bring up iscsi
|
||||
# target. Ideally all this should be pushed into dracut iscsi module
|
||||
# at some point of time.
|
||||
kdump_check_iscsi_targets
|
||||
|
||||
kdump_install_systemd_conf
|
||||
|
||||
# nfs/ssh dump will need to get host ip in second kernel and need to call 'ip' tool, see get_host_ip for more detail
|
||||
if is_nfs_dump_target || is_ssh_dump_target; then
|
||||
inst "ip"
|
||||
fi
|
||||
|
||||
# For the lvm type target under kdump, in /etc/lvm/lvm.conf we can
|
||||
# safely replace "reserved_memory=XXXX"(default value is 8192) with
|
||||
# "reserved_memory=1024" to lower memory pressure under kdump. We do
|
||||
# it unconditionally here, if "/etc/lvm/lvm.conf" doesn't exist, it
|
||||
# actually does nothing.
|
||||
sed -i -e \
|
||||
's/\(^[[:space:]]*reserved_memory[[:space:]]*=\)[[:space:]]*[[:digit:]]*/\1 1024/' \
|
||||
${initdir}/etc/lvm/lvm.conf &>/dev/null
|
||||
|
||||
# Save more memory by dropping switch root capability
|
||||
if ! is_fadump_capable; then
|
||||
dracut_no_switch_root
|
||||
fi
|
||||
}
|
||||
28
dracut-monitor_dd_progress
Normal file
28
dracut-monitor_dd_progress
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
#!/bin/sh
|
||||
|
||||
SRC_FILE_MB=$1
|
||||
|
||||
while true
|
||||
do
|
||||
DD_PID=`pidof dd`
|
||||
if [ -n "$DD_PID" ]; then
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
while true
|
||||
do
|
||||
sleep 5
|
||||
if [ ! -d /proc/$DD_PID ]; then
|
||||
break
|
||||
fi
|
||||
|
||||
kill -s USR1 $DD_PID
|
||||
CURRENT_SIZE=`tail -n 1 /tmp/dd_progress_file | sed "s/[^0-9].*//g"`
|
||||
[ -n "$CURRENT_SIZE" ] && {
|
||||
CURRENT_MB=$(($CURRENT_SIZE / 1048576))
|
||||
echo -e "Copied $CURRENT_MB MB / $SRC_FILE_MB MB\r"
|
||||
}
|
||||
done
|
||||
|
||||
rm -f /tmp/dd_progress_file
|
||||
95
early-kdump-howto.txt
Normal file
95
early-kdump-howto.txt
Normal file
|
|
@ -0,0 +1,95 @@
|
|||
Early Kdump HOWTO
|
||||
|
||||
Introduction
|
||||
------------
|
||||
|
||||
Early kdump is a mechanism to make kdump operational earlier than normal kdump
|
||||
service. The kdump service starts early enough for general crash cases, but
|
||||
there are some cases where it has no chance to make kdump operational in boot
|
||||
sequence, such as detecting devices and starting early services. If you hit
|
||||
such a case, early kdump may allow you to get more information of it.
|
||||
|
||||
Early kdump is implemented as a dracut module. It adds a kernel (vmlinuz) and
|
||||
initramfs for kdump to your system's initramfs in order to load them as early
|
||||
as possible. After that, if you provide "rd.earlykdump" in kernel command line,
|
||||
then in the initramfs, early kdump will load those files like the normal kdump
|
||||
service. This is disabled by default.
|
||||
|
||||
For the normal kdump service, it can check whether the early kdump has loaded
|
||||
the crash kernel and initramfs. It has no conflict with the early kdump.
|
||||
|
||||
How to configure early kdump
|
||||
----------------------------
|
||||
|
||||
We assume if you're reading this document, you should already have kexec-tools
|
||||
installed.
|
||||
|
||||
You can rebuild the initramfs with earlykdump support with below steps:
|
||||
|
||||
1. start kdump service to make sure kdump initramfs is created.
|
||||
|
||||
# systemctl start kdump
|
||||
|
||||
NOTE: If a crash occurs during boot process, early kdump captures a vmcore
|
||||
and reboot the system by default, so the system might go into crash loop.
|
||||
You can avoid such a crash loop by adding the following settings, which
|
||||
power off the system after dump capturing, to kdump.conf in advance:
|
||||
|
||||
final_action poweroff
|
||||
failure_action poweroff
|
||||
|
||||
For the failure_action, you can choose anything other than "reboot".
|
||||
|
||||
2. rebuild system initramfs with earlykdump support.
|
||||
|
||||
# dracut --force --add earlykdump
|
||||
|
||||
NOTE: Recommend to backup the original system initramfs before performing
|
||||
this step to put it back if something happens during boot-up.
|
||||
|
||||
3. add rd.earlykdump in grub kernel command line.
|
||||
|
||||
After making said changes, reboot your system to take effect. Of course, if you
|
||||
want to disable early kdump, you can simply remove "rd.earlykdump" from kernel
|
||||
boot parameters in grub, and reboot system like above.
|
||||
|
||||
Once the boot is completed, you can check the status of the early kdump support
|
||||
on the command prompt:
|
||||
|
||||
# journalctl -b | grep early-kdump
|
||||
|
||||
Then, you will see some useful logs, for example:
|
||||
|
||||
- if early kdump is successful.
|
||||
|
||||
Mar 09 09:57:56 localhost dracut-cmdline[190]: early-kdump is enabled.
|
||||
Mar 09 09:57:56 localhost dracut-cmdline[190]: kexec: loaded early-kdump kernel
|
||||
|
||||
- if early kdump is disabled.
|
||||
|
||||
Mar 09 10:02:47 localhost dracut-cmdline[189]: early-kdump is disabled.
|
||||
|
||||
Notes
|
||||
-----
|
||||
|
||||
- The size of early kdump initramfs will be large because it includes vmlinuz
|
||||
and kdump initramfs.
|
||||
|
||||
- Early kdump inherits the settings of normal kdump, so any changes that
|
||||
caused normal kdump rebuilding also require rebuilding the system initramfs
|
||||
to make sure that the changes take effect for early kdump. Therefore, after
|
||||
the rebuilding of kdump initramfs is completed, provide a prompt message to
|
||||
tell the fact.
|
||||
|
||||
- If you install an updated kernel and reboot the system with it, the early
|
||||
kdump will be disabled by default. To enable it with the new kernel, you
|
||||
need to take the above steps again.
|
||||
|
||||
Limitation
|
||||
----------
|
||||
|
||||
- At present, early kdump doesn't support fadump.
|
||||
|
||||
- Early kdump loads a crash kernel and initramfs at the beginning of the
|
||||
process in system's initramfs, so a crash at earlier than that (e.g. in
|
||||
kernel initialization) cannot be captured even with the early kdump.
|
||||
348
fadump-howto.txt
Normal file
348
fadump-howto.txt
Normal file
|
|
@ -0,0 +1,348 @@
|
|||
Firmware assisted dump (fadump) HOWTO
|
||||
|
||||
Introduction
|
||||
|
||||
Firmware assisted dump is a new feature in the 3.4 mainline kernel supported
|
||||
only on powerpc architecture. The goal of firmware-assisted dump is to enable
|
||||
the dump of a crashed system, and to do so from a fully-reset system, and to
|
||||
minimize the total elapsed time until the system is back in production use. A
|
||||
complete documentation on implementation can be found at
|
||||
Documentation/powerpc/firmware-assisted-dump.txt in upstream linux kernel tree
|
||||
from 3.4 version and above.
|
||||
|
||||
Please note that the firmware-assisted dump feature is only available on Power6
|
||||
and above systems with recent firmware versions.
|
||||
|
||||
Overview
|
||||
|
||||
Fadump
|
||||
|
||||
Fadump is a robust kernel crash dumping mechanism to get reliable kernel crash
|
||||
dump with assistance from firmware. This approach does not use kexec, instead
|
||||
firmware assists in booting the kdump kernel while preserving memory contents.
|
||||
Unlike kdump, the system is fully reset, and loaded with a fresh copy of the
|
||||
kernel. In particular, PCI and I/O devices are reinitialized and are in a
|
||||
clean, consistent state. This second kernel, often called a capture kernel,
|
||||
boots with very little memory and captures the dump image.
|
||||
|
||||
The first kernel registers the sections of memory with the Power firmware for
|
||||
dump preservation during OS initialization. These registered sections of memory
|
||||
are reserved by the first kernel during early boot. When a system crashes, the
|
||||
Power firmware fully resets the system, preserves all the system memory
|
||||
contents, save the low memory (boot memory of size larger of 5% of system
|
||||
RAM or 256MB) of RAM to the previous registered region. It will also save
|
||||
system registers, and hardware PTE's.
|
||||
|
||||
Fadump is supported only on ppc64 platform. The standard kernel and capture
|
||||
kernel are one and the same on ppc64.
|
||||
|
||||
If you're reading this document, you should already have kexec-tools
|
||||
installed. If not, you install it via the following command:
|
||||
|
||||
# yum install kexec-tools
|
||||
|
||||
Fadump Operational Flow:
|
||||
|
||||
Like kdump, fadump also exports the ELF formatted kernel crash dump through
|
||||
/proc/vmcore. Hence existing kdump infrastructure can be used to capture fadump
|
||||
vmcore. The idea is to keep the functionality transparent to end user. From
|
||||
user perspective there is no change in the way kdump init script works.
|
||||
|
||||
However, unlike kdump, fadump does not pre-load kdump kernel and initrd into
|
||||
reserved memory, instead it always uses default OS initrd during second boot
|
||||
after crash. Hence, for fadump, we rebuild the new kdump initrd and replace it
|
||||
with default initrd. Before replacing existing default initrd we take a backup
|
||||
of original default initrd for user's reference. The dracut package has been
|
||||
enhanced to rebuild the default initrd with vmcore capture steps. The initrd
|
||||
image is rebuilt as per the configuration in /etc/kdump.conf file.
|
||||
|
||||
The control flow of fadump works as follows:
|
||||
01. System panics.
|
||||
02. At the crash, kernel informs power firmware that kernel has crashed.
|
||||
03. Firmware takes the control and reboots the entire system preserving
|
||||
only the memory (resets all other devices).
|
||||
04. The reboot follows the normal booting process (non-kexec).
|
||||
05. The boot loader loads the default kernel and initrd from /boot
|
||||
06. The default initrd loads and runs /init
|
||||
07. dracut-kdump.sh script present in fadump aware default initrd checks if
|
||||
'/proc/device-tree/rtas/ibm,kernel-dump' file exists before executing
|
||||
steps to capture vmcore.
|
||||
(This check will help to bypass the vmcore capture steps during normal boot
|
||||
process.)
|
||||
09. Captures dump according to /etc/kdump.conf
|
||||
10. Is dump capture successful (yes goto 12, no goto 11)
|
||||
11. Perform the failure action specified in /etc/kdump.conf
|
||||
(The default failure action is reboot, if unspecified)
|
||||
12. Perform the final action specified in /etc/kdump.conf
|
||||
(The default final action is reboot, if unspecified)
|
||||
|
||||
|
||||
How to configure fadump:
|
||||
|
||||
Again, we assume if you're reading this document, you should already have
|
||||
kexec-tools installed. If not, you install it via the following command:
|
||||
|
||||
# yum install kexec-tools
|
||||
|
||||
Make the kernel to be configured with FADump as the default boot entry, if
|
||||
it isn't already:
|
||||
|
||||
# grubby --set-default=/boot/vmlinuz-<kver>
|
||||
|
||||
Boot into the kernel to be configured for FADump. To be able to do much of
|
||||
anything interesting in the way of debug analysis, you'll also need to install
|
||||
the kernel-debuginfo package, of the same arch as your running kernel, and the
|
||||
crash utility:
|
||||
|
||||
# yum --enablerepo=\*debuginfo install kernel-debuginfo.$(uname -m) crash
|
||||
|
||||
Next up, we need to modify some boot parameters to enable firmware assisted
|
||||
dump. With the help of grubby, it's very easy to append "fadump=on" to the end
|
||||
of your kernel boot parameters. To reserve the appropriate amount of memory
|
||||
for boot memory preservation, pass 'crashkernel=X' kernel cmdline parameter.
|
||||
For the recommended value of X, see 'FADump Memory Requirements' section.
|
||||
|
||||
# grubby --args="fadump=on crashkernel=6G" --update-kernel=/boot/vmlinuz-`uname -r`
|
||||
|
||||
By default, FADump reserved memory will be initialized as CMA area to make the
|
||||
memory available through CMA allocator on the production kernel. We can opt out
|
||||
of this, making reserved memory unavailable to production kernel, by booting the
|
||||
linux kernel with 'fadump=nocma' instead of 'fadump=on'.
|
||||
|
||||
The term 'boot memory' means size of the low memory chunk that is required for
|
||||
a kernel to boot successfully when booted with restricted memory. By default,
|
||||
the boot memory size will be the larger of 5% of system RAM or 256MB.
|
||||
Alternatively, user can also specify boot memory size through boot parameter
|
||||
'fadump_reserve_mem=' which will override the default calculated size. Use this
|
||||
option if default boot memory size is not sufficient for second kernel to boot
|
||||
successfully.
|
||||
|
||||
After making said changes, reboot your system, so that the specified memory is
|
||||
reserved and left untouched by the normal system. Take note that the output of
|
||||
'free -m' will show X MB less memory than without this parameter, which is
|
||||
expected. If you see OOM (Out Of Memory) error messages while loading capture
|
||||
kernel, then you should bump up the memory reservation size.
|
||||
|
||||
Now that you've got that reserved memory region set up, you want to turn on
|
||||
the kdump init script:
|
||||
|
||||
# systemctl enable kdump.service
|
||||
|
||||
Then, start up kdump as well:
|
||||
|
||||
# systemctl start kdump.service
|
||||
|
||||
This should turn on the firmware assisted functionality in kernel by
|
||||
echo'ing 1 to /sys/kernel/fadump_registered, leaving the system ready
|
||||
to capture a vmcore upon crashing. For journaling filesystems like XFS an
|
||||
additional step is required to ensure bootloader does not pick the
|
||||
older initrd (without vmcore capture scripts):
|
||||
|
||||
* If /boot is a separate partition, run the below commands as the root user,
|
||||
or as a user with CAP_SYS_ADMIN rights:
|
||||
|
||||
# fsfreeze -f
|
||||
# fsfreeze -u
|
||||
|
||||
* If /boot is not a separate partition, reboot the system.
|
||||
|
||||
After reboot check if the kdump service is up and running with:
|
||||
|
||||
# systemctl status kdump.service
|
||||
|
||||
To test out whether FADump is configured properly, you can force-crash your
|
||||
system by echo'ing a 'c' into /proc/sysrq-trigger:
|
||||
|
||||
# echo c > /proc/sysrq-trigger
|
||||
|
||||
You should see some panic output, followed by the system reset and booting into
|
||||
fresh copy of kernel. When default initrd loads and runs /init, vmcore should
|
||||
be copied out to disk (by default, in /var/crash/<YYYY.MM.DD-HH:MM:SS>/vmcore),
|
||||
then the system rebooted back into your normal kernel.
|
||||
|
||||
Once back to your normal kernel, you can use the previously installed crash
|
||||
kernel in conjunction with the previously installed kernel-debuginfo to
|
||||
perform postmortem analysis:
|
||||
|
||||
# crash /usr/lib/debug/lib/modules/2.6.17-1.2621.el5/vmlinux
|
||||
/var/crash/2006-08-23-15:34/vmcore
|
||||
|
||||
crash> bt
|
||||
|
||||
and so on...
|
||||
|
||||
Saving vmcore-dmesg.txt
|
||||
-----------------------
|
||||
Kernel log bufferes are one of the most important information available
|
||||
in vmcore. Now before saving vmcore, kernel log bufferes are extracted
|
||||
from /proc/vmcore and saved into a file vmcore-dmesg.txt. After
|
||||
vmcore-dmesg.txt, vmcore is saved. Destination disk and directory for
|
||||
vmcore-dmesg.txt is same as vmcore. Note that kernel log buffers will
|
||||
not be available if dump target is raw device.
|
||||
|
||||
FADump Memory Requirements:
|
||||
|
||||
System Memory Recommended memory
|
||||
--------------------- ----------------------
|
||||
4 GB - 16 GB : 768 MB
|
||||
16 GB - 64 GB : 1024 MB
|
||||
64 GB - 128 GB : 2 GB
|
||||
128 GB - 1 TB : 4 GB
|
||||
1 TB - 2 TB : 6 GB
|
||||
2 TB - 4 TB : 12 GB
|
||||
4 TB - 8 TB : 20 GB
|
||||
8 TB - 16 TB : 36 GB
|
||||
16 TB - 32 TB : 64 GB
|
||||
32 TB - 64 TB : 128 GB
|
||||
64 TB & above : 180 GB
|
||||
|
||||
Things to remember:
|
||||
|
||||
1) The memory required to boot capture Kernel is a moving target that depends
|
||||
on many factors like hardware attached to the system, kernel and modules in
|
||||
use, packages installed and services enabled, there is no one-size-fits-all.
|
||||
But the above recommendations are based on system memory. So, the above
|
||||
recommendations for FADump come with a few assumptions, based on available
|
||||
system memory, about the resources the system could have. So, please take
|
||||
the recommendations with a pinch of salt and remember to try capturing dump
|
||||
a few times to confirm that the system is configured successfully with dump
|
||||
capturing support.
|
||||
|
||||
2) Though the memory requirements for FADump seem high, this memory is not
|
||||
completely set aside but made available for userspace applications to use,
|
||||
through the CMA allocator.
|
||||
|
||||
3) As the same initrd is used for booting production kernel as well as capture
|
||||
kernel and with dump being captured in a restricted memory environment, few
|
||||
optimizations (like not inclding network dracut module, disabling multipath
|
||||
and such) are applied while building the initrd. In case, the production
|
||||
environment needs these optimizations to be avoided, dracut_args option in
|
||||
/etc/kdump.conf file could be leveraged. For example, if a user wishes for
|
||||
network module to be included in the initrd, adding the below entry in
|
||||
/etc/kdump.conf file and restarting kdump service would take care of it.
|
||||
|
||||
dracut_args --add "network"
|
||||
|
||||
4) If FADump is configured to capture vmcore to a remote dump target using SSH
|
||||
or NFS protocol, the network interface is renamed to kdump-<interface-name>
|
||||
if <interface-name> is generic, for example, *eth#, or net#. This problem
|
||||
occurs because the vmcore capture scripts in the initial RAM disk (initrd)
|
||||
add the kdump- prefix to the network interface name to secure persistent
|
||||
naming. As the same initrd is used for production kernel boot, the interface
|
||||
name is changed for the production kernel too.
|
||||
|
||||
Dump Triggering methods:
|
||||
|
||||
This section talks about the various ways, other than a Kernel Panic, in which
|
||||
fadump can be triggered. The following methods assume that fadump is configured
|
||||
on your system, with the scripts enabled as described in the section above.
|
||||
|
||||
1) AltSysRq C
|
||||
|
||||
FAdump can be triggered with the combination of the 'Alt','SysRq' and 'C'
|
||||
keyboard keys. Please refer to the following link for more details:
|
||||
|
||||
https://fedoraproject.org/wiki/QA/Sysrq
|
||||
|
||||
In addition, on PowerPC boxes, fadump can also be triggered via Hardware
|
||||
Management Console(HMC) using 'Ctrl', 'O' and 'C' keyboard keys.
|
||||
|
||||
2) Kernel OOPs
|
||||
|
||||
If we want to generate a dump everytime the Kernel OOPses, we can achieve this
|
||||
by setting the 'Panic On OOPs' option as follows:
|
||||
|
||||
# echo 1 > /proc/sys/kernel/panic_on_oops
|
||||
|
||||
3) PowerPC specific methods:
|
||||
|
||||
On IBM PowerPC machines, issuing a soft reset invokes the XMON debugger(if
|
||||
XMON is configured). To configure XMON one needs to compile the kernel with
|
||||
the CONFIG_XMON and CONFIG_XMON_DEFAULT options, or by compiling with
|
||||
CONFIG_XMON and booting the kernel with xmon=on option.
|
||||
|
||||
Following are the ways to remotely issue a soft reset on PowerPC boxes, which
|
||||
would drop you to XMON. Pressing a 'X' (capital alphabet X) followed by an
|
||||
'Enter' here will trigger the dump.
|
||||
|
||||
3.1) HMC
|
||||
|
||||
Hardware Management Console(HMC) available on Power4 and Power5 machines allow
|
||||
partitions to be reset remotely. This is specially useful in hang situations
|
||||
where the system is not accepting any keyboard inputs.
|
||||
|
||||
Once you have HMC configured, the following steps will enable you to trigger
|
||||
fadump via a soft reset:
|
||||
|
||||
On Power4
|
||||
Using GUI
|
||||
|
||||
* In the right pane, right click on the partition you wish to dump.
|
||||
* Select "Operating System->Reset".
|
||||
* Select "Soft Reset".
|
||||
* Select "Yes".
|
||||
|
||||
Using HMC Commandline
|
||||
|
||||
# reset_partition -m <machine> -p <partition> -t soft
|
||||
|
||||
On Power5
|
||||
Using GUI
|
||||
|
||||
* In the right pane, right click on the partition you wish to dump.
|
||||
* Select "Restart Partition".
|
||||
* Select "Dump".
|
||||
* Select "OK".
|
||||
|
||||
Using HMC Commandline
|
||||
|
||||
# chsysstate -m <managed system name> -n <lpar name> -o dumprestart -r lpar
|
||||
|
||||
3.2) Blade Management Console for Blade Center
|
||||
|
||||
To initiate a dump operation, go to Power/Restart option under "Blade Tasks" in
|
||||
the Blade Management Console. Select the corresponding blade for which you want
|
||||
to initate the dump and then click "Restart blade with NMI". This issues a
|
||||
system reset and invokes xmon debugger.
|
||||
|
||||
|
||||
Advanced Setups & Failure action:
|
||||
|
||||
Kdump and fadump exhibit similar behavior in terms of setup & failure action.
|
||||
For fadump advanced setup related information see section "Advanced Setups" in
|
||||
"kexec-kdump-howto.txt" document. Refer to "Failure action" section in "kexec-
|
||||
kdump-howto.txt" document for fadump failure action related information.
|
||||
|
||||
Compression and filtering
|
||||
|
||||
Refer "Compression and filtering" section in "kexec-kdump-howto.txt" document.
|
||||
Compression and filtering are same for kdump & fadump.
|
||||
|
||||
|
||||
Notes on rootfs mount:
|
||||
Dracut is designed to mount rootfs by default. If rootfs mounting fails it
|
||||
will refuse to go on. So fadump leaves rootfs mounting to dracut currently.
|
||||
We make the assumtion that proper root= cmdline is being passed to dracut
|
||||
initramfs for the time being. If you need modify "KDUMP_COMMANDLINE=" in
|
||||
/etc/sysconfig/kdump, you will need to make sure that appropriate root=
|
||||
options are copied from /proc/cmdline. In general it is best to append
|
||||
command line options using "KDUMP_COMMANDLINE_APPEND=" instead of replacing
|
||||
the original command line completely.
|
||||
|
||||
How to disable FADump:
|
||||
|
||||
Remove "fadump=on"/"fadump=nocma" from kernel cmdline parameters OR replace
|
||||
it with "fadump=off" kernel cmdline parameter:
|
||||
|
||||
# grubby --update-kernel=/boot/vmlinuz-`uname -r` --remove-args="fadump=on"
|
||||
or
|
||||
# grubby --update-kernel=/boot/vmlinuz-`uname -r` --remove-args="fadump=nocma"
|
||||
OR
|
||||
# grubby --update-kernel=/boot/vmlinuz-`uname -r` --args="fadump=off"
|
||||
|
||||
If KDump is to be used as the dump capturing mechanism, update the crashkernel
|
||||
parameter (Else, remove "crashkernel=" parameter too, using grubby):
|
||||
|
||||
# grubby --update-kernel=/boot/vmlinuz-$kver --args="crashkernl=auto"
|
||||
|
||||
Reboot the system for the settings to take effect.
|
||||
23
kdump-dep-generator.sh
Normal file
23
kdump-dep-generator.sh
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
#!/bin/sh
|
||||
|
||||
# More details about systemd generator:
|
||||
# http://www.freedesktop.org/wiki/Software/systemd/Generators/
|
||||
|
||||
. /usr/lib/kdump/kdump-lib.sh
|
||||
. /usr/lib/kdump/kdump-logger.sh
|
||||
|
||||
# If invokded with no arguments for testing purpose, output to /tmp to
|
||||
# avoid overriding the existing.
|
||||
dest_dir="/tmp"
|
||||
|
||||
if [ -n "$1" ]; then
|
||||
dest_dir=$1
|
||||
fi
|
||||
|
||||
systemd_dir=/usr/lib/systemd/system
|
||||
kdump_wants=$dest_dir/kdump.service.wants
|
||||
|
||||
if is_ssh_dump_target; then
|
||||
mkdir -p $kdump_wants
|
||||
ln -sf $systemd_dir/network-online.target $kdump_wants/
|
||||
fi
|
||||
91
kdump-in-cluster-environment.txt
Normal file
91
kdump-in-cluster-environment.txt
Normal file
|
|
@ -0,0 +1,91 @@
|
|||
Kdump-in-cluster-environment HOWTO
|
||||
|
||||
Introduction
|
||||
|
||||
Kdump is a kexec based crash dumping mechansim for Linux. This docuement
|
||||
illustrate how to configure kdump in cluster environment to allow the kdump
|
||||
crash recovery service complete without being preempted by traditional power
|
||||
fencing methods.
|
||||
|
||||
Overview
|
||||
|
||||
Kexec/Kdump
|
||||
|
||||
Details about Kexec/Kdump are available in Kexec-Kdump-howto file and will not
|
||||
be described here.
|
||||
|
||||
fence_kdump
|
||||
|
||||
fence_kdump is an I/O fencing agent to be used with the kdump crash recovery
|
||||
service. When the fence_kdump agent is invoked, it will listen for a message
|
||||
from the failed node that acknowledges that the failed node is executing the
|
||||
kdump crash kernel. Note that fence_kdump is not a replacement for traditional
|
||||
fencing methods. The fence_kdump agent can only detect that a node has entered
|
||||
the kdump crash recovery service. This allows the kdump crash recovery service
|
||||
complete without being preempted by traditional power fencing methods.
|
||||
|
||||
fence_kdump_send
|
||||
|
||||
fence_kdump_send is a utility used to send messages that acknowledge that the
|
||||
node itself has entered the kdump crash recovery service. The fence_kdump_send
|
||||
utility is typically run in the kdump kernel after a cluster node has
|
||||
encountered a kernel panic. Once the cluster node has entered the kdump crash
|
||||
recovery service, fence_kdump_send will periodically send messages to all
|
||||
cluster nodes. When the fence_kdump agent receives a valid message from the
|
||||
failed nodes, fencing is complete.
|
||||
|
||||
How to configure Pacemaker cluster environment:
|
||||
|
||||
If we want to use kdump in Pacemaker cluster environment, fence-agents-kdump
|
||||
should be installed in every nodes in the cluster. You can achieve this via
|
||||
the following command:
|
||||
|
||||
# yum install -y fence-agents-kdump
|
||||
|
||||
Next is to add kdump_fence to the cluster. Assuming that the cluster consists
|
||||
of three nodes, they are node1, node2 and node3, and use Pacemaker to perform
|
||||
resource management and pcs as cli configuration tool.
|
||||
|
||||
With pcs it is easy to add a stonith resource to the cluster. For example, add
|
||||
a stonith resource named mykdumpfence with fence type of fence_kdump via the
|
||||
following commands:
|
||||
|
||||
# pcs stonith create mykdumpfence fence_kdump \
|
||||
pcmk_host_check=static-list pcmk_host_list="node1 node2 node3"
|
||||
# pcs stonith update mykdumpfence pcmk_monitor_action=metadata --force
|
||||
# pcs stonith update mykdumpfence pcmk_status_action=metadata --force
|
||||
# pcs stonith update mykdumpfence pcmk_reboot_action=off --force
|
||||
|
||||
Then enable stonith
|
||||
# pcs property set stonith-enabled=true
|
||||
|
||||
How to configure kdump:
|
||||
|
||||
Actually there are two ways how to configure fence_kdump support:
|
||||
|
||||
1) Pacemaker based clusters
|
||||
If you have successfully configured fence_kdump in Pacemaker, there is
|
||||
no need to add some special configuration in kdump. So please refer to
|
||||
Kexec-Kdump-howto file for more information.
|
||||
|
||||
2) Generic clusters
|
||||
For other types of clusters there are two configuration options in
|
||||
kdump.conf which enables fence_kdump support:
|
||||
|
||||
fence_kdump_nodes <node(s)>
|
||||
Contains list of cluster node(s) separated by space to send
|
||||
fence_kdump notification to (this option is mandatory to enable
|
||||
fence_kdump)
|
||||
|
||||
fence_kdump_args <arg(s)>
|
||||
Command line arguments for fence_kdump_send (it can contain
|
||||
all valid arguments except hosts to send notification to)
|
||||
|
||||
These options will most probably be configured by your cluster software,
|
||||
so please refer to your cluster documentation how to enable fence_kdump
|
||||
support.
|
||||
|
||||
Please be aware that these two ways cannot be combined and 2) has precedence
|
||||
over 1). It means that if fence_kdump is configured using fence_kdump_nodes
|
||||
and fence_kdump_args options in kdump.conf, Pacemaker configuration is not
|
||||
used even if it exists.
|
||||
247
kdump-lib-initramfs.sh
Executable file
247
kdump-lib-initramfs.sh
Executable file
|
|
@ -0,0 +1,247 @@
|
|||
# These variables and functions are useful in 2nd kernel
|
||||
|
||||
. /lib/kdump-lib.sh
|
||||
. /lib/kdump-logger.sh
|
||||
|
||||
KDUMP_PATH="/var/crash"
|
||||
KDUMP_LOG_FILE="/run/initramfs/kexec-dmesg.log"
|
||||
CORE_COLLECTOR=""
|
||||
DEFAULT_CORE_COLLECTOR="makedumpfile -l --message-level 7 -d 31"
|
||||
DMESG_COLLECTOR="/sbin/vmcore-dmesg"
|
||||
FAILURE_ACTION="systemctl reboot -f"
|
||||
DATEDIR=`date +%Y-%m-%d-%T`
|
||||
HOST_IP='127.0.0.1'
|
||||
DUMP_INSTRUCTION=""
|
||||
SSH_KEY_LOCATION="/root/.ssh/kdump_id_rsa"
|
||||
KDUMP_SCRIPT_DIR="/kdumpscripts"
|
||||
DD_BLKSIZE=512
|
||||
FINAL_ACTION="systemctl reboot -f"
|
||||
KDUMP_CONF="/etc/kdump.conf"
|
||||
KDUMP_PRE=""
|
||||
KDUMP_POST=""
|
||||
NEWROOT="/sysroot"
|
||||
OPALCORE="/sys/firmware/opal/mpipl/core"
|
||||
|
||||
#initiate the kdump logger
|
||||
dlog_init
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "failed to initiate the kdump logger."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
get_kdump_confs()
|
||||
{
|
||||
local config_opt config_val
|
||||
|
||||
while read config_opt config_val;
|
||||
do
|
||||
# remove inline comments after the end of a directive.
|
||||
case "$config_opt" in
|
||||
path)
|
||||
KDUMP_PATH="$config_val"
|
||||
;;
|
||||
core_collector)
|
||||
[ -n "$config_val" ] && CORE_COLLECTOR="$config_val"
|
||||
;;
|
||||
sshkey)
|
||||
if [ -f "$config_val" ]; then
|
||||
SSH_KEY_LOCATION=$config_val
|
||||
fi
|
||||
;;
|
||||
kdump_pre)
|
||||
KDUMP_PRE="$config_val"
|
||||
;;
|
||||
kdump_post)
|
||||
KDUMP_POST="$config_val"
|
||||
;;
|
||||
fence_kdump_args)
|
||||
FENCE_KDUMP_ARGS="$config_val"
|
||||
;;
|
||||
fence_kdump_nodes)
|
||||
FENCE_KDUMP_NODES="$config_val"
|
||||
;;
|
||||
failure_action|default)
|
||||
case $config_val in
|
||||
shell)
|
||||
FAILURE_ACTION="kdump_emergency_shell"
|
||||
;;
|
||||
reboot)
|
||||
FAILURE_ACTION="systemctl reboot -f && exit"
|
||||
;;
|
||||
halt)
|
||||
FAILURE_ACTION="halt && exit"
|
||||
;;
|
||||
poweroff)
|
||||
FAILURE_ACTION="systemctl poweroff -f && exit"
|
||||
;;
|
||||
dump_to_rootfs)
|
||||
FAILURE_ACTION="dump_to_rootfs"
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
final_action)
|
||||
case $config_val in
|
||||
reboot)
|
||||
FINAL_ACTION="systemctl reboot -f"
|
||||
;;
|
||||
halt)
|
||||
FINAL_ACTION="halt"
|
||||
;;
|
||||
poweroff)
|
||||
FINAL_ACTION="systemctl poweroff -f"
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
done <<< "$(read_strip_comments $KDUMP_CONF)"
|
||||
|
||||
if [ -z "$CORE_COLLECTOR" ]; then
|
||||
CORE_COLLECTOR="$DEFAULT_CORE_COLLECTOR"
|
||||
if is_ssh_dump_target || is_raw_dump_target; then
|
||||
CORE_COLLECTOR="$CORE_COLLECTOR -F"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# store the kexec kernel log to a file.
|
||||
save_log()
|
||||
{
|
||||
dmesg -T > $KDUMP_LOG_FILE
|
||||
|
||||
if command -v journalctl > /dev/null; then
|
||||
journalctl -ab >> $KDUMP_LOG_FILE
|
||||
fi
|
||||
}
|
||||
|
||||
# dump_fs <mount point>
|
||||
dump_fs()
|
||||
{
|
||||
local _exitcode
|
||||
local _mp=$1
|
||||
ddebug "dump_fs _mp=$_mp"
|
||||
|
||||
if ! is_mounted "$_mp"; then
|
||||
dinfo "dump path \"$_mp\" is not mounted, trying to mount..."
|
||||
mount --target $_mp
|
||||
if [ $? -ne 0 ]; then
|
||||
derror "failed to dump to \"$_mp\", it's not a mount point!"
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
|
||||
# Remove -F in makedumpfile case. We don't want a flat format dump here.
|
||||
[[ $CORE_COLLECTOR = *makedumpfile* ]] && CORE_COLLECTOR=`echo $CORE_COLLECTOR | sed -e "s/-F//g"`
|
||||
|
||||
local _dump_path=$(echo "$_mp/$KDUMP_PATH/$HOST_IP-$DATEDIR/" | tr -s /)
|
||||
|
||||
dinfo "saving to $_dump_path"
|
||||
|
||||
# Only remount to read-write mode if the dump target is mounted read-only.
|
||||
if [[ "$_op" = "ro"* ]]; then
|
||||
dinfo "Mounting Dump target $_dev in rw mode."
|
||||
mount -o remount,rw $_dev $_mp || return 1
|
||||
fi
|
||||
|
||||
mkdir -p $_dump_path || return 1
|
||||
|
||||
save_vmcore_dmesg_fs ${DMESG_COLLECTOR} "$_dump_path"
|
||||
save_opalcore_fs "$_dump_path"
|
||||
|
||||
dinfo "saving vmcore"
|
||||
$CORE_COLLECTOR /proc/vmcore $_dump_path/vmcore-incomplete
|
||||
_exitcode=$?
|
||||
if [ $_exitcode -eq 0 ]; then
|
||||
mv $_dump_path/vmcore-incomplete $_dump_path/vmcore
|
||||
sync
|
||||
dinfo "saving vmcore complete"
|
||||
else
|
||||
derror "saving vmcore failed, _exitcode:$_exitcode"
|
||||
fi
|
||||
|
||||
dinfo "saving the $KDUMP_LOG_FILE to $_dump_path/"
|
||||
save_log
|
||||
mv $KDUMP_LOG_FILE $_dump_path/
|
||||
if [ $_exitcode -ne 0 ]; then
|
||||
return 1
|
||||
fi
|
||||
|
||||
# improper kernel cmdline can cause the failure of echo, we can ignore this kind of failure
|
||||
return 0
|
||||
}
|
||||
|
||||
save_vmcore_dmesg_fs() {
|
||||
local _dmesg_collector=$1
|
||||
local _path=$2
|
||||
|
||||
dinfo "saving vmcore-dmesg.txt to ${_path}"
|
||||
$_dmesg_collector /proc/vmcore > ${_path}/vmcore-dmesg-incomplete.txt
|
||||
_exitcode=$?
|
||||
if [ $_exitcode -eq 0 ]; then
|
||||
mv ${_path}/vmcore-dmesg-incomplete.txt ${_path}/vmcore-dmesg.txt
|
||||
|
||||
# Make sure file is on disk. There have been instances where later
|
||||
# saving vmcore failed and system rebooted without sync and there
|
||||
# was no vmcore-dmesg.txt available.
|
||||
sync
|
||||
dinfo "saving vmcore-dmesg.txt complete"
|
||||
else
|
||||
derror "saving vmcore-dmesg.txt failed"
|
||||
fi
|
||||
}
|
||||
|
||||
save_opalcore_fs() {
|
||||
local _path=$1
|
||||
|
||||
if [ ! -f $OPALCORE ]; then
|
||||
# Check if we are on an old kernel that uses a different path
|
||||
if [ -f /sys/firmware/opal/core ]; then
|
||||
OPALCORE="/sys/firmware/opal/core"
|
||||
else
|
||||
return 0
|
||||
fi
|
||||
fi
|
||||
|
||||
dinfo "saving opalcore:$OPALCORE to ${_path}/opalcore"
|
||||
cp $OPALCORE ${_path}/opalcore
|
||||
if [ $? -ne 0 ]; then
|
||||
derror "saving opalcore failed"
|
||||
return 1
|
||||
fi
|
||||
|
||||
sync
|
||||
dinfo "saving opalcore complete"
|
||||
return 0
|
||||
}
|
||||
|
||||
dump_to_rootfs()
|
||||
{
|
||||
|
||||
dinfo "Trying to bring up rootfs device"
|
||||
systemctl start dracut-initqueue
|
||||
dinfo "Waiting for rootfs mount, will timeout after 90 seconds"
|
||||
systemctl start sysroot.mount
|
||||
|
||||
ddebug "NEWROOT=$NEWROOT"
|
||||
|
||||
dump_fs $NEWROOT
|
||||
}
|
||||
|
||||
kdump_emergency_shell()
|
||||
{
|
||||
echo "PS1=\"kdump:\\\${PWD}# \"" >/etc/profile
|
||||
ddebug "Switching to dracut emergency..."
|
||||
/bin/dracut-emergency
|
||||
rm -f /etc/profile
|
||||
}
|
||||
|
||||
do_failure_action()
|
||||
{
|
||||
dinfo "Executing failure action $FAILURE_ACTION"
|
||||
eval $FAILURE_ACTION
|
||||
}
|
||||
|
||||
do_final_action()
|
||||
{
|
||||
dinfo "Executing final action $FINAL_ACTION"
|
||||
eval $FINAL_ACTION
|
||||
}
|
||||
825
kdump-lib.sh
Executable file
825
kdump-lib.sh
Executable file
|
|
@ -0,0 +1,825 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# Kdump common variables and functions
|
||||
#
|
||||
|
||||
DEFAULT_PATH="/var/crash/"
|
||||
FENCE_KDUMP_CONFIG_FILE="/etc/sysconfig/fence_kdump"
|
||||
FENCE_KDUMP_SEND="/usr/libexec/fence_kdump_send"
|
||||
FADUMP_ENABLED_SYS_NODE="/sys/kernel/fadump_enabled"
|
||||
|
||||
is_fadump_capable()
|
||||
{
|
||||
# Check if firmware-assisted dump is enabled
|
||||
# if no, fallback to kdump check
|
||||
if [ -f $FADUMP_ENABLED_SYS_NODE ]; then
|
||||
rc=`cat $FADUMP_ENABLED_SYS_NODE`
|
||||
[ $rc -eq 1 ] && return 0
|
||||
fi
|
||||
return 1
|
||||
}
|
||||
|
||||
perror_exit() {
|
||||
derror "$@"
|
||||
exit 1
|
||||
}
|
||||
|
||||
is_fs_type_nfs()
|
||||
{
|
||||
[ "$1" = "nfs" ] || [ "$1" = "nfs4" ]
|
||||
}
|
||||
|
||||
is_ssh_dump_target()
|
||||
{
|
||||
grep -q "^ssh[[:blank:]].*@" /etc/kdump.conf
|
||||
}
|
||||
|
||||
is_nfs_dump_target()
|
||||
{
|
||||
if grep -q "^nfs" /etc/kdump.conf; then
|
||||
return 0;
|
||||
fi
|
||||
|
||||
if is_fs_type_nfs $(get_dracut_args_fstype "$(grep "^dracut_args .*\-\-mount" /etc/kdump.conf)"); then
|
||||
return 0
|
||||
fi
|
||||
|
||||
local _save_path=$(get_save_path)
|
||||
local _target=$(get_target_from_path $_save_path)
|
||||
local _fstype=$(get_fs_type_from_target $_target)
|
||||
|
||||
if is_fs_type_nfs $_fstype; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
return 1
|
||||
}
|
||||
|
||||
is_raw_dump_target()
|
||||
{
|
||||
grep -q "^raw" /etc/kdump.conf
|
||||
}
|
||||
|
||||
is_fs_dump_target()
|
||||
{
|
||||
egrep -q "^ext[234]|^xfs|^btrfs|^minix" /etc/kdump.conf
|
||||
}
|
||||
|
||||
strip_comments()
|
||||
{
|
||||
echo $@ | sed -e 's/\(.*\)#.*/\1/'
|
||||
}
|
||||
|
||||
# Read from kdump config file stripping all comments
|
||||
read_strip_comments()
|
||||
{
|
||||
# strip heading spaces, and print any content starting with
|
||||
# neither space or #, and strip everything after #
|
||||
sed -n -e "s/^\s*\([^# \t][^#]\+\).*/\1/gp" $1
|
||||
}
|
||||
|
||||
# Check if fence kdump is configured in Pacemaker cluster
|
||||
is_pcs_fence_kdump()
|
||||
{
|
||||
# no pcs or fence_kdump_send executables installed?
|
||||
type -P pcs > /dev/null || return 1
|
||||
[ -x $FENCE_KDUMP_SEND ] || return 1
|
||||
|
||||
# fence kdump not configured?
|
||||
(pcs cluster cib | grep 'type="fence_kdump"') &> /dev/null || return 1
|
||||
}
|
||||
|
||||
# Check if fence_kdump is configured using kdump options
|
||||
is_generic_fence_kdump()
|
||||
{
|
||||
[ -x $FENCE_KDUMP_SEND ] || return 1
|
||||
|
||||
grep -q "^fence_kdump_nodes" /etc/kdump.conf
|
||||
}
|
||||
|
||||
to_dev_name() {
|
||||
local dev="${1//\"/}"
|
||||
|
||||
case "$dev" in
|
||||
UUID=*)
|
||||
dev=`blkid -U "${dev#UUID=}"`
|
||||
;;
|
||||
LABEL=*)
|
||||
dev=`blkid -L "${dev#LABEL=}"`
|
||||
;;
|
||||
esac
|
||||
echo $dev
|
||||
}
|
||||
|
||||
is_user_configured_dump_target()
|
||||
{
|
||||
grep -E -q "^ext[234]|^xfs|^btrfs|^minix|^raw|^nfs|^ssh" /etc/kdump.conf || is_mount_in_dracut_args;
|
||||
}
|
||||
|
||||
get_user_configured_dump_disk()
|
||||
{
|
||||
local _target
|
||||
|
||||
_target=$(egrep "^ext[234]|^xfs|^btrfs|^minix|^raw" /etc/kdump.conf 2>/dev/null |awk '{print $2}')
|
||||
[ -n "$_target" ] && echo $_target && return
|
||||
|
||||
_target=$(get_dracut_args_target "$(grep "^dracut_args .*\-\-mount" /etc/kdump.conf)")
|
||||
[ -b "$_target" ] && echo $_target
|
||||
}
|
||||
|
||||
get_root_fs_device()
|
||||
{
|
||||
findmnt -k -f -n -o SOURCE /
|
||||
}
|
||||
|
||||
get_save_path()
|
||||
{
|
||||
local _save_path=$(awk '$1 == "path" {print $2}' /etc/kdump.conf)
|
||||
[ -z "$_save_path" ] && _save_path=$DEFAULT_PATH
|
||||
|
||||
# strip the duplicated "/"
|
||||
echo $_save_path | tr -s /
|
||||
}
|
||||
|
||||
get_block_dump_target()
|
||||
{
|
||||
local _target _path
|
||||
|
||||
if is_ssh_dump_target || is_nfs_dump_target; then
|
||||
return
|
||||
fi
|
||||
|
||||
_target=$(get_user_configured_dump_disk)
|
||||
[ -n "$_target" ] && echo $(to_dev_name $_target) && return
|
||||
|
||||
# Get block device name from local save path
|
||||
_path=$(get_save_path)
|
||||
_target=$(get_target_from_path $_path)
|
||||
[ -b "$_target" ] && echo $(to_dev_name $_target)
|
||||
}
|
||||
|
||||
is_dump_to_rootfs()
|
||||
{
|
||||
grep -E "^(failure_action|default)[[:space:]]dump_to_rootfs" /etc/kdump.conf >/dev/null
|
||||
}
|
||||
|
||||
get_failure_action_target()
|
||||
{
|
||||
local _target
|
||||
|
||||
if is_dump_to_rootfs; then
|
||||
# Get rootfs device name
|
||||
_target=$(get_root_fs_device)
|
||||
[ -b "$_target" ] && echo $(to_dev_name $_target) && return
|
||||
# Then, must be nfs root
|
||||
echo "nfs"
|
||||
fi
|
||||
}
|
||||
|
||||
# Get kdump targets(including root in case of dump_to_rootfs).
|
||||
get_kdump_targets()
|
||||
{
|
||||
local _target _root
|
||||
local kdump_targets
|
||||
|
||||
_target=$(get_block_dump_target)
|
||||
if [ -n "$_target" ]; then
|
||||
kdump_targets=$_target
|
||||
elif is_ssh_dump_target; then
|
||||
kdump_targets="ssh"
|
||||
else
|
||||
kdump_targets="nfs"
|
||||
fi
|
||||
|
||||
# Add the root device if dump_to_rootfs is specified.
|
||||
_root=$(get_failure_action_target)
|
||||
if [ -n "$_root" -a "$kdump_targets" != "$_root" ]; then
|
||||
kdump_targets="$kdump_targets $_root"
|
||||
fi
|
||||
|
||||
echo "$kdump_targets"
|
||||
}
|
||||
|
||||
# Return the bind mount source path, return the path itself if it's not bind mounted
|
||||
# Eg. if /path/to/src is bind mounted to /mnt/bind, then:
|
||||
# /mnt/bind -> /path/to/src, /mnt/bind/dump -> /path/to/src/dump
|
||||
#
|
||||
# findmnt uses the option "-v, --nofsroot" to exclusive the [/dir]
|
||||
# in the SOURCE column for bind-mounts, then if $_src equals to
|
||||
# $_src_nofsroot, the mountpoint is not bind mounted directory.
|
||||
#
|
||||
# Below is just an example for mount info
|
||||
# /dev/mapper/atomicos-root[/ostree/deploy/rhel-atomic-host/var], if the
|
||||
# directory is bind mounted. The former part represents the device path, rest
|
||||
# part is the bind mounted directory which quotes by bracket "[]".
|
||||
get_bind_mount_source()
|
||||
{
|
||||
local _mnt=$(df $1 | tail -1 | awk '{print $NF}')
|
||||
local _path=${1#$_mnt}
|
||||
|
||||
local _src=$(get_mount_info SOURCE target $_mnt -f)
|
||||
local _opt=$(get_mount_info OPTIONS target $_mnt -f)
|
||||
local _fstype=$(get_mount_info FSTYPE target $_mnt -f)
|
||||
|
||||
# bind mount in fstab
|
||||
if [[ -d "$_src" ]] && [[ "$_fstype" = none ]] && (echo "$_opt" | grep -q "\bbind\b"); then
|
||||
echo $_src$_path && return
|
||||
fi
|
||||
|
||||
# direct mount
|
||||
local _src_nofsroot=$(get_mount_info SOURCE target $_mnt -v -f)
|
||||
if [[ $_src_nofsroot = $_src ]]; then
|
||||
echo $_mnt$_path && return
|
||||
fi
|
||||
|
||||
local _fsroot=${_src#$_src_nofsroot[}
|
||||
_fsroot=${_fsroot%]}
|
||||
_mnt=$(get_mount_info TARGET source $_src_nofsroot -f)
|
||||
|
||||
# for btrfs, _fsroot will also contain the subvol value as well, strip it
|
||||
if [[ "$_fstype" = btrfs ]]; then
|
||||
local _subvol
|
||||
_subvol=${_opt#*subvol=}
|
||||
_subvol=${_subvol%,*}
|
||||
_fsroot=${_fsroot#$_subvol}
|
||||
fi
|
||||
echo $_mnt$_fsroot$_path
|
||||
}
|
||||
|
||||
# Return the current underlaying device of a path, ignore bind mounts
|
||||
get_target_from_path()
|
||||
{
|
||||
local _target
|
||||
|
||||
_target=$(df $1 2>/dev/null | tail -1 | awk '{print $1}')
|
||||
[[ "$_target" == "/dev/root" ]] && [[ ! -e /dev/root ]] && _target=$(get_root_fs_device)
|
||||
echo $_target
|
||||
}
|
||||
|
||||
is_mounted()
|
||||
{
|
||||
findmnt -k -n $1 &>/dev/null
|
||||
}
|
||||
|
||||
get_mount_info()
|
||||
{
|
||||
local _info_type=$1 _src_type=$2 _src=$3; shift 3
|
||||
local _info=$(findmnt -k -n -r -o $_info_type --$_src_type $_src $@)
|
||||
|
||||
[ -z "$_info" ] && [ -e "/etc/fstab" ] && _info=$(findmnt -s -n -r -o $_info_type --$_src_type $_src $@)
|
||||
|
||||
echo $_info
|
||||
}
|
||||
|
||||
get_fs_type_from_target()
|
||||
{
|
||||
get_mount_info FSTYPE source $1 -f
|
||||
}
|
||||
|
||||
get_mntopt_from_target()
|
||||
{
|
||||
get_mount_info OPTIONS source $1 -f
|
||||
}
|
||||
# Find the general mount point of a dump target, not the bind mount point
|
||||
get_mntpoint_from_target()
|
||||
{
|
||||
# Expcilitly specify --source to findmnt could ensure non-bind mount is returned
|
||||
get_mount_info TARGET source $1 -f
|
||||
}
|
||||
|
||||
# Get the path where the target will be mounted in kdump kernel
|
||||
# $1: kdump target device
|
||||
get_kdump_mntpoint_from_target()
|
||||
{
|
||||
local _mntpoint=$(get_mntpoint_from_target $1)
|
||||
|
||||
# mount under /sysroot if dump to root disk or mount under
|
||||
# mount under /kdumproot if dump target is not mounted in first kernel
|
||||
# mount under /kdumproot/$_mntpoint in other cases in 2nd kernel.
|
||||
# systemd will be in charge to umount it.
|
||||
if [ -z "$_mntpoint" ];then
|
||||
_mntpoint="/kdumproot"
|
||||
else
|
||||
if [ "$_mntpoint" = "/" ];then
|
||||
_mntpoint="/sysroot"
|
||||
else
|
||||
_mntpoint="/kdumproot/$_mntpoint"
|
||||
fi
|
||||
fi
|
||||
|
||||
# strip duplicated "/"
|
||||
echo $_mntpoint | tr -s "/"
|
||||
}
|
||||
|
||||
# get_option_value <option_name>
|
||||
# retrieves value of option defined in kdump.conf
|
||||
get_option_value() {
|
||||
strip_comments `grep "^$1[[:space:]]\+" /etc/kdump.conf | tail -1 | cut -d\ -f2-`
|
||||
}
|
||||
|
||||
kdump_get_persistent_dev() {
|
||||
local dev="${1//\"/}"
|
||||
|
||||
case "$dev" in
|
||||
UUID=*)
|
||||
dev=`blkid -U "${dev#UUID=}"`
|
||||
;;
|
||||
LABEL=*)
|
||||
dev=`blkid -L "${dev#LABEL=}"`
|
||||
;;
|
||||
esac
|
||||
echo $(get_persistent_dev "$dev")
|
||||
}
|
||||
|
||||
is_ipv6_address()
|
||||
{
|
||||
echo $1 | grep -q ":"
|
||||
}
|
||||
|
||||
# get ip address or hostname from nfs/ssh config value
|
||||
get_remote_host()
|
||||
{
|
||||
local _config_val=$1
|
||||
|
||||
# ipv6 address in kdump.conf is around with "[]",
|
||||
# factor out the ipv6 address
|
||||
_config_val=${_config_val#*@}
|
||||
_config_val=${_config_val%:/*}
|
||||
_config_val=${_config_val#[}
|
||||
_config_val=${_config_val%]}
|
||||
echo $_config_val
|
||||
}
|
||||
|
||||
is_hostname()
|
||||
{
|
||||
local _hostname=`echo $1 | grep ":"`
|
||||
|
||||
if [ -n "$_hostname" ]; then
|
||||
return 1
|
||||
fi
|
||||
echo $1 | grep -q "[a-zA-Z]"
|
||||
}
|
||||
|
||||
# Copied from "/etc/sysconfig/network-scripts/network-functions"
|
||||
get_hwaddr()
|
||||
{
|
||||
if [ -f "/sys/class/net/${1}/address" ]; then
|
||||
awk '{ print toupper($0) }' < /sys/class/net/${1}/address
|
||||
elif [ -d "/sys/class/net/${1}" ]; then
|
||||
LC_ALL= LANG= ip -o link show ${1} 2>/dev/null | \
|
||||
awk '{ print toupper(gensub(/.*link\/[^ ]* ([[:alnum:]:]*).*/,
|
||||
"\\1", 1)); }'
|
||||
fi
|
||||
}
|
||||
|
||||
get_ifcfg_by_device()
|
||||
{
|
||||
grep -E -i -l "^[[:space:]]*DEVICE=\"*${1}\"*[[:space:]]*$" \
|
||||
/etc/sysconfig/network-scripts/ifcfg-* 2>/dev/null | head -1
|
||||
}
|
||||
|
||||
get_ifcfg_by_hwaddr()
|
||||
{
|
||||
grep -E -i -l "^[[:space:]]*HWADDR=\"*${1}\"*[[:space:]]*$" \
|
||||
/etc/sysconfig/network-scripts/ifcfg-* 2>/dev/null | head -1
|
||||
}
|
||||
|
||||
get_ifcfg_by_uuid()
|
||||
{
|
||||
grep -E -i -l "^[[:space:]]*UUID=\"*${1}\"*[[:space:]]*$" \
|
||||
/etc/sysconfig/network-scripts/ifcfg-* 2>/dev/null | head -1
|
||||
}
|
||||
|
||||
get_ifcfg_by_name()
|
||||
{
|
||||
grep -E -i -l "^[[:space:]]*NAME=\"*${1}\"*[[:space:]]*$" \
|
||||
/etc/sysconfig/network-scripts/ifcfg-* 2>/dev/null | head -1
|
||||
}
|
||||
|
||||
is_nm_running()
|
||||
{
|
||||
[ "$(LANG=C nmcli -t --fields running general status 2>/dev/null)" = "running" ]
|
||||
}
|
||||
|
||||
is_nm_handling()
|
||||
{
|
||||
LANG=C nmcli -t --fields device,state dev status 2>/dev/null \
|
||||
| grep -q "^\(${1}:connected\)\|\(${1}:connecting.*\)$"
|
||||
}
|
||||
|
||||
# $1: netdev name
|
||||
get_ifcfg_nmcli()
|
||||
{
|
||||
local nm_uuid nm_name
|
||||
local ifcfg_file
|
||||
|
||||
# Get the active nmcli config name of $1
|
||||
if is_nm_running && is_nm_handling "${1}" ; then
|
||||
# The configuration "uuid" and "name" generated by nm is wrote to
|
||||
# the ifcfg file as "UUID=<nm_uuid>" and "NAME=<nm_name>".
|
||||
nm_uuid=$(LANG=C nmcli -t --fields uuid,device c show --active 2>/dev/null \
|
||||
| grep "${1}" | head -1 | cut -d':' -f1)
|
||||
nm_name=$(LANG=C nmcli -t --fields name,device c show --active 2>/dev/null \
|
||||
| grep "${1}" | head -1 | cut -d':' -f1)
|
||||
ifcfg_file=$(get_ifcfg_by_uuid "${nm_uuid}")
|
||||
[ -z "${ifcfg_file}" ] && ifcfg_file=$(get_ifcfg_by_name "${nm_name}")
|
||||
fi
|
||||
|
||||
echo -n "${ifcfg_file}"
|
||||
}
|
||||
|
||||
# $1: netdev name
|
||||
get_ifcfg_legacy()
|
||||
{
|
||||
local ifcfg_file
|
||||
|
||||
ifcfg_file="/etc/sysconfig/network-scripts/ifcfg-${1}"
|
||||
[ -f "${ifcfg_file}" ] && echo -n "${ifcfg_file}" && return
|
||||
|
||||
ifcfg_file=$(get_ifcfg_by_name "${1}")
|
||||
[ -f "${ifcfg_file}" ] && echo -n "${ifcfg_file}" && return
|
||||
|
||||
local hwaddr=$(get_hwaddr "${1}")
|
||||
if [ -n "$hwaddr" ]; then
|
||||
ifcfg_file=$(get_ifcfg_by_hwaddr "${hwaddr}")
|
||||
[ -f "${ifcfg_file}" ] && echo -n "${ifcfg_file}" && return
|
||||
fi
|
||||
|
||||
ifcfg_file=$(get_ifcfg_by_device "${1}")
|
||||
|
||||
echo -n "${ifcfg_file}"
|
||||
}
|
||||
|
||||
# $1: netdev name
|
||||
# Return the ifcfg file whole name(including the path) of $1 if any.
|
||||
get_ifcfg_filename() {
|
||||
local ifcfg_file
|
||||
|
||||
ifcfg_file=$(get_ifcfg_nmcli "${1}")
|
||||
if [ -z "${ifcfg_file}" ]; then
|
||||
ifcfg_file=$(get_ifcfg_legacy "${1}")
|
||||
fi
|
||||
|
||||
echo -n "${ifcfg_file}"
|
||||
}
|
||||
|
||||
# returns 0 when omission of a module is desired in dracut_args
|
||||
# returns 1 otherwise
|
||||
is_dracut_mod_omitted() {
|
||||
local dracut_args dracut_mod=$1
|
||||
|
||||
set -- $(grep "^dracut_args" /etc/kdump.conf)
|
||||
while [ $# -gt 0 ]; do
|
||||
case $1 in
|
||||
-o|--omit)
|
||||
[[ " ${2//[^[:alnum:]]/ } " == *" $dracut_mod "* ]] && return 0
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
return 1
|
||||
}
|
||||
|
||||
is_wdt_active() {
|
||||
local active
|
||||
|
||||
[ -d /sys/class/watchdog ] || return 1
|
||||
for dir in /sys/class/watchdog/*; do
|
||||
[ -f "$dir/state" ] || continue
|
||||
active=$(< "$dir/state")
|
||||
[ "$active" = "active" ] && return 0
|
||||
done
|
||||
return 1
|
||||
}
|
||||
|
||||
# If "dracut_args" contains "--mount" information, use it
|
||||
# directly without any check(users are expected to ensure
|
||||
# its correctness).
|
||||
is_mount_in_dracut_args()
|
||||
{
|
||||
grep -q "^dracut_args .*\-\-mount" /etc/kdump.conf
|
||||
}
|
||||
|
||||
# If $1 contains dracut_args "--mount", return <filesystem type>
|
||||
get_dracut_args_fstype()
|
||||
{
|
||||
echo $1 | grep "\-\-mount" | sed "s/.*--mount .\(.*\)/\1/" | cut -d' ' -f3
|
||||
}
|
||||
|
||||
# If $1 contains dracut_args "--mount", return <device>
|
||||
get_dracut_args_target()
|
||||
{
|
||||
echo $1 | grep "\-\-mount" | sed "s/.*--mount .\(.*\)/\1/" | cut -d' ' -f1
|
||||
}
|
||||
|
||||
check_crash_mem_reserved()
|
||||
{
|
||||
local mem_reserved
|
||||
|
||||
mem_reserved=$(cat /sys/kernel/kexec_crash_size)
|
||||
if [ $mem_reserved -eq 0 ]; then
|
||||
derror "No memory reserved for crash kernel"
|
||||
return 1
|
||||
fi
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
check_kdump_feasibility()
|
||||
{
|
||||
if [ ! -e /sys/kernel/kexec_crash_loaded ]; then
|
||||
derror "Kdump is not supported on this kernel"
|
||||
return 1
|
||||
fi
|
||||
check_crash_mem_reserved
|
||||
return $?
|
||||
}
|
||||
|
||||
check_current_kdump_status()
|
||||
{
|
||||
if [ ! -f /sys/kernel/kexec_crash_loaded ];then
|
||||
derror "Perhaps CONFIG_CRASH_DUMP is not enabled in kernel"
|
||||
return 1
|
||||
fi
|
||||
|
||||
rc=`cat /sys/kernel/kexec_crash_loaded`
|
||||
if [ $rc == 1 ]; then
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
# remove_cmdline_param <kernel cmdline> <param1> [<param2>] ... [<paramN>]
|
||||
# Remove a list of kernel parameters from a given kernel cmdline and print the result.
|
||||
# For each "arg" in the removing params list, "arg" and "arg=xxx" will be removed if exists.
|
||||
remove_cmdline_param()
|
||||
{
|
||||
local cmdline=$1
|
||||
shift
|
||||
|
||||
for arg in $@; do
|
||||
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
|
||||
}
|
||||
|
||||
#
|
||||
# This function returns the "apicid" of the boot
|
||||
# cpu (cpu 0) if present.
|
||||
#
|
||||
get_bootcpu_apicid()
|
||||
{
|
||||
awk ' \
|
||||
BEGIN { CPU = "-1"; } \
|
||||
$1=="processor" && $2==":" { CPU = $NF; } \
|
||||
CPU=="0" && /^apicid/ { print $NF; } \
|
||||
' \
|
||||
/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
|
||||
# 4GB of ram available. Returns 1 if we do, 0 if we dont
|
||||
need_64bit_headers()
|
||||
{
|
||||
return `tail -n 1 /proc/iomem | awk '{ split ($1, r, "-"); \
|
||||
print (strtonum("0x" r[2]) > strtonum("0xffffffff")); }'`
|
||||
}
|
||||
|
||||
# Check if secure boot is being enforced.
|
||||
#
|
||||
# Per Peter Jones, we need check efivar SecureBoot-$(the UUID) and
|
||||
# SetupMode-$(the UUID), they are both 5 bytes binary data. The first four
|
||||
# bytes are the attributes associated with the variable and can safely be
|
||||
# ignored, the last bytes are one-byte true-or-false variables. If SecureBoot
|
||||
# is 1 and SetupMode is 0, then secure boot is being enforced.
|
||||
#
|
||||
# Assume efivars is mounted at /sys/firmware/efi/efivars.
|
||||
is_secure_boot_enforced()
|
||||
{
|
||||
local secure_boot_file setup_mode_file
|
||||
local secure_boot_byte setup_mode_byte
|
||||
|
||||
# On powerpc, os-secureboot-enforcing DT property indicates whether secureboot
|
||||
# is enforced. Return success, if it is found.
|
||||
if [ -f /proc/device-tree/ibm,secureboot/os-secureboot-enforcing ]; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
# Detect secure boot on x86 and arm64
|
||||
secure_boot_file=$(find /sys/firmware/efi/efivars -name SecureBoot-* 2>/dev/null)
|
||||
setup_mode_file=$(find /sys/firmware/efi/efivars -name SetupMode-* 2>/dev/null)
|
||||
|
||||
if [ -f "$secure_boot_file" ] && [ -f "$setup_mode_file" ]; then
|
||||
secure_boot_byte=$(hexdump -v -e '/1 "%d\ "' $secure_boot_file|cut -d' ' -f 5)
|
||||
setup_mode_byte=$(hexdump -v -e '/1 "%d\ "' $setup_mode_file|cut -d' ' -f 5)
|
||||
|
||||
if [ "$secure_boot_byte" = "1" ] && [ "$setup_mode_byte" = "0" ]; then
|
||||
return 0
|
||||
fi
|
||||
fi
|
||||
|
||||
# Detect secure boot on s390x
|
||||
if [[ -e "/sys/firmware/ipl/secure" && "$(cat /sys/firmware/ipl/secure)" == "1" ]]; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
return 1
|
||||
}
|
||||
|
||||
#
|
||||
# prepare_kexec_args <kexec args>
|
||||
# This function prepares kexec argument.
|
||||
#
|
||||
prepare_kexec_args()
|
||||
{
|
||||
local kexec_args=$1
|
||||
local found_elf_args
|
||||
|
||||
ARCH=`uname -m`
|
||||
if [ "$ARCH" == "i686" -o "$ARCH" == "i386" ]
|
||||
then
|
||||
need_64bit_headers
|
||||
if [ $? == 1 ]
|
||||
then
|
||||
found_elf_args=`echo $kexec_args | grep elf32-core-headers`
|
||||
if [ -n "$found_elf_args" ]
|
||||
then
|
||||
dwarn "Warning: elf32-core-headers overrides correct elf64 setting"
|
||||
else
|
||||
kexec_args="$kexec_args --elf64-core-headers"
|
||||
fi
|
||||
else
|
||||
found_elf_args=`echo $kexec_args | grep elf64-core-headers`
|
||||
if [ -z "$found_elf_args" ]
|
||||
then
|
||||
kexec_args="$kexec_args --elf32-core-headers"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
echo $kexec_args
|
||||
}
|
||||
|
||||
#
|
||||
# Detect initrd and kernel location, results are stored in global enviromental variables:
|
||||
# KDUMP_BOOTDIR, KDUMP_KERNELVER, KDUMP_KERNEL, DEFAULT_INITRD, and KDUMP_INITRD
|
||||
#
|
||||
# Expectes KDUMP_BOOTDIR, KDUMP_IMG, KDUMP_IMG_EXT, KDUMP_KERNELVER to be loaded from config already
|
||||
# and will prefer already set values so user can specify custom kernel/initramfs location
|
||||
#
|
||||
prepare_kdump_bootinfo()
|
||||
{
|
||||
local boot_imglist boot_dirlist boot_initrdlist curr_kver="$(uname -r)"
|
||||
local machine_id
|
||||
|
||||
if [ -z "$KDUMP_KERNELVER"]; then
|
||||
KDUMP_KERNELVER="$(uname -r)"
|
||||
fi
|
||||
|
||||
read 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
|
||||
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
|
||||
|
||||
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
|
||||
|
||||
if ! [ -e "$KDUMP_KERNEL" ]; then
|
||||
derror "Failed to detect kdump kernel location"
|
||||
return 1
|
||||
fi
|
||||
|
||||
# Set KDUMP_BOOTDIR to where kernel image is stored
|
||||
KDUMP_BOOTDIR=$(dirname $KDUMP_KERNEL)
|
||||
|
||||
# Default initrd should just stay aside of kernel image, try to find it in KDUMP_BOOTDIR
|
||||
boot_initrdlist="initramfs-$KDUMP_KERNELVER.img initrd"
|
||||
for initrd in $boot_initrdlist; do
|
||||
if [ -f "$KDUMP_BOOTDIR/$initrd" ]; then
|
||||
DEFAULT_INITRD="$KDUMP_BOOTDIR/$initrd"
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
# Get kdump initrd from default initrd filename
|
||||
# initramfs-5.7.9-200.fc32.x86_64.img => initramfs-5.7.9-200.fc32.x86_64kdump.img
|
||||
# initrd => initrdkdump
|
||||
if [[ -z "$DEFAULT_INITRD" ]]; then
|
||||
KDUMP_INITRD=${KDUMP_BOOTDIR}/initramfs-${KDUMP_KERNELVER}kdump.img
|
||||
elif [[ $(basename $DEFAULT_INITRD) == *.* ]]; then
|
||||
KDUMP_INITRD=${DEFAULT_INITRD%.*}kdump.${DEFAULT_INITRD##*.}
|
||||
else
|
||||
KDUMP_INITRD=${DEFAULT_INITRD}kdump
|
||||
fi
|
||||
}
|
||||
|
||||
get_watchdog_drvs()
|
||||
{
|
||||
local _wdtdrvs _drv _dir
|
||||
|
||||
for _dir in /sys/class/watchdog/*; do
|
||||
# device/modalias will return driver of this device
|
||||
[[ -f "$_dir/device/modalias" ]] || continue
|
||||
_drv=$(< "$_dir/device/modalias")
|
||||
_drv=$(modprobe --set-version "$KDUMP_KERNELVER" -R $_drv 2>/dev/null)
|
||||
for i in $_drv; do
|
||||
if ! [[ " $_wdtdrvs " == *" $i "* ]]; then
|
||||
_wdtdrvs="$_wdtdrvs $i"
|
||||
fi
|
||||
done
|
||||
done
|
||||
|
||||
echo $_wdtdrvs
|
||||
}
|
||||
|
||||
#
|
||||
# prepare_cmdline <commandline> <commandline remove> <commandline append>
|
||||
# This function performs a series of edits on the command line.
|
||||
# Store the final result in global $KDUMP_COMMANDLINE.
|
||||
prepare_cmdline()
|
||||
{
|
||||
local cmdline id
|
||||
|
||||
if [ -z "$1" ]; then
|
||||
cmdline=$(cat /proc/cmdline)
|
||||
else
|
||||
cmdline="$1"
|
||||
fi
|
||||
|
||||
# These params should always be removed
|
||||
cmdline=$(remove_cmdline_param "$cmdline" crashkernel panic_on_warn)
|
||||
# These params can be removed configurably
|
||||
cmdline=$(remove_cmdline_param "$cmdline" "$2")
|
||||
|
||||
# Always remove "root=X", as we now explicitly generate all kinds
|
||||
# of dump target mount information including root fs.
|
||||
#
|
||||
# We do this before KDUMP_COMMANDLINE_APPEND, if one really cares
|
||||
# about it(e.g. for debug purpose), then can pass "root=X" using
|
||||
# KDUMP_COMMANDLINE_APPEND.
|
||||
cmdline=$(remove_cmdline_param "$cmdline" root)
|
||||
|
||||
# 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 netroot, rd.iscsi.initiator and iscsi_initiator since
|
||||
# we get duplicate entries for the same in case iscsi code adds
|
||||
# it as well.
|
||||
cmdline=$(remove_cmdline_param "$cmdline" netroot rd.iscsi.initiator iscsi_initiator)
|
||||
|
||||
cmdline="${cmdline} $3"
|
||||
|
||||
id=$(get_bootcpu_apicid)
|
||||
if [ ! -z ${id} ] ; then
|
||||
cmdline=$(append_cmdline "${cmdline}" disable_cpu_apicid ${id})
|
||||
fi
|
||||
|
||||
# If any watchdog is used, set it's pretimeout to 0. pretimeout let
|
||||
# watchdog panic the kernel first, and reset the system after the
|
||||
# panic. If the system is already in kdump, panic is not helpful
|
||||
# and only increase the chance of watchdog failure.
|
||||
for i in $(get_watchdog_drvs); do
|
||||
cmdline+=" $i.pretimeout=0"
|
||||
|
||||
if [[ $i == hpwdt ]]; then
|
||||
# hpwdt have a special parameter kdumptimeout, is's only suppose
|
||||
# to be set to non-zero in first kernel. In kdump, non-zero
|
||||
# value could prevent the watchdog from resetting the system.
|
||||
cmdline+=" $i.kdumptimeout=0"
|
||||
fi
|
||||
done
|
||||
|
||||
echo ${cmdline}
|
||||
}
|
||||
348
kdump-logger.sh
Executable file
348
kdump-logger.sh
Executable file
|
|
@ -0,0 +1,348 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# This comes from the dracut-logger.sh
|
||||
#
|
||||
# The logger defined 4 logging levels:
|
||||
# - ddebug (4)
|
||||
# The DEBUG Level designates fine-grained informational events that are most
|
||||
# useful to debug an application.
|
||||
# - dinfo (3)
|
||||
# The INFO level designates informational messages that highlight the
|
||||
# progress of the application at coarse-grained level.
|
||||
# - dwarn (2)
|
||||
# The WARN level designates potentially harmful situations.
|
||||
# - derror (1)
|
||||
# The ERROR level designates error events that might still allow the
|
||||
# application to continue running.
|
||||
#
|
||||
# Logging is controlled by following global variables:
|
||||
# - @var kdump_stdloglvl - logging level to standard error (console output)
|
||||
# - @var kdump_sysloglvl - logging level to syslog (by logger command)
|
||||
# - @var kdump_kmsgloglvl - logging level to /dev/kmsg (only for boot-time)
|
||||
#
|
||||
# If any of the variables is not set, the function dlog_init() sets it to default:
|
||||
# - In the first kernel:
|
||||
# - @var kdump_stdloglvl = 3 (info)
|
||||
# - @var kdump_sysloglvl = 0 (no logging)
|
||||
# - @var kdump_kmsgloglvl = 0 (no logging)
|
||||
#
|
||||
# -In the second kernel:
|
||||
# - @var kdump_stdloglvl = 0 (no logging)
|
||||
# - @var kdump_sysloglvl = 3 (info)
|
||||
# - @var kdump_kmsgloglvl = 0 (no logging)
|
||||
#
|
||||
# First of all you have to start with dlog_init() function which initializes
|
||||
# required variables. Don't call any other logging function before that one!
|
||||
#
|
||||
|
||||
# Define vairables for the log levels in this module.
|
||||
kdump_stdloglvl=""
|
||||
kdump_sysloglvl=""
|
||||
kdump_kmsgloglvl=""
|
||||
|
||||
# The dracut-lib.sh is only available in the second kernel, and it won't
|
||||
# be used in the first kernel because the dracut-lib.sh is invisible in
|
||||
# the first kernel.
|
||||
if [ -f /lib/dracut-lib.sh ]; then
|
||||
. /lib/dracut-lib.sh
|
||||
fi
|
||||
|
||||
# @brief Get the log level from kernel command line.
|
||||
# @retval 1 if something has gone wrong
|
||||
# @retval 0 on success.
|
||||
#
|
||||
get_kdump_loglvl()
|
||||
{
|
||||
(type -p getarg) && kdump_sysloglvl=$(getarg rd.kdumploglvl)
|
||||
[ -z "$kdump_sysloglvl" ] && return 1;
|
||||
|
||||
(type -p isdigit) && isdigit $kdump_sysloglvl
|
||||
[ $? -ne 0 ] && return 1;
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
# @brief Check the log level.
|
||||
# @retval 1 if something has gone wrong
|
||||
# @retval 0 on success.
|
||||
#
|
||||
check_loglvl()
|
||||
{
|
||||
case "$1" in
|
||||
0|1|2|3|4)
|
||||
return 0
|
||||
;;
|
||||
*)
|
||||
return 1
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
# @brief Initializes Logger.
|
||||
# @retval 1 if something has gone wrong
|
||||
# @retval 0 on success.
|
||||
#
|
||||
dlog_init() {
|
||||
local ret=0; local errmsg
|
||||
|
||||
if [ -s /proc/vmcore ];then
|
||||
get_kdump_loglvl
|
||||
if [ $? -ne 0 ];then
|
||||
logger -t "kdump[$$]" -p warn -- "Kdump is using the default log level(3)."
|
||||
kdump_sysloglvl=3
|
||||
fi
|
||||
kdump_stdloglvl=0
|
||||
kdump_kmsgloglvl=0
|
||||
else
|
||||
kdump_stdloglvl=$KDUMP_STDLOGLVL
|
||||
kdump_sysloglvl=$KDUMP_SYSLOGLVL
|
||||
kdump_kmsgloglvl=$KDUMP_KMSGLOGLVL
|
||||
fi
|
||||
|
||||
[ -z "$kdump_stdloglvl" ] && kdump_stdloglvl=3
|
||||
[ -z "$kdump_sysloglvl" ] && kdump_sysloglvl=0
|
||||
[ -z "$kdump_kmsgloglvl" ] && kdump_kmsgloglvl=0
|
||||
|
||||
for loglvl in "$kdump_stdloglvl" "$kdump_kmsgloglvl" "$kdump_sysloglvl"; do
|
||||
check_loglvl "$loglvl"
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Illegal log level: $kdump_stdloglvl $kdump_kmsgloglvl $kdump_sysloglvl"
|
||||
return 1
|
||||
fi
|
||||
done
|
||||
|
||||
# Skip initialization if it's already done.
|
||||
[ -n "$kdump_maxloglvl" ] && return 0
|
||||
|
||||
if [[ $UID -ne 0 ]]; then
|
||||
kdump_kmsgloglvl=0
|
||||
kdump_sysloglvl=0
|
||||
fi
|
||||
|
||||
if [[ $kdump_sysloglvl -gt 0 ]]; then
|
||||
if [[ -d /run/systemd/journal ]] \
|
||||
&& type -P systemd-cat &>/dev/null \
|
||||
&& systemctl --quiet is-active systemd-journald.socket &>/dev/null; then
|
||||
readonly _systemdcatfile="/var/tmp/systemd-cat"
|
||||
mkfifo "$_systemdcatfile" &>/dev/null
|
||||
readonly _dlogfd=15
|
||||
systemd-cat -t 'kdump' --level-prefix=true <"$_systemdcatfile" &
|
||||
exec 15>"$_systemdcatfile"
|
||||
elif ! [ -S /dev/log -a -w /dev/log ] || ! command -v logger >/dev/null; then
|
||||
# We cannot log to syslog, so turn this facility off.
|
||||
kdump_kmsgloglvl=$kdump_sysloglvl
|
||||
kdump_sysloglvl=0
|
||||
ret=1
|
||||
errmsg="No '/dev/log' or 'logger' included for syslog logging"
|
||||
fi
|
||||
fi
|
||||
|
||||
local lvl; local maxloglvl_l=0
|
||||
for lvl in $kdump_stdloglvl $kdump_sysloglvl $kdump_kmsgloglvl; do
|
||||
[[ $lvl -gt $maxloglvl_l ]] && maxloglvl_l=$lvl
|
||||
done
|
||||
readonly kdump_maxloglvl=$maxloglvl_l
|
||||
export kdump_maxloglvl
|
||||
|
||||
if [[ $kdump_stdloglvl -lt 4 ]] && [[ $kdump_kmsgloglvl -lt 4 ]] && [[ $kdump_sysloglvl -lt 4 ]]; then
|
||||
unset ddebug
|
||||
ddebug() { :; };
|
||||
fi
|
||||
|
||||
if [[ $kdump_stdloglvl -lt 3 ]] && [[ $kdump_kmsgloglvl -lt 3 ]] && [[ $kdump_sysloglvl -lt 3 ]]; then
|
||||
unset dinfo
|
||||
dinfo() { :; };
|
||||
fi
|
||||
|
||||
if [[ $kdump_stdloglvl -lt 2 ]] && [[ $kdump_kmsgloglvl -lt 2 ]] && [[ $kdump_sysloglvl -lt 2 ]]; then
|
||||
unset dwarn
|
||||
dwarn() { :; };
|
||||
unset dwarning
|
||||
dwarning() { :; };
|
||||
fi
|
||||
|
||||
if [[ $kdump_stdloglvl -lt 1 ]] && [[ $kdump_kmsgloglvl -lt 1 ]] && [[ $kdump_sysloglvl -lt 1 ]]; then
|
||||
unset derror
|
||||
derror() { :; };
|
||||
fi
|
||||
|
||||
[ -n "$errmsg" ] && derror "$errmsg"
|
||||
|
||||
return $ret
|
||||
}
|
||||
|
||||
## @brief Converts numeric level to logger priority defined by POSIX.2.
|
||||
#
|
||||
# @param lvl Numeric logging level in range from 1 to 4.
|
||||
# @retval 1 if @a lvl is out of range.
|
||||
# @retval 0 if @a lvl is correct.
|
||||
# @result Echoes logger priority.
|
||||
_lvl2syspri() {
|
||||
case "$1" in
|
||||
1) echo error;;
|
||||
2) echo warning;;
|
||||
3) echo info;;
|
||||
4) echo debug;;
|
||||
*) return 1;;
|
||||
esac
|
||||
}
|
||||
|
||||
## @brief Converts logger numeric level to syslog log level
|
||||
#
|
||||
# @param lvl Numeric logging level in range from 1 to 4.
|
||||
# @retval 1 if @a lvl is out of range.
|
||||
# @retval 0 if @a lvl is correct.
|
||||
# @result Echoes kernel console numeric log level
|
||||
#
|
||||
# Conversion is done as follows:
|
||||
#
|
||||
# <tt>
|
||||
# none -> LOG_EMERG (0)
|
||||
# none -> LOG_ALERT (1)
|
||||
# none -> LOG_CRIT (2)
|
||||
# ERROR(1) -> LOG_ERR (3)
|
||||
# WARN(2) -> LOG_WARNING (4)
|
||||
# none -> LOG_NOTICE (5)
|
||||
# INFO(3) -> LOG_INFO (6)
|
||||
# DEBUG(4) -> LOG_DEBUG (7)
|
||||
# </tt>
|
||||
#
|
||||
# @see /usr/include/sys/syslog.h
|
||||
_dlvl2syslvl() {
|
||||
local lvl
|
||||
|
||||
case "$1" in
|
||||
1) lvl=3;;
|
||||
2) lvl=4;;
|
||||
3) lvl=6;;
|
||||
4) lvl=7;;
|
||||
*) return 1;;
|
||||
esac
|
||||
|
||||
# The number is constructed by multiplying the facility by 8 and then
|
||||
# adding the level.
|
||||
# About The Syslog Protocol, please refer to the RFC5424 for more details.
|
||||
echo $((24+$lvl))
|
||||
}
|
||||
|
||||
## @brief Prints to stderr, to syslog and/or /dev/kmsg given message with
|
||||
# given level (priority).
|
||||
#
|
||||
# @param lvl Numeric logging level.
|
||||
# @param msg Message.
|
||||
# @retval 0 It's always returned, even if logging failed.
|
||||
#
|
||||
# @note This function is not supposed to be called manually. Please use
|
||||
# dinfo(), ddebug(), or others instead which wrap this one.
|
||||
#
|
||||
# This is core logging function which logs given message to standard error
|
||||
# and/or syslog (with POSIX shell command <tt>logger</tt>) and/or to /dev/kmsg.
|
||||
# The format is following:
|
||||
#
|
||||
# <tt>X: some message</tt>
|
||||
#
|
||||
# where @c X is the first letter of logging level. See module description for
|
||||
# details on that.
|
||||
#
|
||||
# Message to syslog is sent with tag @c kdump. Priorities are mapped as
|
||||
# following:
|
||||
# - @c ERROR to @c error
|
||||
# - @c WARN to @c warning
|
||||
# - @c INFO to @c info
|
||||
# - @c DEBUG to @c debug
|
||||
_do_dlog() {
|
||||
local lvl="$1"; shift
|
||||
local msg="$*"
|
||||
|
||||
[[ $lvl -le $kdump_stdloglvl ]] && printf -- 'kdump: %s\n' "$msg" >&2
|
||||
|
||||
if [[ $lvl -le $kdump_sysloglvl ]]; then
|
||||
if [[ "$_dlogfd" ]]; then
|
||||
printf -- "<%s>%s\n" "$(($(_dlvl2syslvl $lvl) & 7))" "$msg" >&$_dlogfd
|
||||
else
|
||||
logger -t "kdump[$$]" -p $(_lvl2syspri $lvl) -- "$msg"
|
||||
fi
|
||||
fi
|
||||
|
||||
[[ $lvl -le $kdump_kmsgloglvl ]] && \
|
||||
echo "<$(_dlvl2syslvl $lvl)>kdump[$$] $msg" >/dev/kmsg
|
||||
}
|
||||
|
||||
## @brief Internal helper function for _do_dlog()
|
||||
#
|
||||
# @param lvl Numeric logging level.
|
||||
# @param msg Message.
|
||||
# @retval 0 It's always returned, even if logging failed.
|
||||
#
|
||||
# @note This function is not supposed to be called manually. Please use
|
||||
# dinfo(), ddebug(), or others instead which wrap this one.
|
||||
#
|
||||
# This function calls _do_dlog() either with parameter msg, or if
|
||||
# none is given, it will read standard input and will use every line as
|
||||
# a message.
|
||||
#
|
||||
# This enables:
|
||||
# dwarn "This is a warning"
|
||||
# echo "This is a warning" | dwarn
|
||||
dlog() {
|
||||
[ -z "$kdump_maxloglvl" ] && return 0
|
||||
[[ $1 -le $kdump_maxloglvl ]] || return 0
|
||||
|
||||
if [[ $# -gt 1 ]]; then
|
||||
_do_dlog "$@"
|
||||
else
|
||||
while read line || [ -n "$line" ]; do
|
||||
_do_dlog "$1" "$line"
|
||||
done
|
||||
fi
|
||||
}
|
||||
|
||||
## @brief Logs message at DEBUG level (4)
|
||||
#
|
||||
# @param msg Message.
|
||||
# @retval 0 It's always returned, even if logging failed.
|
||||
ddebug() {
|
||||
set +x
|
||||
dlog 4 "$@"
|
||||
[ -n "$debug" ] && set -x || :
|
||||
}
|
||||
|
||||
## @brief Logs message at INFO level (3)
|
||||
#
|
||||
# @param msg Message.
|
||||
# @retval 0 It's always returned, even if logging failed.
|
||||
dinfo() {
|
||||
set +x
|
||||
dlog 3 "$@"
|
||||
[ -n "$debug" ] && set -x || :
|
||||
}
|
||||
|
||||
## @brief Logs message at WARN level (2)
|
||||
#
|
||||
# @param msg Message.
|
||||
# @retval 0 It's always returned, even if logging failed.
|
||||
dwarn() {
|
||||
set +x
|
||||
dlog 2 "$@"
|
||||
[ -n "$debug" ] && set -x || :
|
||||
}
|
||||
|
||||
## @brief It's an alias to dwarn() function.
|
||||
#
|
||||
# @param msg Message.
|
||||
# @retval 0 It's always returned, even if logging failed.
|
||||
dwarning() {
|
||||
set +x
|
||||
dwarn "$@"
|
||||
[ -n "$debug" ] && set -x || :
|
||||
}
|
||||
|
||||
## @brief Logs message at ERROR level (1)
|
||||
#
|
||||
# @param msg Message.
|
||||
# @retval 0 It's always returned, even if logging failed.
|
||||
derror() {
|
||||
set +x
|
||||
dlog 1 "$@"
|
||||
[ -n "$debug" ] && set -x || :
|
||||
}
|
||||
42
kdump-udev-throttler
Executable file
42
kdump-udev-throttler
Executable file
|
|
@ -0,0 +1,42 @@
|
|||
#!/bin/bash
|
||||
# This util helps to reduce the workload of kdump service restarting
|
||||
# on udev event. When hotplugging memory / CPU, multiple udev
|
||||
# events may be triggered concurrently, and obviously, we don't want
|
||||
# to restart kdump service for each event.
|
||||
|
||||
# This script will be called by udev, and make sure kdump service is
|
||||
# restart after all events we are watching are settled.
|
||||
|
||||
# On each call, this script will update try to aquire the $throttle_lock
|
||||
# The first instance acquired the file lock will keep waiting for events
|
||||
# to settle and then reload kdump. Other instances will just exit
|
||||
# In this way, we can make sure kdump service is restarted immediately
|
||||
# and for exactly once after udev events are settled.
|
||||
|
||||
throttle_lock="/var/lock/kdump-udev-throttle"
|
||||
|
||||
exec 9>$throttle_lock
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Failed to create the lock file! Fallback to non-throttled kdump service restart"
|
||||
/bin/kdumpctl reload
|
||||
exit 1
|
||||
fi
|
||||
|
||||
flock -n 9
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Throttling kdump restart for concurrent udev event"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Wait for at least 1 second, at most 4 seconds for udev to settle
|
||||
# Idealy we will have a less than 1 second lag between udev events settle
|
||||
# and kdump reload
|
||||
sleep 1 && udevadm settle --timeout 3
|
||||
|
||||
# Release the lock, /bin/kdumpctl will block and make the process
|
||||
# holding two locks at the same time and we might miss some events
|
||||
exec 9>&-
|
||||
|
||||
/bin/kdumpctl reload
|
||||
|
||||
exit 0
|
||||
185
kdump.conf
Normal file
185
kdump.conf
Normal file
|
|
@ -0,0 +1,185 @@
|
|||
# This file contains a series of commands to perform (in order) in the kdump
|
||||
# kernel after a kernel crash in the crash kernel(1st kernel) has happened.
|
||||
#
|
||||
# Directives in this file are only applicable to the kdump initramfs, and have
|
||||
# no effect once the root filesystem is mounted and the normal init scripts are
|
||||
# processed.
|
||||
#
|
||||
# Currently, only one dump target and path can be specified. If the dumping to
|
||||
# the configured target fails, the failure action which can be configured via
|
||||
# the "failure_action" directive will be performed.
|
||||
#
|
||||
# Supported options:
|
||||
#
|
||||
# raw <partition>
|
||||
# - Will dd /proc/vmcore into <partition>.
|
||||
# Use persistent device names for partition devices,
|
||||
# such as /dev/vg/<devname>.
|
||||
#
|
||||
# nfs <nfs mount>
|
||||
# - Will mount nfs to <mnt>, and copy /proc/vmcore to
|
||||
# <mnt>/<path>/%HOST-%DATE/, supports DNS.
|
||||
#
|
||||
# ssh <user@server>
|
||||
# - Will save /proc/vmcore to <user@server>:<path>/%HOST-%DATE/,
|
||||
# supports DNS.
|
||||
# NOTE: make sure the user has write permissions on the server.
|
||||
#
|
||||
# sshkey <path>
|
||||
# - Will use the sshkey to do ssh dump.
|
||||
# Specify the path of the ssh key to use when dumping
|
||||
# via ssh. The default value is /root/.ssh/kdump_id_rsa.
|
||||
#
|
||||
# <fs type> <partition>
|
||||
# - Will mount -t <fs type> <partition> <mnt>, and copy
|
||||
# /proc/vmcore to <mnt>/<path>/%HOST_IP-%DATE/.
|
||||
# NOTE: <partition> can be a device node, label or uuid.
|
||||
# It's recommended to use persistent device names
|
||||
# such as /dev/vg/<devname>.
|
||||
# Otherwise it's suggested to use label or uuid.
|
||||
#
|
||||
# path <path>
|
||||
# - "path" represents the file system path in which vmcore
|
||||
# will be saved. If a dump target is specified in
|
||||
# kdump.conf, then "path" is relative to the specified
|
||||
# dump target.
|
||||
#
|
||||
# Interpretation of "path" changes a bit if the user didn't
|
||||
# specify any dump target explicitly in kdump.conf. In this
|
||||
# case, "path" represents the absolute path from root. The
|
||||
# dump target and adjusted path are arrived at automatically
|
||||
# depending on what's mounted in the current system.
|
||||
#
|
||||
# Ignored for raw device dumps. If unset, will use the default
|
||||
# "/var/crash".
|
||||
#
|
||||
# core_collector <command> <options>
|
||||
# - This allows you to specify the command to copy
|
||||
# the vmcore. The default is makedumpfile, which on
|
||||
# some architectures can drastically reduce vmcore size.
|
||||
# See /sbin/makedumpfile --help for a list of options.
|
||||
# Note that the -i and -g options are not needed here,
|
||||
# as the initrd will automatically be populated with a
|
||||
# config file appropriate for the running kernel.
|
||||
# The default core_collector for raw/ssh dump is:
|
||||
# "makedumpfile -F -l --message-level 7 -d 31".
|
||||
# The default core_collector for other targets is:
|
||||
# "makedumpfile -l --message-level 7 -d 31".
|
||||
#
|
||||
# "makedumpfile -F" will create a flattened vmcore.
|
||||
# You need to use "makedumpfile -R" to rearrange the dump data to
|
||||
# a normal dumpfile readable with analysis tools. For example:
|
||||
# "makedumpfile -R vmcore < vmcore.flat".
|
||||
#
|
||||
# For core_collector format details, you can refer to
|
||||
# kexec-kdump-howto.txt or kdump.conf manpage.
|
||||
#
|
||||
# kdump_post <binary | script>
|
||||
# - This directive allows you to run a executable binary
|
||||
# or script after the vmcore dump process terminates.
|
||||
# The exit status of the current dump process is fed to
|
||||
# the executable binary or script as its first argument.
|
||||
# All files under /etc/kdump/post.d are collectively sorted
|
||||
# and executed in lexical order, before binary or script
|
||||
# specified kdump_post parameter is executed.
|
||||
#
|
||||
# kdump_pre <binary | script>
|
||||
# - Works like the "kdump_post" directive, but instead of running
|
||||
# after the dump process, runs immediately before it.
|
||||
# Exit status of this binary is interpreted as follows:
|
||||
# 0 - continue with dump process as usual
|
||||
# non 0 - run the final action (reboot/poweroff/halt)
|
||||
# All files under /etc/kdump/pre.d are collectively sorted and
|
||||
# executed in lexical order, after binary or script specified
|
||||
# kdump_pre parameter is executed.
|
||||
# Even if the binary or script in /etc/kdump/pre.d directory
|
||||
# returns non 0 exit status, the processing is continued.
|
||||
#
|
||||
# extra_bins <binaries | shell scripts>
|
||||
# - This directive allows you to specify additional binaries or
|
||||
# shell scripts to be included in the kdump initrd.
|
||||
# Generally they are useful in conjunction with a kdump_post
|
||||
# or kdump_pre binary or script which depends on these extra_bins.
|
||||
#
|
||||
# extra_modules <module(s)>
|
||||
# - This directive allows you to specify extra kernel modules
|
||||
# that you want to be loaded in the kdump initrd.
|
||||
# Multiple modules can be listed, separated by spaces, and any
|
||||
# dependent modules will automatically be included.
|
||||
#
|
||||
# failure_action <reboot | halt | poweroff | shell | dump_to_rootfs>
|
||||
# - Action to perform in case dumping fails.
|
||||
# reboot: Reboot the system.
|
||||
# halt: Halt the system.
|
||||
# poweroff: Power down the system.
|
||||
# shell: Drop to a bash shell.
|
||||
# Exiting the shell reboots the system by default,
|
||||
# or perform "final_action".
|
||||
# dump_to_rootfs: Dump vmcore to rootfs from initramfs context and
|
||||
# reboot by default or perform "final_action".
|
||||
# Useful when non-root dump target is specified.
|
||||
# The default option is "reboot".
|
||||
#
|
||||
# default <reboot | halt | poweroff | shell | dump_to_rootfs>
|
||||
# - Same as the "failure_action" directive above, but this directive
|
||||
# is obsolete and will be removed in the future.
|
||||
#
|
||||
# final_action <reboot | halt | poweroff>
|
||||
# - Action to perform in case dumping succeeds. Also performed
|
||||
# when "shell" or "dump_to_rootfs" failure action finishes.
|
||||
# Each action is same as the "failure_action" directive above.
|
||||
# The default is "reboot".
|
||||
#
|
||||
# force_rebuild <0 | 1>
|
||||
# - By default, kdump initrd will only be rebuilt when necessary.
|
||||
# Specify 1 to force rebuilding kdump initrd every time when kdump
|
||||
# service starts.
|
||||
#
|
||||
# force_no_rebuild <0 | 1>
|
||||
# - By default, kdump initrd will be rebuilt when necessary.
|
||||
# Specify 1 to bypass rebuilding of kdump initrd.
|
||||
#
|
||||
# force_no_rebuild and force_rebuild options are mutually
|
||||
# exclusive and they should not be set to 1 simultaneously.
|
||||
#
|
||||
# override_resettable <0 | 1>
|
||||
# - Usually an unresettable block device can't be a dump target.
|
||||
# Specifying 1 when you want to dump even though the block
|
||||
# target is unresettable
|
||||
# By default, it is 0, which will not try dumping destined to fail.
|
||||
#
|
||||
# dracut_args <arg(s)>
|
||||
# - Pass extra dracut options when rebuilding kdump initrd.
|
||||
#
|
||||
# fence_kdump_args <arg(s)>
|
||||
# - Command line arguments for fence_kdump_send (it can contain
|
||||
# all valid arguments except hosts to send notification to).
|
||||
#
|
||||
# fence_kdump_nodes <node(s)>
|
||||
# - List of cluster node(s) except localhost, separated by spaces,
|
||||
# to send fence_kdump notifications to.
|
||||
# (this option is mandatory to enable fence_kdump).
|
||||
#
|
||||
|
||||
#raw /dev/vg/lv_kdump
|
||||
#ext4 /dev/vg/lv_kdump
|
||||
#ext4 LABEL=/boot
|
||||
#ext4 UUID=03138356-5e61-4ab3-b58e-27507ac41937
|
||||
#nfs my.server.com:/export/tmp
|
||||
#nfs [2001:db8::1:2:3:4]:/export/tmp
|
||||
#ssh user@my.server.com
|
||||
#ssh user@2001:db8::1:2:3:4
|
||||
#sshkey /root/.ssh/kdump_id_rsa
|
||||
path /var/crash
|
||||
core_collector makedumpfile -l --message-level 7 -d 31
|
||||
#core_collector scp
|
||||
#kdump_post /var/crash/scripts/kdump-post.sh
|
||||
#kdump_pre /var/crash/scripts/kdump-pre.sh
|
||||
#extra_bins /usr/bin/lftp
|
||||
#extra_modules gfs2
|
||||
#failure_action shell
|
||||
#force_rebuild 1
|
||||
#force_no_rebuild 1
|
||||
#dracut_args --omit-drivers "cfg80211 snd" --add-drivers "ext2 ext3"
|
||||
#fence_kdump_args -p 7410 -f auto -c 0 -i 10
|
||||
#fence_kdump_nodes node1 node2
|
||||
375
kdump.conf.5
Normal file
375
kdump.conf.5
Normal file
|
|
@ -0,0 +1,375 @@
|
|||
.TH KDUMP.CONF 5 "07/23/2008" "kexec-tools"
|
||||
|
||||
.SH NAME
|
||||
kdump.conf \- configuration file for kdump kernel.
|
||||
|
||||
.SH DESCRIPTION
|
||||
|
||||
kdump.conf is a configuration file for the kdump kernel crash
|
||||
collection service.
|
||||
|
||||
kdump.conf provides post-kexec instructions to the kdump kernel. It is
|
||||
stored in the initrd file managed by the kdump service. If you change
|
||||
this file and do not want to reboot in order for the changes to take
|
||||
effect, restart the kdump service to rebuild the initrd.
|
||||
|
||||
For most configurations, you can simply review the examples provided
|
||||
in the stock /etc/kdump.conf.
|
||||
|
||||
.B NOTE:
|
||||
For filesystem dumps the dump target must be mounted before building
|
||||
kdump initramfs.
|
||||
|
||||
kdump.conf only affects the behavior of the initramfs. Please read the
|
||||
kdump operational flow section of kexec-kdump-howto.txt in the docs to better
|
||||
understand how this configuration file affects the behavior of kdump.
|
||||
|
||||
.SH OPTIONS
|
||||
|
||||
.B raw <partition>
|
||||
.RS
|
||||
Will dd /proc/vmcore into <partition>. Use persistent device names for
|
||||
partition devices, such as /dev/vg/<devname>.
|
||||
.RE
|
||||
|
||||
.B nfs <nfs mount>
|
||||
.RS
|
||||
Will mount nfs to <mnt>, and copy /proc/vmcore to <mnt>/<path>/%HOST-%DATE/,
|
||||
supports DNS. Note that a fqdn should be used as the server name in the
|
||||
mount point.
|
||||
.RE
|
||||
|
||||
.B ssh <user@server>
|
||||
.RS
|
||||
Will save /proc/vmcore through ssh pipe to <user@server>:<path>/%HOST-%DATE/,
|
||||
supports DNS. NOTE: make sure user has necessary write permissions on
|
||||
server and that a fqdn is used as the server name.
|
||||
.RE
|
||||
|
||||
.B sshkey <path>
|
||||
.RS
|
||||
Specify the path of the ssh key to use when dumping via ssh.
|
||||
The default value is /root/.ssh/kdump_id_rsa.
|
||||
.RE
|
||||
|
||||
.B <fs type> <partition>
|
||||
.RS
|
||||
Will mount -t <fs type> <partition> <mnt>, and copy /proc/vmcore to
|
||||
<mnt>/<path>/%HOST_IP-%DATE/. NOTE: <partition> can be a device node, label
|
||||
or uuid. It's recommended to use persistent device names such as
|
||||
/dev/vg/<devname>. Otherwise it's suggested to use label or uuid.
|
||||
.RE
|
||||
|
||||
.B path <path>
|
||||
.RS
|
||||
"path" represents the file system path in which vmcore will be saved.
|
||||
If a dump target is specified in kdump.conf, then "path" is relative to the
|
||||
specified dump target.
|
||||
.PP
|
||||
Interpretation of "path" changes a bit if the user didn't specify any dump
|
||||
target explicitly in kdump.conf. In this case, "path" represents the
|
||||
absolute path from root. The dump target and adjusted path are arrived
|
||||
at automatically depending on what's mounted in the current system.
|
||||
.PP
|
||||
Ignored for raw device dumps. If unset, will use the default "/var/crash".
|
||||
.RE
|
||||
|
||||
.B core_collector <command> <options>
|
||||
.RS
|
||||
This allows you to specify the command to copy the vmcore.
|
||||
The default is makedumpfile, which on some architectures can drastically reduce
|
||||
core file size. See /sbin/makedumpfile --help for a list of options.
|
||||
Note that the -i and -g options are not needed here, as the initrd
|
||||
will automatically be populated with a config file appropriate
|
||||
for the running kernel.
|
||||
.PP
|
||||
Note 1: About default core collector:
|
||||
The default core_collector for raw/ssh dump is:
|
||||
"makedumpfile -F -l --message-level 7 -d 31".
|
||||
The default core_collector for other targets is:
|
||||
"makedumpfile -l --message-level 7 -d 31".
|
||||
Even if core_collector option is commented out in kdump.conf, makedumpfile
|
||||
is the default core collector and kdump uses it internally.
|
||||
If one does not want makedumpfile as default core_collector, then they
|
||||
need to specify one using core_collector option to change the behavior.
|
||||
.PP
|
||||
Note 2: If "makedumpfile -F" is used then you will get a flattened format
|
||||
vmcore.flat, you will need to use "makedumpfile -R" to rearrange the
|
||||
dump data from standard input to a normal dumpfile (readable with analysis
|
||||
tools).
|
||||
ie. "makedumpfile -R vmcore < vmcore.flat"
|
||||
.PP
|
||||
Note 3: If specified core_collector simply copy the vmcore file to the
|
||||
dump target (eg: cp, scp), the vmcore could be significantly large.
|
||||
Please make sure the dump target has enough space, at leaset larger
|
||||
than the system's RAM.
|
||||
|
||||
.RE
|
||||
|
||||
.B kdump_post <binary | script>
|
||||
.RS
|
||||
This directive allows you to run a specified executable
|
||||
just after the vmcore dump process terminates. The exit
|
||||
status of the current dump process is fed to the kdump_post
|
||||
executable as its first argument($1). Executable can modify
|
||||
it to indicate the new exit status of succeeding dump process,
|
||||
.PP
|
||||
All files under /etc/kdump/post.d are collectively sorted
|
||||
and executed in lexical order, before binary or script
|
||||
specified kdump_post parameter is executed.
|
||||
.PP
|
||||
Note that scripts written for use with this directive must use
|
||||
the /bin/bash interpreter.
|
||||
.RE
|
||||
|
||||
.B kdump_pre <binary | script>
|
||||
.RS
|
||||
Works just like the "kdump_post" directive, but instead
|
||||
of running after the dump process, runs immediately
|
||||
before. Exit status of this binary is interpreted
|
||||
as follows:
|
||||
.PP
|
||||
0 - continue with dump process as usual
|
||||
.PP
|
||||
non 0 - run the final action (reboot/poweroff/halt)
|
||||
.PP
|
||||
All files under /etc/kdump/pre.d are collectively sorted and
|
||||
executed in lexical order, after binary or script specified
|
||||
kdump_pre parameter is executed.
|
||||
Even if the binary or script in /etc/kdump/pre.d directory
|
||||
returns non 0 exit status, the processing is continued.
|
||||
.PP
|
||||
Note that scripts written for this directive must use
|
||||
the /bin/bash interpreter.
|
||||
.RE
|
||||
|
||||
.B extra_bins <binaries | shell scripts>
|
||||
.RS
|
||||
This directive allows you to specify additional
|
||||
binaries or shell scripts you'd like to include in
|
||||
your kdump initrd. Generally only useful in
|
||||
conjunction with a kdump_post binary or script that
|
||||
relies on other binaries or scripts.
|
||||
.RE
|
||||
|
||||
.B extra_modules <module(s)>
|
||||
.RS
|
||||
This directive allows you to specify extra kernel
|
||||
modules that you want to be loaded in the kdump
|
||||
initrd, typically used to set up access to
|
||||
non-boot-path dump targets that might otherwise
|
||||
not be accessible in the kdump environment. Multiple
|
||||
modules can be listed, separated by spaces, and any
|
||||
dependent modules will automatically be included.
|
||||
.RE
|
||||
|
||||
.B failure_action <reboot | halt | poweroff | shell | dump_to_rootfs>
|
||||
.RS
|
||||
Action to perform in case dumping to the intended target fails. The default is "reboot".
|
||||
reboot: Reboot the system (this is what most people will want, as it returns the system
|
||||
to a normal state). halt: Halt the system and lose the vmcore. poweroff: The system
|
||||
will be powered down. shell: Drop to a shell session inside the initramfs, from which
|
||||
you can manually perform additional recovery actions. Exiting this shell reboots the
|
||||
system by default or performs "final_action".
|
||||
Note: kdump uses bash as the default shell. dump_to_rootfs: If non-root dump
|
||||
target is specified, the failure action can be set as dump_to_rootfs. That means when
|
||||
dumping to target fails, dump vmcore to rootfs from initramfs context and reboot
|
||||
by default or perform "final_action".
|
||||
.RE
|
||||
|
||||
.B default <reboot | halt | poweroff | shell | dump_to_rootfs>
|
||||
.RS
|
||||
Same as the "failure_action" directive above, but this directive is obsolete
|
||||
and will be removed in the future.
|
||||
.RE
|
||||
|
||||
.B final_action <reboot | halt | poweroff>
|
||||
.RS
|
||||
Action to perform in case dumping to the intended target succeeds.
|
||||
Also performed when "shell" or "dump_to_rootfs" failure action finishes.
|
||||
Each action is same as the "failure_action" directive above.
|
||||
The default is "reboot".
|
||||
.RE
|
||||
|
||||
.B force_rebuild <0 | 1>
|
||||
.RS
|
||||
By default, kdump initrd will only be rebuilt when necessary.
|
||||
Specify 1 to force rebuilding kdump initrd every time when kdump service starts.
|
||||
.RE
|
||||
|
||||
.B force_no_rebuild <0 | 1>
|
||||
.RS
|
||||
By default, kdump initrd will be rebuilt when necessary.
|
||||
Specify 1 to bypass rebuilding of kdump initrd.
|
||||
|
||||
.PP
|
||||
force_no_rebuild and force_rebuild options are mutually exclusive and
|
||||
they should not be set to 1 simultaneously.
|
||||
.RE
|
||||
|
||||
.B override_resettable <0 | 1>
|
||||
.RS
|
||||
Usually an unresettable block device can't be a dump target. Specifying 1 means
|
||||
that even though the block target is unresettable, the user wants to try dumping anyway.
|
||||
By default, it's set to 0, which will not try something destined to fail.
|
||||
.RE
|
||||
|
||||
|
||||
.B dracut_args <arg(s)>
|
||||
.RS
|
||||
Kdump uses dracut to generate initramfs for second kernel. This option
|
||||
allows a user to pass arguments to dracut directly.
|
||||
.RE
|
||||
|
||||
|
||||
.B fence_kdump_args <arg(s)>
|
||||
.RS
|
||||
Command line arguments for fence_kdump_send (it can contain all valid
|
||||
arguments except hosts to send notification to).
|
||||
.RE
|
||||
|
||||
|
||||
.B fence_kdump_nodes <node(s)>
|
||||
.RS
|
||||
List of cluster node(s) except localhost, separated by spaces, to send fence_kdump notification
|
||||
to (this option is mandatory to enable fence_kdump).
|
||||
.RE
|
||||
|
||||
|
||||
.SH DEPRECATED OPTIONS
|
||||
|
||||
.B net <nfs mount>|<user@server>
|
||||
.RS
|
||||
net option is replaced by nfs and ssh options. Use nfs or ssh options
|
||||
directly.
|
||||
.RE
|
||||
|
||||
.B options <module> <option list>
|
||||
.RS
|
||||
Use KDUMP_COMMANDLINE_APPEND in /etc/sysconfig/kdump to add module options as
|
||||
kernel command line parameters. For example, specify 'loop.max_loop=1' to limit
|
||||
maximum loop devices to 1.
|
||||
.RE
|
||||
|
||||
.B link_delay <seconds>
|
||||
.RS
|
||||
link_delay was used to wait for a network device to initialize before using it.
|
||||
Now dracut network module takes care of this issue automatically.
|
||||
.RE
|
||||
|
||||
.B disk_timeout <seconds>
|
||||
.RS
|
||||
Similar to link_delay, dracut ensures disks are ready before kdump uses them.
|
||||
.RE
|
||||
|
||||
.B debug_mem_level <0-3>
|
||||
.RS
|
||||
Turn on verbose debug output of kdump scripts regarding free/used memory at
|
||||
various points of execution. This feature has been
|
||||
moved to dracut now.
|
||||
Use KDUMP_COMMANDLINE_APPEND in /etc/sysconfig/kdump and
|
||||
append dracut cmdline param rd.memdebug=[0-3] to enable the debug output.
|
||||
|
||||
Higher level means more debugging output.
|
||||
.PP
|
||||
0 - no output
|
||||
.PP
|
||||
1 - partial /proc/meminfo
|
||||
.PP
|
||||
2 - /proc/meminfo
|
||||
.PP
|
||||
3 - /proc/meminfo + /proc/slabinfo
|
||||
.RE
|
||||
|
||||
.B blacklist <list of kernel modules>
|
||||
.RS
|
||||
blacklist option was recently being used to prevent loading modules in
|
||||
initramfs. General terminology for blacklist has been that module is
|
||||
present in initramfs but it is not actually loaded in kernel. Hence
|
||||
retaining blacklist option creates more confusing behavior. It has been
|
||||
deprecated.
|
||||
.PP
|
||||
Instead, use rd.driver.blacklist option on second kernel to blacklist
|
||||
a certain module. One can edit /etc/sysconfig/kdump.conf and edit
|
||||
KDUMP_COMMANDLINE_APPEND to pass kernel command line options. Refer
|
||||
to dracut.cmdline man page for more details on module blacklist option.
|
||||
.RE
|
||||
|
||||
.RE
|
||||
|
||||
.SH EXAMPLES
|
||||
Here are some examples for core_collector option:
|
||||
.PP
|
||||
Core collector command format depends on dump target type. Typically for
|
||||
filesystem (local/remote), core_collector should accept two arguments.
|
||||
First one is source file and second one is target file. For ex.
|
||||
.TP
|
||||
ex1.
|
||||
core_collector "cp --sparse=always"
|
||||
|
||||
Above will effectively be translated to:
|
||||
|
||||
cp --sparse=always /proc/vmcore <dest-path>/vmcore
|
||||
.TP
|
||||
ex2.
|
||||
core_collector "makedumpfile -l --message-level 7 -d 31"
|
||||
|
||||
Above will effectively be translated to:
|
||||
|
||||
makedumpfile -l --message-level 7 -d 31 /proc/vmcore <dest-path>/vmcore
|
||||
.PP
|
||||
For dump targets like raw and ssh, in general, core collector should expect
|
||||
one argument (source file) and should output the processed core on standard
|
||||
output (There is one exception of "scp", discussed later). This standard
|
||||
output will be saved to destination using appropriate commands.
|
||||
|
||||
raw dumps examples:
|
||||
.TP
|
||||
ex3.
|
||||
core_collector "cat"
|
||||
|
||||
Above will effectively be translated to.
|
||||
|
||||
cat /proc/vmcore | dd of=<target-device>
|
||||
.TP
|
||||
ex4.
|
||||
core_collector "makedumpfile -F -l --message-level 7 -d 31"
|
||||
|
||||
Above will effectively be translated to.
|
||||
|
||||
makedumpfile -F -l --message-level 7 -d 31 | dd of=<target-device>
|
||||
.PP
|
||||
ssh dumps examples
|
||||
.TP
|
||||
ex5.
|
||||
core_collector "cat"
|
||||
|
||||
Above will effectively be translated to.
|
||||
|
||||
cat /proc/vmcore | ssh <options> <remote-location> "dd of=path/vmcore"
|
||||
.TP
|
||||
ex6.
|
||||
core_collector "makedumpfile -F -l --message-level 7 -d 31"
|
||||
|
||||
Above will effectively be translated to.
|
||||
|
||||
makedumpfile -F -l --message-level 7 -d 31 | ssh <options> <remote-location> "dd of=path/vmcore"
|
||||
|
||||
There is one exception to standard output rule for ssh dumps. And that is
|
||||
scp. As scp can handle ssh destinations for file transfers, one can
|
||||
specify "scp" as core collector for ssh targets (no output on stdout).
|
||||
.TP
|
||||
ex7.
|
||||
core_collector "scp"
|
||||
|
||||
Above will effectively be translated to.
|
||||
|
||||
scp /proc/vmcore <user@host>:path/vmcore
|
||||
|
||||
.PP
|
||||
examples for other options please see
|
||||
.I /etc/kdump.conf
|
||||
|
||||
.SH SEE ALSO
|
||||
|
||||
kexec(8) mkdumprd(8) dracut.cmdline(7)
|
||||
16
kdump.service
Normal file
16
kdump.service
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
[Unit]
|
||||
Description=Crash recovery kernel arming
|
||||
After=network.target network-online.target remote-fs.target basic.target
|
||||
DefaultDependencies=no
|
||||
ConditionKernelCommandLine=crashkernel
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
ExecStart=/usr/bin/kdumpctl start
|
||||
ExecStop=/usr/bin/kdumpctl stop
|
||||
ExecReload=/usr/bin/kdumpctl reload
|
||||
RemainAfterExit=yes
|
||||
StartLimitInterval=0
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
53
kdump.sysconfig
Normal file
53
kdump.sysconfig
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
# Kernel Version string for the -kdump kernel, such as 2.6.13-1544.FC5kdump
|
||||
# If no version is specified, then the init script will try to find a
|
||||
# kdump kernel with the same version number as the running kernel.
|
||||
KDUMP_KERNELVER=""
|
||||
|
||||
# The kdump commandline is the command line that needs to be passed off to
|
||||
# the kdump kernel. This will likely match the contents of the grub kernel
|
||||
# line. For example:
|
||||
# KDUMP_COMMANDLINE="ro root=LABEL=/"
|
||||
# Dracut depends on proper root= options, so please make sure that appropriate
|
||||
# root= options are copied from /proc/cmdline. In general it is best to append
|
||||
# command line options using "KDUMP_COMMANDLINE_APPEND=".
|
||||
# If a command line is not specified, the default will be taken from
|
||||
# /proc/cmdline
|
||||
KDUMP_COMMANDLINE=""
|
||||
|
||||
# This variable lets us remove arguments from the current kdump commandline
|
||||
# as taken from either KDUMP_COMMANDLINE above, or from /proc/cmdline
|
||||
# NOTE: some arguments such as crashkernel will always be removed
|
||||
KDUMP_COMMANDLINE_REMOVE="hugepages hugepagesz slub_debug quiet log_buf_len swiotlb"
|
||||
|
||||
# This variable lets us append arguments to the current kdump commandline
|
||||
# after processed by KDUMP_COMMANDLINE_REMOVE
|
||||
KDUMP_COMMANDLINE_APPEND="irqpoll maxcpus=1 reset_devices novmcoredd"
|
||||
|
||||
# Any additional kexec arguments required. In most situations, this should
|
||||
# be left empty
|
||||
#
|
||||
# Example:
|
||||
# KEXEC_ARGS="--elf32-core-headers"
|
||||
KEXEC_ARGS=""
|
||||
|
||||
#Where to find the boot image
|
||||
#KDUMP_BOOTDIR="/boot"
|
||||
|
||||
#What is the image type used for kdump
|
||||
KDUMP_IMG="vmlinuz"
|
||||
|
||||
# Logging is controlled by following variables in the first kernel:
|
||||
# - @var KDUMP_STDLOGLVL - logging level to standard error (console output)
|
||||
# - @var KDUMP_SYSLOGLVL - logging level to syslog (by logger command)
|
||||
# - @var KDUMP_KMSGLOGLVL - logging level to /dev/kmsg (only for boot-time)
|
||||
#
|
||||
# In the second kernel, kdump will use the rd.kdumploglvl option to set the
|
||||
# log level in the above KDUMP_COMMANDLINE_APPEND.
|
||||
# - @var rd.kdumploglvl - logging level to syslog (by logger command)
|
||||
# - for example: add the rd.kdumploglvl=3 option to KDUMP_COMMANDLINE_APPEND
|
||||
#
|
||||
# Logging levels: no logging(0), error(1),warn(2),info(3),debug(4)
|
||||
#
|
||||
# KDUMP_STDLOGLVL=3
|
||||
# KDUMP_SYSLOGLVL=0
|
||||
# KDUMP_KMSGLOGLVL=0
|
||||
53
kdump.sysconfig.aarch64
Normal file
53
kdump.sysconfig.aarch64
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
# Kernel Version string for the -kdump kernel, such as 2.6.13-1544.FC5kdump
|
||||
# If no version is specified, then the init script will try to find a
|
||||
# kdump kernel with the same version number as the running kernel.
|
||||
KDUMP_KERNELVER=""
|
||||
|
||||
# The kdump commandline is the command line that needs to be passed off to
|
||||
# the kdump kernel. This will likely match the contents of the grub kernel
|
||||
# line. For example:
|
||||
# KDUMP_COMMANDLINE="ro root=LABEL=/"
|
||||
# Dracut depends on proper root= options, so please make sure that appropriate
|
||||
# root= options are copied from /proc/cmdline. In general it is best to append
|
||||
# command line options using "KDUMP_COMMANDLINE_APPEND=".
|
||||
# If a command line is not specified, the default will be taken from
|
||||
# /proc/cmdline
|
||||
KDUMP_COMMANDLINE=""
|
||||
|
||||
# This variable lets us remove arguments from the current kdump commandline
|
||||
# as taken from either KDUMP_COMMANDLINE above, or from /proc/cmdline
|
||||
# NOTE: some arguments such as crashkernel will always be removed
|
||||
KDUMP_COMMANDLINE_REMOVE="hugepages hugepagesz slub_debug quiet log_buf_len swiotlb"
|
||||
|
||||
# This variable lets us append arguments to the current kdump commandline
|
||||
# after processed by KDUMP_COMMANDLINE_REMOVE
|
||||
KDUMP_COMMANDLINE_APPEND="irqpoll nr_cpus=1 reset_devices cgroup_disable=memory udev.children-max=2 panic=10 swiotlb=noforce novmcoredd"
|
||||
|
||||
# Any additional kexec arguments required. In most situations, this should
|
||||
# be left empty
|
||||
#
|
||||
# Example:
|
||||
# KEXEC_ARGS="--elf32-core-headers"
|
||||
KEXEC_ARGS=""
|
||||
|
||||
#Where to find the boot image
|
||||
#KDUMP_BOOTDIR="/boot"
|
||||
|
||||
#What is the image type used for kdump
|
||||
KDUMP_IMG="vmlinuz"
|
||||
|
||||
# Logging is controlled by following variables in the first kernel:
|
||||
# - @var KDUMP_STDLOGLVL - logging level to standard error (console output)
|
||||
# - @var KDUMP_SYSLOGLVL - logging level to syslog (by logger command)
|
||||
# - @var KDUMP_KMSGLOGLVL - logging level to /dev/kmsg (only for boot-time)
|
||||
#
|
||||
# In the second kernel, kdump will use the rd.kdumploglvl option to set the
|
||||
# log level in the above KDUMP_COMMANDLINE_APPEND.
|
||||
# - @var rd.kdumploglvl - logging level to syslog (by logger command)
|
||||
# - for example: add the rd.kdumploglvl=3 option to KDUMP_COMMANDLINE_APPEND
|
||||
#
|
||||
# Logging levels: no logging(0), error(1),warn(2),info(3),debug(4)
|
||||
#
|
||||
# KDUMP_STDLOGLVL=3
|
||||
# KDUMP_SYSLOGLVL=0
|
||||
# KDUMP_KMSGLOGLVL=0
|
||||
56
kdump.sysconfig.i386
Normal file
56
kdump.sysconfig.i386
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
# Kernel Version string for the -kdump kernel, such as 2.6.13-1544.FC5kdump
|
||||
# If no version is specified, then the init script will try to find a
|
||||
# kdump kernel with the same version number as the running kernel.
|
||||
KDUMP_KERNELVER=""
|
||||
|
||||
# The kdump commandline is the command line that needs to be passed off to
|
||||
# the kdump kernel. This will likely match the contents of the grub kernel
|
||||
# line. For example:
|
||||
# KDUMP_COMMANDLINE="ro root=LABEL=/"
|
||||
# Dracut depends on proper root= options, so please make sure that appropriate
|
||||
# root= options are copied from /proc/cmdline. In general it is best to append
|
||||
# command line options using "KDUMP_COMMANDLINE_APPEND=".
|
||||
# If a command line is not specified, the default will be taken from
|
||||
# /proc/cmdline
|
||||
KDUMP_COMMANDLINE=""
|
||||
|
||||
# This variable lets us remove arguments from the current kdump commandline
|
||||
# as taken from either KDUMP_COMMANDLINE above, or from /proc/cmdline
|
||||
# NOTE: some arguments such as crashkernel will always be removed
|
||||
KDUMP_COMMANDLINE_REMOVE="hugepages hugepagesz slub_debug quiet log_buf_len swiotlb"
|
||||
|
||||
# This variable lets us append arguments to the current kdump commandline
|
||||
# after processed by KDUMP_COMMANDLINE_REMOVE
|
||||
KDUMP_COMMANDLINE_APPEND="irqpoll nr_cpus=1 reset_devices numa=off udev.children-max=2 panic=10 transparent_hugepage=never novmcoredd"
|
||||
|
||||
# Any additional kexec arguments required. In most situations, this should
|
||||
# be left empty
|
||||
#
|
||||
# Example:
|
||||
# KEXEC_ARGS="--elf32-core-headers"
|
||||
KEXEC_ARGS=""
|
||||
|
||||
#Where to find the boot image
|
||||
#KDUMP_BOOTDIR="/boot"
|
||||
|
||||
#What is the image type used for kdump
|
||||
KDUMP_IMG="vmlinuz"
|
||||
|
||||
#What is the images extension. Relocatable kernels don't have one
|
||||
KDUMP_IMG_EXT=""
|
||||
|
||||
# Logging is controlled by following variables in the first kernel:
|
||||
# - @var KDUMP_STDLOGLVL - logging level to standard error (console output)
|
||||
# - @var KDUMP_SYSLOGLVL - logging level to syslog (by logger command)
|
||||
# - @var KDUMP_KMSGLOGLVL - logging level to /dev/kmsg (only for boot-time)
|
||||
#
|
||||
# In the second kernel, kdump will use the rd.kdumploglvl option to set the
|
||||
# log level in the above KDUMP_COMMANDLINE_APPEND.
|
||||
# - @var rd.kdumploglvl - logging level to syslog (by logger command)
|
||||
# - for example: add the rd.kdumploglvl=3 option to KDUMP_COMMANDLINE_APPEND
|
||||
#
|
||||
# Logging levels: no logging(0), error(1),warn(2),info(3),debug(4)
|
||||
#
|
||||
# KDUMP_STDLOGLVL=3
|
||||
# KDUMP_SYSLOGLVL=0
|
||||
# KDUMP_KMSGLOGLVL=0
|
||||
58
kdump.sysconfig.ppc64
Normal file
58
kdump.sysconfig.ppc64
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
# Kernel Version string for the -kdump kernel, such as 2.6.13-1544.FC5kdump
|
||||
# If no version is specified, then the init script will try to find a
|
||||
# kdump kernel with the same version number as the running kernel.
|
||||
KDUMP_KERNELVER=""
|
||||
|
||||
# The kdump commandline is the command line that needs to be passed off to
|
||||
# the kdump kernel. This will likely match the contents of the grub kernel
|
||||
# line. For example:
|
||||
# KDUMP_COMMANDLINE="ro root=LABEL=/"
|
||||
# Dracut depends on proper root= options, so please make sure that appropriate
|
||||
# root= options are copied from /proc/cmdline. In general it is best to append
|
||||
# command line options using "KDUMP_COMMANDLINE_APPEND=".
|
||||
# If a command line is not specified, the default will be taken from
|
||||
# /proc/cmdline
|
||||
KDUMP_COMMANDLINE=""
|
||||
|
||||
# This variable lets us remove arguments from the current kdump commandline
|
||||
# as taken from either KDUMP_COMMANDLINE above, or from /proc/cmdline
|
||||
# NOTE: some arguments such as crashkernel will always be removed
|
||||
KDUMP_COMMANDLINE_REMOVE="hugepages hugepagesz slub_debug quiet log_buf_len swiotlb"
|
||||
|
||||
# This variable lets us append arguments to the current kdump commandline
|
||||
# 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"
|
||||
|
||||
# Any additional kexec arguments required. In most situations, this should
|
||||
# be left empty
|
||||
#
|
||||
# Example:
|
||||
# KEXEC_ARGS="--elf32-core-headers"
|
||||
KEXEC_ARGS="--dt-no-old-root"
|
||||
|
||||
#Where to find the boot image
|
||||
#KDUMP_BOOTDIR="/boot"
|
||||
|
||||
#What is the image type used for kdump
|
||||
KDUMP_IMG="vmlinuz"
|
||||
|
||||
#What is the images extension. Relocatable kernels don't have one
|
||||
KDUMP_IMG_EXT=""
|
||||
|
||||
#Specify the action after failure
|
||||
|
||||
# Logging is controlled by following variables in the first kernel:
|
||||
# - @var KDUMP_STDLOGLVL - logging level to standard error (console output)
|
||||
# - @var KDUMP_SYSLOGLVL - logging level to syslog (by logger command)
|
||||
# - @var KDUMP_KMSGLOGLVL - logging level to /dev/kmsg (only for boot-time)
|
||||
#
|
||||
# In the second kernel, kdump will use the rd.kdumploglvl option to set the
|
||||
# log level in the above KDUMP_COMMANDLINE_APPEND.
|
||||
# - @var rd.kdumploglvl - logging level to syslog (by logger command)
|
||||
# - for example: add the rd.kdumploglvl=3 option to KDUMP_COMMANDLINE_APPEND
|
||||
#
|
||||
# Logging levels: no logging(0), error(1),warn(2),info(3),debug(4)
|
||||
#
|
||||
# KDUMP_STDLOGLVL=3
|
||||
# KDUMP_SYSLOGLVL=0
|
||||
# KDUMP_KMSGLOGLVL=0
|
||||
58
kdump.sysconfig.ppc64le
Normal file
58
kdump.sysconfig.ppc64le
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
# Kernel Version string for the -kdump kernel, such as 2.6.13-1544.FC5kdump
|
||||
# If no version is specified, then the init script will try to find a
|
||||
# kdump kernel with the same version number as the running kernel.
|
||||
KDUMP_KERNELVER=""
|
||||
|
||||
# The kdump commandline is the command line that needs to be passed off to
|
||||
# the kdump kernel. This will likely match the contents of the grub kernel
|
||||
# line. For example:
|
||||
# KDUMP_COMMANDLINE="ro root=LABEL=/"
|
||||
# Dracut depends on proper root= options, so please make sure that appropriate
|
||||
# root= options are copied from /proc/cmdline. In general it is best to append
|
||||
# command line options using "KDUMP_COMMANDLINE_APPEND=".
|
||||
# If a command line is not specified, the default will be taken from
|
||||
# /proc/cmdline
|
||||
KDUMP_COMMANDLINE=""
|
||||
|
||||
# This variable lets us remove arguments from the current kdump commandline
|
||||
# as taken from either KDUMP_COMMANDLINE above, or from /proc/cmdline
|
||||
# NOTE: some arguments such as crashkernel will always be removed
|
||||
KDUMP_COMMANDLINE_REMOVE="hugepages hugepagesz slub_debug quiet log_buf_len swiotlb"
|
||||
|
||||
# This variable lets us append arguments to the current kdump commandline
|
||||
# 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"
|
||||
|
||||
# Any additional kexec arguments required. In most situations, this should
|
||||
# be left empty
|
||||
#
|
||||
# Example:
|
||||
# KEXEC_ARGS="--elf32-core-headers"
|
||||
KEXEC_ARGS="--dt-no-old-root"
|
||||
|
||||
#Where to find the boot image
|
||||
#KDUMP_BOOTDIR="/boot"
|
||||
|
||||
#What is the image type used for kdump
|
||||
KDUMP_IMG="vmlinuz"
|
||||
|
||||
#What is the images extension. Relocatable kernels don't have one
|
||||
KDUMP_IMG_EXT=""
|
||||
|
||||
#Specify the action after failure
|
||||
|
||||
# Logging is controlled by following variables in the first kernel:
|
||||
# - @var KDUMP_STDLOGLVL - logging level to standard error (console output)
|
||||
# - @var KDUMP_SYSLOGLVL - logging level to syslog (by logger command)
|
||||
# - @var KDUMP_KMSGLOGLVL - logging level to /dev/kmsg (only for boot-time)
|
||||
#
|
||||
# In the second kernel, kdump will use the rd.kdumploglvl option to set the
|
||||
# log level in the above KDUMP_COMMANDLINE_APPEND.
|
||||
# - @var rd.kdumploglvl - logging level to syslog (by logger command)
|
||||
# - for example: add the rd.kdumploglvl=3 option to KDUMP_COMMANDLINE_APPEND
|
||||
#
|
||||
# Logging levels: no logging(0), error(1),warn(2),info(3),debug(4)
|
||||
#
|
||||
# KDUMP_STDLOGLVL=3
|
||||
# KDUMP_SYSLOGLVL=0
|
||||
# KDUMP_KMSGLOGLVL=0
|
||||
59
kdump.sysconfig.s390x
Normal file
59
kdump.sysconfig.s390x
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
# Kernel Version string for the -kdump kernel, such as 2.6.13-1544.FC5kdump
|
||||
# If no version is specified, then the init script will try to find a
|
||||
# kdump kernel with the same version number as the running kernel.
|
||||
KDUMP_KERNELVER=""
|
||||
|
||||
# The kdump commandline is the command line that needs to be passed off to
|
||||
# the kdump kernel. This will likely match the contents of the grub kernel
|
||||
# line. For example:
|
||||
# KDUMP_COMMANDLINE="ro root=LABEL=/"
|
||||
# Dracut depends on proper root= options, so please make sure that appropriate
|
||||
# root= options are copied from /proc/cmdline. In general it is best to append
|
||||
# command line options using "KDUMP_COMMANDLINE_APPEND=".
|
||||
# If a command line is not specified, the default will be taken from
|
||||
# /proc/cmdline
|
||||
KDUMP_COMMANDLINE=""
|
||||
|
||||
# This variable lets us remove arguments from the current kdump commandline
|
||||
# as taken from either KDUMP_COMMANDLINE above, or from /proc/cmdline
|
||||
# NOTE: some arguments such as crashkernel will always be removed
|
||||
KDUMP_COMMANDLINE_REMOVE="hugepages hugepagesz slub_debug quiet log_buf_len swiotlb"
|
||||
|
||||
# This variable lets us append arguments to the current kdump commandline
|
||||
# after processed by KDUMP_COMMANDLINE_REMOVE
|
||||
KDUMP_COMMANDLINE_APPEND="nr_cpus=1 cgroup_disable=memory numa=off udev.children-max=2 panic=10 transparent_hugepage=never novmcoredd"
|
||||
|
||||
# Any additional /sbin/mkdumprd arguments required.
|
||||
MKDUMPRD_ARGS=""
|
||||
|
||||
# Any additional kexec arguments required. In most situations, this should
|
||||
# be left empty
|
||||
#
|
||||
# Example:
|
||||
# KEXEC_ARGS="--elf32-core-headers"
|
||||
KEXEC_ARGS="-s"
|
||||
|
||||
#Where to find the boot image
|
||||
#KDUMP_BOOTDIR="/boot"
|
||||
|
||||
#What is the image type used for kdump
|
||||
KDUMP_IMG="vmlinuz"
|
||||
|
||||
#What is the images extension. Relocatable kernels don't have one
|
||||
KDUMP_IMG_EXT=""
|
||||
|
||||
# Logging is controlled by following variables in the first kernel:
|
||||
# - @var KDUMP_STDLOGLVL - logging level to standard error (console output)
|
||||
# - @var KDUMP_SYSLOGLVL - logging level to syslog (by logger command)
|
||||
# - @var KDUMP_KMSGLOGLVL - logging level to /dev/kmsg (only for boot-time)
|
||||
#
|
||||
# In the second kernel, kdump will use the rd.kdumploglvl option to set the
|
||||
# log level in the above KDUMP_COMMANDLINE_APPEND.
|
||||
# - @var rd.kdumploglvl - logging level to syslog (by logger command)
|
||||
# - for example: add the rd.kdumploglvl=3 option to KDUMP_COMMANDLINE_APPEND
|
||||
#
|
||||
# Logging levels: no logging(0), error(1),warn(2),info(3),debug(4)
|
||||
#
|
||||
# KDUMP_STDLOGLVL=3
|
||||
# KDUMP_SYSLOGLVL=0
|
||||
# KDUMP_KMSGLOGLVL=0
|
||||
56
kdump.sysconfig.x86_64
Normal file
56
kdump.sysconfig.x86_64
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
# Kernel Version string for the -kdump kernel, such as 2.6.13-1544.FC5kdump
|
||||
# If no version is specified, then the init script will try to find a
|
||||
# kdump kernel with the same version number as the running kernel.
|
||||
KDUMP_KERNELVER=""
|
||||
|
||||
# The kdump commandline is the command line that needs to be passed off to
|
||||
# the kdump kernel. This will likely match the contents of the grub kernel
|
||||
# line. For example:
|
||||
# KDUMP_COMMANDLINE="ro root=LABEL=/"
|
||||
# Dracut depends on proper root= options, so please make sure that appropriate
|
||||
# root= options are copied from /proc/cmdline. In general it is best to append
|
||||
# command line options using "KDUMP_COMMANDLINE_APPEND=".
|
||||
# If a command line is not specified, the default will be taken from
|
||||
# /proc/cmdline
|
||||
KDUMP_COMMANDLINE=""
|
||||
|
||||
# This variable lets us remove arguments from the current kdump commandline
|
||||
# as taken from either KDUMP_COMMANDLINE above, or from /proc/cmdline
|
||||
# NOTE: some arguments such as crashkernel will always be removed
|
||||
KDUMP_COMMANDLINE_REMOVE="hugepages hugepagesz slub_debug quiet log_buf_len swiotlb"
|
||||
|
||||
# This variable lets us append arguments to the current kdump commandline
|
||||
# after processed by KDUMP_COMMANDLINE_REMOVE
|
||||
KDUMP_COMMANDLINE_APPEND="irqpoll nr_cpus=1 reset_devices cgroup_disable=memory mce=off numa=off udev.children-max=2 panic=10 acpi_no_memhotplug transparent_hugepage=never nokaslr hest_disable novmcoredd"
|
||||
|
||||
# Any additional kexec arguments required. In most situations, this should
|
||||
# be left empty
|
||||
#
|
||||
# Example:
|
||||
# KEXEC_ARGS="--elf32-core-headers"
|
||||
KEXEC_ARGS=""
|
||||
|
||||
#Where to find the boot image
|
||||
#KDUMP_BOOTDIR="/boot"
|
||||
|
||||
#What is the image type used for kdump
|
||||
KDUMP_IMG="vmlinuz"
|
||||
|
||||
#What is the images extension. Relocatable kernels don't have one
|
||||
KDUMP_IMG_EXT=""
|
||||
|
||||
# Logging is controlled by following variables in the first kernel:
|
||||
# - @var KDUMP_STDLOGLVL - logging level to standard error (console output)
|
||||
# - @var KDUMP_SYSLOGLVL - logging level to syslog (by logger command)
|
||||
# - @var KDUMP_KMSGLOGLVL - logging level to /dev/kmsg (only for boot-time)
|
||||
#
|
||||
# In the second kernel, kdump will use the rd.kdumploglvl option to set the
|
||||
# log level in the above KDUMP_COMMANDLINE_APPEND.
|
||||
# - @var rd.kdumploglvl - logging level to syslog (by logger command)
|
||||
# - for example: add the rd.kdumploglvl=3 option to KDUMP_COMMANDLINE_APPEND
|
||||
#
|
||||
# Logging levels: no logging(0), error(1),warn(2),info(3),debug(4)
|
||||
#
|
||||
# KDUMP_STDLOGLVL=3
|
||||
# KDUMP_SYSLOGLVL=0
|
||||
# KDUMP_KMSGLOGLVL=0
|
||||
50
kdumpctl.8
Normal file
50
kdumpctl.8
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
.TH KDUMPCTL 8 2015-07-13 kexec-tools
|
||||
|
||||
.SH NAME
|
||||
kdumpctl \- control interface for kdump
|
||||
|
||||
.SH SYNOPSIS
|
||||
.B kdumpctl
|
||||
.I COMMAND
|
||||
|
||||
.SH DESCRIPTION
|
||||
.B kdumpctl
|
||||
is used to check or control the kdump service.
|
||||
In most cases, you should use
|
||||
.B systemctl
|
||||
to start / stop / enable kdump service instead. However,
|
||||
.B kdumpctl
|
||||
provides more details for debug and a helper to setup ssh key authentication.
|
||||
|
||||
.SH COMMANDS
|
||||
.TP
|
||||
.I start
|
||||
Start the service.
|
||||
.TP
|
||||
.I stop
|
||||
Stop the service.
|
||||
.TP
|
||||
.I status
|
||||
Prints the current status of kdump service.
|
||||
It returns non-zero value if kdump is not operational.
|
||||
.TP
|
||||
.I restart
|
||||
Is equal to
|
||||
.I start; stop
|
||||
.TP
|
||||
.I reload
|
||||
reload crash kernel image and initramfs without triggering a rebuild.
|
||||
.TP
|
||||
.I rebuild
|
||||
rebuild the crash kernel initramfs.
|
||||
.TP
|
||||
.I propagate
|
||||
Helps to setup key authentication for ssh storage since it's
|
||||
impossible to use password authentication during kdump.
|
||||
.TP
|
||||
.I showmem
|
||||
Prints the size of reserved memory for crash kernel in megabytes.
|
||||
|
||||
.SH "SEE ALSO"
|
||||
.BR kdump.conf (5),
|
||||
.BR mkdumprd (8)
|
||||
1041
kexec-kdump-howto.txt
Normal file
1041
kexec-kdump-howto.txt
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -0,0 +1,98 @@
|
|||
From 23daba8bb97ff4291447e54859ed759cfe07975e Mon Sep 17 00:00:00 2001
|
||||
From: Kairui Song <kasong@redhat.com>
|
||||
Date: Wed, 29 Jan 2020 10:48:27 +0800
|
||||
Subject: [PATCH] kexec-tools: Remove duplicated variable declarations
|
||||
|
||||
When building kexec-tools for Fedora 32, following error is observed:
|
||||
|
||||
/usr/bin/ld: kexec/arch/x86_64/kexec-bzImage64.o:(.bss+0x0): multiple definition of `bzImage_support_efi_boot';
|
||||
kexec/arch/i386/kexec-bzImage.o:(.bss+0x0): first defined here
|
||||
|
||||
/builddir/build/BUILD/kexec-tools-2.0.20/kexec/arch/arm/../../fs2dt.h:33: multiple definition of `my_debug';
|
||||
kexec/fs2dt.o:/builddir/build/BUILD/kexec-tools-2.0.20/kexec/fs2dt.h:33: first defined here
|
||||
|
||||
/builddir/build/BUILD/kexec-tools-2.0.20/kexec/arch/arm64/kexec-arm64.h:68: multiple definition of `arm64_mem';
|
||||
kexec/fs2dt.o:/builddir/build/BUILD/kexec-tools-2.0.20/././kexec/arch/arm64/kexec-arm64.h:68: first defined here
|
||||
|
||||
/builddir/build/BUILD/kexec-tools-2.0.20/kexec/arch/arm64/kexec-arm64.h:54: multiple definition of `initrd_size';
|
||||
kexec/fs2dt.o:/builddir/build/BUILD/kexec-tools-2.0.20/././kexec/arch/arm64/kexec-arm64.h:54: first defined here
|
||||
|
||||
/builddir/build/BUILD/kexec-tools-2.0.20/kexec/arch/arm64/kexec-arm64.h:53: multiple definition of `initrd_base';
|
||||
kexec/fs2dt.o:/builddir/build/BUILD/kexec-tools-2.0.20/././kexec/arch/arm64/kexec-arm64.h:53: first defined here
|
||||
|
||||
And apparently, these variables are wrongly declared multiple times. So
|
||||
remove duplicated declaration.
|
||||
|
||||
Signed-off-by: Kairui Song <kasong@redhat.com>
|
||||
---
|
||||
kexec/arch/arm64/kexec-arm64.h | 6 +++---
|
||||
kexec/arch/ppc64/kexec-elf-ppc64.c | 2 --
|
||||
kexec/arch/x86_64/kexec-bzImage64.c | 1 -
|
||||
kexec/fs2dt.h | 2 +-
|
||||
4 files changed, 4 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/kexec/arch/arm64/kexec-arm64.h b/kexec/arch/arm64/kexec-arm64.h
|
||||
index 628de79..ed447ac 100644
|
||||
--- a/kexec/arch/arm64/kexec-arm64.h
|
||||
+++ b/kexec/arch/arm64/kexec-arm64.h
|
||||
@@ -50,8 +50,8 @@ int zImage_arm64_load(int argc, char **argv, const char *kernel_buf,
|
||||
void zImage_arm64_usage(void);
|
||||
|
||||
|
||||
-off_t initrd_base;
|
||||
-off_t initrd_size;
|
||||
+extern off_t initrd_base;
|
||||
+extern off_t initrd_size;
|
||||
|
||||
/**
|
||||
* struct arm64_mem - Memory layout info.
|
||||
@@ -65,7 +65,7 @@ struct arm64_mem {
|
||||
};
|
||||
|
||||
#define arm64_mem_ngv UINT64_MAX
|
||||
-struct arm64_mem arm64_mem;
|
||||
+extern struct arm64_mem arm64_mem;
|
||||
|
||||
uint64_t get_phys_offset(void);
|
||||
uint64_t get_vp_offset(void);
|
||||
diff --git a/kexec/arch/ppc64/kexec-elf-ppc64.c b/kexec/arch/ppc64/kexec-elf-ppc64.c
|
||||
index 3510b70..695b8b0 100644
|
||||
--- a/kexec/arch/ppc64/kexec-elf-ppc64.c
|
||||
+++ b/kexec/arch/ppc64/kexec-elf-ppc64.c
|
||||
@@ -44,8 +44,6 @@
|
||||
uint64_t initrd_base, initrd_size;
|
||||
unsigned char reuse_initrd = 0;
|
||||
const char *ramdisk;
|
||||
-/* Used for enabling printing message from purgatory code */
|
||||
-int my_debug = 0;
|
||||
|
||||
int elf_ppc64_probe(const char *buf, off_t len)
|
||||
{
|
||||
diff --git a/kexec/arch/x86_64/kexec-bzImage64.c b/kexec/arch/x86_64/kexec-bzImage64.c
|
||||
index 8edb3e4..ba8dc48 100644
|
||||
--- a/kexec/arch/x86_64/kexec-bzImage64.c
|
||||
+++ b/kexec/arch/x86_64/kexec-bzImage64.c
|
||||
@@ -42,7 +42,6 @@
|
||||
#include <arch/options.h>
|
||||
|
||||
static const int probe_debug = 0;
|
||||
-int bzImage_support_efi_boot;
|
||||
|
||||
int bzImage64_probe(const char *buf, off_t len)
|
||||
{
|
||||
diff --git a/kexec/fs2dt.h b/kexec/fs2dt.h
|
||||
index 7633273..fe24931 100644
|
||||
--- a/kexec/fs2dt.h
|
||||
+++ b/kexec/fs2dt.h
|
||||
@@ -30,7 +30,7 @@ extern struct bootblock bb[1];
|
||||
|
||||
/* Used for enabling printing message from purgatory code
|
||||
* Only has implemented for PPC64 */
|
||||
-int my_debug;
|
||||
+extern int my_debug;
|
||||
extern int dt_no_old_root;
|
||||
|
||||
void reserve(unsigned long long where, unsigned long long length);
|
||||
--
|
||||
2.24.1
|
||||
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
From 2837fb1f5f8362976c188b30ebe50dc8b0377f64 Mon Sep 17 00:00:00 2001
|
||||
From: Kairui Song <kasong@redhat.com>
|
||||
Date: Wed, 29 Jan 2020 11:33:18 +0800
|
||||
Subject: [PATCH] Remove duplicated variable declaration
|
||||
|
||||
When building on Fedora 32, following error is observed:
|
||||
|
||||
...
|
||||
/usr/bin/ld: ../eppic/libeppic/libeppic.a(eppic_stat.o):/builddir/build/BUILD/kexec-tools-2.0.20/eppic/libeppic/eppic.h:474: multiple definition of `lastv';
|
||||
../eppic/libeppic/libeppic.a(eppic_func.o):/builddir/build/BUILD/kexec-tools-2.0.20/eppic/libeppic/eppic.h:474: first defined here
|
||||
...
|
||||
|
||||
And apparently, the variable is wrongly declared multiple times. So
|
||||
remove duplicated declaration.
|
||||
|
||||
Signed-off-by: Kairui Song <kasong@redhat.com>
|
||||
---
|
||||
libeppic/eppic.h | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/libeppic/eppic.h b/libeppic/eppic.h
|
||||
index 5664583..836b475 100644
|
||||
--- a/eppic-d84c3541035d95077aa8571f5d5c3e07c6ef510b/libeppic/eppic.h
|
||||
+++ b/eppic-d84c3541035d95077aa8571f5d5c3e07c6ef510b/libeppic/eppic.h
|
||||
@@ -471,7 +471,7 @@ type_t *eppic_addstorage(type_t *t1, type_t *t2);
|
||||
type_t *eppic_getvoidstruct(int ctype);
|
||||
|
||||
extern int lineno, needvar, instruct, nomacs, eppic_legacy;
|
||||
-node_t *lastv;
|
||||
+extern node_t *lastv;
|
||||
|
||||
#define NULLNODE ((node_t*)0)
|
||||
|
||||
--
|
||||
2.24.1
|
||||
|
||||
|
|
@ -0,0 +1,587 @@
|
|||
From c617ec63339222f3a44d73e36677a9acc8954ccd Mon Sep 17 00:00:00 2001
|
||||
From: John Ogness <john.ogness@linutronix.de>
|
||||
Date: Thu, 19 Nov 2020 02:41:21 +0000
|
||||
Subject: [PATCH 1/2] [PATCH 1/2] printk: add support for lockless ringbuffer
|
||||
|
||||
* Required for kernel 5.10
|
||||
|
||||
Linux 5.10 introduces a new lockless ringbuffer. The new ringbuffer
|
||||
is structured completely different to the previous iterations.
|
||||
Add support for retrieving the ringbuffer from debug information
|
||||
and/or using vmcoreinfo. The new ringbuffer is detected based on
|
||||
the availability of the "prb" symbol.
|
||||
|
||||
Signed-off-by: John Ogness <john.ogness@linutronix.de>
|
||||
Signed-off-by: Kazuhito Hagio <k-hagio-ab@nec.com>
|
||||
---
|
||||
Makefile | 2 +-
|
||||
dwarf_info.c | 36 ++++++++-
|
||||
makedumpfile.c | 103 +++++++++++++++++++++++-
|
||||
makedumpfile.h | 58 ++++++++++++++
|
||||
printk.c | 207 +++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
5 files changed, 399 insertions(+), 7 deletions(-)
|
||||
create mode 100644 printk.c
|
||||
|
||||
diff --git a/makedumpfile-1.6.8/Makefile b/makedumpfile-1.6.8/Makefile
|
||||
index e5ac71a..cb6bd42 100644
|
||||
--- a/makedumpfile-1.6.8/Makefile
|
||||
+++ b/makedumpfile-1.6.8/Makefile
|
||||
@@ -45,7 +45,7 @@ CFLAGS_ARCH += -m32
|
||||
endif
|
||||
|
||||
SRC_BASE = makedumpfile.c makedumpfile.h diskdump_mod.h sadump_mod.h sadump_info.h
|
||||
-SRC_PART = print_info.c dwarf_info.c elf_info.c erase_info.c sadump_info.c cache.c tools.c
|
||||
+SRC_PART = print_info.c dwarf_info.c elf_info.c erase_info.c sadump_info.c cache.c tools.c printk.c
|
||||
OBJ_PART=$(patsubst %.c,%.o,$(SRC_PART))
|
||||
SRC_ARCH = arch/arm.c arch/arm64.c arch/x86.c arch/x86_64.c arch/ia64.c arch/ppc64.c arch/s390x.c arch/ppc.c arch/sparc64.c
|
||||
OBJ_ARCH=$(patsubst %.c,%.o,$(SRC_ARCH))
|
||||
diff --git a/makedumpfile-1.6.8/dwarf_info.c b/makedumpfile-1.6.8/dwarf_info.c
|
||||
index e42a9f5..543588b 100644
|
||||
--- a/makedumpfile-1.6.8/dwarf_info.c
|
||||
+++ b/makedumpfile-1.6.8/dwarf_info.c
|
||||
@@ -614,6 +614,7 @@ search_structure(Dwarf_Die *die, int *found)
|
||||
{
|
||||
int tag;
|
||||
const char *name;
|
||||
+ Dwarf_Die die_type;
|
||||
|
||||
/*
|
||||
* If we get to here then we don't have any more
|
||||
@@ -622,9 +623,31 @@ search_structure(Dwarf_Die *die, int *found)
|
||||
do {
|
||||
tag = dwarf_tag(die);
|
||||
name = dwarf_diename(die);
|
||||
- if ((tag != DW_TAG_structure_type) || (!name)
|
||||
- || strcmp(name, dwarf_info.struct_name))
|
||||
+ if ((!name) || strcmp(name, dwarf_info.struct_name))
|
||||
+ continue;
|
||||
+
|
||||
+ if (tag == DW_TAG_typedef) {
|
||||
+ if (!get_die_type(die, &die_type)) {
|
||||
+ ERRMSG("Can't get CU die of DW_AT_type.\n");
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ /* Resolve typedefs of typedefs. */
|
||||
+ while ((tag = dwarf_tag(&die_type)) == DW_TAG_typedef) {
|
||||
+ if (!get_die_type(&die_type, &die_type)) {
|
||||
+ ERRMSG("Can't get CU die of DW_AT_type.\n");
|
||||
+ return;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if (tag != DW_TAG_structure_type)
|
||||
+ continue;
|
||||
+ die = &die_type;
|
||||
+
|
||||
+ } else if (tag != DW_TAG_structure_type) {
|
||||
continue;
|
||||
+ }
|
||||
+
|
||||
/*
|
||||
* Skip if DW_AT_byte_size is not included.
|
||||
*/
|
||||
@@ -740,6 +763,15 @@ search_typedef(Dwarf_Die *die, int *found)
|
||||
ERRMSG("Can't get CU die of DW_AT_type.\n");
|
||||
break;
|
||||
}
|
||||
+
|
||||
+ /* Resolve typedefs of typedefs. */
|
||||
+ while ((tag = dwarf_tag(&die_type)) == DW_TAG_typedef) {
|
||||
+ if (!get_die_type(&die_type, &die_type)) {
|
||||
+ ERRMSG("Can't get CU die of DW_AT_type.\n");
|
||||
+ return;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
dwarf_info.struct_size = dwarf_bytesize(&die_type);
|
||||
if (dwarf_info.struct_size <= 0)
|
||||
continue;
|
||||
diff --git a/makedumpfile-1.6.8/makedumpfile.c b/makedumpfile-1.6.8/makedumpfile.c
|
||||
index cdde040..061741f 100644
|
||||
--- a/makedumpfile-1.6.8/makedumpfile.c
|
||||
+++ b/makedumpfile-1.6.8/makedumpfile.c
|
||||
@@ -1555,6 +1555,7 @@ get_symbol_info(void)
|
||||
SYMBOL_INIT(node_data, "node_data");
|
||||
SYMBOL_INIT(pgdat_list, "pgdat_list");
|
||||
SYMBOL_INIT(contig_page_data, "contig_page_data");
|
||||
+ SYMBOL_INIT(prb, "prb");
|
||||
SYMBOL_INIT(log_buf, "log_buf");
|
||||
SYMBOL_INIT(log_buf_len, "log_buf_len");
|
||||
SYMBOL_INIT(log_end, "log_end");
|
||||
@@ -1971,16 +1972,47 @@ get_structure_info(void)
|
||||
OFFSET_INIT(elf64_phdr.p_memsz, "elf64_phdr", "p_memsz");
|
||||
|
||||
SIZE_INIT(printk_log, "printk_log");
|
||||
- if (SIZE(printk_log) != NOT_FOUND_STRUCTURE) {
|
||||
+ SIZE_INIT(printk_ringbuffer, "printk_ringbuffer");
|
||||
+ if ((SIZE(printk_ringbuffer) != NOT_FOUND_STRUCTURE)) {
|
||||
+ info->flag_use_printk_ringbuffer = TRUE;
|
||||
+ info->flag_use_printk_log = FALSE;
|
||||
+
|
||||
+ OFFSET_INIT(printk_ringbuffer.desc_ring, "printk_ringbuffer", "desc_ring");
|
||||
+ OFFSET_INIT(printk_ringbuffer.text_data_ring, "printk_ringbuffer", "text_data_ring");
|
||||
+
|
||||
+ OFFSET_INIT(prb_desc_ring.count_bits, "prb_desc_ring", "count_bits");
|
||||
+ OFFSET_INIT(prb_desc_ring.descs, "prb_desc_ring", "descs");
|
||||
+ OFFSET_INIT(prb_desc_ring.infos, "prb_desc_ring", "infos");
|
||||
+ OFFSET_INIT(prb_desc_ring.head_id, "prb_desc_ring", "head_id");
|
||||
+ OFFSET_INIT(prb_desc_ring.tail_id, "prb_desc_ring", "tail_id");
|
||||
+
|
||||
+ SIZE_INIT(prb_desc, "prb_desc");
|
||||
+ OFFSET_INIT(prb_desc.state_var, "prb_desc", "state_var");
|
||||
+ OFFSET_INIT(prb_desc.text_blk_lpos, "prb_desc", "text_blk_lpos");
|
||||
+
|
||||
+ OFFSET_INIT(prb_data_blk_lpos.begin, "prb_data_blk_lpos", "begin");
|
||||
+ OFFSET_INIT(prb_data_blk_lpos.next, "prb_data_blk_lpos", "next");
|
||||
+
|
||||
+ OFFSET_INIT(prb_data_ring.size_bits, "prb_data_ring", "size_bits");
|
||||
+ OFFSET_INIT(prb_data_ring.data, "prb_data_ring", "data");
|
||||
+
|
||||
+ SIZE_INIT(printk_info, "printk_info");
|
||||
+ OFFSET_INIT(printk_info.ts_nsec, "printk_info", "ts_nsec");
|
||||
+ OFFSET_INIT(printk_info.text_len, "printk_info", "text_len");
|
||||
+
|
||||
+ OFFSET_INIT(atomic_long_t.counter, "atomic_long_t", "counter");
|
||||
+ } else if (SIZE(printk_log) != NOT_FOUND_STRUCTURE) {
|
||||
/*
|
||||
* In kernel 3.11-rc4 the log structure name was renamed
|
||||
* to "printk_log".
|
||||
*/
|
||||
+ info->flag_use_printk_ringbuffer = FALSE;
|
||||
info->flag_use_printk_log = TRUE;
|
||||
OFFSET_INIT(printk_log.ts_nsec, "printk_log", "ts_nsec");
|
||||
OFFSET_INIT(printk_log.len, "printk_log", "len");
|
||||
OFFSET_INIT(printk_log.text_len, "printk_log", "text_len");
|
||||
} else {
|
||||
+ info->flag_use_printk_ringbuffer = FALSE;
|
||||
info->flag_use_printk_log = FALSE;
|
||||
SIZE_INIT(printk_log, "log");
|
||||
OFFSET_INIT(printk_log.ts_nsec, "log", "ts_nsec");
|
||||
@@ -2191,6 +2223,7 @@ write_vmcoreinfo_data(void)
|
||||
WRITE_SYMBOL("node_data", node_data);
|
||||
WRITE_SYMBOL("pgdat_list", pgdat_list);
|
||||
WRITE_SYMBOL("contig_page_data", contig_page_data);
|
||||
+ WRITE_SYMBOL("prb", prb);
|
||||
WRITE_SYMBOL("log_buf", log_buf);
|
||||
WRITE_SYMBOL("log_buf_len", log_buf_len);
|
||||
WRITE_SYMBOL("log_end", log_end);
|
||||
@@ -2222,7 +2255,11 @@ write_vmcoreinfo_data(void)
|
||||
WRITE_STRUCTURE_SIZE("node_memblk_s", node_memblk_s);
|
||||
WRITE_STRUCTURE_SIZE("nodemask_t", nodemask_t);
|
||||
WRITE_STRUCTURE_SIZE("pageflags", pageflags);
|
||||
- if (info->flag_use_printk_log)
|
||||
+ if (info->flag_use_printk_ringbuffer) {
|
||||
+ WRITE_STRUCTURE_SIZE("printk_ringbuffer", printk_ringbuffer);
|
||||
+ WRITE_STRUCTURE_SIZE("prb_desc", prb_desc);
|
||||
+ WRITE_STRUCTURE_SIZE("printk_info", printk_info);
|
||||
+ } else if (info->flag_use_printk_log)
|
||||
WRITE_STRUCTURE_SIZE("printk_log", printk_log);
|
||||
else
|
||||
WRITE_STRUCTURE_SIZE("log", printk_log);
|
||||
@@ -2268,7 +2305,30 @@ write_vmcoreinfo_data(void)
|
||||
WRITE_MEMBER_OFFSET("vm_struct.addr", vm_struct.addr);
|
||||
WRITE_MEMBER_OFFSET("vmap_area.va_start", vmap_area.va_start);
|
||||
WRITE_MEMBER_OFFSET("vmap_area.list", vmap_area.list);
|
||||
- if (info->flag_use_printk_log) {
|
||||
+ if (info->flag_use_printk_ringbuffer) {
|
||||
+ WRITE_MEMBER_OFFSET("printk_ringbuffer.desc_ring", printk_ringbuffer.desc_ring);
|
||||
+ WRITE_MEMBER_OFFSET("printk_ringbuffer.text_data_ring", printk_ringbuffer.text_data_ring);
|
||||
+
|
||||
+ WRITE_MEMBER_OFFSET("prb_desc_ring.count_bits", prb_desc_ring.count_bits);
|
||||
+ WRITE_MEMBER_OFFSET("prb_desc_ring.descs", prb_desc_ring.descs);
|
||||
+ WRITE_MEMBER_OFFSET("prb_desc_ring.infos", prb_desc_ring.infos);
|
||||
+ WRITE_MEMBER_OFFSET("prb_desc_ring.head_id", prb_desc_ring.head_id);
|
||||
+ WRITE_MEMBER_OFFSET("prb_desc_ring.tail_id", prb_desc_ring.tail_id);
|
||||
+
|
||||
+ WRITE_MEMBER_OFFSET("prb_desc.state_var", prb_desc.state_var);
|
||||
+ WRITE_MEMBER_OFFSET("prb_desc.text_blk_lpos", prb_desc.text_blk_lpos);
|
||||
+
|
||||
+ WRITE_MEMBER_OFFSET("prb_data_blk_lpos.begin", prb_data_blk_lpos.begin);
|
||||
+ WRITE_MEMBER_OFFSET("prb_data_blk_lpos.next", prb_data_blk_lpos.next);
|
||||
+
|
||||
+ WRITE_MEMBER_OFFSET("prb_data_ring.size_bits", prb_data_ring.size_bits);
|
||||
+ WRITE_MEMBER_OFFSET("prb_data_ring.data", prb_data_ring.data);
|
||||
+
|
||||
+ WRITE_MEMBER_OFFSET("printk_info.ts_nsec", printk_info.ts_nsec);
|
||||
+ WRITE_MEMBER_OFFSET("printk_info.text_len", printk_info.text_len);
|
||||
+
|
||||
+ WRITE_MEMBER_OFFSET("atomic_long_t.counter", atomic_long_t.counter);
|
||||
+ } else if (info->flag_use_printk_log) {
|
||||
WRITE_MEMBER_OFFSET("printk_log.ts_nsec", printk_log.ts_nsec);
|
||||
WRITE_MEMBER_OFFSET("printk_log.len", printk_log.len);
|
||||
WRITE_MEMBER_OFFSET("printk_log.text_len", printk_log.text_len);
|
||||
@@ -2606,6 +2666,7 @@ read_vmcoreinfo(void)
|
||||
READ_SYMBOL("node_data", node_data);
|
||||
READ_SYMBOL("pgdat_list", pgdat_list);
|
||||
READ_SYMBOL("contig_page_data", contig_page_data);
|
||||
+ READ_SYMBOL("prb", prb);
|
||||
READ_SYMBOL("log_buf", log_buf);
|
||||
READ_SYMBOL("log_buf_len", log_buf_len);
|
||||
READ_SYMBOL("log_end", log_end);
|
||||
@@ -2684,12 +2745,43 @@ read_vmcoreinfo(void)
|
||||
READ_MEMBER_OFFSET("cpu_spec.mmu_features", cpu_spec.mmu_features);
|
||||
|
||||
READ_STRUCTURE_SIZE("printk_log", printk_log);
|
||||
- if (SIZE(printk_log) != NOT_FOUND_STRUCTURE) {
|
||||
+ READ_STRUCTURE_SIZE("printk_ringbuffer", printk_ringbuffer);
|
||||
+ if (SIZE(printk_ringbuffer) != NOT_FOUND_STRUCTURE) {
|
||||
+ info->flag_use_printk_ringbuffer = TRUE;
|
||||
+ info->flag_use_printk_log = FALSE;
|
||||
+
|
||||
+ READ_MEMBER_OFFSET("printk_ringbuffer.desc_ring", printk_ringbuffer.desc_ring);
|
||||
+ READ_MEMBER_OFFSET("printk_ringbuffer.text_data_ring", printk_ringbuffer.text_data_ring);
|
||||
+
|
||||
+ READ_MEMBER_OFFSET("prb_desc_ring.count_bits", prb_desc_ring.count_bits);
|
||||
+ READ_MEMBER_OFFSET("prb_desc_ring.descs", prb_desc_ring.descs);
|
||||
+ READ_MEMBER_OFFSET("prb_desc_ring.infos", prb_desc_ring.infos);
|
||||
+ READ_MEMBER_OFFSET("prb_desc_ring.head_id", prb_desc_ring.head_id);
|
||||
+ READ_MEMBER_OFFSET("prb_desc_ring.tail_id", prb_desc_ring.tail_id);
|
||||
+
|
||||
+ READ_STRUCTURE_SIZE("prb_desc", prb_desc);
|
||||
+ READ_MEMBER_OFFSET("prb_desc.state_var", prb_desc.state_var);
|
||||
+ READ_MEMBER_OFFSET("prb_desc.text_blk_lpos", prb_desc.text_blk_lpos);
|
||||
+
|
||||
+ READ_MEMBER_OFFSET("prb_data_blk_lpos.begin", prb_data_blk_lpos.begin);
|
||||
+ READ_MEMBER_OFFSET("prb_data_blk_lpos.next", prb_data_blk_lpos.next);
|
||||
+
|
||||
+ READ_MEMBER_OFFSET("prb_data_ring.size_bits", prb_data_ring.size_bits);
|
||||
+ READ_MEMBER_OFFSET("prb_data_ring.data", prb_data_ring.data);
|
||||
+
|
||||
+ READ_STRUCTURE_SIZE("printk_info", printk_info);
|
||||
+ READ_MEMBER_OFFSET("printk_info.ts_nsec", printk_info.ts_nsec);
|
||||
+ READ_MEMBER_OFFSET("printk_info.text_len", printk_info.text_len);
|
||||
+
|
||||
+ READ_MEMBER_OFFSET("atomic_long_t.counter", atomic_long_t.counter);
|
||||
+ } else if (SIZE(printk_log) != NOT_FOUND_STRUCTURE) {
|
||||
+ info->flag_use_printk_ringbuffer = FALSE;
|
||||
info->flag_use_printk_log = TRUE;
|
||||
READ_MEMBER_OFFSET("printk_log.ts_nsec", printk_log.ts_nsec);
|
||||
READ_MEMBER_OFFSET("printk_log.len", printk_log.len);
|
||||
READ_MEMBER_OFFSET("printk_log.text_len", printk_log.text_len);
|
||||
} else {
|
||||
+ info->flag_use_printk_ringbuffer = FALSE;
|
||||
info->flag_use_printk_log = FALSE;
|
||||
READ_STRUCTURE_SIZE("log", printk_log);
|
||||
READ_MEMBER_OFFSET("log.ts_nsec", printk_log.ts_nsec);
|
||||
@@ -5286,6 +5378,9 @@ dump_dmesg()
|
||||
if (!initial())
|
||||
return FALSE;
|
||||
|
||||
+ if ((SYMBOL(prb) != NOT_FOUND_SYMBOL))
|
||||
+ return dump_lockless_dmesg();
|
||||
+
|
||||
if ((SYMBOL(log_buf) == NOT_FOUND_SYMBOL)
|
||||
|| (SYMBOL(log_buf_len) == NOT_FOUND_SYMBOL)) {
|
||||
ERRMSG("Can't find some symbols for log_buf.\n");
|
||||
diff --git a/makedumpfile-1.6.8/makedumpfile.h b/makedumpfile-1.6.8/makedumpfile.h
|
||||
index 698c054..47f7e79 100644
|
||||
--- a/makedumpfile-1.6.8/makedumpfile.h
|
||||
+++ b/makedumpfile-1.6.8/makedumpfile.h
|
||||
@@ -1317,6 +1317,7 @@ struct DumpInfo {
|
||||
int flag_partial_dmesg; /* dmesg dump only from the last cleared index*/
|
||||
int flag_mem_usage; /*show the page number of memory in different use*/
|
||||
int flag_use_printk_log; /* did we read printk_log symbol name? */
|
||||
+ int flag_use_printk_ringbuffer; /* using lockless printk ringbuffer? */
|
||||
int flag_nospace; /* the flag of "No space on device" error */
|
||||
int flag_vmemmap; /* kernel supports vmemmap address space */
|
||||
int flag_excludevm; /* -e - excluding unused vmemmap pages */
|
||||
@@ -1602,6 +1603,7 @@ struct symbol_table {
|
||||
unsigned long long node_data;
|
||||
unsigned long long pgdat_list;
|
||||
unsigned long long contig_page_data;
|
||||
+ unsigned long long prb;
|
||||
unsigned long long log_buf;
|
||||
unsigned long long log_buf_len;
|
||||
unsigned long long log_end;
|
||||
@@ -1689,6 +1691,13 @@ struct size_table {
|
||||
long nodemask_t;
|
||||
long printk_log;
|
||||
|
||||
+ /*
|
||||
+ * for lockless printk ringbuffer
|
||||
+ */
|
||||
+ long printk_ringbuffer;
|
||||
+ long prb_desc;
|
||||
+ long printk_info;
|
||||
+
|
||||
/*
|
||||
* for Xen extraction
|
||||
*/
|
||||
@@ -1864,6 +1873,52 @@ struct offset_table {
|
||||
long text_len;
|
||||
} printk_log;
|
||||
|
||||
+ /*
|
||||
+ * for lockless printk ringbuffer
|
||||
+ */
|
||||
+ struct printk_ringbuffer_s {
|
||||
+ long desc_ring;
|
||||
+ long text_data_ring;
|
||||
+ long fail;
|
||||
+ } printk_ringbuffer;
|
||||
+
|
||||
+ struct prb_desc_ring_s {
|
||||
+ long count_bits;
|
||||
+ long descs;
|
||||
+ long infos;
|
||||
+ long head_id;
|
||||
+ long tail_id;
|
||||
+ } prb_desc_ring;
|
||||
+
|
||||
+ struct prb_desc_s {
|
||||
+ long state_var;
|
||||
+ long text_blk_lpos;
|
||||
+ } prb_desc;
|
||||
+
|
||||
+ struct prb_data_blk_lpos_s {
|
||||
+ long begin;
|
||||
+ long next;
|
||||
+ } prb_data_blk_lpos;
|
||||
+
|
||||
+ struct printk_info_s {
|
||||
+ long seq;
|
||||
+ long ts_nsec;
|
||||
+ long text_len;
|
||||
+ long caller_id;
|
||||
+ long dev_info;
|
||||
+ } printk_info;
|
||||
+
|
||||
+ struct prb_data_ring_s {
|
||||
+ long size_bits;
|
||||
+ long data;
|
||||
+ long head_lpos;
|
||||
+ long tail_lpos;
|
||||
+ } prb_data_ring;
|
||||
+
|
||||
+ struct atomic_long_t_s {
|
||||
+ long counter;
|
||||
+ } atomic_long_t;
|
||||
+
|
||||
/*
|
||||
* symbols on ppc64 arch
|
||||
*/
|
||||
@@ -2390,4 +2445,7 @@ int hexadecimal(char *s, int count);
|
||||
int decimal(char *s, int count);
|
||||
int file_exists(char *file);
|
||||
|
||||
+int open_dump_file(void);
|
||||
+int dump_lockless_dmesg(void);
|
||||
+
|
||||
#endif /* MAKEDUMPFILE_H */
|
||||
diff --git a/makedumpfile-1.6.8/printk.c b/makedumpfile-1.6.8/printk.c
|
||||
new file mode 100644
|
||||
index 0000000..acffb6c
|
||||
--- /dev/null
|
||||
+++ b/makedumpfile-1.6.8/printk.c
|
||||
@@ -0,0 +1,207 @@
|
||||
+#include "makedumpfile.h"
|
||||
+#include <ctype.h>
|
||||
+
|
||||
+#define DESC_SV_BITS (sizeof(unsigned long) * 8)
|
||||
+#define DESC_COMMITTED_MASK (1UL << (DESC_SV_BITS - 1))
|
||||
+#define DESC_REUSE_MASK (1UL << (DESC_SV_BITS - 2))
|
||||
+#define DESC_FLAGS_MASK (DESC_COMMITTED_MASK | DESC_REUSE_MASK)
|
||||
+#define DESC_ID_MASK (~DESC_FLAGS_MASK)
|
||||
+
|
||||
+/* convenience struct for passing many values to helper functions */
|
||||
+struct prb_map {
|
||||
+ char *prb;
|
||||
+
|
||||
+ char *desc_ring;
|
||||
+ unsigned long desc_ring_count;
|
||||
+ char *descs;
|
||||
+ char *infos;
|
||||
+
|
||||
+ char *text_data_ring;
|
||||
+ unsigned long text_data_ring_size;
|
||||
+ char *text_data;
|
||||
+};
|
||||
+
|
||||
+static void
|
||||
+dump_record(struct prb_map *m, unsigned long id)
|
||||
+{
|
||||
+ unsigned long long ts_nsec;
|
||||
+ unsigned long state_var;
|
||||
+ unsigned short text_len;
|
||||
+ unsigned long begin;
|
||||
+ unsigned long next;
|
||||
+ char buf[BUFSIZE];
|
||||
+ ulonglong nanos;
|
||||
+ int indent_len;
|
||||
+ int buf_need;
|
||||
+ char *bufp;
|
||||
+ char *text;
|
||||
+ char *desc;
|
||||
+ char *inf;
|
||||
+ ulong rem;
|
||||
+ char *p;
|
||||
+ int i;
|
||||
+
|
||||
+ desc = m->descs + ((id % m->desc_ring_count) * SIZE(prb_desc));
|
||||
+
|
||||
+ /* skip non-committed record */
|
||||
+ state_var = ULONG(desc + OFFSET(prb_desc.state_var) + OFFSET(atomic_long_t.counter));
|
||||
+ if ((state_var & DESC_FLAGS_MASK) != DESC_COMMITTED_MASK)
|
||||
+ return;
|
||||
+
|
||||
+ begin = ULONG(desc + OFFSET(prb_desc.text_blk_lpos) + OFFSET(prb_data_blk_lpos.begin)) %
|
||||
+ m->text_data_ring_size;
|
||||
+ next = ULONG(desc + OFFSET(prb_desc.text_blk_lpos) + OFFSET(prb_data_blk_lpos.next)) %
|
||||
+ m->text_data_ring_size;
|
||||
+
|
||||
+ /* skip data-less text blocks */
|
||||
+ if (begin == next)
|
||||
+ return;
|
||||
+
|
||||
+ inf = m->infos + ((id % m->desc_ring_count) * SIZE(printk_info));
|
||||
+
|
||||
+ text_len = USHORT(inf + OFFSET(printk_info.text_len));
|
||||
+
|
||||
+ /* handle wrapping data block */
|
||||
+ if (begin > next)
|
||||
+ begin = 0;
|
||||
+
|
||||
+ /* skip over descriptor ID */
|
||||
+ begin += sizeof(unsigned long);
|
||||
+
|
||||
+ /* handle truncated messages */
|
||||
+ if (next - begin < text_len)
|
||||
+ text_len = next - begin;
|
||||
+
|
||||
+ text = m->text_data + begin;
|
||||
+
|
||||
+ ts_nsec = ULONGLONG(inf + OFFSET(printk_info.ts_nsec));
|
||||
+ nanos = (ulonglong)ts_nsec / (ulonglong)1000000000;
|
||||
+ rem = (ulonglong)ts_nsec % (ulonglong)1000000000;
|
||||
+
|
||||
+ bufp = buf;
|
||||
+ bufp += sprintf(buf, "[%5lld.%06ld] ", nanos, rem/1000);
|
||||
+ indent_len = strlen(buf);
|
||||
+
|
||||
+ /* How much buffer space is needed in the worst case */
|
||||
+ buf_need = MAX(sizeof("\\xXX\n"), sizeof("\n") + indent_len);
|
||||
+
|
||||
+ for (i = 0, p = text; i < text_len; i++, p++) {
|
||||
+ if (bufp - buf >= sizeof(buf) - buf_need) {
|
||||
+ if (write(info->fd_dumpfile, buf, bufp - buf) < 0)
|
||||
+ return;
|
||||
+ bufp = buf;
|
||||
+ }
|
||||
+
|
||||
+ if (*p == '\n')
|
||||
+ bufp += sprintf(bufp, "\n%-*s", indent_len, "");
|
||||
+ else if (isprint(*p) || isspace(*p))
|
||||
+ *bufp++ = *p;
|
||||
+ else
|
||||
+ bufp += sprintf(bufp, "\\x%02x", *p);
|
||||
+ }
|
||||
+
|
||||
+ *bufp++ = '\n';
|
||||
+
|
||||
+ write(info->fd_dumpfile, buf, bufp - buf);
|
||||
+}
|
||||
+
|
||||
+int
|
||||
+dump_lockless_dmesg(void)
|
||||
+{
|
||||
+ unsigned long head_id;
|
||||
+ unsigned long tail_id;
|
||||
+ unsigned long kaddr;
|
||||
+ unsigned long id;
|
||||
+ struct prb_map m;
|
||||
+ int ret = FALSE;
|
||||
+
|
||||
+ /* setup printk_ringbuffer */
|
||||
+ if (!readmem(VADDR, SYMBOL(prb), &kaddr, sizeof(kaddr))) {
|
||||
+ ERRMSG("Can't get the prb address.\n");
|
||||
+ return ret;
|
||||
+ }
|
||||
+
|
||||
+ m.prb = malloc(SIZE(printk_ringbuffer));
|
||||
+ if (!m.prb) {
|
||||
+ ERRMSG("Can't allocate memory for prb.\n");
|
||||
+ return ret;
|
||||
+ }
|
||||
+ if (!readmem(VADDR, kaddr, m.prb, SIZE(printk_ringbuffer))) {
|
||||
+ ERRMSG("Can't get prb.\n");
|
||||
+ goto out_prb;
|
||||
+ }
|
||||
+
|
||||
+ /* setup descriptor ring */
|
||||
+ m.desc_ring = m.prb + OFFSET(printk_ringbuffer.desc_ring);
|
||||
+ m.desc_ring_count = 1 << UINT(m.desc_ring + OFFSET(prb_desc_ring.count_bits));
|
||||
+
|
||||
+ kaddr = ULONG(m.desc_ring + OFFSET(prb_desc_ring.descs));
|
||||
+ m.descs = malloc(SIZE(prb_desc) * m.desc_ring_count);
|
||||
+ if (!m.descs) {
|
||||
+ ERRMSG("Can't allocate memory for prb.desc_ring.descs.\n");
|
||||
+ goto out_prb;
|
||||
+ }
|
||||
+ if (!readmem(VADDR, kaddr, m.descs,
|
||||
+ SIZE(prb_desc) * m.desc_ring_count)) {
|
||||
+ ERRMSG("Can't get prb.desc_ring.descs.\n");
|
||||
+ goto out_descs;
|
||||
+ }
|
||||
+
|
||||
+ kaddr = ULONG(m.desc_ring + OFFSET(prb_desc_ring.infos));
|
||||
+ m.infos = malloc(SIZE(printk_info) * m.desc_ring_count);
|
||||
+ if (!m.infos) {
|
||||
+ ERRMSG("Can't allocate memory for prb.desc_ring.infos.\n");
|
||||
+ goto out_descs;
|
||||
+ }
|
||||
+ if (!readmem(VADDR, kaddr, m.infos, SIZE(printk_info) * m.desc_ring_count)) {
|
||||
+ ERRMSG("Can't get prb.desc_ring.infos.\n");
|
||||
+ goto out_infos;
|
||||
+ }
|
||||
+
|
||||
+ /* setup text data ring */
|
||||
+ m.text_data_ring = m.prb + OFFSET(printk_ringbuffer.text_data_ring);
|
||||
+ m.text_data_ring_size = 1 << UINT(m.text_data_ring + OFFSET(prb_data_ring.size_bits));
|
||||
+
|
||||
+ kaddr = ULONG(m.text_data_ring + OFFSET(prb_data_ring.data));
|
||||
+ m.text_data = malloc(m.text_data_ring_size);
|
||||
+ if (!m.text_data) {
|
||||
+ ERRMSG("Can't allocate memory for prb.text_data_ring.data.\n");
|
||||
+ goto out_infos;
|
||||
+ }
|
||||
+ if (!readmem(VADDR, kaddr, m.text_data, m.text_data_ring_size)) {
|
||||
+ ERRMSG("Can't get prb.text_data_ring.\n");
|
||||
+ goto out_text_data;
|
||||
+ }
|
||||
+
|
||||
+ /* ready to go */
|
||||
+
|
||||
+ tail_id = ULONG(m.desc_ring + OFFSET(prb_desc_ring.tail_id) +
|
||||
+ OFFSET(atomic_long_t.counter));
|
||||
+ head_id = ULONG(m.desc_ring + OFFSET(prb_desc_ring.head_id) +
|
||||
+ OFFSET(atomic_long_t.counter));
|
||||
+
|
||||
+ if (!open_dump_file()) {
|
||||
+ ERRMSG("Can't open output file.\n");
|
||||
+ goto out_text_data;
|
||||
+ }
|
||||
+
|
||||
+ for (id = tail_id; id != head_id; id = (id + 1) & DESC_ID_MASK)
|
||||
+ dump_record(&m, id);
|
||||
+
|
||||
+ /* dump head record */
|
||||
+ dump_record(&m, id);
|
||||
+
|
||||
+ if (!close_files_for_creating_dumpfile())
|
||||
+ goto out_text_data;
|
||||
+
|
||||
+ ret = TRUE;
|
||||
+out_text_data:
|
||||
+ free(m.text_data);
|
||||
+out_infos:
|
||||
+ free(m.infos);
|
||||
+out_descs:
|
||||
+ free(m.descs);
|
||||
+out_prb:
|
||||
+ free(m.prb);
|
||||
+ return ret;
|
||||
+}
|
||||
--
|
||||
2.29.2
|
||||
|
||||
|
|
@ -0,0 +1,99 @@
|
|||
From 44b073b7ec467aee0d7de381d455b8ace1199184 Mon Sep 17 00:00:00 2001
|
||||
From: John Ogness <john.ogness@linutronix.de>
|
||||
Date: Wed, 25 Nov 2020 10:10:31 +0106
|
||||
Subject: [PATCH 2/2] [PATCH 2/2] printk: use committed/finalized state values
|
||||
|
||||
* Required for kernel 5.10
|
||||
|
||||
The ringbuffer entries use 2 state values (committed and finalized)
|
||||
rather than a single flag to represent being available for reading.
|
||||
Copy the definitions and state lookup function directly from the
|
||||
kernel source and use the new states.
|
||||
|
||||
Signed-off-by: John Ogness <john.ogness@linutronix.de>
|
||||
---
|
||||
printk.c | 48 +++++++++++++++++++++++++++++++++++++++++-------
|
||||
1 file changed, 41 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/makedumpfile-1.6.8/printk.c b/makedumpfile-1.6.8/printk.c
|
||||
index acffb6c..2af8562 100644
|
||||
--- a/makedumpfile-1.6.8/printk.c
|
||||
+++ b/makedumpfile-1.6.8/printk.c
|
||||
@@ -1,12 +1,6 @@
|
||||
#include "makedumpfile.h"
|
||||
#include <ctype.h>
|
||||
|
||||
-#define DESC_SV_BITS (sizeof(unsigned long) * 8)
|
||||
-#define DESC_COMMITTED_MASK (1UL << (DESC_SV_BITS - 1))
|
||||
-#define DESC_REUSE_MASK (1UL << (DESC_SV_BITS - 2))
|
||||
-#define DESC_FLAGS_MASK (DESC_COMMITTED_MASK | DESC_REUSE_MASK)
|
||||
-#define DESC_ID_MASK (~DESC_FLAGS_MASK)
|
||||
-
|
||||
/* convenience struct for passing many values to helper functions */
|
||||
struct prb_map {
|
||||
char *prb;
|
||||
@@ -21,12 +15,51 @@ struct prb_map {
|
||||
char *text_data;
|
||||
};
|
||||
|
||||
+/*
|
||||
+ * desc_state and DESC_* definitions taken from kernel source:
|
||||
+ *
|
||||
+ * kernel/printk/printk_ringbuffer.h
|
||||
+ */
|
||||
+
|
||||
+/* The possible responses of a descriptor state-query. */
|
||||
+enum desc_state {
|
||||
+ desc_miss = -1, /* ID mismatch (pseudo state) */
|
||||
+ desc_reserved = 0x0, /* reserved, in use by writer */
|
||||
+ desc_committed = 0x1, /* committed by writer, could get reopened */
|
||||
+ desc_finalized = 0x2, /* committed, no further modification allowed */
|
||||
+ desc_reusable = 0x3, /* free, not yet used by any writer */
|
||||
+};
|
||||
+
|
||||
+#define DESC_SV_BITS (sizeof(unsigned long) * 8)
|
||||
+#define DESC_FLAGS_SHIFT (DESC_SV_BITS - 2)
|
||||
+#define DESC_FLAGS_MASK (3UL << DESC_FLAGS_SHIFT)
|
||||
+#define DESC_STATE(sv) (3UL & (sv >> DESC_FLAGS_SHIFT))
|
||||
+#define DESC_ID_MASK (~DESC_FLAGS_MASK)
|
||||
+#define DESC_ID(sv) ((sv) & DESC_ID_MASK)
|
||||
+
|
||||
+/*
|
||||
+ * get_desc_state() taken from kernel source:
|
||||
+ *
|
||||
+ * kernel/printk/printk_ringbuffer.c
|
||||
+ */
|
||||
+
|
||||
+/* Query the state of a descriptor. */
|
||||
+static enum desc_state get_desc_state(unsigned long id,
|
||||
+ unsigned long state_val)
|
||||
+{
|
||||
+ if (id != DESC_ID(state_val))
|
||||
+ return desc_miss;
|
||||
+
|
||||
+ return DESC_STATE(state_val);
|
||||
+}
|
||||
+
|
||||
static void
|
||||
dump_record(struct prb_map *m, unsigned long id)
|
||||
{
|
||||
unsigned long long ts_nsec;
|
||||
unsigned long state_var;
|
||||
unsigned short text_len;
|
||||
+ enum desc_state state;
|
||||
unsigned long begin;
|
||||
unsigned long next;
|
||||
char buf[BUFSIZE];
|
||||
@@ -45,7 +78,8 @@ dump_record(struct prb_map *m, unsigned long id)
|
||||
|
||||
/* skip non-committed record */
|
||||
state_var = ULONG(desc + OFFSET(prb_desc.state_var) + OFFSET(atomic_long_t.counter));
|
||||
- if ((state_var & DESC_FLAGS_MASK) != DESC_COMMITTED_MASK)
|
||||
+ state = get_desc_state(id, state_var);
|
||||
+ if (state != desc_committed && state != desc_finalized)
|
||||
return;
|
||||
|
||||
begin = ULONG(desc + OFFSET(prb_desc.text_blk_lpos) + OFFSET(prb_data_blk_lpos.begin)) %
|
||||
--
|
||||
2.29.2
|
||||
|
||||
|
|
@ -0,0 +1,101 @@
|
|||
From 54aec3878b3f91341e6bc735eda158cca5c54ec9 Mon Sep 17 00:00:00 2001
|
||||
From: Alexander Egorenkov <egorenar@linux.ibm.com>
|
||||
Date: Fri, 18 Sep 2020 13:55:56 +0200
|
||||
Subject: [PATCH] [PATCH] make use of 'uts_namespace.name' offset in VMCOREINFO
|
||||
|
||||
* Required for kernel 5.11
|
||||
|
||||
The offset of the field 'init_uts_ns.name' has changed since
|
||||
kernel commit 9a56493f6942 ("uts: Use generic ns_common::count").
|
||||
Make use of the offset 'uts_namespace.name' if available in
|
||||
VMCOREINFO.
|
||||
|
||||
Signed-off-by: Alexander Egorenkov <egorenar@linux.ibm.com>
|
||||
---
|
||||
makedumpfile.c | 17 +++++++++++++++--
|
||||
makedumpfile.h | 6 ++++++
|
||||
2 files changed, 21 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/makedumpfile.c b/makedumpfile.c
|
||||
index 061741f..ecd63fa 100644
|
||||
--- a/makedumpfile-1.6.8/makedumpfile.c
|
||||
+++ b/makedumpfile-1.6.8/makedumpfile.c
|
||||
@@ -1159,7 +1159,10 @@ check_release(void)
|
||||
if (SYMBOL(system_utsname) != NOT_FOUND_SYMBOL) {
|
||||
utsname = SYMBOL(system_utsname);
|
||||
} else if (SYMBOL(init_uts_ns) != NOT_FOUND_SYMBOL) {
|
||||
- utsname = SYMBOL(init_uts_ns) + sizeof(int);
|
||||
+ if (OFFSET(uts_namespace.name) != NOT_FOUND_STRUCTURE)
|
||||
+ utsname = SYMBOL(init_uts_ns) + OFFSET(uts_namespace.name);
|
||||
+ else
|
||||
+ utsname = SYMBOL(init_uts_ns) + sizeof(int);
|
||||
} else {
|
||||
ERRMSG("Can't get the symbol of system_utsname.\n");
|
||||
return FALSE;
|
||||
@@ -2040,6 +2043,11 @@ get_structure_info(void)
|
||||
SIZE_INIT(cpu_spec, "cpu_spec");
|
||||
OFFSET_INIT(cpu_spec.mmu_features, "cpu_spec", "mmu_features");
|
||||
|
||||
+ /*
|
||||
+ * Get offsets of the uts_namespace's members.
|
||||
+ */
|
||||
+ OFFSET_INIT(uts_namespace.name, "uts_namespace", "name");
|
||||
+
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -2109,7 +2117,10 @@ get_str_osrelease_from_vmlinux(void)
|
||||
if (SYMBOL(system_utsname) != NOT_FOUND_SYMBOL) {
|
||||
utsname = SYMBOL(system_utsname);
|
||||
} else if (SYMBOL(init_uts_ns) != NOT_FOUND_SYMBOL) {
|
||||
- utsname = SYMBOL(init_uts_ns) + sizeof(int);
|
||||
+ if (OFFSET(uts_namespace.name) != NOT_FOUND_STRUCTURE)
|
||||
+ utsname = SYMBOL(init_uts_ns) + OFFSET(uts_namespace.name);
|
||||
+ else
|
||||
+ utsname = SYMBOL(init_uts_ns) + sizeof(int);
|
||||
} else {
|
||||
ERRMSG("Can't get the symbol of system_utsname.\n");
|
||||
return FALSE;
|
||||
@@ -2344,6 +2355,7 @@ write_vmcoreinfo_data(void)
|
||||
WRITE_MEMBER_OFFSET("vmemmap_backing.list", vmemmap_backing.list);
|
||||
WRITE_MEMBER_OFFSET("mmu_psize_def.shift", mmu_psize_def.shift);
|
||||
WRITE_MEMBER_OFFSET("cpu_spec.mmu_features", cpu_spec.mmu_features);
|
||||
+ WRITE_MEMBER_OFFSET("uts_namespace.name", uts_namespace.name);
|
||||
|
||||
if (SYMBOL(node_data) != NOT_FOUND_SYMBOL)
|
||||
WRITE_ARRAY_LENGTH("node_data", node_data);
|
||||
@@ -2743,6 +2755,7 @@ read_vmcoreinfo(void)
|
||||
READ_MEMBER_OFFSET("vmemmap_backing.list", vmemmap_backing.list);
|
||||
READ_MEMBER_OFFSET("mmu_psize_def.shift", mmu_psize_def.shift);
|
||||
READ_MEMBER_OFFSET("cpu_spec.mmu_features", cpu_spec.mmu_features);
|
||||
+ READ_MEMBER_OFFSET("uts_namespace.name", uts_namespace.name);
|
||||
|
||||
READ_STRUCTURE_SIZE("printk_log", printk_log);
|
||||
READ_STRUCTURE_SIZE("printk_ringbuffer", printk_ringbuffer);
|
||||
diff --git a/makedumpfile.h b/makedumpfile.h
|
||||
index 47f7e79..5f50080 100644
|
||||
--- a/makedumpfile-1.6.8/makedumpfile.h
|
||||
+++ b/makedumpfile-1.6.8/makedumpfile.h
|
||||
@@ -1728,6 +1728,8 @@ struct size_table {
|
||||
long cpu_spec;
|
||||
|
||||
long pageflags;
|
||||
+
|
||||
+ long uts_namespace;
|
||||
};
|
||||
|
||||
struct offset_table {
|
||||
@@ -1935,6 +1937,10 @@ struct offset_table {
|
||||
struct cpu_spec_s {
|
||||
long mmu_features;
|
||||
} cpu_spec;
|
||||
+
|
||||
+ struct uts_namespace_s {
|
||||
+ long name;
|
||||
+ } uts_namespace;
|
||||
};
|
||||
|
||||
/*
|
||||
--
|
||||
2.29.2
|
||||
|
||||
843
kexec-tools.spec
843
kexec-tools.spec
|
|
@ -1,20 +1,80 @@
|
|||
%global eppic_ver d84c3541035d95077aa8571f5d5c3e07c6ef510b
|
||||
%global eppic_shortver %(c=%{eppic_ver}; echo ${c:0:7})
|
||||
%global mkdf_ver 1.6.8
|
||||
%global mkdf_shortver %(c=%{mkdf_ver}; echo ${c:0:7})
|
||||
|
||||
Name: kexec-tools
|
||||
Version: 2.0.32
|
||||
Release: 1%{?dist}
|
||||
URL: https://kernel.org/pub/linux/utils/kernel/kexec
|
||||
License: GPL-2.0-only
|
||||
Version: 2.0.21
|
||||
Release: 4%{?dist}
|
||||
License: GPLv2
|
||||
Summary: The kexec/kdump userspace component
|
||||
|
||||
Source0: https://kernel.org/pub/linux/utils/kernel/kexec/%{name}-%{version}.tar.xz
|
||||
Recommends: kdump-utils
|
||||
Source0: http://kernel.org/pub/linux/utils/kernel/kexec/%{name}-%{version}.tar.xz
|
||||
Source1: kdumpctl
|
||||
Source2: kdump.sysconfig
|
||||
Source3: kdump.sysconfig.x86_64
|
||||
Source4: kdump.sysconfig.i386
|
||||
Source5: kdump.sysconfig.ppc64
|
||||
Source7: mkdumprd
|
||||
Source8: kdump.conf
|
||||
Source9: https://github.com/makedumpfile/makedumpfile/archive/%{mkdf_ver}/makedumpfile-%{mkdf_shortver}.tar.gz
|
||||
Source10: kexec-kdump-howto.txt
|
||||
Source11: fadump-howto.txt
|
||||
Source12: mkdumprd.8
|
||||
Source13: 98-kexec.rules
|
||||
Source14: 98-kexec.rules.ppc64
|
||||
Source15: kdump.conf.5
|
||||
Source16: kdump.service
|
||||
Source18: kdump.sysconfig.s390x
|
||||
Source19: https://github.com/lucchouina/eppic/archive/%{eppic_ver}/eppic-%{eppic_shortver}.tar.gz
|
||||
Source20: kdump-lib.sh
|
||||
Source21: kdump-in-cluster-environment.txt
|
||||
Source22: kdump-dep-generator.sh
|
||||
Source23: kdump-lib-initramfs.sh
|
||||
Source24: kdump.sysconfig.ppc64le
|
||||
Source25: kdumpctl.8
|
||||
Source26: live-image-kdump-howto.txt
|
||||
Source27: early-kdump-howto.txt
|
||||
Source28: kdump-udev-throttler
|
||||
Source29: kdump.sysconfig.aarch64
|
||||
Source30: 60-kdump.install
|
||||
Source31: kdump-logger.sh
|
||||
|
||||
BuildRequires: automake
|
||||
BuildRequires: autoconf
|
||||
BuildRequires: libtool
|
||||
BuildRequires: gcc
|
||||
BuildRequires: xz-devel
|
||||
BuildRequires: zlib-devel
|
||||
BuildRequires: libzstd-devel
|
||||
#######################################
|
||||
# These are sources for mkdumpramfs
|
||||
# Which is currently in development
|
||||
#######################################
|
||||
Source100: dracut-kdump.sh
|
||||
Source101: dracut-module-setup.sh
|
||||
Source102: dracut-monitor_dd_progress
|
||||
Source103: dracut-kdump-error-handler.sh
|
||||
Source104: dracut-kdump-emergency.service
|
||||
Source105: dracut-kdump-error-handler.service
|
||||
Source106: dracut-kdump-capture.service
|
||||
Source107: dracut-kdump-emergency.target
|
||||
Source108: dracut-early-kdump.sh
|
||||
Source109: dracut-early-kdump-module-setup.sh
|
||||
|
||||
Requires(post): systemd-units
|
||||
Requires(preun): systemd-units
|
||||
Requires(postun): systemd-units
|
||||
Requires(pre): coreutils sed zlib
|
||||
Requires: dracut >= 050
|
||||
Requires: dracut-network >= 050
|
||||
Recommends: dracut-squash >= 050
|
||||
Requires: ethtool
|
||||
BuildRequires: make
|
||||
BuildRequires: zlib-devel elfutils-devel glib2-devel bzip2-devel ncurses-devel bison flex lzo-devel snappy-devel
|
||||
BuildRequires: pkgconfig intltool gettext
|
||||
BuildRequires: systemd-units
|
||||
BuildRequires: automake autoconf libtool
|
||||
%ifarch %{ix86} x86_64 ppc64 ppc s390x ppc64le
|
||||
Obsoletes: diskdumputils netdump kexec-tools-eppic
|
||||
%endif
|
||||
|
||||
%ifnarch s390x
|
||||
Requires: systemd-udev%{?_isa}
|
||||
%endif
|
||||
|
||||
#START INSERT
|
||||
|
||||
|
|
@ -33,14 +93,17 @@ BuildRequires: libzstd-devel
|
|||
#
|
||||
# Patches 401 through 500 are meant for s390 kexec-tools enablement
|
||||
#
|
||||
|
||||
#
|
||||
# Patches 501 through 600 are meant for ARM kexec-tools enablement
|
||||
#
|
||||
|
||||
#
|
||||
# Patches 601 onward are generic patches
|
||||
|
||||
#
|
||||
Patch601: ./kexec-tools-2.0.20-eppic-Remove-duplicated-variable-declaration.patch
|
||||
Patch603: ./kexec-tools-2.0.20-makedumpfile-printk-add-support-for-lockless-ringbuffer.patch
|
||||
Patch604: ./kexec-tools-2.0.20-makedumpfile-printk-use-committed-finalized-state-value.patch
|
||||
Patch605: ./kexec-tools-2.0.21-makedumpfile-make-use-of-uts_namespace.name-offset-in-VMCOR.patch
|
||||
|
||||
%description
|
||||
kexec-tools provides /sbin/kexec binary that facilitates a new
|
||||
|
|
@ -50,7 +113,20 @@ binary and ancillary utilities that together form the userspace
|
|||
component of the kernel's kexec feature.
|
||||
|
||||
%prep
|
||||
%autosetup -p1
|
||||
%setup -q
|
||||
|
||||
mkdir -p -m755 kcp
|
||||
tar -z -x -v -f %{SOURCE9}
|
||||
tar -z -x -v -f %{SOURCE19}
|
||||
|
||||
%patch601 -p1
|
||||
%patch603 -p1
|
||||
%patch604 -p1
|
||||
%patch605 -p1
|
||||
|
||||
%ifarch ppc
|
||||
%define archdef ARCH=ppc
|
||||
%endif
|
||||
|
||||
%build
|
||||
autoreconf
|
||||
|
|
@ -63,507 +139,228 @@ autoreconf
|
|||
--host=powerpc64le-redhat-linux-gnu \
|
||||
--build=powerpc64le-redhat-linux-gnu \
|
||||
%endif
|
||||
--sbindir=%{_sbindir}
|
||||
--sbindir=/usr/sbin
|
||||
rm -f kexec-tools.spec.in
|
||||
# setup the docs
|
||||
cp %{SOURCE10} .
|
||||
cp %{SOURCE11} .
|
||||
cp %{SOURCE21} .
|
||||
cp %{SOURCE26} .
|
||||
cp %{SOURCE27} .
|
||||
|
||||
%make_build
|
||||
make
|
||||
%ifarch %{ix86} x86_64 ppc64 s390x ppc64le aarch64
|
||||
make -C eppic-%{eppic_ver}/libeppic
|
||||
make -C makedumpfile-%{mkdf_ver} LINKTYPE=dynamic USELZO=on USESNAPPY=on
|
||||
make -C makedumpfile-%{mkdf_ver} LDFLAGS="$LDFLAGS -I../eppic-%{eppic_ver}/libeppic -L../eppic-%{eppic_ver}/libeppic" eppic_makedumpfile.so
|
||||
%endif
|
||||
|
||||
%install
|
||||
%make_install
|
||||
rm -f %{buildroot}/%{_libdir}/kexec-tools/kexec_test
|
||||
mkdir -p -m755 $RPM_BUILD_ROOT/usr/sbin
|
||||
mkdir -p -m755 $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig
|
||||
mkdir -p -m755 $RPM_BUILD_ROOT%{_sysconfdir}/kdump
|
||||
mkdir -p -m755 $RPM_BUILD_ROOT%{_sysconfdir}/kdump/pre.d
|
||||
mkdir -p -m755 $RPM_BUILD_ROOT%{_sysconfdir}/kdump/post.d
|
||||
mkdir -p -m755 $RPM_BUILD_ROOT%{_localstatedir}/crash
|
||||
mkdir -p -m755 $RPM_BUILD_ROOT%{_mandir}/man8/
|
||||
mkdir -p -m755 $RPM_BUILD_ROOT%{_mandir}/man5/
|
||||
mkdir -p -m755 $RPM_BUILD_ROOT%{_docdir}
|
||||
mkdir -p -m755 $RPM_BUILD_ROOT%{_datadir}/kdump
|
||||
mkdir -p -m755 $RPM_BUILD_ROOT%{_udevrulesdir}
|
||||
mkdir -p $RPM_BUILD_ROOT%{_unitdir}
|
||||
mkdir -p -m755 $RPM_BUILD_ROOT%{_bindir}
|
||||
mkdir -p -m755 $RPM_BUILD_ROOT%{_libdir}
|
||||
mkdir -p -m755 $RPM_BUILD_ROOT%{_prefix}/lib/kdump
|
||||
install -m 755 %{SOURCE1} $RPM_BUILD_ROOT%{_bindir}/kdumpctl
|
||||
|
||||
install -m 755 build/sbin/kexec $RPM_BUILD_ROOT/usr/sbin/kexec
|
||||
install -m 755 build/sbin/vmcore-dmesg $RPM_BUILD_ROOT/usr/sbin/vmcore-dmesg
|
||||
install -m 644 build/man/man8/kexec.8 $RPM_BUILD_ROOT%{_mandir}/man8/
|
||||
install -m 644 build/man/man8/vmcore-dmesg.8 $RPM_BUILD_ROOT%{_mandir}/man8/
|
||||
|
||||
SYSCONFIG=$RPM_SOURCE_DIR/kdump.sysconfig.%{_target_cpu}
|
||||
[ -f $SYSCONFIG ] || SYSCONFIG=$RPM_SOURCE_DIR/kdump.sysconfig.%{_arch}
|
||||
[ -f $SYSCONFIG ] || SYSCONFIG=$RPM_SOURCE_DIR/kdump.sysconfig
|
||||
install -m 644 $SYSCONFIG $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/kdump
|
||||
|
||||
install -m 755 %{SOURCE7} $RPM_BUILD_ROOT/usr/sbin/mkdumprd
|
||||
install -m 644 %{SOURCE8} $RPM_BUILD_ROOT%{_sysconfdir}/kdump.conf
|
||||
install -m 644 kexec/kexec.8 $RPM_BUILD_ROOT%{_mandir}/man8/kexec.8
|
||||
install -m 644 %{SOURCE12} $RPM_BUILD_ROOT%{_mandir}/man8/mkdumprd.8
|
||||
install -m 644 %{SOURCE25} $RPM_BUILD_ROOT%{_mandir}/man8/kdumpctl.8
|
||||
install -m 755 %{SOURCE20} $RPM_BUILD_ROOT%{_prefix}/lib/kdump/kdump-lib.sh
|
||||
install -m 755 %{SOURCE23} $RPM_BUILD_ROOT%{_prefix}/lib/kdump/kdump-lib-initramfs.sh
|
||||
install -m 755 %{SOURCE31} $RPM_BUILD_ROOT%{_prefix}/lib/kdump/kdump-logger.sh
|
||||
%ifnarch s390x
|
||||
install -m 755 %{SOURCE28} $RPM_BUILD_ROOT%{_udevrulesdir}/../kdump-udev-throttler
|
||||
%endif
|
||||
%ifnarch s390x ppc64 ppc64le
|
||||
# For s390x the ELF header is created in the kdump kernel and therefore kexec
|
||||
# udev rules are not required
|
||||
install -m 644 %{SOURCE13} $RPM_BUILD_ROOT%{_udevrulesdir}/98-kexec.rules
|
||||
%endif
|
||||
%ifarch ppc64 ppc64le
|
||||
install -m 644 %{SOURCE14} $RPM_BUILD_ROOT%{_udevrulesdir}/98-kexec.rules
|
||||
%endif
|
||||
install -m 644 %{SOURCE15} $RPM_BUILD_ROOT%{_mandir}/man5/kdump.conf.5
|
||||
install -m 644 %{SOURCE16} $RPM_BUILD_ROOT%{_unitdir}/kdump.service
|
||||
install -m 755 -D %{SOURCE22} $RPM_BUILD_ROOT%{_prefix}/lib/systemd/system-generators/kdump-dep-generator.sh
|
||||
install -m 755 -D %{SOURCE30} $RPM_BUILD_ROOT%{_prefix}/lib/kernel/install.d/60-kdump.install
|
||||
|
||||
%ifarch %{ix86} x86_64 ppc64 s390x ppc64le aarch64
|
||||
install -m 755 makedumpfile-%{mkdf_ver}/makedumpfile $RPM_BUILD_ROOT/usr/sbin/makedumpfile
|
||||
install -m 644 makedumpfile-%{mkdf_ver}/makedumpfile.8.gz $RPM_BUILD_ROOT/%{_mandir}/man8/makedumpfile.8.gz
|
||||
install -m 644 makedumpfile-%{mkdf_ver}/makedumpfile.conf.5.gz $RPM_BUILD_ROOT/%{_mandir}/man5/makedumpfile.conf.5.gz
|
||||
install -m 644 makedumpfile-%{mkdf_ver}/makedumpfile.conf $RPM_BUILD_ROOT/%{_sysconfdir}/makedumpfile.conf.sample
|
||||
install -m 755 makedumpfile-%{mkdf_ver}/eppic_makedumpfile.so $RPM_BUILD_ROOT/%{_libdir}/eppic_makedumpfile.so
|
||||
mkdir -p $RPM_BUILD_ROOT/usr/share/makedumpfile/eppic_scripts/
|
||||
install -m 644 makedumpfile-%{mkdf_ver}/eppic_scripts/* $RPM_BUILD_ROOT/usr/share/makedumpfile/eppic_scripts/
|
||||
%endif
|
||||
|
||||
%define remove_dracut_prefix() %(echo -n %1|sed 's/.*dracut-//g')
|
||||
%define remove_dracut_early_kdump_prefix() %(echo -n %1|sed 's/.*dracut-early-kdump-//g')
|
||||
|
||||
# deal with dracut modules
|
||||
mkdir -p -m755 $RPM_BUILD_ROOT/etc/kdump-adv-conf/kdump_dracut_modules/99kdumpbase
|
||||
cp %{SOURCE100} $RPM_BUILD_ROOT/etc/kdump-adv-conf/kdump_dracut_modules/99kdumpbase/%{remove_dracut_prefix %{SOURCE100}}
|
||||
cp %{SOURCE101} $RPM_BUILD_ROOT/etc/kdump-adv-conf/kdump_dracut_modules/99kdumpbase/%{remove_dracut_prefix %{SOURCE101}}
|
||||
cp %{SOURCE102} $RPM_BUILD_ROOT/etc/kdump-adv-conf/kdump_dracut_modules/99kdumpbase/%{remove_dracut_prefix %{SOURCE102}}
|
||||
cp %{SOURCE103} $RPM_BUILD_ROOT/etc/kdump-adv-conf/kdump_dracut_modules/99kdumpbase/%{remove_dracut_prefix %{SOURCE103}}
|
||||
cp %{SOURCE104} $RPM_BUILD_ROOT/etc/kdump-adv-conf/kdump_dracut_modules/99kdumpbase/%{remove_dracut_prefix %{SOURCE104}}
|
||||
cp %{SOURCE105} $RPM_BUILD_ROOT/etc/kdump-adv-conf/kdump_dracut_modules/99kdumpbase/%{remove_dracut_prefix %{SOURCE105}}
|
||||
cp %{SOURCE106} $RPM_BUILD_ROOT/etc/kdump-adv-conf/kdump_dracut_modules/99kdumpbase/%{remove_dracut_prefix %{SOURCE106}}
|
||||
cp %{SOURCE107} $RPM_BUILD_ROOT/etc/kdump-adv-conf/kdump_dracut_modules/99kdumpbase/%{remove_dracut_prefix %{SOURCE107}}
|
||||
chmod 755 $RPM_BUILD_ROOT/etc/kdump-adv-conf/kdump_dracut_modules/99kdumpbase/%{remove_dracut_prefix %{SOURCE100}}
|
||||
chmod 755 $RPM_BUILD_ROOT/etc/kdump-adv-conf/kdump_dracut_modules/99kdumpbase/%{remove_dracut_prefix %{SOURCE101}}
|
||||
mkdir -p -m755 $RPM_BUILD_ROOT/etc/kdump-adv-conf/kdump_dracut_modules/99earlykdump
|
||||
cp %{SOURCE108} $RPM_BUILD_ROOT/etc/kdump-adv-conf/kdump_dracut_modules/99earlykdump/%{remove_dracut_prefix %{SOURCE108}}
|
||||
cp %{SOURCE109} $RPM_BUILD_ROOT/etc/kdump-adv-conf/kdump_dracut_modules/99earlykdump/%{remove_dracut_early_kdump_prefix %{SOURCE109}}
|
||||
chmod 755 $RPM_BUILD_ROOT/etc/kdump-adv-conf/kdump_dracut_modules/99earlykdump/%{remove_dracut_prefix %{SOURCE108}}
|
||||
chmod 755 $RPM_BUILD_ROOT/etc/kdump-adv-conf/kdump_dracut_modules/99earlykdump/%{remove_dracut_early_kdump_prefix %{SOURCE109}}
|
||||
|
||||
|
||||
%define dracutlibdir %{_prefix}/lib/dracut
|
||||
#and move the custom dracut modules to the dracut directory
|
||||
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/
|
||||
|
||||
%post
|
||||
# Initial installation
|
||||
%systemd_post kdump.service
|
||||
|
||||
touch /etc/kdump.conf
|
||||
# This portion of the script is temporary. Its only here
|
||||
# to fix up broken boxes that require special settings
|
||||
# in /etc/sysconfig/kdump. It will be removed when
|
||||
# These systems are fixed.
|
||||
|
||||
if [ -d /proc/bus/mckinley ]
|
||||
then
|
||||
# This is for HP zx1 machines
|
||||
# They require machvec=dig on the kernel command line
|
||||
sed -e's/\(^KDUMP_COMMANDLINE_APPEND.*\)\("$\)/\1 machvec=dig"/' \
|
||||
/etc/sysconfig/kdump > /etc/sysconfig/kdump.new
|
||||
mv /etc/sysconfig/kdump.new /etc/sysconfig/kdump
|
||||
elif [ -d /proc/sgi_sn ]
|
||||
then
|
||||
# This is for SGI SN boxes
|
||||
# They require the --noio option to kexec
|
||||
# since they don't support legacy io
|
||||
sed -e's/\(^KEXEC_ARGS.*\)\("$\)/\1 --noio"/' \
|
||||
/etc/sysconfig/kdump > /etc/sysconfig/kdump.new
|
||||
mv /etc/sysconfig/kdump.new /etc/sysconfig/kdump
|
||||
fi
|
||||
|
||||
|
||||
%postun
|
||||
%systemd_postun_with_restart kdump.service
|
||||
|
||||
%preun
|
||||
# Package removal, not upgrade
|
||||
%systemd_preun kdump.service
|
||||
|
||||
%triggerun -- kexec-tools < 2.0.2-3
|
||||
# Save the current service runlevel info
|
||||
# User must manually run systemd-sysv-convert --apply kdump
|
||||
# to migrate them to systemd targets
|
||||
/usr/bin/systemd-sysv-convert --save kdump >/dev/null 2>&1 ||:
|
||||
|
||||
# Run these because the SysV package being removed won't do them
|
||||
/sbin/chkconfig --del kdump >/dev/null 2>&1 || :
|
||||
/bin/systemctl try-restart kdump.service >/dev/null 2>&1 || :
|
||||
|
||||
|
||||
%triggerin -- kernel-kdump
|
||||
touch %{_sysconfdir}/kdump.conf
|
||||
|
||||
|
||||
%triggerpostun -- kernel kernel-xen kernel-debug kernel-PAE kernel-kdump
|
||||
# List out the initrds here, strip out version nubmers
|
||||
# and search for corresponding kernel installs, if a kernel
|
||||
# is not found, remove the corresponding kdump initrd
|
||||
|
||||
|
||||
IMGDIR=/boot
|
||||
for i in `ls $IMGDIR/initramfs*kdump.img 2>/dev/null`
|
||||
do
|
||||
KDVER=`echo $i | sed -e's/^.*initramfs-//' -e's/kdump.*$//'`
|
||||
if [ ! -e $IMGDIR/vmlinuz-$KDVER ]
|
||||
then
|
||||
# We have found an initrd with no corresponding kernel
|
||||
# so we should be able to remove it
|
||||
rm -f $i
|
||||
fi
|
||||
done
|
||||
|
||||
%files
|
||||
%{_sbindir}/kexec
|
||||
%{_mandir}/man8/kexec.8*
|
||||
%{_sbindir}/vmcore-dmesg
|
||||
%{_mandir}/man8/vmcore-dmesg.8*
|
||||
/usr/sbin/kexec
|
||||
%ifarch %{ix86} x86_64 ppc64 s390x ppc64le aarch64
|
||||
/usr/sbin/makedumpfile
|
||||
%endif
|
||||
/usr/sbin/mkdumprd
|
||||
/usr/sbin/vmcore-dmesg
|
||||
%{_bindir}/*
|
||||
%{_datadir}/kdump
|
||||
%{_prefix}/lib/kdump
|
||||
%ifarch %{ix86} x86_64 ppc64 s390x ppc64le aarch64
|
||||
%{_sysconfdir}/makedumpfile.conf.sample
|
||||
%endif
|
||||
%config(noreplace,missingok) %{_sysconfdir}/sysconfig/kdump
|
||||
%config(noreplace,missingok) %verify(not mtime) %{_sysconfdir}/kdump.conf
|
||||
%ifnarch s390x
|
||||
%config %{_udevrulesdir}
|
||||
%{_udevrulesdir}/../kdump-udev-throttler
|
||||
%endif
|
||||
%{dracutlibdir}/modules.d/*
|
||||
%dir %{_localstatedir}/crash
|
||||
%dir %{_sysconfdir}/kdump
|
||||
%dir %{_sysconfdir}/kdump/pre.d
|
||||
%dir %{_sysconfdir}/kdump/post.d
|
||||
%{_mandir}/man8/kdumpctl.8.gz
|
||||
%{_mandir}/man8/kexec.8.gz
|
||||
%ifarch %{ix86} x86_64 ppc64 s390x ppc64le aarch64
|
||||
%{_mandir}/man8/makedumpfile.8.gz
|
||||
%endif
|
||||
%{_mandir}/man8/mkdumprd.8.gz
|
||||
%{_mandir}/man8/vmcore-dmesg.8.gz
|
||||
%{_mandir}/man5/*
|
||||
%{_unitdir}/kdump.service
|
||||
%{_prefix}/lib/systemd/system-generators/kdump-dep-generator.sh
|
||||
%{_prefix}/lib/kernel/install.d/60-kdump.install
|
||||
%doc News
|
||||
%license COPYING
|
||||
%doc TODO
|
||||
%doc kexec-kdump-howto.txt
|
||||
%doc early-kdump-howto.txt
|
||||
%doc fadump-howto.txt
|
||||
%doc kdump-in-cluster-environment.txt
|
||||
%doc live-image-kdump-howto.txt
|
||||
%ifarch %{ix86} x86_64 ppc64 s390x ppc64le aarch64
|
||||
%{_libdir}/eppic_makedumpfile.so
|
||||
/usr/share/makedumpfile/
|
||||
%endif
|
||||
|
||||
%changelog
|
||||
* Thu Oct 16 2025 Packit <hello@packit.dev> - 2.0.32-1
|
||||
- Update to version 2.0.32
|
||||
- Resolves: rhbz#2404365
|
||||
|
||||
* Thu Jul 24 2025 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.31-3
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild
|
||||
|
||||
* Wed May 21 2025 Coiby Xu <coxu@redhat.com> - 2.0.31-2
|
||||
- Add BuildRequires libzstd-devel to support loading zstd-compressed kernel
|
||||
|
||||
* Tue Apr 22 2025 Packit <hello@packit.dev> - 2.0.31-1
|
||||
- Update to version 2.0.31
|
||||
- Resolves: rhbz#2359477
|
||||
|
||||
* Fri Jan 17 2025 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.30-3
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild
|
||||
|
||||
* Sun Jan 12 2025 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 2.0.30-2
|
||||
- Rebuilt for the bin-sbin merge (2nd attempt)
|
||||
|
||||
* Mon Dec 02 2024 Packit <hello@packit.dev> - 2.0.30-1
|
||||
- Update to version 2.0.30
|
||||
- Resolves: rhbz#2326470
|
||||
|
||||
* Tue Aug 06 2024 Coiby Xu <coxu@redhat.com> - 2.0.29-1
|
||||
- Update to version 2.0.29
|
||||
- Resolves: 2297928
|
||||
|
||||
* Thu Jul 18 2024 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.28-14
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild
|
||||
|
||||
* Sat Jul 13 2024 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 2.0.28-13
|
||||
- Rebuilt for the bin-sbin merge (again)
|
||||
|
||||
* Thu Jul 11 2024 Coiby Xu <coxu@redhat.com> - 2.0.28-12
|
||||
- Re-add missing build dependencies
|
||||
|
||||
* Tue Jul 09 2024 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 2.0.28-11
|
||||
- Rebuilt for the bin-sbin merge
|
||||
|
||||
* Thu Apr 25 2024 Coiby Xu <coxu@redhat.com> - 2.0.28-10
|
||||
- Split out kdump-utils and makedumpfile
|
||||
|
||||
* Thu Apr 25 2024 Coiby Xu <coxu@redhat.com> - 2.0.28-9
|
||||
- Update to makedumpfile-1.7.5
|
||||
|
||||
* Tue Apr 09 2024 Coiby Xu <coxu@redhat.com> - 2.0.28-8
|
||||
- Add a kdump-utils subpackage
|
||||
|
||||
* Sun Apr 07 2024 Coiby Xu <coxu@redhat.com> - 2.0.28-7
|
||||
- Release 2.0.28-7
|
||||
|
||||
* Sat Mar 16 2024 Coiby Xu <coxu@redhat.com> - 2.0.28-6
|
||||
- let kexec-tools depends on makedumpfile
|
||||
|
||||
* Fri Feb 23 2024 Carl George <carlwgeorge@fedoraproject.org> - 2.0.28-5
|
||||
- Add a makedumpfile subpackage
|
||||
|
||||
* Fri Feb 02 2024 Coiby Xu <coxu@redhat.com> - 2.0.28-4
|
||||
- kexec: don't use kexec_file_load on XEN
|
||||
- Fix building on x86_64 with binutils 2.41
|
||||
|
||||
* Wed Jan 24 2024 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.28-3
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
|
||||
|
||||
* Sun Jan 21 2024 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.28-2
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
|
||||
|
||||
* Wed Jan 17 2024 Coiby Xu <coxu@redhat.com> - 2.0.28-1
|
||||
- kexec-tools 2.0.28 (Simon Horman)
|
||||
- Use the same /etc/resolve.conf in kdump initrd if it's managed manually
|
||||
- dracut-module-setup: consolidate s390 network device config
|
||||
|
||||
* Mon Dec 11 2023 Coiby Xu <coxu@redhat.com> - 2.0.27-5
|
||||
- Let %post scriptlet always exits with the zero exit status
|
||||
|
||||
* Wed Nov 08 2023 Coiby Xu <coxu@redhat.com> - 2.0.27-4
|
||||
- update to makedumpfile-1.7.4
|
||||
- kdump-lib.sh: add extra 64M to default crashkernel if sme/sev is active
|
||||
- Allow _crashkernel_add to address larger memory ranges
|
||||
|
||||
* Tue Oct 17 2023 Coiby Xu <coxu@redhat.com> - 2.0.27-3
|
||||
- Only try to reset crashkernel when kdump.service is enabled
|
||||
|
||||
* Fri Oct 13 2023 Coiby Xu <coxu@redhat.com> - 2.0.27-2
|
||||
- update to latest upstream kexec-tools
|
||||
|
||||
* Tue Oct 10 2023 Coiby Xu <coxu@redhat.com> - 2.0.27-1
|
||||
- kexec-tools 2.0.27 (Simon Horman)
|
||||
|
||||
* Thu Aug 31 2023 Coiby Xu <coxu@redhat.com> - 2.0.27-1
|
||||
- kexec-tools 2.0.27 (Simon Horman)
|
||||
|
||||
* Thu Jul 20 2023 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.26-8
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild
|
||||
|
||||
* Wed Jun 14 2023 Coiby <coxu@redhat.com> - 2.0.26-7
|
||||
- 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()
|
||||
|
||||
* Fri Jun 02 2023 Timothée Ravier <tim@siosm.fr> - 2.0.26-6
|
||||
- Make binutils a recommend as it's only needed for UKI support
|
||||
|
||||
* Mon May 29 2023 Coiby <coxu@redhat.com> - 2.0.26-5
|
||||
- Simplify the management of the kernel parameter crashkernel
|
||||
- Let _update_kernel_cmdline return the correct return code
|
||||
- mkdumprd: call dracut with --add-device to install the drivers needed by /boot partition automatically for FIPS
|
||||
- kdump-lib: fix the matching pattern for debug-kernel
|
||||
|
||||
* Tue May 16 2023 Coiby <coxu@redhat.com> - 2.0.26-4
|
||||
- kdumpctl: Add support for systemd-boot paths
|
||||
- mkdumprd: add --aggressive-strip as default dracut args
|
||||
- kdumpctl: Add basic UKI support
|
||||
- kdumpctl: Move temp file in get_kernel_size to global temp dir
|
||||
- kdumpctl: Move get_kernel_size to kdumpctl
|
||||
- kdumpctl: fix is_dracut_mod_omitted
|
||||
- kdump-lib: move is_dracut_mod_omitted to kdumpctl
|
||||
- kdump-lib: remove get_nmcli_connection_apath_by_ifname
|
||||
- kdump-lib: remove get_nmcli_field_by_conpath
|
||||
- dracut-module-setup: remove dead source_ifcfg_file
|
||||
- kdump-lib-initramfs: remove is_fs_dump_target
|
||||
- kdump-lib-initramfs: harden is_mounted
|
||||
- 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
|
||||
- kdumpctl: lower the log level in reset_crashkernel_for_installed_kernel
|
||||
- Install nfsv4-related drivers when users specify nfs dumping via dracut_args
|
||||
- sysconfig: add zfcp.allow_lun_scan to KDUMP_COMMANDLINE_REMOVE on s390
|
||||
- Use the correct command to get architecture
|
||||
|
||||
* Mon Jan 30 2023 Coiby <coxu@redhat.com> - 2.0.26-3
|
||||
- kdumpctl: make do_estimate more robust
|
||||
- kdumpctl: refractor check_rebuild
|
||||
- kdumpctl: cleanup 'stop'
|
||||
- kdumpctl: cleanup 'start'
|
||||
- kdump-lib: fix prepare_cmdline
|
||||
- kdumpctl: move aws workaround to kdump-lib
|
||||
- unit tests: add tests for prepare_cmdline
|
||||
- kdump-lib: always specify version in is_squash_available
|
||||
- mkfadumprd: drop unset globals from debug output
|
||||
- kdumpctl: merge check_current_{kdump,fadump}_status
|
||||
- dracut-early-kdump: explicitly use bash
|
||||
- dracut-early-kdump: fix shellcheck findings
|
||||
- kdumpctl: simplify check_failure_action_config
|
||||
- makedumpfile: Fix wrong exclusion of slab pages on Linux 6.2-rc1
|
||||
|
||||
* Thu Jan 19 2023 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.26-2
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild
|
||||
|
||||
* Thu Dec 22 2022 Coiby <coxu@redhat.com> - 2.0.26-1
|
||||
- Update kexec-tools to 2.0.25
|
||||
- Don't try to update crashkernel when bootloader is not installed
|
||||
- dracut-module-setup.sh: also install the driver of physical NIC for Hyper-V VM with accelerated networking
|
||||
- dracut-module-setup.sh: skip installing driver for the loopback interface
|
||||
|
||||
* Wed Dec 07 2022 Coiby <coxu@redhat.com> - 2.0.25-4
|
||||
- dracut-module-setup.sh: stop overwriting dracut's trap handler
|
||||
- fadump: avoid status check while starting in fadump mode
|
||||
- fadump: add a kernel install hook to clean up fadump initramfs
|
||||
- fadump: fix default initrd backup and restore logic
|
||||
- fadump: use 'zstd' as the default compression method
|
||||
|
||||
* Fri Nov 25 2022 Coiby <coxu@redhat.com> - 2.0.25-3
|
||||
- kdumpctl: Optimize _find_kernel_path_by_release regex string
|
||||
- unit tests: adapt check_config to gen-kdump-conf.sh
|
||||
- kdump.conf: use a simple generator script to maintain
|
||||
- Don't run kdump_check_setup_iscsi in a subshell in order to collect needed network interfaces
|
||||
- Simplify setup_znet by copying connection profile to initrd
|
||||
- Wait for the network to be truly ready before dumping vmcore
|
||||
- Address the cases where a NIC has a different name in kdump kernel
|
||||
- Reduce kdump memory consumption by only installing needed NIC drivers
|
||||
- Reduce kdump memory consumption by not letting NetworkManager manage unneeded network interfaces
|
||||
- Set up kdump network by directly copying NM connection profile to initrd
|
||||
- Stop dracut 35network-manager from running nm-initrd-generator
|
||||
- Apply the timeout configuration of nm-initrd-generator
|
||||
- Determine whether IPv4 or IPv6 is needed
|
||||
- Add functions to copy NetworkManage connection profiles to the initramfs
|
||||
- Fix error for vlan over team network interface
|
||||
- Skip reset_crashkernel_after_update during package install
|
||||
- Don't check fs modified when dump target is lvm2 thinp
|
||||
- tests: use .nmconnection to set up test network
|
||||
- fadump: preserve file modification time to help with hardlinking
|
||||
- fadump: do not use squash to reduce image size
|
||||
- selftest: Add lvm2 thin provision for kdump test
|
||||
- selftest: Only iterate the .sh files for test execution
|
||||
- Add dependency of dracut lvmthinpool-monitor module
|
||||
- lvm.conf should be check modified if lvm2 thinp enabled
|
||||
- Add lvm2 thin provision dump target checker
|
||||
|
||||
* Thu Oct 27 2022 Coiby <coxu@redhat.com> - 2.0.25-2
|
||||
- Update makedumpfile to 1.7.2
|
||||
- Skip reading /etc/defaut/grub for s390x
|
||||
- Include the memory overhead cost of cryptsetup when estimating the memory requirement for LUKS-encrypted target
|
||||
- Choosing the most memory-consuming key slot when estimating the memory requirement for LUKS-encrypted target
|
||||
- Fix grep warnings "grep: warning: stray \ before -"
|
||||
- Only try to reset crashkernel for osbuild during package install
|
||||
- Prefix reset-crashkernel-{for-installed_kernel,after-update} with underscore
|
||||
- Seperate dracut and dracut-squash compressor for zstd
|
||||
- Fix the sync issue for dump_fs
|
||||
- virtiofs support for kexec-tools
|
||||
- fadump: avoid non-debug kernel use for fadump case
|
||||
- mkdumprd: Improve error messages on non-existing NFS target directories
|
||||
- kdumpctl: make the kdump.log root-readable-only
|
||||
- sysconfig: use a simple generator script to maintain
|
||||
|
||||
* Wed Aug 03 2022 Coiby <coxu@redhat.com> - 2.0.25-1
|
||||
- Update kexec-tools to 2.0.25
|
||||
- remind the users to run zipl after calling grubby on s390x
|
||||
- remove useless --zipl when calling grubby to update kernel command line
|
||||
- skip updating /etc/default/grub for s390x
|
||||
- use /run/ostree-booted to tell if scriptlet is running on OSTree system
|
||||
- Allow to update kexec-tools using virt-customize for cloud base image
|
||||
- KDUMP_COMMANDLINE: remove irqpoll parameter on aws aarch64 platform
|
||||
|
||||
* Thu Jul 21 2022 Coiby <coxu@redhat.com> - 2.0.24-4
|
||||
- Checking the existence of 40-redhat.rules before modifying
|
||||
- kdump-lib: Add the CoreOS kernel dir to the boot_dirlist
|
||||
- kdump-lib: attempt to fix BOOT_IMAGE detection
|
||||
- kdump-lib: change how ostree based systems are detected
|
||||
- kdump-lib: clear up references to Atomic/CoreOS
|
||||
- crashkernel: optimize arm64 reserved size if PAGE_SIZE=4k
|
||||
- kdump-lib: use non-debug kernels first
|
||||
|
||||
* Mon May 23 2022 Coiby <coxu@redhat.com> - 2.0.24-3
|
||||
- Update makedumpfile to 1.7.1
|
||||
- unit tests: add tests for get_system_size and get_recommend_size
|
||||
- improve get_recommend_size
|
||||
- fix a calculation error in get_system_size
|
||||
- logger: save log after all kdump progress finished
|
||||
|
||||
* Sun Apr 24 2022 Coiby <coxu@redhat.com> - 2.0.24-2
|
||||
- remove the upper bound of default crashkernel value example
|
||||
- update fadump-howto
|
||||
- update kexec-kdump-howto
|
||||
- update crashkernel-howto
|
||||
- add man documentation for kdumpctl get-default-crashkernel
|
||||
- unit tests: add check_config with with the default kdump.conf
|
||||
- unit tests: add tests for kdump_get_conf_val in kdump-lib-initramfs.sh
|
||||
- unit tests: add tests for "kdumpctl reset-crashkernel"
|
||||
- unit tests: add tests for _{update,read}_kernel_arg_in_grub_etc_default in kdumpctl
|
||||
- unit tests: add tests for kdumpctl read_proc_environ_var and _is_osbuild
|
||||
- unit tests: add tests for get_dump_mode_by_fadump_val
|
||||
- unit tests: add tests for get_grub_kernel_boot_parameter
|
||||
- unit tests: prepare for kdumpctl and kdump-lib.sh to be unit-tested
|
||||
|
||||
* Mon Apr 11 2022 Coiby <coxu@redhat.com> - 2.0.24-1
|
||||
- Update kexec-tools to 2.0.24
|
||||
- kdumpctl: remove kdump_get_conf_val in save_raw
|
||||
- kdumpctl: drop DUMP_TARGET variable
|
||||
- kdumpctl: drop SSH_KEY_LOCATION variable
|
||||
- kdumpctl: drop SAVE_PATH variable
|
||||
- kdumpctl: reduce file operations on kdump.conf
|
||||
- kdumpctl: merge check_ssh_config into check_config
|
||||
- kdumpctl: simplify propagate_ssh_key
|
||||
- kdumpctl: forbid aliases from ssh config
|
||||
- kdumpctl: fix comment in check_and_wait_network_ready
|
||||
- kdump-lib-initramfs: merge definitions for default ssh key
|
||||
- kdumpctl: remove unnecessary uses of $?
|
||||
- kdump-lib: fix typo in variable name
|
||||
- kdump-capture.service: switch to journal for stdout
|
||||
- kdumpctl/estimate: Fix unnecessary warning
|
||||
- kdumpctl: sync the $TARGET_INITRD after rebuild
|
||||
- try to update the crashkernel in GRUB_ETC_DEFAULT after kexec-tools updates the default crashkernel value
|
||||
- address the case where there are multiple values for the same kernel arg
|
||||
- update kernel crashkernel in posttrans RPM scriptlet when updating kexec-tools
|
||||
- kdump-lib.sh: Check the output of blkid with sed instead of eval
|
||||
|
||||
* Mon Feb 14 2022 Coiby <coxu@redhat.com> - 2.0.23-5
|
||||
- fix incorrect usage of _get_all_kernels_from_grubby
|
||||
- fix the mistake of swapping function parameters of read_proc_environ_var
|
||||
|
||||
* Wed Jan 26 2022 Coiby <coxu@redhat.com> - 2.0.23-4
|
||||
- fix broken kdump_get_arch_recommend_size
|
||||
- remove the upper bound of 102400T for the range in default crashkernel
|
||||
- fix the error of parsing the container environ variable for osbuild
|
||||
- s390: handle R_390_PLT32DBL reloc entries in machine_apply_elf_rel()
|
||||
- Revert "Remove trace_buf_size and trace_event from the kernel bootparameters of the kdump kernel"
|
||||
- spec: only install mkfadumprd for ppc
|
||||
- selftest: Add early kdump test
|
||||
- selftest: run-test.sh: wait for subprocess instead of kill it
|
||||
|
||||
* Thu Jan 20 2022 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.23-3
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild
|
||||
|
||||
* Thu Jan 13 2022 Coiby <coxu@redhat.com> - 2.0.23-2
|
||||
- fix "kdump: Invalid kdump config option auto_reset_crashkernel" error
|
||||
- use grep -s to suppress error messages about nonexistent or unreadable files
|
||||
- kdump-lib.sh: Escape '|' for 'failure_action|default' in is_dump_to_rootfs
|
||||
- Set zstd as the default compression method for kdump initrd
|
||||
- (origin/auto_reset_crashkernel, auto_reset_crashkernel) update crashkernel-howto
|
||||
- set up kernel crashkernel for osbuild in kernel hook
|
||||
- reset kernel crashkernel for the special case where the kernel is updated right after kexec-tools
|
||||
- try to reset kernel crashkernel when kexec-tools updates the default crashkernel value
|
||||
- introduce the auto_reset_crashkernel option to kdump.conf
|
||||
- rewrite reset_crashkernel to support fadump and to used by RPM scriptlet
|
||||
- fix incorrect usage of rpm-ostree to update kernel command line parameters
|
||||
- add helper functions to get kernel path by kernel release and the path of current running kernel
|
||||
- add helper functions to get dump mode
|
||||
- add a helper function to read kernel cmdline parameter from grubby --info
|
||||
- provide kdumpctl get-default-crashkernel for kdump_anaconda_addon and RPM scriptlet
|
||||
- factor out kdump_get_arch_recommend_crashkernel
|
||||
- update default crashkernel value
|
||||
- kdumpctl: remove some legacy code
|
||||
- dracut-early-kdump-module-setup.sh: install xargs and kdump-lib-initramfs.sh
|
||||
- ppc64/ppc64le: drop cpu online rule in 40-redhat.rules in kdump initramfs
|
||||
- kdump/ppc64: suppress the error message "Could not find a registered notification tool" from servicelog_notify
|
||||
- add keytuils as a weak dependency for POWER
|
||||
- Document/kexec-kdump-howto.txt: improve notes for kdump_pre and kdump_post scripts
|
||||
- sysconfig: make kexec_file_load as default option on ppc64le
|
||||
- sysconfig: make kexec_file_load as default option on aarch64
|
||||
- Enable zstd compression for makedumpfile in kexec-tools.spec
|
||||
|
||||
* Thu Nov 18 2021 Coiby <coxu@redhat.com> - 2.0.23-1
|
||||
- Update kexec-tools to 2.0.23
|
||||
- Rebase makedumpfile to 1.7.0
|
||||
- fix broken extra_bins when installing multiple binaries
|
||||
- mkdumprd: drop mountaddr/mountproto nfs mount options
|
||||
- selftest: kill VM reliably by recursively kill children processes
|
||||
|
||||
* Thu Sep 16 2021 Kairui Song <kasong@redhat.com> - 2.0.22-8
|
||||
- 92-crashkernel.install: fix exit code
|
||||
- dracut-early-kdump.sh: make it POSIX compatible
|
||||
- Add header comment for POSIX compliant scripts
|
||||
- mkdumprd: allow using dash
|
||||
- kdump-logger.sh: make it POSIX compatible
|
||||
- kdump-lib.sh: reformat with shfmt
|
||||
- kdump-lib.sh: declare and assign separately
|
||||
- kdump-lib.sh: fix variable quoting issue
|
||||
- kdump-lib.sh: fix a few ambiguous or redundant code
|
||||
- kdump-lib.sh: fix arithmetic operation syntax
|
||||
- kdump-lib.sh: remove useless echo and cat
|
||||
- kdump-lib.sh: rework nmcli related functions
|
||||
- kdump-lib.sh: replace '[ ]' with '[[ ]]' and get rid of legacy ``
|
||||
- kdump-lib-initramfs.sh: make it POSIX compatible
|
||||
- dracut-kdump.sh: reformat with shfmt
|
||||
- dracut-kdump.sh: make it POSIX compatible
|
||||
- dracut-kdump.sh: POSIX doesn't support pipefail
|
||||
- dracut-kdump.sh: Use stat instead of ls to get vmcore size
|
||||
- dracut-kdump.sh: simplify dump_ssh
|
||||
- dracut-kdump.sh: remove add_dump_code
|
||||
- dracut-kdump.sh: don't put KDUMP_SCRIPT_DIR in PATH
|
||||
- kdump-lib-initramfs.sh: move dump related functions to kdump.sh
|
||||
- Merge kdump-error-handler.sh into kdump.sh
|
||||
- kdump-lib-initramfs.sh: prepare to be a POSIX compatible lib
|
||||
- bash scripts: reformat with shfmt
|
||||
- bash scripts: declare and assign separately
|
||||
- bash scripts: fix redundant exit code check
|
||||
- bash scripts: fix variable quoting issue
|
||||
- bash scripts: replace '[ ]' with '[[ ]]' for bash scripts
|
||||
- bash scripts: use $(...) notation instead of legacy `...`
|
||||
- bash scripts: always use "read -r"
|
||||
- bash scripts: get rid of unnecessary sed calls
|
||||
- bash scripts: get rid of expr and let
|
||||
- bash scripts: remove useless cat
|
||||
- dracut-module-setup.sh: remove surrounding $() for subshell
|
||||
- dracut-module-setup.sh: make iscsi check fail early if cd failed
|
||||
- dracut-module-setup.sh: fix a loop over ls issue
|
||||
- dracut-module-setup.sh: fix a ambiguous variable reference
|
||||
- dracut-module-setup.sh: use "*" to expend array as string
|
||||
- dracut-module-setup.sh: fix _bondoptions wrong references
|
||||
- dracut-module-setup.sh: remove an unused variable
|
||||
- dracut-module-setup.sh: rework kdump_get_ip_route_field
|
||||
- mkfadumprd: make _dracut_isolate_args an array
|
||||
- mkdumprd: use array to store ssh arguments in mkdir_save_path_ssh
|
||||
- mkdumprd: remove an awk call in get_fs_size
|
||||
- mkdumprd: fix multiple issues with get_ssh_size
|
||||
- mkdumprd: remove some redundant echo
|
||||
- mkdumprd: make dracut_args an array again
|
||||
- mkdumprd: use kdump_get_conf_val to read config values
|
||||
- kdumpctl: refine grep usage
|
||||
- kdumpctl: fix fragile loops over find output
|
||||
- kdumpctl: use kdump_get_conf_val to read config values
|
||||
- kdump-lib.sh: use kdump_get_conf_val to read config values
|
||||
- kdump-lib.sh: add a config value retrive helper
|
||||
- kdump-lib.sh: add a config format and read helper
|
||||
- Add a .editorconfig file
|
||||
|
||||
* Tue Aug 31 2021 Adam Williamson <awilliam@redhat.com> - 2.0.22-7
|
||||
- Don't exit 1 from 92-crashkernel.install if zipl is absent (#1993505)
|
||||
|
||||
* Fri Aug 20 2021 Kairui Song <kasong@redhat.com> - 2.0.22-6
|
||||
- Remove hard requirement on grubby
|
||||
- Clear old crashkernl=auto in comment and doc
|
||||
- kdump/ppc64: migration action registration clean up
|
||||
- Check the existence of /sys/bus/ccwgroup/devices/*/online beforehand
|
||||
- Make `dump_to_rootfs` wait for 90s for real
|
||||
- Update crashkernel-howto.txt
|
||||
- kdump/ppc64: rebuild initramfs image after migration
|
||||
- kdump.sysconfig.s390: Remove "prot_virt" from kdump kernel cmdline
|
||||
- kdumpctl: fix a typo
|
||||
- Remove references to systemd-sysv-convert
|
||||
- kdump-lib.sh: kdump_get_arch_recommend_size uses crashkernel.default
|
||||
- Revert "Revert "x86_64: enable the kexec file load by default""
|
||||
- Cleanup dead systemd services before start sysroot.mount
|
||||
- Add a crashkernel-howto.txt doc
|
||||
- Add a new hook: 92-crashkernel.install
|
||||
- kdumpctl: Add kdumpctl reset-crashkernel
|
||||
- Revert "kdump-lib.sh: Remove is_atomic"
|
||||
- fadump-init: clean up mount points properly
|
||||
- fadump: kdumpctl should check the modules used by the fadump initramfs
|
||||
- fadump: isolate fadump initramfs image within the default one
|
||||
|
||||
* Thu Jul 22 2021 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.22-5
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild
|
||||
|
||||
* Tue Jun 29 2021 Kairui Song <kasong@redhat.com> - 2.0.22-4
|
||||
- fix format issue in find_online_znet_device
|
||||
- check the existence of /sys/bus/ccwgroup/devices before trying to find online network device
|
||||
- check for invalid physical address of /proc/kcore when making ELF dumpfile
|
||||
- check for invalid physical address of /proc/kcore when finding max_paddr
|
||||
- Increase SECTION_MAP_LAST_BIT to 5
|
||||
|
||||
* Sun Jun 20 2021 Kairui Song <kasong@redhat.com> - 2.0.22-3
|
||||
- selftest: Make test_base_image depends on EXTRA_RPMS
|
||||
- selftest: fix the error of misplacing double quotes
|
||||
- mkdumprd: display the absolute path of dump location in the check_user_configured_target()
|
||||
- Iterate /sys/bus/ccwgroup/devices to tell if we should set up rd.znet
|
||||
- Use a customized emergency shell
|
||||
- Remove the kdump error handler isolation wrapper
|
||||
- Don's try to restart dracut-initqueue if it's already there
|
||||
- kdump-lib.sh: fix a warning in prepare_kdump_bootinfo()
|
||||
- kdump-lib.sh: fix the case if no enough total RAM for kdump in get_recommend_size()
|
||||
- kdumpctl: Add kdumpctl estimate
|
||||
- mkdumprd: make use of the new get_luks_crypt_dev helper
|
||||
- kdump-lib.sh: introduce a helper to get all crypt dev used by kdump
|
||||
- kdump-lib.sh: introduce a helper to get underlying crypt device
|
||||
|
||||
* Thu May 13 2021 Kairui Song <kasong@redhat.com> - 2.0.22-2
|
||||
- Disable CMA in kdump 2nd kernel
|
||||
- Warn the user if network scripts are used
|
||||
- Set up bond cmdline by "nmcli --get-values"
|
||||
- Set up dns cmdline by parsing "nmcli --get-values"
|
||||
- Set up s390 znet cmdline by "nmcli --get-values"
|
||||
- Add helper to get nmcli connection show cmd by ifname
|
||||
- Add helper to get nmcli connection apath by ifname
|
||||
- Add helper to get value by field using "nmcli --get-values"
|
||||
- Update makedumpfile to 1.6.9
|
||||
|
||||
* Tue May 11 2021 Kairui Song <kasong@redhat.com> - 2.0.22-1
|
||||
- Update kexec-tools to 2.0.22
|
||||
- rd.route should use the name from kdump_setup_ifname
|
||||
- get kdump ifname once in kdump_install_net
|
||||
- Fix incorrect file permissions of vmcore-dmesg-incomplete.txt
|
||||
- Revert "Always set vm.zone_reclaim_mode = 3 in kdump kernel"
|
||||
- kdumpctl: fix check_config error when kdump.conf is empty
|
||||
|
||||
* Wed Apr 28 2021 Kairui Song <kasong@redhat.com> - 2.0.21-9
|
||||
- Make dracut-squash required for kexec-tools
|
||||
- Show write byte size in report messages
|
||||
- Add shorthand --show-stats option to show report stats
|
||||
- Add --dry-run option to prevent writing the dumpfile
|
||||
- fadump: fix dump capture failure to root disk
|
||||
- Write to `/var/lib/kdump` if $KDUMP_BOOTDIR not writable
|
||||
- Drop dependency on ipcalc
|
||||
- Implement IP netmask calculation to replace "ipcalc -m"
|
||||
- Don't use die in dracut-module-setup.sh
|
||||
- Don't iterate the whole /sys/devices just to find drm device
|
||||
|
||||
* Sat Apr 03 2021 Kairui Song <kasong@redhat.com> - 2.0.21-8
|
||||
- Update eppic to latest upstream snapshot
|
||||
- mkdumprd: prompt the user to install nfs-utils when mounting NFS fs failed
|
||||
- Fix incorrect permissions on kdump dmesg file
|
||||
- Fix incorrect vmcore permissions when dumped through ssh
|
||||
- (origin/main) Stop reloading kdump service on CPU hotplug event for FADump
|
||||
- Rebuilt for updated systemd-rpm-macros
|
||||
- fadump: improve fadump-howto.txt about remote dump target setup
|
||||
- kdumpctl: enable secure boot on ppc64le LPARs
|
||||
- add dependency on ipcalc
|
||||
|
||||
* Tue Mar 02 2021 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 2.0.21-7
|
||||
- Rebuilt for updated systemd-rpm-macros
|
||||
See https://pagure.io/fesco/issue/2583.
|
||||
|
||||
* Mon Feb 08 2021 Kairui Song <kasong@redhat.com> - 2.0.21-6
|
||||
- Remove trace_buf_size and trace_event from the kernel bootparameters of the kdump kernel
|
||||
- kdump-lib.sh: introduce functions to return recommened mem size
|
||||
|
||||
* Tue Jan 26 2021 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.21-5
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
|
||||
|
||||
* Fri Jan 22 2021 Kairui Song <kasong@redhat.com> - 2.0.21-4
|
||||
- dracut-module-setup.sh: enable ForwardToConsole=yes in fadump mode
|
||||
- kdump.conf: add ipv6 example for nfs and ssh dump
|
||||
|
|
@ -920,7 +717,7 @@ rm -f %{buildroot}/%{_libdir}/kexec-tools/kexec_test
|
|||
- Revert "dracut-module-setup.sh: pass correct ip= param for ipv6"
|
||||
|
||||
* Sat Apr 28 2018 Dave Young <dyoung@redhat.com> - 2.0.17-2
|
||||
- pull in makedumpfile 1.6.3
|
||||
- pull in makedumpfile 1.6.3
|
||||
|
||||
* Sat Apr 28 2018 Dave Young <dyoung@redhat.com> - 2.0.17-1
|
||||
- pull in 2.0.17
|
||||
|
|
@ -980,10 +777,10 @@ rm -f %{buildroot}/%{_libdir}/kexec-tools/kexec_test
|
|||
* Tue Aug 8 2017 Dave Young <dyoung@redhat.com> - 2.0.15-10
|
||||
- Improve 'cpu add' udev rules
|
||||
- module-setup: suppress the early iscsi error messages
|
||||
- mkdumprd: use 300s as the default systemd unit timeout for kdump mount
|
||||
- mkdumprd: use 300s as the default systemd unit timeout for kdump mount
|
||||
|
||||
* Mon Aug 7 2017 Dave Young <dyoung@redhat.com> - 2.0.15-9
|
||||
- fix makedumpfile bug 1474706
|
||||
- fix makedumpfile bug 1474706
|
||||
|
||||
* Thu Aug 03 2017 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.15-8
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild
|
||||
|
|
@ -1139,9 +936,9 @@ rm -f %{buildroot}/%{_libdir}/kexec-tools/kexec_test
|
|||
- module-setup: Use get_ifcfg_filename() to get the proper ifcfg file
|
||||
|
||||
* Mon May 30 2016 Dave Young <dyoung@redhat.com> - 2.0.12-4
|
||||
- update kdump anaconda addon to add mem range in tui
|
||||
- update kdump anaconda addon to add mem range in tui
|
||||
- .gitignore: Update to make it more generic
|
||||
- kdumpctl: check_rebuild improvement
|
||||
- kdumpctl: check_rebuild improvement
|
||||
- kdumpctl: Do not rebuild initramfs when $KDUMP_BOOTDIR is read only
|
||||
|
||||
* Tue Mar 29 2016 Dave Young <dyoung@redhat.com> - 2.0.12-3
|
||||
|
|
@ -1152,7 +949,7 @@ rm -f %{buildroot}/%{_libdir}/kexec-tools/kexec_test
|
|||
- ppc64le: fix kexec hang due to ppc64 elf abi breakage
|
||||
|
||||
* Tue Mar 22 2016 Dave Young <dyoung@redhat.com> - 2.0.12-1
|
||||
- Rebase kexec-tools to 2.0.12
|
||||
- Rebase kexec-tools to 2.0.12
|
||||
|
||||
* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.11-4
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
|
||||
|
|
@ -1165,7 +962,7 @@ rm -f %{buildroot}/%{_libdir}/kexec-tools/kexec_test
|
|||
- fix bogus date in changelog
|
||||
|
||||
* Thu Nov 19 2015 Dave Young <dyoung@redhat.com> - 2.0.11-2
|
||||
- Rebase to upstream makedumpfile 1.5.9
|
||||
- Rebase to upstream makedumpfile 1.5.9
|
||||
|
||||
* Mon Nov 9 2015 Dave Young <dyoung@redhat.com> - 2.0.11-1
|
||||
- Rebase to upstream kexec-tools 2.0.11
|
||||
|
|
@ -1175,7 +972,7 @@ rm -f %{buildroot}/%{_libdir}/kexec-tools/kexec_test
|
|||
- Remove duplicate prefix path ${initdir}
|
||||
|
||||
* Tue Sep 8 2015 Dave Young <dyoung@redhat.com> - 2.0.10-8
|
||||
- update kdump addon to fix a kickstart installationi issue
|
||||
- update kdump addon to fix a kickstart installationi issue
|
||||
|
||||
* Wed Aug 19 2015 Dave Young <dyoung@redhat.com> - 2.0.10-7
|
||||
- add man page for kdumpctl
|
||||
|
|
@ -1517,7 +1314,7 @@ rm -f %{buildroot}/%{_libdir}/kexec-tools/kexec_test
|
|||
|
||||
* Thu Mar 14 2013 Baoquan He <bhe@redhat.com> - 2.0.3-69
|
||||
- Support for eppic language as a subpackage
|
||||
|
||||
|
||||
* Thu Mar 14 2013 Baoquan He <bhe@redhat.com> - 2.0.3-68
|
||||
- tune sysconfig to save memory usage
|
||||
- Remove useless codes related to LOGGER in kdumpctl
|
||||
|
|
@ -1644,7 +1441,7 @@ rm -f %{buildroot}/%{_libdir}/kexec-tools/kexec_test
|
|||
- do not add fstab-sys module in dracut cmdline
|
||||
- omit dash module
|
||||
- network dns config fix
|
||||
- shell exit value fix
|
||||
- shell exit value fix
|
||||
|
||||
* Thu Jul 19 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.0.3-52
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild
|
||||
|
|
@ -1971,7 +1768,7 @@ rm -f %{buildroot}/%{_libdir}/kexec-tools/kexec_test
|
|||
- Make makedumpfile a dynamic binary
|
||||
|
||||
* Mon Jul 06 2009 Neil Horman <nhorman@redhat.com> 2.0.0-19
|
||||
- Fix build issue
|
||||
- Fix build issue
|
||||
|
||||
* Mon Jul 06 2009 Neil Horman <nhorman@redhat.com> 2.0.0-18
|
||||
- Updated initscript to use mkdumprd2 if manifest is present
|
||||
|
|
@ -2183,7 +1980,7 @@ rm -f %{buildroot}/%{_libdir}/kexec-tools/kexec_test
|
|||
- updating mkdumprd to use new kcp syntax
|
||||
|
||||
* Wed Aug 23 2006 Neil Horman <nhorman@redhat.com> - 1.101-48
|
||||
- Bumping revision number
|
||||
- Bumping revision number
|
||||
|
||||
* Tue Aug 22 2006 Jarod Wilson <jwilson@redhat.com> - 1.101-47
|
||||
- ppc64 no-more-platform fix
|
||||
|
|
@ -2203,7 +2000,7 @@ rm -f %{buildroot}/%{_libdir}/kexec-tools/kexec_test
|
|||
|
||||
* Tue Aug 15 2006 Neil Horman <nhorman@redhat.com> - 1.101-44
|
||||
- updated init script to implement status function/scrub err messages
|
||||
|
||||
|
||||
* Wed Aug 09 2006 Jarod Wilson <jwilson@redhat.com> - 1.101-43
|
||||
- Misc spec cleanups and macro-ifications
|
||||
|
||||
|
|
@ -2211,13 +2008,13 @@ rm -f %{buildroot}/%{_libdir}/kexec-tools/kexec_test
|
|||
- Add %%dir /var/crash, so default kdump setup works
|
||||
|
||||
* Thu Aug 03 2006 Neil Horman <nhorman@redhat.com> - 1.101-41
|
||||
- fix another silly makefile error for makedumpfile
|
||||
- fix another silly makefile error for makedumpfile
|
||||
|
||||
* Thu Aug 03 2006 Neil Horman <nhorman@redhat.com> - 1.101-40
|
||||
- exclude makedumpfile from build on non-x86[_64] arches
|
||||
- exclude makedumpfile from build on non-x86[_64] arches
|
||||
|
||||
* Thu Aug 03 2006 Neil Horman <nhorman@redhat.com> - 1.101-39
|
||||
- exclude makedumpfile from build on non-x86[_64] arches
|
||||
- exclude makedumpfile from build on non-x86[_64] arches
|
||||
|
||||
* Thu Aug 03 2006 Neil Horman <nhorman@redhat.com> - 1.101-38
|
||||
- updating makedumpfile makefile to use pkg-config on glib-2.0
|
||||
|
|
@ -2314,7 +2111,7 @@ rm -f %{buildroot}/%{_libdir}/kexec-tools/kexec_test
|
|||
|
||||
* Wed Nov 16 2005 Thomas Graf <tgraf@redhat.com> - 1.101-5
|
||||
- Report missing kdump kernel image as warning
|
||||
|
||||
|
||||
* Thu Nov 3 2005 Jeff Moyer <jmoyer@redhat.com> - 1.101-4
|
||||
- Build for x86_64 as well. Kdump support doesn't work there, but users
|
||||
should be able to use kexec.
|
||||
|
|
|
|||
25
live-image-kdump-howto.txt
Normal file
25
live-image-kdump-howto.txt
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
Kdump now works on live images with some manual configurations. Here is the step
|
||||
by step guide.
|
||||
|
||||
1. Enable crashkernel reservation
|
||||
|
||||
Since there isn't any config file that can be used to configure kernel
|
||||
parameters for live images before booting them, we have to append 'crashkernel'
|
||||
argument in boot menu every time we boot a live image.
|
||||
|
||||
2. Change dump target in /etc/kdump.conf
|
||||
|
||||
When kdump kernel boots in a live environment, the default target /var/crash is
|
||||
in RAM so you need to change the dump target to an external disk or a network
|
||||
dump target.
|
||||
|
||||
Besides, make sure that "default dump_to_rootfs" is not specified.
|
||||
|
||||
3. Start kdump service
|
||||
|
||||
$ kdumpctl start
|
||||
|
||||
4. Trigger a kdump test
|
||||
|
||||
$ echo 1 > /proc/sys/kernel/sysrq
|
||||
$ echo c > /proc/sysrq-trigger
|
||||
467
mkdumprd
Normal file
467
mkdumprd
Normal file
|
|
@ -0,0 +1,467 @@
|
|||
#!/bin/bash --norc
|
||||
# New mkdumprd
|
||||
#
|
||||
# Copyright 2011 Red Hat, Inc.
|
||||
#
|
||||
# Written by Cong Wang <amwang@redhat.com>
|
||||
#
|
||||
|
||||
if [ -f /etc/sysconfig/kdump ]; then
|
||||
. /etc/sysconfig/kdump
|
||||
fi
|
||||
|
||||
[[ $dracutbasedir ]] || dracutbasedir=/usr/lib/dracut
|
||||
. $dracutbasedir/dracut-functions.sh
|
||||
. /lib/kdump/kdump-lib.sh
|
||||
. /lib/kdump/kdump-logger.sh
|
||||
export IN_KDUMP=1
|
||||
|
||||
#initiate the kdump logger
|
||||
dlog_init
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "failed to initiate the kdump logger."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
conf_file="/etc/kdump.conf"
|
||||
SSH_KEY_LOCATION="/root/.ssh/kdump_id_rsa"
|
||||
SAVE_PATH=$(get_save_path)
|
||||
OVERRIDE_RESETTABLE=0
|
||||
|
||||
extra_modules=""
|
||||
dracut_args="--add kdumpbase --quiet --hostonly --hostonly-cmdline --hostonly-i18n --hostonly-mode strict -o \"plymouth dash resume ifcfg earlykdump\""
|
||||
|
||||
readonly MKDUMPRD_TMPDIR="$(mktemp -d -t mkdumprd.XXXXXX)"
|
||||
[ -d "$MKDUMPRD_TMPDIR" ] || perror_exit "dracut: mktemp -p -d -t dracut.XXXXXX failed."
|
||||
readonly MKDUMPRD_TMPMNT="$MKDUMPRD_TMPDIR/target"
|
||||
|
||||
trap '
|
||||
ret=$?;
|
||||
is_mounted $MKDUMPRD_TMPMNT && umount -f $MKDUMPRD_TMPMNT;
|
||||
[[ -d $MKDUMPRD_TMPDIR ]] && rm --one-file-system -rf -- "$MKDUMPRD_TMPDIR";
|
||||
exit $ret;
|
||||
' EXIT
|
||||
|
||||
# clean up after ourselves no matter how we die.
|
||||
trap 'exit 1;' SIGINT
|
||||
|
||||
add_dracut_arg() {
|
||||
dracut_args="$dracut_args $@"
|
||||
}
|
||||
|
||||
add_dracut_mount() {
|
||||
add_dracut_arg "--mount" "\"$1\""
|
||||
}
|
||||
|
||||
add_dracut_sshkey() {
|
||||
add_dracut_arg "--sshkey" "\"$1\""
|
||||
}
|
||||
|
||||
# caller should ensure $1 is valid and mounted in 1st kernel
|
||||
to_mount() {
|
||||
local _target=$1 _fstype=$2 _options=$3 _new_mntpoint _pdev
|
||||
|
||||
_new_mntpoint=$(get_kdump_mntpoint_from_target $_target)
|
||||
_fstype="${_fstype:-$(get_fs_type_from_target $_target)}"
|
||||
_options="${_options:-$(get_mntopt_from_target $_target)}"
|
||||
_options="${_options:-defaults}"
|
||||
|
||||
if [[ "$_fstype" == "nfs"* ]]; then
|
||||
_pdev=$_target
|
||||
_options=$(echo $_options | sed 's/,addr=[^,]*//')
|
||||
_options=$(echo $_options | sed 's/,proto=[^,]*//')
|
||||
_options=$(echo $_options | sed 's/,clientaddr=[^,]*//')
|
||||
else
|
||||
# for non-nfs _target converting to use udev persistent name
|
||||
_pdev="$(kdump_get_persistent_dev $_target)"
|
||||
if [ -z "$_pdev" ]; then
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
|
||||
# mount fs target as rw in 2nd kernel
|
||||
_options=$(echo $_options | sed 's/\(^\|,\)ro\($\|,\)/\1rw\2/g')
|
||||
# with 'noauto' in fstab nfs and non-root disk mount will fail in 2nd
|
||||
# kernel, filter it out here.
|
||||
_options=$(echo $_options | sed 's/\(^\|,\)noauto\($\|,\)/\1/g')
|
||||
# drop nofail or nobootwait
|
||||
_options=$(echo $_options | sed 's/\(^\|,\)nofail\($\|,\)/\1/g')
|
||||
_options=$(echo $_options | sed 's/\(^\|,\)nobootwait\($\|,\)/\1/g')
|
||||
|
||||
echo "$_pdev $_new_mntpoint $_fstype $_options"
|
||||
}
|
||||
|
||||
#Function: get_ssh_size
|
||||
#$1=dump target
|
||||
#called from while loop and shouldn't read from stdin, so we're using "ssh -n"
|
||||
get_ssh_size() {
|
||||
local _opt _out _size
|
||||
_opt="-i $SSH_KEY_LOCATION -o BatchMode=yes -o StrictHostKeyChecking=yes"
|
||||
_out=$(ssh -q -n $_opt $1 "df -P $SAVE_PATH")
|
||||
[ $? -ne 0 ] && {
|
||||
perror_exit "checking remote ssh server available size failed."
|
||||
}
|
||||
|
||||
#ssh output removed the line break, so print field NF-2
|
||||
_size=$(echo -n $_out| awk '{avail=NF-2; print $avail}')
|
||||
echo -n $_size
|
||||
}
|
||||
|
||||
#mkdir if save path does not exist on ssh dump target
|
||||
#$1=ssh dump target
|
||||
#caller should ensure write permission on $1:$SAVE_PATH
|
||||
#called from while loop and shouldn't read from stdin, so we're using "ssh -n"
|
||||
mkdir_save_path_ssh()
|
||||
{
|
||||
local _opt _dir
|
||||
_opt="-i $SSH_KEY_LOCATION -o BatchMode=yes -o StrictHostKeyChecking=yes"
|
||||
ssh -qn $_opt $1 mkdir -p $SAVE_PATH 2>&1 > /dev/null
|
||||
_ret=$?
|
||||
if [ $_ret -ne 0 ]; then
|
||||
perror_exit "mkdir failed on $1:$SAVE_PATH"
|
||||
fi
|
||||
|
||||
#check whether user has write permission on $1:$SAVE_PATH
|
||||
_dir=$(ssh -qn $_opt $1 mktemp -dqp $SAVE_PATH 2>/dev/null)
|
||||
_ret=$?
|
||||
if [ $_ret -ne 0 ]; then
|
||||
perror_exit "Could not create temporary directory on $1:$SAVE_PATH. Make sure user has write permission on destination"
|
||||
fi
|
||||
ssh -qn $_opt $1 rmdir $_dir
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
#Function: get_fs_size
|
||||
#$1=dump target
|
||||
get_fs_size() {
|
||||
local _mnt=$(get_mntpoint_from_target $1)
|
||||
echo -n $(df -P "${_mnt}/$SAVE_PATH"|tail -1|awk '{print $4}')
|
||||
}
|
||||
|
||||
#Function: get_raw_size
|
||||
#$1=dump target
|
||||
get_raw_size() {
|
||||
echo -n $(fdisk -s "$1")
|
||||
}
|
||||
|
||||
#Function: check_size
|
||||
#$1: dump type string ('raw', 'fs', 'ssh')
|
||||
#$2: dump target
|
||||
check_size() {
|
||||
local avail memtotal
|
||||
|
||||
memtotal=$(awk '/MemTotal/{print $2}' /proc/meminfo)
|
||||
case "$1" in
|
||||
raw)
|
||||
avail=$(get_raw_size "$2")
|
||||
;;
|
||||
ssh)
|
||||
avail=$(get_ssh_size "$2")
|
||||
;;
|
||||
fs)
|
||||
avail=$(get_fs_size "$2")
|
||||
;;
|
||||
*)
|
||||
return
|
||||
esac
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
perror_exit "Check dump target size failed"
|
||||
fi
|
||||
|
||||
if [ $avail -lt $memtotal ]; then
|
||||
dwarn "Warning: There might not be enough space to save a vmcore."
|
||||
dwarn " The size of $2 should be greater than $memtotal kilo bytes."
|
||||
fi
|
||||
}
|
||||
|
||||
check_save_path_fs()
|
||||
{
|
||||
local _path=$1
|
||||
|
||||
if [ ! -d $_path ]; then
|
||||
perror_exit "Dump path $_path does not exist."
|
||||
fi
|
||||
}
|
||||
|
||||
check_user_configured_target()
|
||||
{
|
||||
local _target=$1 _cfg_fs_type=$2 _mounted
|
||||
local _mnt=$(get_mntpoint_from_target $_target)
|
||||
local _opt=$(get_mntopt_from_target $_target)
|
||||
local _fstype=$(get_fs_type_from_target $_target)
|
||||
|
||||
if [ -n "$_fstype" ]; then
|
||||
# In case of nfs4, nfs should be used instead, nfs* options is deprecated in kdump.conf
|
||||
[[ $_fstype = "nfs"* ]] && _fstype=nfs
|
||||
|
||||
if [ -n "$_cfg_fs_type" ] && [ "$_fstype" != "$_cfg_fs_type" ]; then
|
||||
perror_exit "\"$_target\" have a wrong type config \"$_cfg_fs_type\", expected \"$_fstype\""
|
||||
fi
|
||||
else
|
||||
_fstype="$_cfg_fs_type"
|
||||
_fstype="$_cfg_fs_type"
|
||||
fi
|
||||
|
||||
# For noauto mount, mount it inplace with default value.
|
||||
# Else use the temporary target directory
|
||||
if [ -n "$_mnt" ]; then
|
||||
if ! is_mounted "$_mnt"; then
|
||||
if [[ $_opt = *",noauto"* ]]; then
|
||||
mount $_mnt
|
||||
[ $? -ne 0 ] && perror_exit "Failed to mount $_target on $_mnt for kdump preflight check."
|
||||
_mounted=$_mnt
|
||||
else
|
||||
perror_exit "Dump target \"$_target\" is neither mounted nor configured as \"noauto\""
|
||||
fi
|
||||
fi
|
||||
else
|
||||
_mnt=$MKDUMPRD_TMPMNT
|
||||
mkdir -p $_mnt
|
||||
mount $_target $_mnt -t $_fstype -o defaults
|
||||
[ $? -ne 0 ] && perror_exit "Failed to mount $_target for kdump preflight check."
|
||||
_mounted=$_mnt
|
||||
fi
|
||||
|
||||
# For user configured target, use $SAVE_PATH as the dump path within the target
|
||||
if [ ! -d "$_mnt/$SAVE_PATH" ]; then
|
||||
perror_exit "Dump path \"$SAVE_PATH\" does not exist in dump target \"$_target\""
|
||||
fi
|
||||
|
||||
check_size fs "$_target"
|
||||
|
||||
# Unmount it early, if function is interrupted and didn't reach here, the shell trap will clear it up anyway
|
||||
if [ -n "$_mounted" ]; then
|
||||
umount -f -- $_mounted
|
||||
fi
|
||||
}
|
||||
|
||||
# $1: core_collector config value
|
||||
verify_core_collector() {
|
||||
local _cmd="${1%% *}"
|
||||
local _params="${1#* }"
|
||||
|
||||
if [ "$_cmd" != "makedumpfile" ]; then
|
||||
if is_raw_dump_target; then
|
||||
dwarn "Warning: specifying a non-makedumpfile core collector, you will have to recover the vmcore manually."
|
||||
fi
|
||||
return
|
||||
fi
|
||||
|
||||
if is_ssh_dump_target || is_raw_dump_target; then
|
||||
if ! strstr "$_params" "-F"; then
|
||||
perror_exit "The specified dump target needs makedumpfile \"-F\" option."
|
||||
fi
|
||||
_params="$_params vmcore"
|
||||
else
|
||||
_params="$_params vmcore dumpfile"
|
||||
fi
|
||||
|
||||
if ! $_cmd --check-params $_params; then
|
||||
perror_exit "makedumpfile parameter check failed."
|
||||
fi
|
||||
}
|
||||
|
||||
add_mount() {
|
||||
local _mnt=$(to_mount $@)
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
add_dracut_mount "$_mnt"
|
||||
}
|
||||
|
||||
#handle the case user does not specify the dump target explicitly
|
||||
handle_default_dump_target()
|
||||
{
|
||||
local _target
|
||||
local _mntpoint
|
||||
|
||||
is_user_configured_dump_target && return
|
||||
|
||||
check_save_path_fs $SAVE_PATH
|
||||
|
||||
_save_path=$(get_bind_mount_source $SAVE_PATH)
|
||||
_target=$(get_target_from_path $_save_path)
|
||||
_mntpoint=$(get_mntpoint_from_target $_target)
|
||||
|
||||
SAVE_PATH=${_save_path##"$_mntpoint"}
|
||||
add_mount "$_target"
|
||||
check_size fs $_target
|
||||
}
|
||||
|
||||
get_override_resettable()
|
||||
{
|
||||
local override_resettable
|
||||
|
||||
override_resettable=$(grep "^override_resettable" $conf_file)
|
||||
if [ -n "$override_resettable" ]; then
|
||||
OVERRIDE_RESETTABLE=$(echo $override_resettable | cut -d' ' -f2)
|
||||
if [ "$OVERRIDE_RESETTABLE" != "0" ] && [ "$OVERRIDE_RESETTABLE" != "1" ];then
|
||||
perror_exit "override_resettable value $OVERRIDE_RESETTABLE is invalid"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
# $1: function name
|
||||
for_each_block_target()
|
||||
{
|
||||
local dev majmin
|
||||
|
||||
for dev in $(get_kdump_targets); do
|
||||
[ -b "$dev" ] || continue
|
||||
majmin=$(get_maj_min $dev)
|
||||
check_block_and_slaves $1 $majmin && return 1
|
||||
done
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
|
||||
|
||||
#judge if a specific device with $1 is unresettable
|
||||
#return false if unresettable.
|
||||
is_unresettable()
|
||||
{
|
||||
local path="/sys/$(udevadm info --query=all --path=/sys/dev/block/$1 | awk '/^P:/ {print $2}' | sed -e 's/\(cciss[0-9]\+\/\).*/\1/g' -e 's/\/block\/.*$//')/resettable"
|
||||
local resettable=1
|
||||
|
||||
if [ -f "$path" ]
|
||||
then
|
||||
resettable="$(cat $path)"
|
||||
[ $resettable -eq 0 -a "$OVERRIDE_RESETTABLE" -eq 0 ] && {
|
||||
local device=$(udevadm info --query=all --path=/sys/dev/block/$1 | awk -F= '/DEVNAME/{print $2}')
|
||||
derror "Error: Can not save vmcore because device $device is unresettable"
|
||||
return 0
|
||||
}
|
||||
fi
|
||||
|
||||
return 1
|
||||
}
|
||||
|
||||
#check if machine is resettable.
|
||||
#return true if resettable
|
||||
check_resettable()
|
||||
{
|
||||
local _ret _target
|
||||
|
||||
get_override_resettable
|
||||
|
||||
for_each_block_target is_unresettable
|
||||
_ret=$?
|
||||
|
||||
[ $_ret -eq 0 ] && return
|
||||
|
||||
return 1
|
||||
}
|
||||
|
||||
# $1: maj:min
|
||||
is_crypt()
|
||||
{
|
||||
local majmin=$1 dev line ID_FS_TYPE=""
|
||||
|
||||
line=$(udevadm info --query=property --path=/sys/dev/block/$majmin \
|
||||
| grep "^ID_FS_TYPE")
|
||||
eval "$line"
|
||||
[[ "$ID_FS_TYPE" = "crypto_LUKS" ]] && {
|
||||
dev=$(udevadm info --query=all --path=/sys/dev/block/$majmin | awk -F= '/DEVNAME/{print $2}')
|
||||
derror "Device $dev is encrypted."
|
||||
return 0
|
||||
}
|
||||
return 1
|
||||
}
|
||||
|
||||
check_crypt()
|
||||
{
|
||||
local _ret _target
|
||||
|
||||
for_each_block_target is_crypt
|
||||
_ret=$?
|
||||
|
||||
[ $_ret -eq 0 ] && return
|
||||
|
||||
return 1
|
||||
}
|
||||
|
||||
if ! check_resettable; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if ! check_crypt; then
|
||||
dwarn "Warning: Encrypted device is in dump path, which is not recommended, see kexec-kdump-howto.txt for more details."
|
||||
fi
|
||||
|
||||
# firstly get right SSH_KEY_LOCATION
|
||||
keyfile=$(awk '/^sshkey/ {print $2}' $conf_file)
|
||||
if [ -f "$keyfile" ]; then
|
||||
# canonicalize the path
|
||||
SSH_KEY_LOCATION=$(/usr/bin/readlink -m $keyfile)
|
||||
fi
|
||||
|
||||
while read config_opt config_val;
|
||||
do
|
||||
# remove inline comments after the end of a directive.
|
||||
case "$config_opt" in
|
||||
extra_modules)
|
||||
extra_modules="$extra_modules $config_val"
|
||||
;;
|
||||
ext[234]|xfs|btrfs|minix|nfs)
|
||||
check_user_configured_target "$config_val" "$config_opt"
|
||||
add_mount "$config_val" "$config_opt"
|
||||
;;
|
||||
raw)
|
||||
# checking raw disk writable
|
||||
dd if=$config_val count=1 of=/dev/null > /dev/null 2>&1 || {
|
||||
perror_exit "Bad raw disk $config_val"
|
||||
}
|
||||
_praw=$(persistent_policy="by-id" kdump_get_persistent_dev $config_val)
|
||||
if [ -z "$_praw" ]; then
|
||||
exit 1
|
||||
fi
|
||||
add_dracut_arg "--device" "$_praw"
|
||||
check_size raw $config_val
|
||||
;;
|
||||
ssh)
|
||||
if strstr "$config_val" "@";
|
||||
then
|
||||
mkdir_save_path_ssh $config_val
|
||||
check_size ssh $config_val
|
||||
add_dracut_sshkey "$SSH_KEY_LOCATION"
|
||||
else
|
||||
perror_exit "Bad ssh dump target $config_val"
|
||||
fi
|
||||
;;
|
||||
core_collector)
|
||||
verify_core_collector "$config_val"
|
||||
;;
|
||||
dracut_args)
|
||||
add_dracut_arg $config_val
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
done <<< "$(read_strip_comments $conf_file)"
|
||||
|
||||
handle_default_dump_target
|
||||
|
||||
if [ -n "$extra_modules" ]
|
||||
then
|
||||
add_dracut_arg "--add-drivers" \"$extra_modules\"
|
||||
fi
|
||||
|
||||
if ! is_fadump_capable; then
|
||||
# The 2nd rootfs mount stays behind the normal dump target mount,
|
||||
# so it doesn't affect the logic of check_dump_fs_modified().
|
||||
is_dump_to_rootfs && add_mount "$(to_dev_name $(get_root_fs_device))"
|
||||
|
||||
add_dracut_arg "--no-hostonly-default-device"
|
||||
fi
|
||||
|
||||
echo "$dracut_args $@" | xargs dracut
|
||||
|
||||
_rc=$?
|
||||
sync
|
||||
exit $_rc
|
||||
39
mkdumprd.8
Normal file
39
mkdumprd.8
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
.TH MKDUMRD 8 "Fri Feb 9 2007"
|
||||
.SH NAME
|
||||
mkdumprd \- creates initial ramdisk images for kdump crash recovery
|
||||
.SH SYNOPSIS
|
||||
\fBmkdumprd\fR [OPTION]
|
||||
|
||||
.SH DESCRIPTION
|
||||
\fBmkdumprd\fR creates an initial ram file system for use in conjunction with
|
||||
the booting of a kernel within the kdump framework for crash recovery.
|
||||
\fBmkdumprds\fR purpose is to create an initial ram filesystem capable of copying
|
||||
the crashed systems vmcore image to a location specified in \fI/etc/kdump.conf
|
||||
|
||||
\fBmkdumprd\fR interrogates the running system to understand what modules need to
|
||||
be loaded in the initramfs (based on configuration retrieved from
|
||||
\fI/etc/kdump.conf)\fR
|
||||
|
||||
\fBmkdumprd\fR add a new \fBdracut\fR module 99kdumpbase and use \fBdracut\fR
|
||||
utility to generate the initramfs. When generating a kdump initramfs, \fBmkdumprd\fR
|
||||
will determine how much disk space is available, if the dump target's available
|
||||
space is not greater than the total system memory, \fBmkdumprd\fR will print a
|
||||
warning to remind that there might not be enough space to save a vmcore. The
|
||||
warning covers extreme scenarios such as the slab explodes with non-zero data or
|
||||
a full vmcore, etc. Therefore, need to prevent users from having minimum disk
|
||||
space for crash dump.
|
||||
|
||||
\fBmkdumprd\fR was not intended for casual use outside of the service
|
||||
initialization script for the kdump utility, and should not be run manually. If
|
||||
you require a custom kdump initramfs image, it is suggested that you use the
|
||||
kdump service infrastructure to create one, and then manually unpack, modify and
|
||||
repack the image.
|
||||
|
||||
|
||||
.SH OPTIONS
|
||||
.TP
|
||||
All options here are passed to dracut directly, please refer \fBdracut\fR docs
|
||||
for the info.
|
||||
|
||||
.SH "SEE ALSO"
|
||||
.BR dracut (8)
|
||||
4
sources
4
sources
|
|
@ -1 +1,3 @@
|
|||
SHA512 (kexec-tools-2.0.32.tar.xz) = 60f120f8e46b9fb5dcf5a5b344ee8b303878ba9f71d58a3eefa1c9f044a6a2192b285154b738970263384c6e7281a854cd48a185334c08141aa4e6cf08230654
|
||||
SHA512 (eppic-d84c354.tar.gz) = 455b3386c3e4cc546b858f1f8b0e6874072aaae708ebe072452fb5f0b6a81b1f3a315b40f94c3967f38525cadd276864a7bc7f0f12fa421655dcc3b15b70914d
|
||||
SHA512 (makedumpfile-1.6.8.tar.gz) = 15e60688b06013bf86e339ec855774ea2c904d425371ea867101704ba0611c69da891eb3cc96f67eb10197d8c42d217ea28bf11bcaa93ddc2495cbf984c0b7ec
|
||||
SHA512 (kexec-tools-2.0.21.tar.xz) = f487d2e243c2c4f29fbc9da7d06806f65210f717904655fc84d8d162b9c4614c3dd62e1bb47104a79f0dc2af04e462baf764fb309b5d7e6d287264cb48fd2a3e
|
||||
|
|
|
|||
|
|
@ -1,41 +0,0 @@
|
|||
#!/bin/bash
|
||||
Describe 'kdump-lib-initramfs'
|
||||
Include ./kdump-lib-initramfs.sh
|
||||
|
||||
Describe 'Test kdump_get_conf_val'
|
||||
KDUMP_CONFIG_FILE=/tmp/kdump_shellspec_test.conf
|
||||
kdump_config() {
|
||||
%text
|
||||
#|default shell
|
||||
#|nfs my.server.com:/export/tmp # trailing comment
|
||||
#| failure_action shell
|
||||
#|dracut_args --omit-drivers "cfg80211 snd" --add-drivers "ext2 ext3"
|
||||
#|sshkey /root/.ssh/kdump_id_rsa
|
||||
#|ssh user@my.server.com
|
||||
}
|
||||
kdump_config >$KDUMP_CONFIG_FILE
|
||||
Context 'Given different cases'
|
||||
# Test the following cases:
|
||||
# - there is trailing comment
|
||||
# - there is space before the parameter
|
||||
# - complicate value for dracut_args
|
||||
# - Given two parameters, retrive one parameter that has value specified
|
||||
# - Given two parameters (in reverse order), retrive one parameter that has value specified
|
||||
Parameters
|
||||
"#1" nfs my.server.com:/export/tmp
|
||||
"#2" ssh user@my.server.com
|
||||
"#3" failure_action shell
|
||||
"#4" dracut_args '--omit-drivers "cfg80211 snd" --add-drivers "ext2 ext3"'
|
||||
"#5" 'ssh\|aaa' user@my.server.com
|
||||
"#6" 'aaa\|ssh' user@my.server.com
|
||||
End
|
||||
|
||||
It 'should handle all cases correctly'
|
||||
When call kdump_get_conf_val "$2"
|
||||
The output should equal "$3"
|
||||
End
|
||||
End
|
||||
|
||||
End
|
||||
|
||||
End
|
||||
|
|
@ -1,121 +0,0 @@
|
|||
#!/bin/bash
|
||||
Describe 'kdump-lib'
|
||||
Include ./kdump-lib.sh
|
||||
|
||||
Describe 'get_system_size()'
|
||||
|
||||
PROC_IOMEM=$(mktemp -t spec_test_proc_iomem_file.XXXXXXXXXX)
|
||||
|
||||
cleanup() {
|
||||
rm -rf "$PROC_IOMEM"
|
||||
}
|
||||
|
||||
AfterAll 'cleanup'
|
||||
|
||||
ONE_GIGABYTE='000000-3fffffff : System RAM'
|
||||
Parameters
|
||||
1
|
||||
3
|
||||
End
|
||||
|
||||
It 'should return correct system RAM size'
|
||||
echo -n >"$PROC_IOMEM"
|
||||
for _ in $(seq 1 "$1"); do echo "$ONE_GIGABYTE" >>"$PROC_IOMEM"; done
|
||||
When call get_system_size
|
||||
The output should equal "$1"
|
||||
End
|
||||
|
||||
End
|
||||
|
||||
Describe 'get_recommend_size()'
|
||||
# Testing stragety:
|
||||
# 1. inclusive for the lower bound of the range of crashkernel
|
||||
# 2. exclusive for the upper bound of the range of crashkernel
|
||||
# 3. supports ranges not sorted in increasing order
|
||||
|
||||
ck="4G-64G:256M,2G-4G:192M,64G-1T:512M,1T-:12345M"
|
||||
Parameters
|
||||
1 0M
|
||||
2 192M
|
||||
64 512M
|
||||
1024 12345M
|
||||
"$((64 * 1024))" 12345M
|
||||
End
|
||||
|
||||
It 'should handle all cases correctly'
|
||||
When call get_recommend_size "$1" $ck
|
||||
The output should equal "$2"
|
||||
End
|
||||
End
|
||||
|
||||
Describe "_crashkernel_add()"
|
||||
Context "For valid input values"
|
||||
Parameters
|
||||
"1G-4G:256M,4G-64G:320M,64G-:576M" "100M" "1G-4G:356M,4G-64G:420M,64G-:676M"
|
||||
"1G-4G:256M" "100" "1G-4G:268435556" # avoids any rounding when size % 1024 != 0
|
||||
"1G-4G:256M,4G-64G:320M,64G-:576M@4G" "100M" "1G-4G:356M,4G-64G:420M,64G-:676M@4G"
|
||||
"1G-4G:1G,4G-64G:2G,64G-:3G@4G" "100M" "1G-4G:1124M,4G-64G:2148M,64G-:3172M@4G"
|
||||
"1G-4G:10000K,4G-64G:20000K,64G-:40000K@4G" "100M" "1G-4G:112400K,4G-64G:122400K,64G-:142400K@4G"
|
||||
"1,high" "1" "2,high"
|
||||
"1K,low" "1" "1025,low"
|
||||
"128G-1T:4G" "0" "128G-1T:4G"
|
||||
"10T-100T:1T" "0" "10T-100T:1T"
|
||||
"128G-1T:4G" "0M" "128G-1T:4G"
|
||||
"128G-1P:4G" "0M" "128G-1P:4G"
|
||||
"128G-1E:4G" "0M" "128G-1E:4G"
|
||||
"1M@1G" "1k" "1025K@1G"
|
||||
"500M@1G" "-100m" "400M@1G"
|
||||
"1099511627776" "0" "1T"
|
||||
End
|
||||
It "should add delta to every value after ':'"
|
||||
When call _crashkernel_add "$1" "$2"
|
||||
The output should equal "$3"
|
||||
End
|
||||
End
|
||||
Context "For invalid input values"
|
||||
Parameters
|
||||
"1G-4G:256M.4G-64G:320M" "100M"
|
||||
"foo" "1"
|
||||
"1" "bar"
|
||||
End
|
||||
It "shall return an error"
|
||||
When call _crashkernel_add "$1" "$2"
|
||||
The output should equal ""
|
||||
The status should be failure
|
||||
End
|
||||
End
|
||||
End
|
||||
|
||||
Describe 'prepare_cmdline()'
|
||||
get_bootcpu_apicid() {
|
||||
echo 1
|
||||
}
|
||||
|
||||
get_watchdog_drvs() {
|
||||
echo foo
|
||||
}
|
||||
|
||||
add="disable_cpu_apicid=1 foo.pretimeout=0"
|
||||
|
||||
Parameters
|
||||
#test cmdline remove add result
|
||||
"#1" "a b c" "" "" "a b c"
|
||||
"#2" "a b c" "b" "" "a c"
|
||||
"#3" "a b=x c" "b" "" "a c"
|
||||
"#4" "a b='x y' c" "b" "" "a c"
|
||||
"#5" "a b='x y' c" "b=x" "" "a c"
|
||||
"#6" "a b='x y' c" "b='x y'" "" "a c"
|
||||
"#7" "a b c" "" "x" "a b c x"
|
||||
"#8" "a b c" "" "x=1" "a b c x=1"
|
||||
"#9" "a b c" "" "x='1 2'" "a b c x='1 2'"
|
||||
"#10" "a b c" "a" "x='1 2'" "b c x='1 2'"
|
||||
"#11" "a b c" "x" "x='1 2'" "a b c x='1 2'"
|
||||
End
|
||||
|
||||
It "Test $1: should generate the correct kernel command line"
|
||||
When call prepare_cmdline "$2" "$3" "$4"
|
||||
The output should equal "$5 $add"
|
||||
End
|
||||
End
|
||||
|
||||
End
|
||||
|
|
@ -1,215 +0,0 @@
|
|||
#!/bin/bash
|
||||
Describe 'kdumpctl'
|
||||
Include ./kdumpctl
|
||||
|
||||
Describe 'get_grub_kernel_boot_parameter()'
|
||||
grubby() {
|
||||
%text
|
||||
#|index=1
|
||||
#|kernel="/boot/vmlinuz-5.14.14-200.fc34.x86_64"
|
||||
#|args="crashkernel=11M nvidia-drm.modeset=1 crashkernel=100M ro rhgb quiet crcrashkernel=200M crashkernel=32T-64T:128G,64T-102400T:180G fadump=on"
|
||||
#|root="UUID=45fdf703-3966-401b-b8f7-cf056affd2b0"
|
||||
}
|
||||
DUMMY_PARAM=/boot/vmlinuz
|
||||
|
||||
Context "when given a kernel parameter in different positions"
|
||||
# Test the following cases:
|
||||
# - the kernel parameter in the end
|
||||
# - the kernel parameter in the first
|
||||
# - the kernel parameter is crashkernel (suffix of crcrashkernel)
|
||||
# - the kernel parameter that does not exist
|
||||
# - the kernel parameter doesn't have a value
|
||||
Parameters
|
||||
# parameter answer
|
||||
fadump on
|
||||
nvidia-drm.modeset 1
|
||||
crashkernel 32T-64T:128G,64T-102400T:180G
|
||||
aaaa ""
|
||||
ro ""
|
||||
End
|
||||
|
||||
It 'should retrieve the value succesfully'
|
||||
When call get_grub_kernel_boot_parameter "$DUMMY_PARAM" "$2"
|
||||
The output should equal "$3"
|
||||
End
|
||||
End
|
||||
|
||||
It 'should retrive the last value if multiple <parameter=value> entries exist'
|
||||
When call get_grub_kernel_boot_parameter "$DUMMY_PARAM" crashkernel
|
||||
The output should equal '32T-64T:128G,64T-102400T:180G'
|
||||
End
|
||||
|
||||
It 'should fail when called with kernel_path=ALL'
|
||||
When call get_grub_kernel_boot_parameter ALL ro
|
||||
The status should be failure
|
||||
The error should include "kernel_path=ALL invalid"
|
||||
End
|
||||
End
|
||||
|
||||
Describe 'get_dump_mode_by_fadump_val()'
|
||||
|
||||
Context 'when given valid fadump values'
|
||||
Parameters
|
||||
"#1" on fadump
|
||||
"#2" nocma fadump
|
||||
"#3" "" kdump
|
||||
"#4" off kdump
|
||||
End
|
||||
It "should return the dump mode correctly"
|
||||
When call get_dump_mode_by_fadump_val "$2"
|
||||
The output should equal "$3"
|
||||
The status should be success
|
||||
End
|
||||
End
|
||||
|
||||
It 'should complain given invalid fadump value'
|
||||
When call get_dump_mode_by_fadump_val /boot/vmlinuz
|
||||
The status should be failure
|
||||
The error should include 'invalid fadump'
|
||||
End
|
||||
|
||||
End
|
||||
|
||||
Describe "read_proc_environ_var()"
|
||||
environ_test_file=$(mktemp -t spec_test_environ_test_file.XXXXXXXXXX)
|
||||
cleanup() {
|
||||
rm -rf "$environ_test_file"
|
||||
}
|
||||
AfterAll 'cleanup'
|
||||
echo -ne "container=bwrap-osbuild\x00SSH_AUTH_SOCK=/tmp/ssh-XXXXXXEbw33A/agent.1794\x00SSH_AGENT_PID=1929\x00env=test_env" >"$environ_test_file"
|
||||
Parameters
|
||||
container bwrap-osbuild
|
||||
SSH_AUTH_SOCK /tmp/ssh-XXXXXXEbw33A/agent.1794
|
||||
env test_env
|
||||
not_exist ""
|
||||
End
|
||||
It 'should read the environ variable value as expected'
|
||||
When call read_proc_environ_var "$1" "$environ_test_file"
|
||||
The output should equal "$2"
|
||||
The status should be success
|
||||
End
|
||||
End
|
||||
|
||||
Describe "_is_osbuild()"
|
||||
environ_test_file=$(mktemp -t spec_test_environ_test_file.XXXXXXXXXX)
|
||||
# shellcheck disable=SC2034
|
||||
# override the _OSBUILD_ENVIRON_PATH variable
|
||||
_OSBUILD_ENVIRON_PATH="$environ_test_file"
|
||||
Parameters
|
||||
'container=bwrap-osbuild' success
|
||||
'' failure
|
||||
End
|
||||
It 'should be able to tell if it is the osbuild environment'
|
||||
echo -ne "$1" >"$environ_test_file"
|
||||
When call _is_osbuild
|
||||
The status should be "$2"
|
||||
The stderr should equal ""
|
||||
End
|
||||
End
|
||||
|
||||
Describe "_get_dracut_arg"
|
||||
dracut_args='-o "foo bar baz" -t 1 --test="a b c" --omit bla'
|
||||
Parameters
|
||||
-o --omit 2 "foo bar baz bla"
|
||||
-e --empty 0 ""
|
||||
-t "" 1 "1"
|
||||
"" --test 1 "a b c"
|
||||
"" "" 0 ""
|
||||
End
|
||||
It "should parse the dracut_args correctly"
|
||||
When call _get_dracut_arg "$1" "$2" "$dracut_args"
|
||||
The status should equal $3
|
||||
The output should equal "$4"
|
||||
End
|
||||
End
|
||||
|
||||
Describe "is_dracut_mod_omitted()"
|
||||
KDUMP_CONFIG_FILE=$(mktemp -t kdump_conf.XXXXXXXXXX)
|
||||
cleanup() {
|
||||
rm -f "$kdump_conf"
|
||||
}
|
||||
AfterAll 'cleanup'
|
||||
|
||||
Parameters:dynamic
|
||||
for opt in '-o ' '--omit ' '--omit='; do
|
||||
for val in \
|
||||
'foo' \
|
||||
'"foo"' \
|
||||
'"foo bar baz"' \
|
||||
'"bar foo baz"' \
|
||||
'"bar baz foo"'; do
|
||||
%data success foo "$opt$val"
|
||||
%data success foo "-a x $opt$val -i y"
|
||||
%data failure xyz "$opt$val"
|
||||
%data failure xyz "-a x $opt$val -i y"
|
||||
done
|
||||
done
|
||||
%data success foo "-o xxx -o foo"
|
||||
%data failure foo "-a x -i y"
|
||||
End
|
||||
It "shall return $1 for module $2 and dracut_args '$3'"
|
||||
echo "dracut_args $3" > $KDUMP_CONFIG_FILE
|
||||
parse_config
|
||||
When call is_dracut_mod_omitted $2
|
||||
The status should be $1
|
||||
End
|
||||
End
|
||||
|
||||
Describe '_find_kernel_path_by_release()'
|
||||
# When the array length changes, the Parameters:dynamic should change as well
|
||||
kernel_paths=(/boot/vmlinuz-6.2.11-200.fc37.x86_64
|
||||
/boot/vmlinuz-5.14.0-316.el9.aarch64+64k
|
||||
/boot/vmlinuz-5.14.0-322.el9.aarch64
|
||||
/boot/efi/36b54597c46383/6.4.0-0.rc0.20230427git6e98b09da931.5.fc39.aarch64/linux)
|
||||
|
||||
kernels=(vmlinuz-6.2.11-200.fc37.x86_64
|
||||
vmlinuz-5.14.0-316.el9.aarch64+64k
|
||||
vmlinuz-5.14.0-322.el9.aarch64
|
||||
6.4.0-0.rc0.20230427git6e98b09da931.5.fc39.aarch64)
|
||||
|
||||
grubby() {
|
||||
for key in "${!kernel_paths[@]}"; do
|
||||
echo "kernel=\"${kernel_paths[$key]}\""
|
||||
done
|
||||
}
|
||||
|
||||
Parameters:dynamic
|
||||
# Due to a bug [1] in shellspec, hardcode the loop number instead of using the
|
||||
# array length
|
||||
# [1] https://github.com/shellspec/shellspec/issues/259
|
||||
for key in {0..3}; do
|
||||
%data "${kernels[$key]}" "${kernel_paths[$key]}"
|
||||
done
|
||||
End
|
||||
|
||||
It 'returns the kernel path for the given release'
|
||||
When call _find_kernel_path_by_release "$1"
|
||||
The output should equal "$2"
|
||||
End
|
||||
End
|
||||
|
||||
Describe 'parse_config()'
|
||||
KDUMP_CONFIG_FILE=$(mktemp -t kdump_conf.XXXXXXXXXX)
|
||||
cleanup() {
|
||||
rm -f "$KDUMP_CONFIG_FILE"
|
||||
}
|
||||
AfterAll 'cleanup'
|
||||
|
||||
It 'should not be happy with unkown option in kdump.conf'
|
||||
echo blabla > "$KDUMP_CONFIG_FILE"
|
||||
When call parse_config
|
||||
The status should be failure
|
||||
The stderr should include 'Invalid kdump config option blabla'
|
||||
End
|
||||
|
||||
Parameters:value aarch64 ppc64le s390x x86_64
|
||||
|
||||
It 'should be happy with the default kdump.conf'
|
||||
./gen-kdump-conf.sh "$1" > "$KDUMP_CONFIG_FILE"
|
||||
When call parse_config
|
||||
The status should be success
|
||||
End
|
||||
|
||||
End
|
||||
|
||||
End
|
||||
|
|
@ -1,118 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
Describe 'Management of the kernel crashkernel parameter.'
|
||||
Include ./kdumpctl
|
||||
kernel1=/boot/vmlinuz-5.15.6-100.fc34.x86_64
|
||||
kernel2=/boot/vmlinuz-5.14.14-200.fc34.x86_64
|
||||
old_ck=1G-4G:162M,4G-64G:256M,64G-:512M
|
||||
new_ck=1G-4G:196M,4G-64G:256M,64G-:512M
|
||||
KDUMP_SPEC_TEST_RUN_DIR=$(mktemp -u /tmp/spec_test.XXXXXXXXXX)
|
||||
GRUB_CFG="$KDUMP_SPEC_TEST_RUN_DIR/grub.cfg"
|
||||
|
||||
uname() {
|
||||
if [[ $1 == '-m' ]]; then
|
||||
echo -n x86_64
|
||||
elif [[ $1 == '-r' ]]; then
|
||||
echo -n $current_kernel
|
||||
fi
|
||||
}
|
||||
|
||||
# dinfo is a bit complex for unit tets, simply mock it
|
||||
dinfo() {
|
||||
echo "$1"
|
||||
}
|
||||
|
||||
kdump_get_arch_recommend_crashkernel() {
|
||||
echo -n "$new_ck"
|
||||
}
|
||||
|
||||
setup() {
|
||||
mkdir -p "$KDUMP_SPEC_TEST_RUN_DIR"
|
||||
cp -r spec/support/boot_load_entries "$KDUMP_SPEC_TEST_RUN_DIR"
|
||||
cp spec/support/grub_env "$KDUMP_SPEC_TEST_RUN_DIR"/env_temp
|
||||
touch "$GRUB_CFG"
|
||||
|
||||
grubby --args crashkernel=$old_ck --update-kernel=$kernel1
|
||||
grubby --args crashkernel=$new_ck --update-kernel=$kernel2
|
||||
grubby --remove-args fadump --update-kernel=ALL
|
||||
|
||||
}
|
||||
|
||||
cleanup() {
|
||||
rm -rf "$KDUMP_SPEC_TEST_RUN_DIR"
|
||||
}
|
||||
|
||||
# the boot loader entries are for a system without a boot partition, mock
|
||||
# mountpoint to let grubby know it
|
||||
Mock mountpoint
|
||||
exit 1
|
||||
End
|
||||
|
||||
grubby() {
|
||||
# - --no-etc-grub-update, not update /etc/default/grub
|
||||
# - --bad-image-okay, don't check the validity of the image
|
||||
# - --env, specify custom grub2 environment block file to avoid modifying
|
||||
# the default /boot/grub2/grubenv
|
||||
# - --bls-directory, specify custom BootLoaderSpec config files to avoid
|
||||
# modifying the default /boot/loader/entries
|
||||
/usr/sbin/grubby --no-etc-grub-update --grub2 --config-file="$GRUB_CFG" --bad-image-okay --env="$KDUMP_SPEC_TEST_RUN_DIR"/env_temp -b "$KDUMP_SPEC_TEST_RUN_DIR"/boot_load_entries "$@"
|
||||
}
|
||||
|
||||
# The mocking breaks has_command. Mock it as well to fix the tests.
|
||||
has_command() {
|
||||
[[ "$1" == grubby ]]
|
||||
}
|
||||
|
||||
Describe "When kexec-tools have its default crashkernel updated, "
|
||||
|
||||
Context "if kexec-tools is updated alone, "
|
||||
BeforeAll 'setup'
|
||||
AfterAll 'cleanup'
|
||||
Specify 'reset_crashkernel_after_update should report updated kernels and note that auto_reset_crashkernel=yes'
|
||||
When call reset_crashkernel_after_update
|
||||
The output should include "For kernel=$kernel1, crashkernel=$new_ck now."
|
||||
The output should not include "For kernel=$kernel2, crashkernel=$new_ck now."
|
||||
# A hint on how to turn off auto update of crashkernel
|
||||
The output should include "auto_reset_crashkernel=no"
|
||||
End
|
||||
|
||||
Specify 'kernel1 should have crashkernel updated'
|
||||
When call grubby --info $kernel1
|
||||
The line 3 of output should include crashkernel="$new_ck"
|
||||
End
|
||||
|
||||
Specify 'kernel2 should also have crashkernel updated'
|
||||
When call grubby --info $kernel2
|
||||
The line 3 of output should include crashkernel="$new_ck"
|
||||
End
|
||||
|
||||
End
|
||||
|
||||
Context "If kernel package is installed alone, "
|
||||
BeforeAll 'setup'
|
||||
AfterAll 'cleanup'
|
||||
# BeforeAll somehow doesn't work as expected, manually call setup to bypass this issue.
|
||||
setup
|
||||
new_kernel_ver=new_kernel
|
||||
new_kernel=/boot/vmlinuz-$new_kernel_ver
|
||||
grubby --add-kernel=$new_kernel --initrd=/boot/initramfs-$new_kernel_ver.img --title=$new_kernel_ver
|
||||
|
||||
Specify 'reset_crashkernel_for_installed_kernel should report the new kernel has its crashkernel updated'
|
||||
When call reset_crashkernel_for_installed_kernel $new_kernel_ver
|
||||
The output should include "crashkernel=$new_ck"
|
||||
End
|
||||
|
||||
Specify 'the new kernel should have crashkernel updated'
|
||||
When call grubby --info $new_kernel
|
||||
The output should include crashkernel="$new_ck"
|
||||
End
|
||||
|
||||
Specify 'kernel1 keeps its crashkernel value'
|
||||
When call grubby --info $kernel1
|
||||
The output should include crashkernel="$old_ck"
|
||||
End
|
||||
|
||||
End
|
||||
|
||||
End
|
||||
End
|
||||
|
|
@ -1,225 +0,0 @@
|
|||
#!/bin/bash
|
||||
Describe 'kdumpctl reset-crashkernel [--kernel] [--fadump]'
|
||||
Include ./kdumpctl
|
||||
kernel1=/boot/vmlinuz-5.15.6-100.fc34.x86_64
|
||||
kernel2=/boot/vmlinuz-5.14.14-200.fc34.x86_64
|
||||
ck=222M
|
||||
KDUMP_SPEC_TEST_RUN_DIR=$(mktemp -d /tmp/spec_test.XXXXXXXXXX)
|
||||
current_kernel=5.15.6-100.fc34.x86_64
|
||||
|
||||
setup() {
|
||||
cp -r spec/support/boot_load_entries "$KDUMP_SPEC_TEST_RUN_DIR"
|
||||
cp spec/support/grub_env "$KDUMP_SPEC_TEST_RUN_DIR"/env_temp
|
||||
}
|
||||
|
||||
cleanup() {
|
||||
rm -rf "$KDUMP_SPEC_TEST_RUN_DIR"
|
||||
}
|
||||
|
||||
BeforeAll 'setup'
|
||||
AfterAll 'cleanup'
|
||||
|
||||
# the boot loader entries are for a system without a boot partition, mock
|
||||
# mountpoint to let grubby know it
|
||||
Mock mountpoint
|
||||
exit 1
|
||||
End
|
||||
|
||||
grubby() {
|
||||
# - --no-etc-grub-update, not update /etc/default/grub
|
||||
# - --bad-image-okay, don't check the validity of the image
|
||||
# - --env, specify custom grub2 environment block file to avoid modifying
|
||||
# the default /boot/grub2/grubenv
|
||||
# - --bls-directory, specify custom BootLoaderSpec config files to avoid
|
||||
# modifying the default /boot/loader/entries
|
||||
/usr/sbin/grubby --no-etc-grub-update --grub2 --bad-image-okay --env="$KDUMP_SPEC_TEST_RUN_DIR"/env_temp -b "$KDUMP_SPEC_TEST_RUN_DIR"/boot_load_entries "$@"
|
||||
}
|
||||
|
||||
# The mocking breaks has_command. Mock it as well to fix the tests.
|
||||
has_command() {
|
||||
[[ "$1" == grubby ]]
|
||||
}
|
||||
|
||||
Describe "Test the kdump dump mode "
|
||||
uname() {
|
||||
if [[ $1 == '-m' ]]; then
|
||||
echo -n x86_64
|
||||
elif [[ $1 == '-r' ]]; then
|
||||
echo -n $current_kernel
|
||||
fi
|
||||
}
|
||||
kdump_crashkernel=$(get_default_crashkernel kdump)
|
||||
Context "when --kernel not specified"
|
||||
grubby --args crashkernel=$ck --update-kernel ALL
|
||||
Specify 'kdumpctl should warn the user that crashkernel has been udpated'
|
||||
When call reset_crashkernel
|
||||
The error should include "Updated crashkernel=$kdump_crashkernel"
|
||||
End
|
||||
|
||||
Specify 'Current running kernel should have crashkernel updated'
|
||||
When call grubby --info $kernel1
|
||||
The line 3 of output should include crashkernel="$kdump_crashkernel"
|
||||
The line 3 of output should not include crashkernel=$ck
|
||||
End
|
||||
|
||||
Specify 'Other kernel still use the old crashkernel value'
|
||||
When call grubby --info $kernel2
|
||||
The line 3 of output should include crashkernel=$ck
|
||||
End
|
||||
End
|
||||
|
||||
Context "--kernel=ALL"
|
||||
grubby --args crashkernel=$ck --update-kernel ALL
|
||||
Specify 'kdumpctl should warn the user that crashkernel has been udpated'
|
||||
When call reset_crashkernel --kernel=ALL
|
||||
The error should include "Updated crashkernel=$kdump_crashkernel for kernel=$kernel1"
|
||||
The error should include "Updated crashkernel=$kdump_crashkernel for kernel=$kernel2"
|
||||
End
|
||||
|
||||
Specify 'kernel1 should have crashkernel updated'
|
||||
When call grubby --info $kernel1
|
||||
The line 3 of output should include crashkernel="$kdump_crashkernel"
|
||||
End
|
||||
|
||||
Specify 'kernel2 should have crashkernel updated'
|
||||
When call grubby --info $kernel2
|
||||
The line 3 of output should include crashkernel="$kdump_crashkernel"
|
||||
End
|
||||
End
|
||||
|
||||
Context "--kernel=/boot/one-kernel to update one specified kernel"
|
||||
grubby --args crashkernel=$ck --update-kernel ALL
|
||||
Specify 'kdumpctl should warn the user that crashkernel has been updated'
|
||||
When call reset_crashkernel --kernel=$kernel1
|
||||
The error should include "Updated crashkernel=$kdump_crashkernel for kernel=$kernel1"
|
||||
End
|
||||
|
||||
Specify 'kernel1 should have crashkernel updated'
|
||||
When call grubby --info $kernel1
|
||||
The line 3 of output should include crashkernel="$kdump_crashkernel"
|
||||
End
|
||||
|
||||
Specify 'kernel2 should have the old crashkernel'
|
||||
When call grubby --info $kernel2
|
||||
The line 3 of output should include crashkernel=$ck
|
||||
End
|
||||
|
||||
End
|
||||
|
||||
End
|
||||
|
||||
Describe "FADump" fadump
|
||||
uname() {
|
||||
if [[ $1 == '-m' ]]; then
|
||||
echo -n ppc64le
|
||||
elif [[ $1 == '-r' ]]; then
|
||||
echo -n $current_kernel
|
||||
fi
|
||||
}
|
||||
|
||||
kdump_crashkernel=$(get_default_crashkernel kdump)
|
||||
fadump_crashkernel=$(get_default_crashkernel fadump)
|
||||
Context "when no --kernel specified"
|
||||
grubby --args crashkernel=$ck --update-kernel ALL
|
||||
grubby --remove-args=fadump --update-kernel ALL
|
||||
Specify 'kdumpctl should warn the user that crashkernel has been udpated'
|
||||
When call reset_crashkernel
|
||||
The error should include "Updated crashkernel=$kdump_crashkernel"
|
||||
End
|
||||
|
||||
Specify 'Current running kernel should have crashkernel updated'
|
||||
When call grubby --info $kernel1
|
||||
The line 3 of output should include crashkernel="$kdump_crashkernel"
|
||||
End
|
||||
|
||||
Specify 'Other kernel still use the old crashkernel value'
|
||||
When call grubby --info $kernel2
|
||||
The line 3 of output should include crashkernel=$ck
|
||||
End
|
||||
End
|
||||
|
||||
Context "--kernel=ALL --fadump=on"
|
||||
grubby --args crashkernel=$ck --update-kernel ALL
|
||||
Specify 'kdumpctl should warn the user that crashkernel has been udpated'
|
||||
When call reset_crashkernel --kernel=ALL --fadump=on
|
||||
The error should include "Updated crashkernel=$fadump_crashkernel for kernel=$kernel1"
|
||||
The error should include "Updated crashkernel=$fadump_crashkernel for kernel=$kernel2"
|
||||
End
|
||||
|
||||
Specify 'kernel1 should have crashkernel updated'
|
||||
When call grubby --info $kernel1
|
||||
The line 3 of output should include crashkernel="$fadump_crashkernel"
|
||||
End
|
||||
|
||||
Specify 'kernel2 should have crashkernel updated'
|
||||
When call get_grub_kernel_boot_parameter $kernel2 crashkernel
|
||||
The output should equal "$fadump_crashkernel"
|
||||
End
|
||||
End
|
||||
|
||||
Context "--kernel=/boot/one-kernel to update one specified kernel"
|
||||
grubby --args crashkernel=$ck --update-kernel ALL
|
||||
grubby --args fadump=on --update-kernel $kernel1
|
||||
Specify 'kdumpctl should warn the user that crashkernel has been updated'
|
||||
When call reset_crashkernel --kernel=$kernel1
|
||||
The error should include "Updated crashkernel=$fadump_crashkernel for kernel=$kernel1"
|
||||
End
|
||||
|
||||
Specify 'kernel1 should have crashkernel updated'
|
||||
When call grubby --info $kernel1
|
||||
The line 3 of output should include crashkernel="$fadump_crashkernel"
|
||||
End
|
||||
|
||||
Specify 'kernel2 should have the old crashkernel'
|
||||
When call get_grub_kernel_boot_parameter $kernel2 crashkernel
|
||||
The output should equal $ck
|
||||
End
|
||||
End
|
||||
|
||||
Context "Update all kernels but without --fadump specified"
|
||||
grubby --args crashkernel=$ck --update-kernel ALL
|
||||
grubby --args fadump=on --update-kernel $kernel1
|
||||
Specify 'kdumpctl should warn the user that crashkernel has been updated'
|
||||
When call reset_crashkernel --kernel=$kernel1
|
||||
The error should include "Updated crashkernel=$fadump_crashkernel for kernel=$kernel1"
|
||||
End
|
||||
|
||||
Specify 'kernel1 should have crashkernel updated'
|
||||
When call get_grub_kernel_boot_parameter $kernel1 crashkernel
|
||||
The output should equal "$fadump_crashkernel"
|
||||
End
|
||||
|
||||
Specify 'kernel2 should have the old crashkernel'
|
||||
When call get_grub_kernel_boot_parameter $kernel2 crashkernel
|
||||
The output should equal $ck
|
||||
End
|
||||
End
|
||||
|
||||
Context 'Switch between fadump=on and fadump=nocma'
|
||||
grubby --args crashkernel=$ck --update-kernel ALL
|
||||
grubby --args fadump=on --update-kernel ALL
|
||||
Specify 'fadump=on to fadump=nocma'
|
||||
When call reset_crashkernel --kernel=ALL --fadump=nocma
|
||||
The error should include "Updated crashkernel=$fadump_crashkernel for kernel=$kernel1"
|
||||
The error should include "Updated crashkernel=$fadump_crashkernel for kernel=$kernel2"
|
||||
End
|
||||
|
||||
Specify 'kernel1 should have fadump=nocma in cmdline'
|
||||
When call get_grub_kernel_boot_parameter $kernel1 fadump
|
||||
The output should equal nocma
|
||||
End
|
||||
|
||||
Specify 'fadump=nocma to fadump=on'
|
||||
When call reset_crashkernel --kernel=ALL --fadump=on
|
||||
The error should include "Updated fadump=on for kernel=$kernel1"
|
||||
End
|
||||
|
||||
Specify 'kernel2 should have fadump=on in cmdline'
|
||||
When call get_grub_kernel_boot_parameter $kernel1 fadump
|
||||
The output should equal on
|
||||
End
|
||||
|
||||
End
|
||||
|
||||
End
|
||||
End
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
title Fedora (0-rescue-e986846f63134c7295458cf36300ba5b) 33 (Workstation Edition)
|
||||
version 0-rescue-e986846f63134c7295458cf36300ba5b
|
||||
linux /boot/vmlinuz-0-rescue-e986846f63134c7295458cf36300ba5b
|
||||
initrd /boot/initramfs-0-rescue-e986846f63134c7295458cf36300ba5b.img
|
||||
options root=UUID=45fdf703-3966-401b-b8f7-cf056affd2b0 ro rd.driver.blacklist=nouveau modprobe.blacklist=nouveau nvidia-drm.modeset=1 rhgb quiet rd.driver.blacklist=nouveau modprobe.blacklist=nouveau nvidia-drm.modeset=1 crashkernel=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-102400T:180G fadump=on
|
||||
grub_users $grub_users
|
||||
grub_arg --unrestricted
|
||||
grub_class kernel
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
title Fedora (5.14.14-200.fc34.x86_64) 34 (Workstation Edition)
|
||||
version 5.14.14-200.fc34.x86_64
|
||||
linux /boot/vmlinuz-5.14.14-200.fc34.x86_64
|
||||
initrd /boot/initramfs-5.14.14-200.fc34.x86_64.img
|
||||
options root=UUID=45fdf703-3966-401b-b8f7-cf056affd2b0 ro rd.driver.blacklist=nouveau modprobe.blacklist=nouveau nvidia-drm.modeset=1 rhgb quiet rd.driver.blacklist=nouveau modprobe.blacklist=nouveau nvidia-drm.modeset=1 crashkernel=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-102400T:180G fadump=on
|
||||
grub_users $grub_users
|
||||
grub_arg --unrestricted
|
||||
grub_class kernel
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
title Fedora (5.15.6-100.fc34.x86_64) 34 (Workstation Edition)
|
||||
version 5.15.6-100.fc34.x86_64
|
||||
linux /boot/vmlinuz-5.15.6-100.fc34.x86_64
|
||||
initrd /boot/initramfs-5.15.6-100.fc34.x86_64.img
|
||||
options root=UUID=45fdf703-3966-401b-b8f7-cf056affd2b0 ro rd.driver.blacklist=nouveau modprobe.blacklist=nouveau nvidia-drm.modeset=1 rhgb quiet rd.driver.blacklist=nouveau modprobe.blacklist=nouveau nvidia-drm.modeset=1 crashkernel=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-102400T:180G fadump=on
|
||||
grub_users $grub_users
|
||||
grub_arg --unrestricted
|
||||
grub_class fedora
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
# GRUB Environment Block
|
||||
# WARNING: Do not edit this file by tools other than grub-editenv!!!
|
||||
##################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################
|
||||
|
|
@ -30,7 +30,7 @@ RPMDEFINE = --define '_sourcedir $(REPO)'\
|
|||
|
||||
KEXEC_TOOLS_SRC = $(filter-out $(REPO)/tests,$(wildcard $(REPO)/*))
|
||||
KEXEC_TOOLS_TEST_SRC = $(wildcard $(REPO)/tests/scripts/**/*)
|
||||
KEXEC_TOOLS_NVR = $(shell rpm $(RPMDEFINE) -q --specfile $(REPO)/$(SPEC) 2>/dev/null | grep -m 1 . | sed -e 's#.src#.$(ARCH)#')
|
||||
KEXEC_TOOLS_NVR = $(shell rpm $(RPMDEFINE) -q --specfile $(REPO)/$(SPEC) 2>/dev/null | grep -m 1 .)
|
||||
KEXEC_TOOLS_RPM = $(BUILD_ROOT)/$(ARCH)/$(KEXEC_TOOLS_NVR).rpm
|
||||
|
||||
all: $(TEST_ROOT)/output/test-base-image
|
||||
|
|
@ -42,7 +42,7 @@ all: $(TEST_ROOT)/output/test-base-image
|
|||
# to rebuild the rpm, currently use rpmbuild to have better control over the rpm building process
|
||||
#
|
||||
$(KEXEC_TOOLS_RPM): $(KEXEC_TOOLS_SRC)
|
||||
sh -c "cd .. && fedpkg --release f$(RELEASE) sources"
|
||||
sh -c "cd .. && fedpkg sources"
|
||||
@echo Rebuilding RPM due to modification of sources: $?
|
||||
rpmbuild $(RPMDEFINE) -ba $(REPO)/$(SPEC)
|
||||
|
||||
|
|
@ -67,14 +67,14 @@ $(BUILD_ROOT)/inst-base-image: $(BUILD_ROOT)/base-image
|
|||
$(BUILD_ROOT)/inst-base-image \
|
||||
$(TEST_ROOT)/scripts/build-scripts/base-image.sh
|
||||
|
||||
$(TEST_ROOT)/output/test-base-image: $(BUILD_ROOT)/inst-base-image $(KEXEC_TOOLS_RPM) $(KEXEC_TOOLS_TEST_SRC) $(EXTRA_RPMS)
|
||||
$(TEST_ROOT)/output/test-base-image: $(BUILD_ROOT)/inst-base-image $(KEXEC_TOOLS_RPM) $(KEXEC_TOOLS_TEST_SRC)
|
||||
@echo "Building test base image"
|
||||
mkdir -p $(TEST_ROOT)/output
|
||||
$(TEST_ROOT)/scripts/build-image.sh \
|
||||
$(BUILD_ROOT)/inst-base-image \
|
||||
$(TEST_ROOT)/output/test-base-image \
|
||||
$(TEST_ROOT)/scripts/build-scripts/test-base-image.sh \
|
||||
$(KEXEC_TOOLS_RPM) $(EXTRA_RPMS)
|
||||
$(KEXEC_TOOLS_RPM)
|
||||
|
||||
test-run: $(TEST_ROOT)/output/test-base-image
|
||||
ifeq ($(strip $(TEST_CASE)),)
|
||||
|
|
|
|||
|
|
@ -3,7 +3,8 @@
|
|||
img_inst_pkg grubby\
|
||||
dnsmasq\
|
||||
openssh openssh-server\
|
||||
dracut-network dracut-squash squashfs-tools ethtool snappy kernel-modules
|
||||
dracut-network dracut-squash squashfs-tools ethtool snappy
|
||||
|
||||
img_run_cmd "grubby --args systemd.journald.forward_to_console=1 systemd.log_target=console --update-kernel ALL"
|
||||
img_run_cmd "grubby --args selinux=0 --update-kernel ALL"
|
||||
img_run_cmd "grubby --args crashkernel=224M --update-kernel ALL"
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ for _rpm in $@; do
|
|||
if [[ ! -e $_rpm ]]; then
|
||||
perror_exit "'$_rpm' not found"
|
||||
else
|
||||
TEST_RPMS="$TEST_RPMS $(realpath "$_rpm")"
|
||||
TEST_RPMS=$(realpath "$_rpm")
|
||||
fi
|
||||
done
|
||||
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ is_mounted()
|
|||
clean_up()
|
||||
{
|
||||
for _mnt in ${MNTS[@]}; do
|
||||
is_mounted $_mnt && $SUDO umount -f -R $_mnt
|
||||
is_mounted $_mnt && $SUDO umount -f $_mnt
|
||||
done
|
||||
|
||||
for _dev in ${DEVS[@]}; do
|
||||
|
|
@ -81,17 +81,6 @@ get_mountable_dev() {
|
|||
fi
|
||||
}
|
||||
|
||||
# get the separate boot partition
|
||||
# return the 2nd partition as boot partition
|
||||
get_mount_boot() {
|
||||
local dev=$1 _second_part=${dev}p2
|
||||
|
||||
# it's better to check if the 2nd partition has the boot label using lsblk
|
||||
# but somehow this doesn't work starting with Fedora37
|
||||
echo $_second_part
|
||||
}
|
||||
|
||||
|
||||
prepare_loop() {
|
||||
[ -n "$(lsmod | grep "^loop")" ] && return
|
||||
|
||||
|
|
@ -144,7 +133,7 @@ image_lock()
|
|||
# Mount a device, will umount it automatially when shell exits
|
||||
mount_image() {
|
||||
local image=$1 fmt
|
||||
local dev mnt mnt_dev boot root
|
||||
local dev mnt mnt_dev
|
||||
|
||||
# Lock the image just in case user run this script in parrel
|
||||
image_lock $image
|
||||
|
|
@ -177,20 +166,12 @@ mount_image() {
|
|||
|
||||
$SUDO mount $mnt_dev $mnt
|
||||
[ $? -ne 0 ] && perror_exit "failed to mount device '$mnt_dev'"
|
||||
boot=$(get_mount_boot "$dev")
|
||||
if [[ -n "$boot" ]]; then
|
||||
root=$(get_image_mount_root $image)
|
||||
$SUDO mount $boot $root/boot
|
||||
[ $? -ne 0 ] && perror_exit "failed to mount the bootable partition for device '$mnt_dev'"
|
||||
fi
|
||||
}
|
||||
|
||||
get_image_mount_root() {
|
||||
local image=$1
|
||||
local root=${MNTS[$image]}
|
||||
|
||||
# Starting from Fedora 36, the root node is /root/root of the last partition
|
||||
[ -d "$root/root/root" ] && root=$root/root
|
||||
echo $root
|
||||
|
||||
if [ -z "$root" ]; then
|
||||
|
|
@ -232,7 +213,7 @@ run_in_image() {
|
|||
|
||||
inst_in_image() {
|
||||
local image=$1 src=$2 dst=$3
|
||||
local root=$(get_image_mount_root $1)
|
||||
local root=${MNTS[$image]}
|
||||
|
||||
$SUDO cp $src $root/$dst
|
||||
}
|
||||
|
|
@ -259,7 +240,7 @@ create_image_from_base_image() {
|
|||
if [ "$image_fmt" != "raw" ]; then
|
||||
if fmt_is_qcow2 "$image_fmt"; then
|
||||
echo "Source image is qcow2, using snapshot..."
|
||||
qemu-img create -f qcow2 -b $image -F qcow2 $output
|
||||
qemu-img create -f qcow2 -b $image $output
|
||||
else
|
||||
perror_exit "Unrecognized base image format '$image_mnt'"
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -95,7 +95,7 @@ has_valid_vmcore_dir() {
|
|||
return 1
|
||||
fi
|
||||
|
||||
if ! diff -w $vmcore_dir/vmcore-dmesg.txt.2 $vmcore_dir/vmcore-dmesg.txt; then
|
||||
if ! diff $vmcore_dir/vmcore-dmesg.txt.2 $vmcore_dir/vmcore-dmesg.txt; then
|
||||
test_output "Dmesg retrived from vmcore is different from dump version!"
|
||||
return 1
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -1,23 +0,0 @@
|
|||
#!/bin/bash
|
||||
# Check which virtualization technology to use
|
||||
# We prefer kvm, kqemu, userspace in that order.
|
||||
|
||||
# This script is based on https://github.com/dracutdevs/dracut/blob/master/test/run-qemu
|
||||
|
||||
export PATH=/sbin:/bin:/usr/sbin:/usr/bin
|
||||
|
||||
[[ -x /usr/bin/qemu ]] && BIN=/usr/bin/qemu && ARGS="-cpu max"
|
||||
$(lsmod | grep -q '^kqemu ') && BIN=/usr/bin/qemu && ARGS="-kernel-kqemu -cpu host"
|
||||
[[ -c /dev/kvm && -x /usr/bin/kvm ]] && BIN=/usr/bin/kvm && ARGS="-cpu host"
|
||||
[[ -c /dev/kvm && -x /usr/bin/qemu-kvm ]] && BIN=/usr/bin/qemu-kvm && ARGS="-cpu host"
|
||||
[[ -c /dev/kvm && -x /usr/libexec/qemu-kvm ]] && BIN=/usr/libexec/qemu-kvm && ARGS="-cpu host"
|
||||
[[ -x /usr/bin/qemu-system-$(uname -i) ]] && BIN=/usr/bin/qemu-system-$(uname -i) && ARGS="-cpu max"
|
||||
[[ -c /dev/kvm && -x /usr/bin/qemu-system-$(uname -i) ]] && BIN=/usr/bin/qemu-system-$(uname -i) && ARGS="-enable-kvm -cpu host"
|
||||
|
||||
[[ $BIN ]] || {
|
||||
echo "Could not find a working KVM or QEMU to test with!" >&2
|
||||
echo "Please install kvm or qemu." >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
exec $BIN $ARGS "$@"
|
||||
|
|
@ -1,38 +1,9 @@
|
|||
#!/bin/bash
|
||||
|
||||
_kill_if_valid_pid() {
|
||||
local _pid="$1"
|
||||
if ps -p "$_pid" > /dev/null
|
||||
then
|
||||
kill "$_pid"
|
||||
fi
|
||||
}
|
||||
|
||||
_recursive_kill() {
|
||||
local _pid="$1"
|
||||
local _children _child
|
||||
|
||||
_children=$(pgrep -P "$_pid")
|
||||
if [ -n "$_children" ]; then
|
||||
for _child in $_children
|
||||
do
|
||||
_recursive_kill "$_child"
|
||||
_kill_if_valid_pid "$_child"
|
||||
done
|
||||
fi
|
||||
_kill_if_valid_pid "$_pid"
|
||||
}
|
||||
|
||||
_kill_all_jobs() {
|
||||
local _jobs=$(jobs -r -p)
|
||||
local _job
|
||||
|
||||
if [ -n "$_jobs" ]; then
|
||||
for _job in $_jobs
|
||||
do
|
||||
_recursive_kill "$_job"
|
||||
done
|
||||
fi
|
||||
[ -n "$_jobs" ] && kill $_jobs
|
||||
}
|
||||
|
||||
trap '
|
||||
|
|
@ -85,7 +56,8 @@ for test_case in $testcases; do
|
|||
results[$test_case]="<Test Skipped>"
|
||||
|
||||
testdir=$TESTCASEDIR/$test_case
|
||||
scripts=$(ls -r -1 $testdir | egrep "\.sh$" | tr '\n' ' ')
|
||||
script_num=$(ls -1 $testdir | wc -l)
|
||||
scripts=$(ls -r -1 $testdir | tr '\n' ' ')
|
||||
test_outputs=""
|
||||
read main_script aux_script <<< "$scripts"
|
||||
|
||||
|
|
@ -139,7 +111,7 @@ for test_case in $testcases; do
|
|||
|
||||
if [ $console -eq 1 ]; then
|
||||
run_test_sync $script | tee $(get_test_console_file $script)
|
||||
[ -n "$(jobs -p)" ] && wait $(jobs -p)
|
||||
[ -n "$(jobs -p)" ] && kill $(jobs -p)
|
||||
else
|
||||
$(run_test_sync $script > $(get_test_console_file $script)) &
|
||||
watch_test_outputs $test_outputs
|
||||
|
|
@ -149,7 +121,7 @@ for test_case in $testcases; do
|
|||
|
||||
[ $? -ne 0 ] && ret=$(expr $ret + 1)
|
||||
results[$test_case]="$res"
|
||||
_kill_all_jobs
|
||||
|
||||
echo -e "-------- Test finished: $test_case $res --------"
|
||||
for script in $scripts; do
|
||||
script="$testdir/$script"
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
DEFAULT_QEMU_CMD="-nodefaults \
|
||||
-nographic \
|
||||
-smp 2 \
|
||||
-m 1G \
|
||||
-m 768M \
|
||||
-monitor none"
|
||||
|
||||
_YELLOW='\033[1;33m'
|
||||
|
|
@ -89,7 +89,7 @@ run_test_sync() {
|
|||
local qemu_cmd=$(get_test_qemu_cmd $1)
|
||||
|
||||
if [ -n "$qemu_cmd" ]; then
|
||||
timeout --foreground 10m $BASEDIR/run-qemu $(get_test_qemu_cmd $1)
|
||||
timeout --foreground 10m qemu-kvm $(get_test_qemu_cmd $1)
|
||||
else
|
||||
echo "error: test qemu command line is not configured" > /dev/stderr
|
||||
return 1
|
||||
|
|
@ -146,7 +146,8 @@ watch_test_outputs() {
|
|||
ret=$?
|
||||
|
||||
if [ $ret -ne 255 ]; then
|
||||
# Test finished
|
||||
# Test finished, kill VMs
|
||||
kill $(jobs -p)
|
||||
break 2
|
||||
fi
|
||||
done
|
||||
|
|
|
|||
|
|
@ -1,59 +0,0 @@
|
|||
on_build() {
|
||||
TEST_DIR_PREFIX=/tmp/lvm_test.XXXXXX
|
||||
# clear TEST_DIRs if any
|
||||
rm -rf ${TEST_DIR_PREFIX%.*}.*
|
||||
TEST_IMG="$(mktemp -d $TEST_DIR_PREFIX)/test.img"
|
||||
|
||||
img_inst_pkg "lvm2"
|
||||
img_inst $TESTDIR/scripts/testcases/lvm2-thinp-kdump/lvm.conf /etc/lvm/
|
||||
dd if=/dev/zero of=$TEST_IMG bs=300M count=1
|
||||
# The test.img will be /dev/sdb
|
||||
img_add_qemu_cmd "-hdb $TEST_IMG"
|
||||
}
|
||||
|
||||
on_test() {
|
||||
VG=vg00
|
||||
LV_THINPOOL=thinpool
|
||||
LV_VOLUME=thinlv
|
||||
VMCORE_PATH=var/crash
|
||||
|
||||
local boot_count=$(get_test_boot_count)
|
||||
|
||||
if [ $boot_count -eq 1 ]; then
|
||||
|
||||
vgcreate $VG /dev/sdb
|
||||
# Create a small thinpool which is definitely not enough for
|
||||
# vmcore, then create a thin volume which is definitely enough
|
||||
# for vmcore, so we can make sure thinpool should be autoextend
|
||||
# during runtime.
|
||||
lvcreate -L 10M -T $VG/$LV_THINPOOL
|
||||
lvcreate -V 300M -T $VG/$LV_THINPOOL -n $LV_VOLUME
|
||||
mkfs.ext4 /dev/$VG/$LV_VOLUME
|
||||
mount /dev/$VG/$LV_VOLUME /mnt
|
||||
mkdir -p /mnt/$VMCORE_PATH
|
||||
|
||||
cat << EOF > /etc/kdump.conf
|
||||
ext4 /dev/$VG/$LV_VOLUME
|
||||
path /$VMCORE_PATH
|
||||
core_collector makedumpfile -l --message-level 7 -d 31
|
||||
EOF
|
||||
kdumpctl start || test_failed "Failed to start kdump"
|
||||
|
||||
sync
|
||||
|
||||
echo 1 > /proc/sys/kernel/sysrq
|
||||
echo c > /proc/sysrq-trigger
|
||||
|
||||
elif [ $boot_count -eq 2 ]; then
|
||||
mount /dev/$VG/$LV_VOLUME /mnt
|
||||
if has_valid_vmcore_dir /mnt/$VMCORE_PATH; then
|
||||
test_passed
|
||||
else
|
||||
test_failed "Vmcore missing"
|
||||
fi
|
||||
|
||||
shutdown -h 0
|
||||
else
|
||||
test_failed "Unexpected reboot"
|
||||
fi
|
||||
}
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
activation {
|
||||
thin_pool_autoextend_threshold = 70
|
||||
thin_pool_autoextend_percent = 20
|
||||
monitoring = 1
|
||||
}
|
||||
|
|
@ -1 +0,0 @@
|
|||
../nfs-kdump/0-server.sh
|
||||
|
|
@ -1,46 +0,0 @@
|
|||
# Executed before VM starts
|
||||
on_build() {
|
||||
img_inst_pkg "nfs-utils"
|
||||
img_add_qemu_cmd "-nic socket,connect=127.0.0.1:8010,mac=52:54:00:12:34:57"
|
||||
}
|
||||
|
||||
on_test() {
|
||||
local boot_count=$(get_test_boot_count)
|
||||
local nfs_server=192.168.77.1
|
||||
local earlykdump_path="/usr/lib/dracut/modules.d/99earlykdump/early-kdump.sh"
|
||||
local tmp_file="/tmp/.tmp-file"
|
||||
|
||||
if [[ ! -f $earlykdump_path ]]; then
|
||||
test_failed "early-kdump.sh not exist!"
|
||||
fi
|
||||
|
||||
if [ $boot_count -eq 1 ]; then
|
||||
cat << EOF > /etc/kdump.conf
|
||||
nfs $nfs_server:/srv/nfs
|
||||
core_collector makedumpfile -l --message-level 7 -d 31
|
||||
final_action poweroff
|
||||
EOF
|
||||
|
||||
while ! ping -c 1 $nfs_server -W 1; do
|
||||
sleep 1
|
||||
done
|
||||
|
||||
kdumpctl start \
|
||||
|| test_failed "Failed to start kdump"
|
||||
grubby --update-kernel=ALL --args=rd.earlykdump
|
||||
|
||||
cat << EOF > $tmp_file
|
||||
echo 1 > /proc/sys/kernel/sysrq
|
||||
echo c > /proc/sysrq-trigger
|
||||
EOF
|
||||
sed -i "/early_kdump_load$/r $tmp_file" $earlykdump_path
|
||||
dracut -f --add earlykdump
|
||||
kdumpctl restart \
|
||||
|| test_failed "Failed to start earlykdump"
|
||||
|
||||
sync
|
||||
reboot
|
||||
else
|
||||
test_failed "Unexpected reboot"
|
||||
fi
|
||||
}
|
||||
|
|
@ -16,13 +16,12 @@ on_build() {
|
|||
img_run_cmd "echo dhcp-range=192.168.77.50,192.168.77.100,255.255.255.0,12h >> /etc/dnsmasq.conf"
|
||||
img_run_cmd "systemctl enable dnsmasq"
|
||||
|
||||
img_run_cmd 'echo [connection] > /etc/NetworkManager/system-connections/eth0.nmconnection'
|
||||
img_run_cmd 'echo type=ethernet >> /etc/NetworkManager/system-connections/eth0.nmconnection'
|
||||
img_run_cmd 'echo interface-name=eth0 >> /etc/NetworkManager/system-connections/eth0.nmconnection'
|
||||
img_run_cmd 'echo [ipv4] >> /etc/NetworkManager/system-connections/eth0.nmconnection'
|
||||
img_run_cmd 'echo address1=192.168.77.1/24 >> /etc/NetworkManager/system-connections/eth0.nmconnection'
|
||||
img_run_cmd 'echo method=manual >> /etc/NetworkManager/system-connections/eth0.nmconnection'
|
||||
img_run_cmd 'chmod 600 /etc/NetworkManager/system-connections/eth0.nmconnection'
|
||||
img_run_cmd 'echo DEVICE="eth0" > /etc/sysconfig/network-scripts/ifcfg-eth0'
|
||||
img_run_cmd 'echo BOOTPROTO="none >> /etc/sysconfig/network-scripts/ifcfg-eth0"'
|
||||
img_run_cmd 'echo ONBOOT="yes" >> /etc/sysconfig/network-scripts/ifcfg-eth0'
|
||||
img_run_cmd 'echo PREFIX="24" >> /etc/sysconfig/network-scripts/ifcfg-eth0'
|
||||
img_run_cmd 'echo IPADDR="192.168.77.1" >> /etc/sysconfig/network-scripts/ifcfg-eth0'
|
||||
img_run_cmd 'echo TYPE="Ethernet" >> /etc/sysconfig/network-scripts/ifcfg-eth0'
|
||||
|
||||
img_add_qemu_cmd "-nic socket,listen=:8010,mac=52:54:00:12:34:56"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,13 +17,12 @@ on_build() {
|
|||
img_run_cmd "echo dhcp-range=192.168.77.50,192.168.77.100,255.255.255.0,12h >> /etc/dnsmasq.conf"
|
||||
img_run_cmd "systemctl enable dnsmasq"
|
||||
|
||||
img_run_cmd 'echo [connection] > /etc/NetworkManager/system-connections/eth0.nmconnection'
|
||||
img_run_cmd 'echo type=ethernet >> /etc/NetworkManager/system-connections/eth0.nmconnection'
|
||||
img_run_cmd 'echo interface-name=eth0 >> /etc/NetworkManager/system-connections/eth0.nmconnection'
|
||||
img_run_cmd 'echo [ipv4] >> /etc/NetworkManager/system-connections/eth0.nmconnection'
|
||||
img_run_cmd 'echo address1=192.168.77.1/24 >> /etc/NetworkManager/system-connections/eth0.nmconnection'
|
||||
img_run_cmd 'echo method=manual >> /etc/NetworkManager/system-connections/eth0.nmconnection'
|
||||
img_run_cmd 'chmod 600 /etc/NetworkManager/system-connections/eth0.nmconnection'
|
||||
img_run_cmd 'echo DEVICE="eth0" > /etc/sysconfig/network-scripts/ifcfg-eth0'
|
||||
img_run_cmd 'echo BOOTPROTO="none >> /etc/sysconfig/network-scripts/ifcfg-eth0"'
|
||||
img_run_cmd 'echo ONBOOT="yes" >> /etc/sysconfig/network-scripts/ifcfg-eth0'
|
||||
img_run_cmd 'echo PREFIX="24" >> /etc/sysconfig/network-scripts/ifcfg-eth0'
|
||||
img_run_cmd 'echo IPADDR="192.168.77.1" >> /etc/sysconfig/network-scripts/ifcfg-eth0'
|
||||
img_run_cmd 'echo TYPE="Ethernet" >> /etc/sysconfig/network-scripts/ifcfg-eth0'
|
||||
}
|
||||
|
||||
# Executed when VM boots
|
||||
|
|
|
|||
79
zanata-notes.txt
Normal file
79
zanata-notes.txt
Normal file
|
|
@ -0,0 +1,79 @@
|
|||
Zanata is a web-based system for managing localisation projects.
|
||||
For kexec-tools firstboot module, I created a zanata project with name of
|
||||
"kexec-tools": https://translate.zanata.org/zanata/project/view/kexec-tools
|
||||
|
||||
There's several clients available for zanata translation management, such as
|
||||
python client and Maven client. It's suggested to use maven client for latest
|
||||
zanata issues
|
||||
|
||||
Firstly you need install mvn rpms, just do below for fedora 16 and beyond:
|
||||
yum install maven
|
||||
|
||||
create zanata.ini in your home dir:
|
||||
>~/.config/zanata.ini
|
||||
There should be something need to change like below:
|
||||
translate_zanata_org.url=https://translate.zanata.org/zanata/
|
||||
translate_zanata_org.username=
|
||||
translate_zanata_org.key=
|
||||
|
||||
Change username to your zanata username
|
||||
Change the key to the "API key" of zanata which can be generate from
|
||||
zanata web page.
|
||||
Open user profile page of zanata.org, click "Generate API Key" to create it.
|
||||
|
||||
zanata is a plugin of maven, to activate it, you need do below configurations:
|
||||
1. cd kexec-tools/po, (assume kexec-tools is the git repo)
|
||||
2. add a pom.xml like below: (note: version 2.0.0 is better than 1.7.5
|
||||
for performance improvement)
|
||||
<project>
|
||||
...
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.zanata</groupId>
|
||||
<artifactId>zanata-maven-plugin</artifactId>
|
||||
<version>1.7.5</version>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
...
|
||||
</project>
|
||||
3. add zanata.xml for your project with content like below:
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<config xmlns="http://zanata.org/namespace/config/">
|
||||
<url>https://translate.zanata.org/zanata/</url>
|
||||
<project>kexec-tools</project>
|
||||
<project-version>F18</project-version>
|
||||
<project-type>gettext</project-type>
|
||||
|
||||
<locales>
|
||||
<locale>ar</locale>
|
||||
...
|
||||
</config>
|
||||
|
||||
You can get mostly-complete zanata.xml from the project version page on zanata
|
||||
Things need to be modified is:
|
||||
a) project-type, please use gettext
|
||||
b) for locales which are diffrent between local name and zanata server name,
|
||||
for example for kexec-tools we have bn_IN but zanata server accept bn-IN,
|
||||
so we need to add below line:
|
||||
<locale map-from="bn_IN">bn-IN</locale>
|
||||
|
||||
The first running of "mvn zanata:help" will download and activate the new
|
||||
version of zanata plugin for you.
|
||||
|
||||
I use below command to upload both pot file and translated po files:
|
||||
mvn zanata:push -Dzanata.pushType=both
|
||||
If you only need to upload po files, you can use:
|
||||
mvn zanata:push -Dzanata.pushType=trans
|
||||
|
||||
You can use mvn zanata:help to lookup the detail help content of param names
|
||||
|
||||
The other thing to be careful is specifying the correct source and
|
||||
translation directories.
|
||||
They are relative path. You can also put the pom.xml and zanata.xml under toplevel directory and run:
|
||||
mvn zanata:push -Dzanata.pushType=both -Dzanata.srcDir=po -Dzanata.transDir=po
|
||||
|
||||
--
|
||||
[1] https://github.com/zanata/zanata/wiki/Zanata-Maven-Integration
|
||||
[2] https://github.com/zanata/zanata/wiki/client-configuration
|
||||
Loading…
Add table
Add a link
Reference in a new issue