Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions kdump-lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -778,6 +778,8 @@ prepare_cmdline()
# (if at all) and add it explicitly.
out+="rd.systemd.gpt_auto=no "

shopt -q -o xtrace && out+="rd.debug "

# Trim unnecessary whitespaces
echo "$out" | sed -e "s/^ *//g" -e "s/ *$//g" -e "s/ \+/ /g"
}
Expand Down
8 changes: 8 additions & 0 deletions kdump-logger.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,14 @@
# The code in this file might be run in an environment without bash.
# Any code added must be POSIX compliant.

# When xtrace is enabled, set debug to prevent logger functions from turning
# off xtrace
case "$-" in
*"x"*)
debug=1
;;
esac

# Define vairables for the log levels in this module.
kdump_stdloglvl=""
kdump_sysloglvl=""
Expand Down
10 changes: 9 additions & 1 deletion kdumpctl
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,16 @@ KEXEC=/sbin/kexec
KDUMP_KERNELVER=""
KDUMP_KERNEL=""
KEXEC_ARGS=""
MKDUMPRD="/sbin/mkdumprd -f"
MKDUMPRD="/sbin/mkdumprd"
MKFADUMPRD="/sbin/mkfadumprd"
if shopt -q -o xtrace; then
# shells running as root don't inherit PS4
PS4='${BASH_SOURCE}@${LINENO}(${FUNCNAME[0]-}): '
MKDUMPRD+=" --debug"
MKFADUMPRD+=" --debug"
fi
MKDUMPRD+=" -f"

DRACUT_MODULES_FILE="/usr/lib/dracut/modules.txt"

# Path to the initrd used for normal boot. Used to determine the naming
Expand Down
12 changes: 10 additions & 2 deletions mkdumprd
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@
# Written by Cong Wang <amwang@redhat.com>
#

[[ -n $debug ]] && set -x
if [[ $1 == --debug ]]; then
set -x
PS4='${BASH_SOURCE}@${LINENO}(${FUNCNAME[0]-}): '
shift
fi

if [[ -f /etc/sysconfig/kdump ]]; then
# shellcheck source=/dev/null
Expand All @@ -32,7 +36,11 @@ SSH_KEY_LOCATION=$DEFAULT_SSHKEY
SAVE_PATH=$(get_save_path)

declare -a dracut_args
dracut_args+=(--quiet)
if [[ -n $debug ]]; then
dracut_args+=(--debug)
else
dracut_args+=(--quiet)
fi
dracut_args+=(--hostonly)
dracut_args+=(--hostonly-cmdline)
dracut_args+=(--hostonly-i18n)
Expand Down
15 changes: 13 additions & 2 deletions mkfadumprd
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,18 @@
# Generate an initramfs image that isolates dump capture capability within
# the default initramfs using zz-fadumpinit dracut module.

MKDUMPRD="/sbin/mkdumprd"
if [[ $1 == --debug ]]; then
set -x
PS4='${BASH_SOURCE}@${LINENO}(${FUNCNAME[0]-}): '
shift
MKDUMPRD+=" --debug"
debug_dracut=--debug
else
debug_dracut=--quiet
fi
MKDUMPRD+=" -f"

if [[ -f /etc/sysconfig/kdump ]]; then
# shellcheck source=/dev/null
. /etc/sysconfig/kdump
Expand Down Expand Up @@ -33,7 +45,6 @@ trap '
# clean up after ourselves no matter how we die.
trap 'exit 1;' SIGINT

MKDUMPRD="/sbin/mkdumprd -f"
# Default boot initramfs to be rebuilt
REBUILD_INITRD="$1" && shift
TARGET_INITRD="$1" && shift
Expand Down Expand Up @@ -74,6 +85,6 @@ if ! have_compression_in_dracut_args; then
fi
fi

if ! dracut --force --quiet "${_dracut_isolate_args[@]}" "$@" "$TARGET_INITRD"; then
if ! dracut "$debug_dracut" --force "${_dracut_isolate_args[@]}" "$@" "$TARGET_INITRD"; then
perror_exit "mkfadumprd: failed to setup '$TARGET_INITRD' with dump capture capability"
fi