Sometimes, debugging the kdump service failure becomes very challenging
because there is no additional debugging information, which requires
modification of the scripts like kdumpctl, mkdumprd, etc to collect the
information for troubleshooting.
In view of this, add 'set -x' in the scripts in order to get the complete
debugging information.
Signed-off-by: Lianbo Jiang <lijiang(a)redhat.com>
---
kdumpctl | 10 ++++++++++
mkdumprd | 10 ++++++++++
2 files changed, 20 insertions(+)
diff --git a/kdumpctl b/kdumpctl
index 122e065b8c69..4138f8798d5e 100755
--- a/kdumpctl
+++ b/kdumpctl
@@ -5,6 +5,7 @@ KDUMP_KERNELVER=""
KDUMP_COMMANDLINE=""
KEXEC_ARGS=""
KDUMP_CONFIG_FILE="/etc/kdump.conf"
+KDUMP_LOG_PATH="/var/log"
MKDUMPRD="/sbin/mkdumprd -f"
DRACUT_MODULES_FILE="/usr/lib/dracut/modules.txt"
SAVE_PATH=/var/crash
@@ -32,6 +33,15 @@ if [ -f /etc/sysconfig/kdump ]; then
. /etc/sysconfig/kdump
fi
+if [ ! -d $KDUMP_LOG_PATH ]; then
+ mkdir -p $KDUMP_LOG_PATH
+fi
+
+#redirect stderr and apend debug messages to a file
+exec 2>> $KDUMP_LOG_PATH/kdump.log
+export PS4='+ $(date "+%Y-%m-%d %H:%M:%S") ${BASH_SOURCE}@${LINENO}: '
+set -x
+
single_instance_lock()
{
local rc timeout=5
diff --git a/mkdumprd b/mkdumprd
index 91ce3d5a0686..f352a026b3a7 100644
--- a/mkdumprd
+++ b/mkdumprd
@@ -15,6 +15,16 @@ conf_file="/etc/kdump.conf"
SSH_KEY_LOCATION="/root/.ssh/kdump_id_rsa"
SAVE_PATH=$(get_save_path)
OVERRIDE_RESETTABLE=0
+KDUMP_LOG_PATH="/var/log"
+
+if [ ! -d $KDUMP_LOG_PATH ]; then
+ mkdir -p $KDUMP_LOG_PATH
+fi
+
+#redirect stderr and apend debug messages to a file
+exec 2>> $KDUMP_LOG_PATH/kdump.log
+export PS4='+ $(date "+%Y-%m-%d %H:%M:%S") ${BASH_SOURCE}@${LINENO}: '
+set -x
extra_modules=""
dracut_args="--quiet --hostonly --hostonly-cmdline --hostonly-i18n --hostonly-mode
strict -o \"plymouth dash resume ifcfg earlykdump\""
--
2.17.1