Skip to content

Commit 08d68ff

Browse files
committed
Enable xtrace in mkdumprd, mkfadumprd and dracut when kdumpctl enables xtrace
Resolves: #118 Since dracut commit 5042681("fix(dracut.sh): initialize variables that get exported"), debug=1 won't enable xtrace in dracut. Let's call dracut with --debug explicitly in mkdumprd and mkfadumprd. Also enable xtrace in mkdumprd and mkfadumprd by passing --debug argument when kdumpctl enables xtrace. Signed-off-by: Coiby Xu <coxu@redhat.com>
1 parent b603b0b commit 08d68ff

File tree

3 files changed

+30
-5
lines changed

3 files changed

+30
-5
lines changed

kdumpctl

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,16 @@ KEXEC=/sbin/kexec
44
KDUMP_KERNELVER=""
55
KDUMP_KERNEL=""
66
KEXEC_ARGS=""
7-
MKDUMPRD="/sbin/mkdumprd -f"
7+
8+
MKDUMPRD="/sbin/mkdumprd"
89
MKFADUMPRD="/sbin/mkfadumprd"
10+
11+
if shopt -q -o xtrace; then
12+
MKDUMPRD+=" --debug"
13+
MKFADUMPRD+=" --debug"
14+
fi
15+
MKDUMPRD+=" -f"
16+
917
DRACUT_MODULES_FILE="/usr/lib/dracut/modules.txt"
1018

1119
# Path to the initrd used for normal boot. Used to determine the naming

mkdumprd

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,10 @@
66
# Written by Cong Wang <amwang@redhat.com>
77
#
88

9-
[[ -n $debug ]] && set -x
9+
if [[ $1 == --debug ]]; then
10+
set -x
11+
shift
12+
fi
1013

1114
if [[ -f /etc/sysconfig/kdump ]]; then
1215
# shellcheck source=/dev/null
@@ -32,7 +35,11 @@ SSH_KEY_LOCATION=$DEFAULT_SSHKEY
3235
SAVE_PATH=$(get_save_path)
3336

3437
declare -a dracut_args
35-
dracut_args+=(--quiet)
38+
if [[ -n $debug ]]; then
39+
dracut_args+=(--debug)
40+
else
41+
dracut_args+=(--quiet)
42+
fi
3643
dracut_args+=(--hostonly)
3744
dracut_args+=(--hostonly-cmdline)
3845
dracut_args+=(--hostonly-i18n)

mkfadumprd

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,17 @@
22
# Generate an initramfs image that isolates dump capture capability within
33
# the default initramfs using zz-fadumpinit dracut module.
44

5+
MKDUMPRD="/sbin/mkdumprd"
6+
if [[ $1 == --debug ]]; then
7+
set -x
8+
shift
9+
MKDUMPRD+=" --debug"
10+
debug_dracut=--debug
11+
else
12+
debug_dracut=--quiet
13+
fi
14+
MKDUMPRD+=" -f"
15+
516
if [[ -f /etc/sysconfig/kdump ]]; then
617
# shellcheck source=/dev/null
718
. /etc/sysconfig/kdump
@@ -33,7 +44,6 @@ trap '
3344
# clean up after ourselves no matter how we die.
3445
trap 'exit 1;' SIGINT
3546

36-
MKDUMPRD="/sbin/mkdumprd -f"
3747
# Default boot initramfs to be rebuilt
3848
REBUILD_INITRD="$1" && shift
3949
TARGET_INITRD="$1" && shift
@@ -74,6 +84,6 @@ if ! have_compression_in_dracut_args; then
7484
fi
7585
fi
7686

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

0 commit comments

Comments
 (0)