[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, 6 months
[PATCH] Drop switch root capability for non fadump initramfs
by Kairui Song
Switch root is never used for kdump image, and this will be helpful to
reduce the initramfs size.
Also increase dracut dependency version and the function is
dracut_no_switch_root is new introduced.
This commit is applied to RHEL some time ago, but missing in Fedora as
Fedora's Dracut didn't backport this feature at that time. Now apply
this missing commit.
Signed-off-by: Kairui Song <kasong(a)redhat.com>
---
dracut-module-setup.sh | 3 +++
kexec-tools.spec | 10 +++++-----
2 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh
index 5397eb5..2cf7518 100755
--- a/dracut-module-setup.sh
+++ b/dracut-module-setup.sh
@@ -843,5 +843,8 @@ install() {
echo "[Journal]" > ${initdir}/etc/systemd/journald.conf.d/kdump.conf
echo "Storage=none" >> ${initdir}/etc/systemd/journald.conf.d/kdump.conf
echo "ForwardToConsole=yes" >> ${initdir}/etc/systemd/journald.conf.d/kdump.conf
+
+ # Save more memory by dropping switch root capability
+ dracut_no_switch_root
fi
}
diff --git a/kexec-tools.spec b/kexec-tools.spec
index 6bada4a..cbea367 100644
--- a/kexec-tools.spec
+++ b/kexec-tools.spec
@@ -55,13 +55,13 @@ Source110: dracut-kdump-wait-for-target.sh
Requires(post): systemd-units
Requires(preun): systemd-units
Requires(postun): systemd-units
-Requires(pre): coreutils sed zlib
-Requires: dracut >= 047-34.git20180604
-Requires: dracut-network >= 044-117
-Requires: dracut-squash >= 049-4
+Requires(pre): coreutils sed zlib
+Requires: dracut >= 050
+Requires: dracut-network >= 050
+Requires: dracut-squash >= 050
Requires: ethtool
BuildRequires: zlib-devel zlib zlib-static elfutils-devel-static glib2-devel bzip2-devel ncurses-devel bison flex lzo-devel snappy-devel
-BuildRequires: pkgconfig intltool gettext
+BuildRequires: pkgconfig intltool gettext
BuildRequires: systemd-units
BuildRequires: automake autoconf libtool
%ifarch %{ix86} x86_64 ppc64 ppc s390x ppc64le
--
2.26.2
3 years, 6 months
[PATCH] Don't inherit swiotlb parameter form 1st kernel by default
by Kairui Song
Usually kdump kernel don't need a swiotlb. There are two cases known
common case a swiotlb is needed:
- SEV/SME is active.
- crashkernel high reservation is used, or there are crashkernel memory
above 4G.
For both case, if swiotlb is set to a large value in first kernel, kdump
kernel will likely to fail with OOM. So don't inherit swiotlb parameter
by default.
Signed-off-by: Kairui Song <kasong(a)redhat.com>
---
kdump.sysconfig | 2 +-
kdump.sysconfig.aarch64 | 2 +-
kdump.sysconfig.i386 | 2 +-
kdump.sysconfig.ppc64 | 2 +-
kdump.sysconfig.ppc64le | 2 +-
kdump.sysconfig.s390x | 2 +-
kdump.sysconfig.x86_64 | 2 +-
7 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/kdump.sysconfig b/kdump.sysconfig
index df518d6..d8b301c 100644
--- a/kdump.sysconfig
+++ b/kdump.sysconfig
@@ -17,7 +17,7 @@ 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"
+KDUMP_COMMANDLINE_REMOVE="hugepages hugepagesz slub_debug quiet swiotlb"
# This variable lets us append arguments to the current kdump commandline
# after processed by KDUMP_COMMANDLINE_REMOVE
diff --git a/kdump.sysconfig.aarch64 b/kdump.sysconfig.aarch64
index d5d7624..bcb4a37 100644
--- a/kdump.sysconfig.aarch64
+++ b/kdump.sysconfig.aarch64
@@ -17,7 +17,7 @@ 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"
+KDUMP_COMMANDLINE_REMOVE="hugepages hugepagesz slub_debug quiet swiotlb"
# This variable lets us append arguments to the current kdump commandline
# after processed by KDUMP_COMMANDLINE_REMOVE
diff --git a/kdump.sysconfig.i386 b/kdump.sysconfig.i386
index c31a8cb..650e405 100644
--- a/kdump.sysconfig.i386
+++ b/kdump.sysconfig.i386
@@ -17,7 +17,7 @@ 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"
+KDUMP_COMMANDLINE_REMOVE="hugepages hugepagesz slub_debug quiet swiotlb"
# This variable lets us append arguments to the current kdump commandline
# after processed by KDUMP_COMMANDLINE_REMOVE
diff --git a/kdump.sysconfig.ppc64 b/kdump.sysconfig.ppc64
index 1f95452..03fde14 100644
--- a/kdump.sysconfig.ppc64
+++ b/kdump.sysconfig.ppc64
@@ -17,7 +17,7 @@ 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"
+KDUMP_COMMANDLINE_REMOVE="hugepages hugepagesz slub_debug quiet swiotlb"
# This variable lets us append arguments to the current kdump commandline
# after processed by KDUMP_COMMANDLINE_REMOVE
diff --git a/kdump.sysconfig.ppc64le b/kdump.sysconfig.ppc64le
index 1f95452..03fde14 100644
--- a/kdump.sysconfig.ppc64le
+++ b/kdump.sysconfig.ppc64le
@@ -17,7 +17,7 @@ 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"
+KDUMP_COMMANDLINE_REMOVE="hugepages hugepagesz slub_debug quiet swiotlb"
# This variable lets us append arguments to the current kdump commandline
# after processed by KDUMP_COMMANDLINE_REMOVE
diff --git a/kdump.sysconfig.s390x b/kdump.sysconfig.s390x
index abd45a2..6effd6d 100644
--- a/kdump.sysconfig.s390x
+++ b/kdump.sysconfig.s390x
@@ -17,7 +17,7 @@ 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"
+KDUMP_COMMANDLINE_REMOVE="hugepages hugepagesz slub_debug quiet swiotlb"
# This variable lets us append arguments to the current kdump commandline
# after processed by KDUMP_COMMANDLINE_REMOVE
diff --git a/kdump.sysconfig.x86_64 b/kdump.sysconfig.x86_64
index a43a970..7b3c68c 100644
--- a/kdump.sysconfig.x86_64
+++ b/kdump.sysconfig.x86_64
@@ -17,7 +17,7 @@ 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"
+KDUMP_COMMANDLINE_REMOVE="hugepages hugepagesz slub_debug quiet swiotlb"
# This variable lets us append arguments to the current kdump commandline
# after processed by KDUMP_COMMANDLINE_REMOVE
--
2.26.2
3 years, 6 months
[PATCH 0/2] Revert previous workaround for network-manager module
by Kairui Song
Upstream dracut have provided a parameter for adding mandantory network
requirement by appending "rd.neednet" parameter, so we should use that
instead.
See https://github.com/dracutdevs/dracut/pull/761/files
Kairui Song (2):
Revert "Add a hook to wait for kdump target in initqueue"
module-setup.sh: Add "rd.neednet" parameter if network is needed
dracut-kdump-wait-for-target.sh | 23 ----------------
dracut-kdump.sh | 49 +++++++++++++++++++++++++++++++++
dracut-module-setup.sh | 7 +++--
kdump-lib-initramfs.sh | 49 ---------------------------------
kexec-tools.spec | 2 --
5 files changed, 54 insertions(+), 76 deletions(-)
delete mode 100755 dracut-kdump-wait-for-target.sh
--
2.26.2
3 years, 6 months
[PATCH v2 0/7] Add support for unmounted dump target
by Kairui Song
Currently kexec-tools always depend on dump target to be mounted, which
caused some inconvenience for setup.
So for user configured target, allow kdump to start and build initramfs
even if target is not mounted.
Behavior is not changed for "path" based dump target config.
When a unmounted dump target is explcitely configured, mkdumprd will look
for corresponding mount info in fstab for the mount options, and
failback to use "defaults" as mount option.
Then mkdumprd will try to mount it and do basic checks on the device,
then umount it on exit.
NOTE: If there is a fstab entry but "noauto" option is not used, then
there must be some reason that the target device is not mounted,
mkdumprd will error out and ask user to double check.
Update from v1:
Rebase and add some document.
Kairui Song (7):
Add a is_mounted helper
Allow calling mkdumprd from kdumpctl even if targat not mounted
kdump-lib.sh: add fstab failback helper for getting mount info
User get_mount_info to replace findmnt calls
mkdumprd: generate usable kdump initramfs even target is not mounted
kexec-kdump-howto.txt: Add some format to the document
Update docs for the new noauto dump target support
kdump-lib-initramfs.sh | 23 ++-
kdump-lib.sh | 58 ++++---
kdumpctl | 9 +-
kexec-kdump-howto.txt | 363 ++++++++++++++++++++++++++---------------
mkdumprd | 130 +++++++++++----
5 files changed, 371 insertions(+), 212 deletions(-)
--
2.26.2
3 years, 6 months
[PATCH v3 4/4] kdump.conf: Specify /etc/kdump/{pre.d,post.d}
interface
by onitsuka.shinic@fujitsu.com
This patch discribe /etc/kdump/{pre.d,post.d} interface.
Signed-off-by: Shinichi Onitsuka <onitsuka.shinic(a)fujitsu.com>
---
kdump.conf | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/kdump.conf b/kdump.conf
index 1f0fc2d..b1d68f1 100644
--- a/kdump.conf
+++ b/kdump.conf
@@ -79,13 +79,23 @@
# 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.
+# If /etc/kdump/post.d directory is exist, All files in
+# the directory 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 - reboot the system
+# 0 - continue with dump process as usual
+# non 0 - reboot the system
+# If /etc/kdump/pre.d directory exists, all files in
+# the directory 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
--
1.8.3.1
3 years, 6 months
[PATCH v3 3/4] dracut-kdump.sh: Execute the binary and script files
in /etc/kdump/{pre.d,post.d}
by onitsuka.shinic@fujitsu.com
This patch executes the binary and script files in /etc/kdump/{pre.d,post.d}
just like kdump_pre or kdump_post directive written in /etc/kdump.conf.
Signed-off-by: Shinichi Onitsuka <onitsuka.shinic(a)fujitsu.com>
---
dracut-kdump.sh | 34 ++++++++++++++++++++++++++++++++++
1 file changed, 34 insertions(+)
diff --git a/dracut-kdump.sh b/dracut-kdump.sh
index 0f54ddc..d2d2b33 100755
--- a/dracut-kdump.sh
+++ b/dracut-kdump.sh
@@ -30,15 +30,49 @@ do_dump()
do_kdump_pre()
{
+ local _ret
+
if [ -n "$KDUMP_PRE" ]; then
"$KDUMP_PRE"
+ _ret=$?
+ if [ $_ret -ne 0 ]; then
+ echo "kdump: $KDUMP_PRE exited with $_ret status"
+ return $_ret
+ fi
fi
+
+ if [ -d /etc/kdump/pre.d ]; then
+ for file in /etc/kdump/pre.d/*; do
+ "$file"
+ _ret=$?
+ if [ $_ret -ne 0 ]; then
+ echo "kdump: $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
+ echo "kdump: $file exited with $_ret status"
+ fi
+ done
+ fi
+
if [ -n "$KDUMP_POST" ]; then
"$KDUMP_POST" "$1"
+ _ret=$?
+ if [ $_ret -ne 0 ]; then
+ echo "kdump: $KDUMP_POST exited with $_ret status"
+ fi
fi
}
--
1.8.3.1
3 years, 6 months
[PATCH v3 2/4] kdumpctl: Check the update of the binary and script
files in /etc/kdump/{pre.d,post.d}
by onitsuka.shinic@fujitsu.com
This patch adds the binary and script files in /etc/kdump/{pre.d,post.d}
to modified checklist.
When kdumpd service is started or restarted, initramfs of kdump is recreated
by new the binary and script files, if the binary and script files in
/etc/kdump/{pre.d,post.d} are updated.
Signed-off-by: Shinichi Onitsuka <onitsuka.shinic(a)fujitsu.com>
---
kdumpctl | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
diff --git a/kdumpctl b/kdumpctl
index 2da3846..ef2926d 100755
--- a/kdumpctl
+++ b/kdumpctl
@@ -339,9 +339,23 @@ check_files_modified()
EXTRA_BINS=`grep ^kdump_post $KDUMP_CONFIG_FILE | cut -d\ -f2`
CHECK_FILES=`grep ^kdump_pre $KDUMP_CONFIG_FILE | cut -d\ -f2`
+ if [ -d /etc/kdump/post.d ]; then
+ for file in /etc/kdump/post.d/*; do
+ if [ -x "$file" ]; then
+ POST_FILES="$POST_FILES $file"
+ fi
+ done
+ fi
+ if [ -d /etc/kdump/pre.d ]; then
+ for file in /etc/kdump/pre.d/*; do
+ if [ -x "$file" ]; then
+ PRE_FILES="$PRE_FILES $file"
+ fi
+ done
+ fi
CORE_COLLECTOR=`grep ^core_collector $KDUMP_CONFIG_FILE | cut -d\ -f2`
CORE_COLLECTOR=`type -P $CORE_COLLECTOR`
- EXTRA_BINS="$EXTRA_BINS $CHECK_FILES"
+ EXTRA_BINS="$EXTRA_BINS $CHECK_FILES $POST_FILES $PRE_FILES"
CHECK_FILES=`grep ^extra_bins $KDUMP_CONFIG_FILE | cut -d\ -f2-`
EXTRA_BINS="$EXTRA_BINS $CHECK_FILES"
files="$KDUMP_CONFIG_FILE $kdump_kernel $EXTRA_BINS $CORE_COLLECTOR"
--
1.8.3.1
3 years, 6 months
[PATCH v3 1/4] dracut-module-setup.sh: Install files under
by onitsuka.shinic@fujitsu.com
This patch installs the binary and script files under /etc/kdump/{pre.d,post.d}
into new initramfs of kdump.
Signed-off-by: Shinichi Onitsuka <onitsuka.shinic(a)fujitsu.com>
---
dracut-module-setup.sh | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)
diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh
index 7a2c7b4..cc9d009 100755
--- a/dracut-module-setup.sh
+++ b/dracut-module-setup.sh
@@ -521,6 +521,8 @@ kdump_install_conf() {
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"
@@ -528,6 +530,29 @@ kdump_install_conf() {
rm -f ${initdir}/tmp/$$-kdump.conf
}
+# 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
+ else
+ 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
+ else
+ echo "$file is not executable"
+ fi
+ done
+ fi
+}
+
# Remove user custom configurations sysctl.conf & sysctl.d/*
# and apply some optimization for kdump
overwrite_sysctl_conf() {
--
1.8.3.1
3 years, 6 months
[PATCH v3 0/4] /etc/kdump/{pre.d,post.d} interface to set up multiple
binary and script files
by onitsuka.shinic@fujitsu.com
There is restriction on kdump_pre and kdump_post directives now that can be
specified only once in /etc/kdump.conf.
However, there are multiple components that need to use the directives.
This patch implements /etc/kdump/{pre.d,post.d} interface to set up multiple
binary and script files.
For example, users put multiple binary and script files under
/etc/kdump/pre.d directory as below:
# find /etc/kdump/pre.d
/etc/kdump/pre.d/50-foo.sh
/etc/kdump/pre.d/75-hoge.sh
Then, 50-foo.sh and 75-hoge.sh are executed in order before kdump dump process
begins just like kdump_pre directive written in /etc/kdump.conf.
This is composed of the following three patches created based on
commit 4b43ba063ddbcdccf95d761d2a3641f3006d814d.
Signed-off-by: Shinichi Onitsuka <onitsuka.shinic(a)fujitsu.com>
---
Changes since v1:
[1]Change title.
[2]Change behavior of non 0 Exit status that script/binary in kdump/pre.d was returned.
[3]Stop using find/sort commands.
[4]Add checking execution bit.
[5]Add specification of /etc/kdump/{pre.d,post.d} interface
Changes since v2:
[1]Correct sentence errors in kdump.conf.
[2]Move the doc commit after the code change.
[3]Change the name of the added function in dracut-module-setup.sh.
[4]Change the commit comment of kdumpctl
---
Shin-ichi Onitsuka (4):
dracut-module-setup.sh: Install files under /etc/kdump/{pre.d,post.d}
into kdump initramfs
kdumpctl: Check the update of the binary and script files in
/etc/kdump/{pre.d,post.d}
dracut-kdump.sh: Execute the binary and script files in
/etc/kdump/{pre.d,post.d}
kdump.conf: Specify /etc/kdump/{pre.d,post.d} interface
dracut-kdump.sh | 34 ++++++++++++++++++++++++++++++++++
dracut-module-setup.sh | 25 +++++++++++++++++++++++++
kdump.conf | 14 ++++++++++++--
kdumpctl | 16 +++++++++++++++-
4 files changed, 86 insertions(+), 3 deletions(-)
--
1.8.3.1
3 years, 6 months