[PATCH] mkdumprd: allow spaces after 'path' config phrase when network dump
by Kazuhito Hagio
Without this patch, when there are two or more spaces after 'path'
configuration phrase with ssh or nfs setting, SAVE_PATH is set to
'/var/crash' in mkdumprd, and in most cases kdump service fails to
start.
ssh kdump(a)192.168.122.1
path /kdump
^^
This behavior would be too sensitive and different from the other
configurations. With this patch, mkdumprd allows such spaces.
Signed-off-by: Kazuhito Hagio <k-hagio(a)ab.jp.nec.com>
---
mkdumprd | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mkdumprd b/mkdumprd
index a6f7fe8..aa0abfd 100644
--- a/mkdumprd
+++ b/mkdumprd
@@ -13,7 +13,7 @@ export IN_KDUMP=1
conf_file="/etc/kdump.conf"
SSH_KEY_LOCATION="/root/.ssh/kdump_id_rsa"
-SAVE_PATH=$(grep ^path $conf_file| cut -d' ' -f2)
+SAVE_PATH=$(awk '/^path/ {print $2}' $conf_file)
[ -z "$SAVE_PATH" ] && SAVE_PATH=$DEFAULT_PATH
# strip the duplicated "/"
SAVE_PATH=$(echo $SAVE_PATH | tr -s /)
--
2.18.0
1 year, 4 months
[PATCH] Add code comments to help better understanding
by Lianbo Jiang
Let's add some code comments to help better understanding, and
no code changes.
Signed-off-by: Lianbo Jiang <lijiang(a)redhat.com>
---
dracut-early-kdump.sh | 3 +++
kdumpctl | 4 ++++
2 files changed, 7 insertions(+)
diff --git a/dracut-early-kdump.sh b/dracut-early-kdump.sh
index 23bb369a0c13..a4e14a46bf75 100755
--- a/dracut-early-kdump.sh
+++ b/dracut-early-kdump.sh
@@ -53,6 +53,9 @@ early_kdump_load()
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"
diff --git a/kdumpctl b/kdumpctl
index e81671987c9b..94e4f5a1c020 100755
--- a/kdumpctl
+++ b/kdumpctl
@@ -719,6 +719,10 @@ load_kdump()
ddebug "$KEXEC $KEXEC_ARGS $standard_kexec_args --command-line=$KDUMP_COMMANDLINE --initrd=$TARGET_INITRD $KDUMP_KERNEL"
+ # The '12' represents an intermediate temporary file descriptor
+ # to store the standard error file descriptor '2', and later
+ # restore the error file descriptor with the file descriptor '12'
+ # and release it.
exec 12>&2
exec 2>> $KDUMP_LOG_PATH/kdump.log
PS4='+ $(date "+%Y-%m-%d %H:%M:%S") ${BASH_SOURCE}@${LINENO}: '
--
2.17.1
2 years, 10 months
[PATCH 0/3] Improve dracut module install code
by Kairui Song
Now all dracut module dependency install code are in one place in
module-setup.sh, and allows user to omit non-mandatory modules.
For example, squash module could be omitted by using:
dracut_args --omit squash
Kairui Song (3):
Move some dracut module dependencies checks to module-setup.sh
Add a helper to omit non-mandatory dracut module
Move watchdog detect and install code to module-setup.sh
dracut-module-setup.sh | 21 ++++++++++++++++++---
kdump-lib.sh | 12 ++++++++++++
mkdumprd | 27 ---------------------------
3 files changed, 30 insertions(+), 30 deletions(-)
--
2.28.0
2 years, 10 months
[PATCH] Fix comment about ssh dump target
by Kairui Song
When using ssh dump target, scp is always used, correct the comment.
Signed-off-by: Kairui Song <kasong(a)redhat.com>
---
kdump.conf.5 | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kdump.conf.5 b/kdump.conf.5
index 34c996c..7f1c8a4 100644
--- a/kdump.conf.5
+++ b/kdump.conf.5
@@ -41,7 +41,7 @@ mount point.
.B ssh <user@server>
.RS
-Will scp /proc/vmcore to <user@server>:<path>/%HOST-%DATE/,
+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
--
2.28.0
2 years, 10 months
[PATCH] mkdumprd: Ensure kdumpbase is added
by Kairui Song
Dracut only check if a module failed installtion if the module is listed
in --add params. Without this param, if kdumpbase failed to install due
to any reason, dracut will still build the initramfs only print a
warning. Add this param to ensure it fail early.
Signed-off-by: Kairui Song <kasong(a)redhat.com>
---
mkdumprd | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mkdumprd b/mkdumprd
index 36f71b7..3ea1d19 100644
--- a/mkdumprd
+++ b/mkdumprd
@@ -17,7 +17,7 @@ SAVE_PATH=$(get_save_path)
OVERRIDE_RESETTABLE=0
extra_modules=""
-dracut_args="--quiet --hostonly --hostonly-cmdline --hostonly-i18n --hostonly-mode strict -o \"plymouth dash resume ifcfg earlykdump\""
+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."
--
2.28.0
2 years, 10 months
[PATCH] Doc: improve the usage documentation of the logger
by Lianbo Jiang
Let's remove some redundant descriptions in the usage
documentation of the logger, and make it clear.
Signed-off-by: Lianbo Jiang <lijiang(a)redhat.com>
---
kexec-kdump-howto.txt | 65 ++++++++++++++++++++++++-------------------
1 file changed, 37 insertions(+), 28 deletions(-)
diff --git a/kexec-kdump-howto.txt b/kexec-kdump-howto.txt
index 5f57a8428e4f..d2dba492ed60 100644
--- a/kexec-kdump-howto.txt
+++ b/kexec-kdump-howto.txt
@@ -888,35 +888,44 @@ Debugging Tips
- Using the logger to output kdump log messages
- Currently, kdump messages are printed with the 'echo' command or redirect
- to console, and which does not support to output kdump messages according
- to the log level.
-
- That is not convenient to debug kdump issues, we usually need to capture
- additional debugging information via the modification of the options or the
- scripts like kdumpctl, mkdumprd, etc. Because there is no complete debugging
- messages, which could waste valuable time.
-
- To cope with this challenging, we introduce the logger to output the kdump
- messages according to the log level, and provide a chance to save logs to
- the journald if the journald service is available, and then dump all logs
- to a file, otherwise dump the logs with the dmesg to a file.
-
- 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, this function set it to default:
- - @var kdump_stdloglvl=4 (info)
- - @var kdump_sysloglvl=4 (info)
- - @var kdump_kmsgloglvl=0 (no logging)
+ You can configure the kdump log level in the /etc/sysconfig/kdump.
+ For example:
+
+ kdump_sysloglvl=4
+ kdump_stdloglvl=4
+
+ The above configurations indicate that kdump messages will be printed to the
+ console and journald if the journald service is enabled, and the log level is
+ set to 4(info). This is also the current default log level.
Logging levels: fatal(1),error(2),warn(3),info(4),debug(5),trace(6)
- We can easily configure the above variables in the /etc/sysconfig/kdump. For
- example:
- kdump_sysloglvl=5
- kdump_stdloglvl=5
+ The FATAL level designates very severe error events that will presumably lead
+ the application to abort.
- The above configurations indicate that kdump messages will be printed to the
- console and journald if the journald service is enabled.
+ The ERROR level designates error events that might still allow the application
+ to continue running.
+
+ The WARN level designates potentially harmful situations.
+
+ The INFO level designates informational messages that highlight the progress
+ of the application at coarse-grained level.
+
+ The DEBUG level designates fine-grained informational events that are most
+ useful to debug an application.
+
+ The TRACE level designates finer-grained informational events than the DEBUG.
+
+ Currently, the logger works in both the first kernel(kdump service debugging)
+ and the second kernel.
+
+ In the first kernel, you can find the historical logs in the /var/log/messages
+ or use the journalctl command to check kdump service debugging information. In
+ addition, the 'kexec -d' debugging messages are also saved to /var/log/kdump.log
+ in the first kernel.
+
+ In the second kernel, put the kexec-dmesg.log to a same directory with the
+ vmcore, the log file includes the debugging messages like dmesg and journald
+ logs.
+
+ For more details, please refer to the /etc/sysconfig/kdump.
--
2.17.1
2 years, 11 months
[PATCH v2] increase makdumpfile default message level to 7
by Lianbo Jiang
Currently, the makedumpfile option '--message-level' is set to 1 when
dumping the vmcore, it only displays the progress indicator message,
but there are no common message and error message, it is important to
report some additional messages, especially for the error message,
which is very useful for the debugging.
In view of this, let's change the message level to 7 by default.
Signed-off-by: Lianbo Jiang <lijiang(a)redhat.com>
---
kdump-lib-initramfs.sh | 2 +-
kdump.conf | 6 +++---
kdump.conf.5 | 16 ++++++++--------
kexec-kdump-howto.txt | 18 +++++++++---------
tests/scripts/testcases/local-kdump/0-local.sh | 2 +-
tests/scripts/testcases/nfs-kdump/1-client.sh | 2 +-
tests/scripts/testcases/ssh-kdump/1-client.sh | 2 +-
7 files changed, 24 insertions(+), 24 deletions(-)
diff --git a/kdump-lib-initramfs.sh b/kdump-lib-initramfs.sh
index c98a43b473cd..8ef3cd00615a 100755
--- a/kdump-lib-initramfs.sh
+++ b/kdump-lib-initramfs.sh
@@ -4,7 +4,7 @@
KDUMP_PATH="/var/crash"
CORE_COLLECTOR=""
-DEFAULT_CORE_COLLECTOR="makedumpfile -l --message-level 1 -d 31"
+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`
diff --git a/kdump.conf b/kdump.conf
index 9fc0a4fb7538..e4db52e2db97 100644
--- a/kdump.conf
+++ b/kdump.conf
@@ -62,9 +62,9 @@
# 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 1 -d 31".
+# "makedumpfile -F -l --message-level 7 -d 31".
# The default core_collector for other targets is:
-# "makedumpfile -l --message-level 1 -d 31".
+# "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
@@ -169,7 +169,7 @@
#ssh user(a)my.server.com
#sshkey /root/.ssh/kdump_id_rsa
path /var/crash
-core_collector makedumpfile -l --message-level 1 -d 31
+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
diff --git a/kdump.conf.5 b/kdump.conf.5
index 34c996c76888..4be3c7773de5 100644
--- a/kdump.conf.5
+++ b/kdump.conf.5
@@ -85,9 +85,9 @@ 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 1 -d 31".
+"makedumpfile -F -l --message-level 7 -d 31".
The default core_collector for other targets is:
-"makedumpfile -l --message-level 1 -d 31".
+"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
@@ -307,11 +307,11 @@ Above will effectively be translated to:
cp --sparse=always /proc/vmcore <dest-path>/vmcore
.TP
ex2.
-core_collector "makedumpfile -l --message-level 1 -d 31"
+core_collector "makedumpfile -l --message-level 7 -d 31"
Above will effectively be translated to:
-makedumpfile -l --message-level 1 -d 31 /proc/vmcore <dest-path>/vmcore
+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
@@ -328,11 +328,11 @@ Above will effectively be translated to.
cat /proc/vmcore | dd of=<target-device>
.TP
ex4.
-core_collector "makedumpfile -F -l --message-level 1 -d 31"
+core_collector "makedumpfile -F -l --message-level 7 -d 31"
Above will effectively be translated to.
-makedumpfile -F -l --message-level 1 -d 31 | dd of=<target-device>
+makedumpfile -F -l --message-level 7 -d 31 | dd of=<target-device>
.PP
ssh dumps examples
.TP
@@ -344,11 +344,11 @@ 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 1 -d 31"
+core_collector "makedumpfile -F -l --message-level 7 -d 31"
Above will effectively be translated to.
-makedumpfile -F -l --message-level 1 -d 31 | ssh <options> <remote-location> "dd of=path/vmcore"
+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
diff --git a/kexec-kdump-howto.txt b/kexec-kdump-howto.txt
index 2209e5a573d3..7491a7d5b329 100644
--- a/kexec-kdump-howto.txt
+++ b/kexec-kdump-howto.txt
@@ -613,7 +613,7 @@ is a dump filtering and compression utility provided with kexec-tools. On
some architectures, it can drastically reduce the size of your vmcore files,
which becomes very useful on systems with large amounts of memory.
-A typical setup is 'core_collector makedumpfile -F -l --message-level 1 -d 31',
+A typical setup is 'core_collector makedumpfile -F -l --message-level 7 -d 31',
but check the output of '/sbin/makedumpfile --help' for a list of all available
options (-i and -g don't need to be specified, they're automatically taken care
of). Note that use of makedumpfile requires that the kernel-debuginfo package
@@ -633,11 +633,11 @@ First one is source file and second one is target file. For ex.
- ex2.
- core_collector "makedumpfile -l --message-level 1 -d 31"
+ core_collector "makedumpfile -l --message-level 7 -d 31"
Above will effectively be translated to:
- makedumpfile -l --message-level 1 -d 31 /proc/vmcore <dest-path>/vmcore
+ makedumpfile -l --message-level 7 -d 31 /proc/vmcore <dest-path>/vmcore
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
@@ -656,11 +656,11 @@ raw dumps core_collector examples:
- ex4.
- core_collector "makedumpfile -F -l --message-level 1 -d 31"
+ core_collector "makedumpfile -F -l --message-level 7 -d 31"
Above will effectively be translated to.
- makedumpfile -F -l --message-level 1 -d 31 | dd of=<target-device>
+ makedumpfile -F -l --message-level 7 -d 31 | dd of=<target-device>
ssh dumps core_collector examples:
@@ -674,11 +674,11 @@ ssh dumps core_collector examples:
- ex6.
- core_collector "makedumpfile -F -l --message-level 1 -d 31"
+ core_collector "makedumpfile -F -l --message-level 7 -d 31"
Above will effectively be translated to.
- makedumpfile -F -l --message-level 1 -d 31 | ssh <options> <remote-location> "dd of=path/vmcore"
+ 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
@@ -696,9 +696,9 @@ About default core collector
----------------------------
Default core_collector for ssh/raw dump is:
-"makedumpfile -F -l --message-level 1 -d 31".
+"makedumpfile -F -l --message-level 7 -d 31".
Default core_collector for other targets is:
-"makedumpfile -l --message-level 1 -d 31".
+"makedumpfile -l --message-level 7 -d 31".
Even if core_collector option is commented out in kdump.conf, makedumpfile
is default core collector and kdump uses it internally.
diff --git a/tests/scripts/testcases/local-kdump/0-local.sh b/tests/scripts/testcases/local-kdump/0-local.sh
index d09c6f0fd6e1..948cfa15def0 100755
--- a/tests/scripts/testcases/local-kdump/0-local.sh
+++ b/tests/scripts/testcases/local-kdump/0-local.sh
@@ -8,7 +8,7 @@ on_test() {
if [ $boot_count -eq 1 ]; then
cat << EOF > /etc/kdump.conf
path /var/crash
-core_collector makedumpfile -l --message-level 1 -d 31
+core_collector makedumpfile -l --message-level 7 -d 31
EOF
kdumpctl start || test_failed "Failed to start kdump"
diff --git a/tests/scripts/testcases/nfs-kdump/1-client.sh b/tests/scripts/testcases/nfs-kdump/1-client.sh
index df6246320d0e..4122bb830598 100755
--- a/tests/scripts/testcases/nfs-kdump/1-client.sh
+++ b/tests/scripts/testcases/nfs-kdump/1-client.sh
@@ -11,7 +11,7 @@ on_test() {
if [ "$boot_count" -eq 1 ]; then
cat << EOF > /etc/kdump.conf
nfs $nfs_server:/srv/nfs
-core_collector makedumpfile -l --message-level 1 -d 31
+core_collector makedumpfile -l --message-level 7 -d 31
EOF
while ! ping -c 1 $nfs_server -W 1; do
diff --git a/tests/scripts/testcases/ssh-kdump/1-client.sh b/tests/scripts/testcases/ssh-kdump/1-client.sh
index d79f00f65376..bd03eff2c4f8 100755
--- a/tests/scripts/testcases/ssh-kdump/1-client.sh
+++ b/tests/scripts/testcases/ssh-kdump/1-client.sh
@@ -11,7 +11,7 @@ on_test() {
if [ "$boot_count" -eq 1 ]; then
cat << EOF > /etc/kdump.conf
ssh root(a)192.168.77.1
-core_collector makedumpfile -l --message-level 1 -d 31 -F
+core_collector makedumpfile -l --message-level 7 -d 31 -F
EOF
ssh-keygen -q -t rsa -N '' -f /root/.ssh/id_rsa <<< y &>/dev/ttyS1
--
2.17.1
2 years, 11 months
[PATCH] module-setup.sh: Instead of drop journalctl log, just don't read kmsg
by Kairui Song
Previously journalctl logs are directly dropped to save memory, but this
make journalctl unusable in kdump kernel and diffcult to debug. So
instead just don't let it read kmsg but keep other logs stored as volatile.
Kernel message are already stored in the kernel log ring buffer,
no need to let journalctl make a copy, especially when in kdump
kernel, ususlly there won't be too much kernel log overlapping
the old ring buffer.
Signed-off-by: Kairui Song <kasong(a)redhat.com>
---
dracut-module-setup.sh | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh
index b0b30af..42bef7a 100755
--- a/dracut-module-setup.sh
+++ b/dracut-module-setup.sh
@@ -799,13 +799,14 @@ kdump_install_systemd_conf() {
echo "DefaultTimeoutStartSec=300s" >> ${initdir}/etc/systemd/system.conf.d/kdump.conf
fi
- # Forward logs to console directly, this avoids unneccessary memory
- # consumption and make console output more useful.
+ # Forward logs to console directly, and don't read Kmesg this
+ # avoids unneccessary memory consumption and make console output more useful.
# Only do so for non fadump image.
- if ! is_fadump_capable && [ "$failure_action" != "shell" ]; then
+ if ! is_fadump_capable; then
mkdir -p ${initdir}/etc/systemd/journald.conf.d
echo "[Journal]" > ${initdir}/etc/systemd/journald.conf.d/kdump.conf
- echo "Storage=none" >> ${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
fi
}
--
2.28.0
2 years, 11 months
[PATCH v7 0/6] Improve kdump debugging messages
by Lianbo Jiang
Sometimes, debugging the kdump service failure becomes very challenging
because there is no complete debugging information, which requires
modification of the options or the scripts like kdumpctl, mkdumprd, etc
to collect the information for troubleshooting.
That means users have to wait for the next failure so that they can
capture the additional information, which could waste valuable time.
This patch series will improve kdump debugging messages and have a
chance to save them to journald or a file. It includes the following
patches:
[1] [PATCH 1/6] introduce the kdump logger from the dracut
[2] [PATCH 2/6] enable the logger for kdump
[3] [PATCH 3/6] kdump.sysconfig: add the kdump logger configurations
[4] [PATCH 4/6] kdumpctl: add the '-d' option to enable the kexec loading
debugging messages
[5] [PATCH 5/6] Improve debugging in the kdump kernel
[6] [PATCH 6/6] Doc: add a documentation for the usage of logger
In addition, this patch series won't cause performance degradation,
basically this effect can be ignored. I simply checked the result of
executing the loading command as follow:
[1] before
# time kdumpctl start
Detected change(s) in the following file(s):
/etc/kdump.conf
Rebuilding /boot/initramfs-4.18.0-232.el8.x86_64kdump.img
Tips: If early kdump is enabled, also require rebuilding the system initramfs to make the changes take effect for early kdump.
kexec: loaded kdump kernel
Starting kdump: [OK]
real 0m9.145s
user 0m20.733s
sys 0m1.765s
[2] after
# time kdumpctl start
kdump: Detected change(s) in the following file(s): /etc/kdump.conf
kdump: Rebuilding /boot/initramfs-4.18.0-232.el8.x86_64kdump.img
kdump: Tips: If early kdump is enabled, also require rebuilding the system initramfs to make the changes take effect for early kdump.
kdump: kexec: loaded kdump kernel
kdump: Starting kdump: [OK]
real 0m9.177s
user 0m20.784s
sys 0m1.901s
Changes since v6:
[1] remove the syslogfacility in kdump-logger.sh
[2] remove redundant include files(kdump-logger.sh)
[3] add the dlog_init() in mkdumprd
[4] improve the save_log() in kdump-lib-initramfs.sh
Note:
Currently, kexec-tools disable storing logs to journald in order
to save memory, please refer to the following changes:
+++ b/dracut-module-setup.sh
@@ -788,6 +788,8 @@ kdump_install_random_seed() {
}
...
kdump_install_systemd_conf() {
if ! is_fadump_capable && [ "$failure_action" != "shell" ]; then
mkdir -p ${initdir}/etc/systemd/journald.conf.d
echo "[Journal]" > ${initdir}/etc/systemd/journald.conf.d/kdump.conf
echo "Storage=none" >> ${initdir}/etc/systemd/journald.conf.d/kdump.conf
^^^^
If we want to use the journald in kdump kernel, we have to enable the
journald for kdump and optionally save the logs. I have discussed with
Kairui, and he will post a patch to improve the journald configuration.
Lianbo Jiang (6):
introduce the kdump logger from the dracut
enable the logger for kdump
kdump.sysconfig: add the kdump logger configurations
kdumpctl: add the '-d' option to enable the kexec loading debugging
messages
Improve debugging in the kdump kernel
Doc: add a documentation for the usage of logger
dracut-early-kdump-module-setup.sh | 3 +
dracut-early-kdump.sh | 23 +-
dracut-kdump.sh | 68 +++---
dracut-module-setup.sh | 4 +
kdump-lib-initramfs.sh | 66 ++++--
kdump-lib.sh | 23 +-
kdump-logger.sh | 334 +++++++++++++++++++++++++++++
kdump.sysconfig | 16 ++
kdump.sysconfig.aarch64 | 16 ++
kdump.sysconfig.i386 | 16 ++
kdump.sysconfig.ppc64 | 16 ++
kdump.sysconfig.ppc64le | 16 ++
kdump.sysconfig.s390x | 16 ++
kdump.sysconfig.x86_64 | 16 ++
kdumpctl | 240 ++++++++++++---------
kexec-kdump-howto.txt | 35 +++
kexec-tools.spec | 2 +
mkdumprd | 23 +-
18 files changed, 764 insertions(+), 169 deletions(-)
create mode 100755 kdump-logger.sh
--
2.17.1
2 years, 11 months
[PATCH] Rework check_config and warn on any duplicated option
by Kairui Song
Instead of read and parse the kdump.conf multiple times, only read once
and use a single loop to handle the error check, which is faster.
Also check for any duplicated config otion, and error out if there are
duplicated ones.
Now it checks for following errors, most are unchanged from before:
- Any duplicated config options. (New added)
- Deprecated/Invalid kdump config option.
- Duplicated kdump target, will have a different error message of
other duplicated config options.
- Duplicated --mount options in dracut_args.
- Empty config values. All kdump configs should be in
"<config_opt> <config_value>" format.
- Check If raw target is used in fadump mode.
And removed detect of lines start with space, it will not break kdump
anyway.
The performance is measurable better than before for the check_config
function.
Signed-off-by: Kairui Song <kasong(a)redhat.com>
---
kdumpctl | 72 ++++++++++++++++++++++++++------------------------------
1 file changed, 34 insertions(+), 38 deletions(-)
diff --git a/kdumpctl b/kdumpctl
index 2248da4..f191d9a 100755
--- a/kdumpctl
+++ b/kdumpctl
@@ -217,47 +217,34 @@ restore_default_initrd()
check_config()
{
- local nr
-
- nr=$(awk 'BEGIN{cnt=0} /^raw|^ssh[[:blank:]]|^nfs|^ext[234]|^xfs|^btrfs|^minix|^dracut_args .*\-\-mount/{cnt++} END{print cnt}' $KDUMP_CONFIG_FILE)
- [ $nr -gt 1 ] && {
- echo "More than one dump targets specified."
- return 1
- }
-
- # Check if path option is set more than once.
- nr=$(awk 'BEGIN{cnt=0} /^path /{cnt++} END{print cnt}' $KDUMP_CONFIG_FILE)
- [ $nr -gt 1 ] && {
- echo "Mutiple paths specifed in $KDUMP_CONFIG_FILE"
- return 1
- }
-
- nr=$(grep "^dracut_args .*\-\-mount" $KDUMP_CONFIG_FILE | grep -o "\-\-mount" | wc -l)
- [ $nr -gt 1 ] && {
- echo "Multiple mount targets specified in one \"dracut_args\"."
- return 1
- }
-
- # Check if we have any leading spaces (or tabs) before the
- # variable name in the kdump conf file
- if grep -E -q '^[[:blank:]]+[a-z]' $KDUMP_CONFIG_FILE; then
- echo "No whitespaces are allowed before a kdump option name in $KDUMP_CONFIG_FILE"
- return 1
- fi
-
+ local -A _opt_rec
while read config_opt config_val; do
+ if [ -z "$config_val" ]; then
+ echo "Invalid kdump config value for option $config_opt"
+ return 1
+ fi
+
case "$config_opt" in
- \#* | "")
+ dracut_args)
+ if [[ $config_val == *--mount* ]]; then
+ if [ $(echo $config_val | grep -o "\-\-mount" | wc -l) -ne 1 ]; then
+ echo "Multiple mount targets specified in one \"dracut_args\"."
+ return 1
+ fi
+ config_opt=_target
+ fi
;;
- raw|ext2|ext3|ext4|minix|btrfs|xfs|nfs|ssh|sshkey|path|core_collector|kdump_post|kdump_pre|extra_bins|extra_modules|failure_action|default|final_action|force_rebuild|force_no_rebuild|dracut_args|fence_kdump_args|fence_kdump_nodes)
- # remove inline comments after the end of a directive.
- [ -z "$config_val" ] && {
- echo "Invalid kdump config value for option $config_opt."
- return 1;
- }
- if [ -d "/proc/device-tree/ibm,opal/dump" ] && [ "$config_opt" == "raw" ]; then
+ raw)
+ if [ -d "/proc/device-tree/ibm,opal/dump" ]; then
echo "WARNING: Won't capture opalcore when 'raw' dump target is used."
+ return 1
fi
+ config_opt=_target
+ ;;
+ ext[234]|minix|btrfs|xfs|nfs|ssh)
+ config_opt=_target
+ ;;
+ sshkey|path|core_collector|kdump_post|kdump_pre|extra_bins|extra_modules|failure_action|default|final_action|force_rebuild|force_no_rebuild|fence_kdump_args|fence_kdump_nodes)
;;
net|options|link_delay|disk_timeout|debug_mem_level|blacklist)
echo "Deprecated kdump config option: $config_opt. Refer to kdump.conf manpage for alternatives."
@@ -265,14 +252,23 @@ check_config()
;;
*)
echo "Invalid kdump config option $config_opt"
- return 1;
+ return 1
;;
esac
+
+ if [ -n "${_opt_rec[$config_opt]}" ]; then
+ if [ $config_opt == _target ]; then
+ echo "More than one dump targets specified"
+ else
+ echo "Duplicated kdump config value of option $config_opt"
+ fi
+ return 1
+ fi
+ _opt_rec[$config_opt]="$config_val"
done <<< "$(read_strip_comments $KDUMP_CONFIG_FILE)"
check_failure_action_config || return 1
check_final_action_config || return 1
-
check_fence_kdump_config || return 1
return 0
--
2.26.2
2 years, 11 months