[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
[PATCH v3 0/2] Disable device dump by default and update doc
by Kairui Song
Update from V2:
Adjust the doc.
Update from V1:
Split into two patches and update docs as well.
Kairui Song (2):
Disable device dump by default
kexec-kdump-howto.txt: Add notes about device dump
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 +-
kexec-kdump-howto.txt | 17 +++++++++++++++++
8 files changed, 24 insertions(+), 7 deletions(-)
--
2.21.0
4 years
[PATCH v2 0/2] Disable device dump by default and update doc
by Kairui Song
Kairui Song (2):
Disable device dump by default
kexec-kdump-howto.txt: Add notes about device dump
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 +-
kexec-kdump-howto.txt | 16 ++++++++++++++++
8 files changed, 23 insertions(+), 7 deletions(-)
--
2.21.0
4 years
[PATCH] Disabled device dump by default
by Kairui Song
Device dump may use a log of memory and cause OOM issue, so append
novmcoredd option for second kernel and disable it by default.
To use device dump, user could remove the vmcoredd parameter
manually.
And update kexec-kdump-howto.txt to add note about vmcore device dump.
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 +-
kexec-kdump-howto.txt | 12 ++++++++++++
8 files changed, 19 insertions(+), 7 deletions(-)
diff --git a/kdump.sysconfig b/kdump.sysconfig
index ffe1df8..df518d6 100644
--- a/kdump.sysconfig
+++ b/kdump.sysconfig
@@ -21,7 +21,7 @@ KDUMP_COMMANDLINE_REMOVE="hugepages hugepagesz slub_debug quiet"
# This variable lets us append arguments to the current kdump commandline
# after processed by KDUMP_COMMANDLINE_REMOVE
-KDUMP_COMMANDLINE_APPEND="irqpoll maxcpus=1 reset_devices"
+KDUMP_COMMANDLINE_APPEND="irqpoll maxcpus=1 reset_devices novmcoredd"
# Any additional kexec arguments required. In most situations, this should
# be left empty
diff --git a/kdump.sysconfig.aarch64 b/kdump.sysconfig.aarch64
index c72a040..d5d7624 100644
--- a/kdump.sysconfig.aarch64
+++ b/kdump.sysconfig.aarch64
@@ -21,7 +21,7 @@ KDUMP_COMMANDLINE_REMOVE="hugepages hugepagesz slub_debug quiet"
# This variable lets us append arguments to the current kdump commandline
# after processed by KDUMP_COMMANDLINE_REMOVE
-KDUMP_COMMANDLINE_APPEND="irqpoll nr_cpus=1 reset_devices cgroup_disable=memory udev.children-max=2 panic=10 swiotlb=noforce"
+KDUMP_COMMANDLINE_APPEND="irqpoll nr_cpus=1 reset_devices cgroup_disable=memory udev.children-max=2 panic=10 swiotlb=noforce novmcoredd"
# Any additional kexec arguments required. In most situations, this should
# be left empty
diff --git a/kdump.sysconfig.i386 b/kdump.sysconfig.i386
index b5ec653..c31a8cb 100644
--- a/kdump.sysconfig.i386
+++ b/kdump.sysconfig.i386
@@ -21,7 +21,7 @@ KDUMP_COMMANDLINE_REMOVE="hugepages hugepagesz slub_debug quiet"
# This variable lets us append arguments to the current kdump commandline
# after processed by KDUMP_COMMANDLINE_REMOVE
-KDUMP_COMMANDLINE_APPEND="irqpoll nr_cpus=1 reset_devices numa=off udev.children-max=2 panic=10 transparent_hugepage=never"
+KDUMP_COMMANDLINE_APPEND="irqpoll nr_cpus=1 reset_devices numa=off udev.children-max=2 panic=10 transparent_hugepage=never novmcoredd"
# Any additional kexec arguments required. In most situations, this should
# be left empty
diff --git a/kdump.sysconfig.ppc64 b/kdump.sysconfig.ppc64
index e142c6e..1f95452 100644
--- a/kdump.sysconfig.ppc64
+++ b/kdump.sysconfig.ppc64
@@ -21,7 +21,7 @@ KDUMP_COMMANDLINE_REMOVE="hugepages hugepagesz slub_debug quiet"
# This variable lets us append arguments to the current kdump commandline
# after processed by KDUMP_COMMANDLINE_REMOVE
-KDUMP_COMMANDLINE_APPEND="irqpoll maxcpus=1 noirqdistrib reset_devices cgroup_disable=memory numa=off udev.children-max=2 ehea.use_mcs=0 panic=10 kvm_cma_resv_ratio=0 transparent_hugepage=never"
+KDUMP_COMMANDLINE_APPEND="irqpoll maxcpus=1 noirqdistrib reset_devices cgroup_disable=memory numa=off udev.children-max=2 ehea.use_mcs=0 panic=10 kvm_cma_resv_ratio=0 transparent_hugepage=never novmcoredd"
# Any additional kexec arguments required. In most situations, this should
# be left empty
diff --git a/kdump.sysconfig.ppc64le b/kdump.sysconfig.ppc64le
index e142c6e..1f95452 100644
--- a/kdump.sysconfig.ppc64le
+++ b/kdump.sysconfig.ppc64le
@@ -21,7 +21,7 @@ KDUMP_COMMANDLINE_REMOVE="hugepages hugepagesz slub_debug quiet"
# This variable lets us append arguments to the current kdump commandline
# after processed by KDUMP_COMMANDLINE_REMOVE
-KDUMP_COMMANDLINE_APPEND="irqpoll maxcpus=1 noirqdistrib reset_devices cgroup_disable=memory numa=off udev.children-max=2 ehea.use_mcs=0 panic=10 kvm_cma_resv_ratio=0 transparent_hugepage=never"
+KDUMP_COMMANDLINE_APPEND="irqpoll maxcpus=1 noirqdistrib reset_devices cgroup_disable=memory numa=off udev.children-max=2 ehea.use_mcs=0 panic=10 kvm_cma_resv_ratio=0 transparent_hugepage=never novmcoredd"
# Any additional kexec arguments required. In most situations, this should
# be left empty
diff --git a/kdump.sysconfig.s390x b/kdump.sysconfig.s390x
index 6edc2fa..abd45a2 100644
--- a/kdump.sysconfig.s390x
+++ b/kdump.sysconfig.s390x
@@ -21,7 +21,7 @@ KDUMP_COMMANDLINE_REMOVE="hugepages hugepagesz slub_debug quiet"
# This variable lets us append arguments to the current kdump commandline
# after processed by KDUMP_COMMANDLINE_REMOVE
-KDUMP_COMMANDLINE_APPEND="nr_cpus=1 cgroup_disable=memory numa=off udev.children-max=2 panic=10 transparent_hugepage=never"
+KDUMP_COMMANDLINE_APPEND="nr_cpus=1 cgroup_disable=memory numa=off udev.children-max=2 panic=10 transparent_hugepage=never novmcoredd"
# Any additional /sbin/mkdumprd arguments required.
MKDUMPRD_ARGS=""
diff --git a/kdump.sysconfig.x86_64 b/kdump.sysconfig.x86_64
index 4a5ec1c..0ceed1f 100644
--- a/kdump.sysconfig.x86_64
+++ b/kdump.sysconfig.x86_64
@@ -21,7 +21,7 @@ KDUMP_COMMANDLINE_REMOVE="hugepages hugepagesz slub_debug quiet"
# This variable lets us append arguments to the current kdump commandline
# after processed by KDUMP_COMMANDLINE_REMOVE
-KDUMP_COMMANDLINE_APPEND="irqpoll nr_cpus=1 reset_devices cgroup_disable=memory mce=off numa=off udev.children-max=2 panic=10 acpi_no_memhotplug transparent_hugepage=never nokaslr"
+KDUMP_COMMANDLINE_APPEND="irqpoll nr_cpus=1 reset_devices cgroup_disable=memory mce=off numa=off udev.children-max=2 panic=10 acpi_no_memhotplug transparent_hugepage=never nokaslr novmcoredd"
# Any additional kexec arguments required. In most situations, this should
# be left empty
diff --git a/kexec-kdump-howto.txt b/kexec-kdump-howto.txt
index 7e9e58a..2e52455 100644
--- a/kexec-kdump-howto.txt
+++ b/kexec-kdump-howto.txt
@@ -698,6 +698,18 @@ crash kernel according, or update your encryption setup.
It's recommanded to use a non-encrypted target (eg. remote target)
instead.
+Notes on device dump:
+
+Device dump allows drivers to append dump data to vmcore, so you can
+collect driver specified debug info. The drivers could append the
+data without any limit, and the data is stored in memory, this may
+bring a significant memory stress. So device dump is disabled by default
+by passing novmcoredd command line option to the kdump capture kernel.
+If you want to collect debug data with device dump, you need to modify
+"KDUMP_COMMANDLINE_APPEND=" value in /etc/sysconfig/kdump and remove the
+novmcoredd option. You also need to increase the reserved enough memory
+in case of OOM issue.
+
Parallel Dumping Operation
==========================
Kexec allows kdump using multiple cpus. So parallel feature can accelerate
--
2.21.0
4 years
[PATCH 0/2] Add aarch64 specific kdump.sysconfig and make it similar to x86_64
by Bhupesh Sharma
This patchset adds an aarch64 specific kdump.sysconfig and tries to make
it as similar to x86_64 as possible.
Note that not all x86_64 kdump config options make sense for aarch64
architecture, so we will not include those (see PATCH 2/2 for details).
Bhupesh Sharma (2):
Add aarch64 specific kdump.sysconfig and use 'nr_cpus' instead of
'maxcpus'
aarch64/kdump.sysconfig: Make config options similar to x86_64
kdump.sysconfig.aarch64 | 37 +++++++++++++++++++++++++++++++++++++
kexec-tools.spec | 1 +
2 files changed, 38 insertions(+)
create mode 100644 kdump.sysconfig.aarch64
--
2.7.4
4 years
[PATCH] kdumpctl: check for ssh path availability when rebuild
by Kairui Song
Currently kdumpctl rebuild will simply rebuild the initramfs, and
only perform basic config syntax check. But it should also check if the
target path is available when using SSH target, else kdump may fail.
is second kernel. kdumpctl rebuild should cover this case, and create
the path if it doesn't exist.
This patch make rebuild and restart behaves the same, rebuild is
now equal to restart, except it won't check config change or reload
kdump resource.
Signed-off-by: Kairui Song <kasong(a)redhat.com>
---
kdumpctl | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/kdumpctl b/kdumpctl
index bb61415..a1a6ee2 100755
--- a/kdumpctl
+++ b/kdumpctl
@@ -1174,6 +1174,12 @@ rebuild() {
return 1
fi
+ if check_ssh_config; then
+ if ! check_ssh_target; then
+ return 1
+ fi
+ fi
+
setup_initrd
if [ $? -ne 0 ]; then
return 1
--
2.21.0
4 years
[PATCH] kdumpctl: Check kdump.conf for error when rebuild is called
by Kairui Song
Although "kdumpctl rebuild" is introduced to help user rebuild the
initramfs without modifying the kdump.conf, if the kdump.conf is
modified and "kdumpctl rebuild" is called, a initramfs with a faulty
kdump.conf will be built.
Kdump will refuse to load the initramfs when restarted, but kdumpctl
reload may load the faulty initramfs. So need to make sure the faulty
build won't be generate in the first place.
Check for kdump.conf error before building the initramfs to ensure such
failure won't happen.
Signed-off-by: Kairui Song <kasong(a)redhat.com>
---
kdumpctl | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/kdumpctl b/kdumpctl
index 20afb30..bb61415 100755
--- a/kdumpctl
+++ b/kdumpctl
@@ -1169,6 +1169,11 @@ stop()
}
rebuild() {
+ check_config
+ if [ $? -ne 0 ]; then
+ return 1
+ fi
+
setup_initrd
if [ $? -ne 0 ]; then
return 1
--
2.21.0
4 years
[PATCH V3] earlykdump: provide a prompt message after the rebuilding of kdump initramfs.
by Lianbo Jiang
Early kdump inherits the settings of normal kdump, so any changes that
caused normal kdump rebuilding also require rebuilding the system initramfs
to make sure that the changes take effect for early kdump.
Therefore, when the early kdump is enabled, provide a prompt message after
the rebuilding of kdump initramfs is completed.
Signed-off-by: Lianbo Jiang <lijiang(a)redhat.com>
---
early-kdump-howto.txt | 9 ++++++++-
kdumpctl | 10 ++++++++++
2 files changed, 18 insertions(+), 1 deletion(-)
diff --git a/early-kdump-howto.txt b/early-kdump-howto.txt
index 9af0ef1ad054..b8cab6aa2699 100644
--- a/early-kdump-howto.txt
+++ b/early-kdump-howto.txt
@@ -38,10 +38,17 @@ You can rebuild the initramfs with earlykdump support with below steps:
3. add rd.earlykdump in grub kernel command line.
-Note: earlykdump initramfs size will be large because it includes vmlinuz and
+Note:
+[1]. Early kdump initramfs size will be large because it includes vmlinuz and
kdump initramfs. And for step 2 if you are sure to overwrite system initramfs
you can backup the original initramfs and use "--force" option.
+[2]. Early kdump inherits the settings of normal kdump, so any changes that
+caused normal kdump rebuilding also require rebuilding the system initramfs
+to make sure that the changes take effect for early kdump. Therefore, after
+the rebuilding of kdump initramfs is completed, provide a prompt message to
+tell the fact.
+
After making said changes, reboot your system to take effect. Of course, if you
want to disable early kdump, you can simply remove "rd.earlykdump" from kernel
boot parameters in grub, and reboot system like above.
diff --git a/kdumpctl b/kdumpctl
index 75eebacef92b..72f9d7e46d91 100755
--- a/kdumpctl
+++ b/kdumpctl
@@ -110,6 +110,12 @@ rebuild_fadump_initrd()
return 0
}
+check_earlykdump_is_enabled()
+{
+ grep -q -w "rd.earlykdump" /proc/cmdline
+ return $?
+}
+
rebuild_kdump_initrd()
{
$MKDUMPRD $TARGET_INITRD $kdump_kver
@@ -118,6 +124,10 @@ rebuild_kdump_initrd()
return 1
fi
+ if check_earlykdump_is_enabled; then
+ echo "Tips: If early kdump is enabled, also require rebuilding the system initramfs to make the changes take effect for early kdump."
+ fi
+
return 0
}
--
2.17.1
4 years
[PATCH v2] Get rid of duplicated strip_comments when reading config
by Kairui Song
When reading kdump configs, a single parsing should be enough and this
saves a lot of duplicated striping call which speed up the total load
speed.
Speed up about 2 second when building and 0.1 second for reload in my
tests.
Signed-off-by: Kairui Song <kasong(a)redhat.com>
---
Update from V1:
Let the regex filters out lines containing only spaces.
dracut-kdump.sh | 3 +--
dracut-module-setup.sh | 3 +--
kdump-lib-initramfs.sh | 3 +--
kdump-lib.sh | 8 ++++++++
kdumpctl | 8 ++------
mkdumprd | 3 +--
6 files changed, 14 insertions(+), 14 deletions(-)
diff --git a/dracut-kdump.sh b/dracut-kdump.sh
index b75c2a5..2ae1c7c 100755
--- a/dracut-kdump.sh
+++ b/dracut-kdump.sh
@@ -144,7 +144,6 @@ read_kdump_conf()
while read config_opt config_val;
do
# remove inline comments after the end of a directive.
- config_val=$(strip_comments $config_val)
case "$config_opt" in
dracut_args)
config_val=$(get_dracut_args_target "$config_val")
@@ -160,7 +159,7 @@ read_kdump_conf()
add_dump_code "dump_ssh $SSH_KEY_LOCATION $config_val"
;;
esac
- done < $KDUMP_CONF
+ done <<< "$(read_strip_comments $KDUMP_CONF)"
}
fence_kdump_notify()
diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh
index db7cd23..2998c72 100755
--- a/dracut-module-setup.sh
+++ b/dracut-module-setup.sh
@@ -501,7 +501,6 @@ kdump_install_conf() {
while read _opt _val;
do
# remove inline comments after the end of a directive.
- _val=$(strip_comments $_val)
case "$_opt" in
raw)
_pdev=$(persistent_policy="by-id" kdump_get_persistent_dev $_val)
@@ -529,7 +528,7 @@ kdump_install_conf() {
dracut_install "${_val%%[[:blank:]]*}"
;;
esac
- done < /etc/kdump.conf
+ done <<< "$(read_strip_comments /etc/kdump.conf)"
default_dump_target_install_conf
diff --git a/kdump-lib-initramfs.sh b/kdump-lib-initramfs.sh
index d6c01d1..608dc6e 100755
--- a/kdump-lib-initramfs.sh
+++ b/kdump-lib-initramfs.sh
@@ -26,7 +26,6 @@ get_kdump_confs()
while read config_opt config_val;
do
# remove inline comments after the end of a directive.
- config_val=$(strip_comments $config_val)
case "$config_opt" in
path)
KDUMP_PATH="$config_val"
@@ -84,7 +83,7 @@ get_kdump_confs()
esac
;;
esac
- done < $KDUMP_CONF
+ done <<< "$(read_strip_comments $KDUMP_CONF)"
if [ -z "$CORE_COLLECTOR" ]; then
CORE_COLLECTOR="$DEFAULT_CORE_COLLECTOR"
diff --git a/kdump-lib.sh b/kdump-lib.sh
index 3118a4b..feb4584 100755
--- a/kdump-lib.sh
+++ b/kdump-lib.sh
@@ -61,6 +61,14 @@ strip_comments()
echo $@ | sed -e 's/\(.*\)#.*/\1/'
}
+# Read from kdump config file stripping all comments
+read_strip_comments()
+{
+ # strip heading spaces, and print any content starting with
+ # neither space or #, and strip everything after #
+ sed -n -e "s/^\s*\([^# \t][^#]\+\).*/\1/gp" $1
+}
+
# Check if fence kdump is configured in Pacemaker cluster
is_pcs_fence_kdump()
{
diff --git a/kdumpctl b/kdumpctl
index e77877a..8edd58a 100755
--- a/kdumpctl
+++ b/kdumpctl
@@ -235,7 +235,6 @@ check_config()
;;
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.
- config_val=$(strip_comments $config_val)
[ -z "$config_val" ] && {
echo "Invalid kdump config value for option $config_opt."
return 1;
@@ -250,7 +249,7 @@ check_config()
return 1;
;;
esac
- done < $KDUMP_CONFIG_FILE
+ done <<< "$(read_strip_comments $KDUMP_CONFIG_FILE)"
check_failure_action_config || return 1
check_final_action_config || return 1
@@ -695,7 +694,6 @@ check_ssh_config()
case "$config_opt" in
sshkey)
# remove inline comments after the end of a directive.
- config_val=$(strip_comments $config_val)
if [ -f "$config_val" ]; then
# canonicalize the path
SSH_KEY_LOCATION=$(/usr/bin/readlink -m $config_val)
@@ -704,17 +702,15 @@ check_ssh_config()
fi
;;
path)
- config_val=$(strip_comments $config_val)
SAVE_PATH=$config_val
;;
ssh)
- config_val=$(strip_comments $config_val)
DUMP_TARGET=$config_val
;;
*)
;;
esac
- done < $KDUMP_CONFIG_FILE
+ done <<< "$(read_strip_comments $KDUMP_CONFIG_FILE)"
#make sure they've configured kdump.conf for ssh dumps
local SSH_TARGET=`echo -n $DUMP_TARGET | sed -n '/.*@/p'`
diff --git a/mkdumprd b/mkdumprd
index a99d5f1..cf3533f 100644
--- a/mkdumprd
+++ b/mkdumprd
@@ -392,7 +392,6 @@ fi
while read config_opt config_val;
do
# remove inline comments after the end of a directive.
- config_val=$(strip_comments $config_val)
case "$config_opt" in
extra_modules)
extra_modules="$extra_modules $config_val"
@@ -446,7 +445,7 @@ do
*)
;;
esac
-done <<< "$(grep -v -e "^#" -e "^$" $conf_file)"
+done <<< "$(read_strip_comments $conf_file)"
handle_default_dump_target
--
2.21.0
4 years
[PATCH v3 0/2] Check if extra_modules is modified rather then always rebuild
by Kairui Song
Update from V2:
- Improve the error message
- Also check module dependencies
- Clean up code
Update from V1:
- Update check_files_modified instead of introduce a new function
- Give proper message when invalid/builtin module name is given
- Behave properly with weak-modules
Kairui Song (2):
kdumpctl: follow symlink when checking for modified files
kdumpctl: don't always rebuild when extra_modules is set
kdumpctl | 43 ++++++++++++++++++++++++++++++++++---------
1 file changed, 34 insertions(+), 9 deletions(-)
--
2.20.1
4 years