[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
[RESEND PATCH v2 0/3] fadump: cleanup network configuration
by Hari Bathini
Currently, while building the initrd with dump capture support, if a
network-based dump target is specified, network is configured in the
initial ramdisk which includes an interface name change if necessary.
When fadump is configured, the initrd used for booting production
kernel is rebuilt with dump capturing support. This initrd applies
the network configuration changes, intended for capturing a dump,
while booting the production kernel as well, potentially changing
the network interface name in production kernel. Avoid enforcing
kdump specific network parameters while boot production kernel to
tackle that problem. The first patch in this patch-set prefixes all
network related cmdline conf files with 'kdump' for graceful handling.
The second patch adds a dracut cmdline hook in the initrd to remove
network cmdline conf files while booting production kernel. The last
patch reverts an old commit that is no longer relevant with the
change in second patch.
---
Hari Bathini (3):
add kdump prefix to network cmdline config files
fadump: avoid renaming network interface name during regular boot
avoid network interface rename when unnecessary
dracut-kdump-boot.sh | 12 ++++++++++++
dracut-module-setup.sh | 13 +++++--------
kexec-tools.spec | 3 +++
3 files changed, 20 insertions(+), 8 deletions(-)
create mode 100644 dracut-kdump-boot.sh
4 years, 4 months
[PATCH] fadump: leverage kernel support to re-regisgter FADump
by Hari Bathini
With kernel commit 0823c68b054b ("powerpc/fadump: re-register firmware-
assisted dump if already registered") support is enabled to re-register
when FADump is alredy registered. Leverage that option in kdump scripts.
Signed-off-by: Hari Bathini <hbathini(a)linux.ibm.com>
---
kdumpctl | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
diff --git a/kdumpctl b/kdumpctl
index de6da39..c93c3fa 100755
--- a/kdumpctl
+++ b/kdumpctl
@@ -1047,7 +1047,8 @@ reload()
fi
if [ $DEFAULT_DUMP_MODE == "fadump" ]; then
- stop_fadump
+ reload_fadump
+ return $?
else
stop_kdump
fi
@@ -1103,6 +1104,19 @@ stop_kdump()
return 0
}
+reload_fadump()
+{
+ start_fadump
+ if [ $? != 0 ]; then
+ # FADump could fail on older kernel where re-register
+ # support is not enabled. Try stop/start from userspace
+ # to handle such scenario.
+ stop_fadump
+ start_fadump
+ return $?
+ fi
+}
+
stop()
{
if [ $DEFAULT_DUMP_MODE == "fadump" ]; then
4 years, 4 months
[PATCH] Series short description
by Hari Bathini
The following series implements...
---
Hari Bathini (1):
fadump: leverage kernel support to re-regisgter FADump
kdumpctl | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
--
Signature
4 years, 4 months
[RESEND PATCH v2 0/3] fadump: cleanup network configuration
by Hari Bathini
Currently, while building the initrd with dump capture support, if a
network-based dump target is specified, network is configured in the
initial ramdisk which includes an interface name change if necessary.
When fadump is configured, the initrd used for booting production
kernel is rebuilt with dump capturing support. This initrd applies
the network configuration changes, intended for capturing a dump,
while booting the production kernel as well, potentially changing
the network interface name in production kernel. Avoid enforcing
kdump specific network parameters while boot production kernel to
tackle that problem. The first patch in this patch-set prefixes all
network related cmdline conf files with 'kdump' for graceful handling.
The second patch adds a dracut cmdline hook in the initrd to remove
network cmdline conf files while booting production kernel. The last
patch reverts an old commit that is no longer relevant with the
change in second patch.
---
Hari Bathini (3):
add kdump prefix to network cmdline config files
fadump: avoid renaming network interface name during regular boot
avoid network interface rename when unnecessary
dracut-kdump-boot.sh | 12 ++++++++++++
dracut-module-setup.sh | 13 +++++--------
kexec-tools.spec | 3 +++
3 files changed, 20 insertions(+), 8 deletions(-)
create mode 100644 dracut-kdump-boot.sh
4 years, 4 months
[PATCH] mkdumprd: refine regex on dropping mount options
by Kairui Song
Currently we use "\b" (word boundary) as the delimiter for ro option,
which is not correct. For mount options like
"defaults,errors=remount-ro" the ro on the tail will also be replaced
and result in an invalid mount option.
So we use a more strict logic on detecting ro mount option. It should
either starts with "," or "^" (begin of line) and ends with "," or "$"
(end of line), and keep the delimiter untouched. This should ensure
only valid mount option got detected and replaced.
This passed following tests:
defaults,ro,noauto,errors=remount-ro,nobootwait,nofail => defaults,rw,errors=remount-ro,
defaults,errors=remount-ro => defaults,errors=remount-ro
defaults,ro,relatime => defaults,rw,relatime
defaults,ro => defaults,rw
Signed-off-by: Kairui Song <kasong(a)redhat.com>
---
mkdumprd | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/mkdumprd b/mkdumprd
index de9ca48..6fc68fe 100644
--- a/mkdumprd
+++ b/mkdumprd
@@ -106,14 +106,14 @@ to_mount() {
_options=$(echo $_options | sed 's/,clientaddr=[^,]*//')
fi
fi
+ # mount fs target as rw in 2nd kernel
+ _options=$(echo $_options | sed 's/\(^\|,\)ro\($\|,\)/\1rw\2/g')
# with 'noauto' in fstab nfs and non-root disk mount will fail in 2nd
# kernel, filter it out here.
- _options=$(echo $_options | sed 's/\bnoauto\b//')
- #mount fs target as rw in 2nd kernel
- _options=$(echo $_options | sed 's/\bro\b/rw/')
+ _options=$(echo $_options | sed 's/\(^\|,\)noauto\($\|,\)/\1/g')
# drop nofail or nobootwait
- _options=$(echo $_options | sed 's/\bnofail\b//')
- _options=$(echo $_options | sed 's/\bnobootwait\b//')
+ _options=$(echo $_options | sed 's/\(^\|,\)nofail\($\|,\)/\1/g')
+ _options=$(echo $_options | sed 's/\(^\|,\)nobootwait\($\|,\)/\1/g')
_mntopts="$_target $_fstype $_options"
#for non-nfs _dev converting to use udev persistent name
--
2.20.1
4 years, 4 months
[PATCH v2 0/3] Add final_action option to avoid crash loop
by Kazuhito Hagio
If a crash occurs repeatedly after enabling kdump, the system goes
into a crash loop and the dump target may get filled up by vmcores.
This is likely especially with early kdump.
This patchset introduces 'final_action' option to kdump.conf, in order
for users to be able to power off the system even after capturing
a vmcore successfully.
In preparation for adding 'final_action' option, since it's confusing
to have the 'final_action' and 'default' options at the same time,
this patchset introduces 'failure_action' as an alias of the 'default'
option to /etc/kdump.conf, and makes 'default' obsolete to be removed
in the future.
Also, the "default action" term is renamed to "failure action".
Changes from v1:
- Add a patch that introduces 'failure_action' option as an alias of
'default' option and make 'default' option obsolete.
- Improve some descriptions of 'final_action' behavior.
- Add a description that early kdump user can choose anything other
than "reboot" as failure_action to avoid crash loop.
Kazuhito Hagio (3):
Add failure_action as alias of default and make default obsolete
Add final_action option to kdump.conf
earlykdump: Add a note of final_action option to avoid crash loop
dracut-kdump-error-handler.service | 2 +-
dracut-kdump-error-handler.sh | 2 +-
early-kdump-howto.txt | 15 +++++++++-
fadump-howto.txt | 15 +++++-----
kdump-lib-initramfs.sh | 33 ++++++++++++++-------
kdump-lib.sh | 6 ++--
kdump.conf | 24 ++++++++++++----
kdump.conf.5 | 24 +++++++++++++---
kdumpctl | 46 +++++++++++++++++++++++++-----
kexec-kdump-howto.txt | 12 ++++----
10 files changed, 133 insertions(+), 46 deletions(-)
--
2.20.1
4 years, 4 months
[PATCH 1/2] Add final_action option to kdump.conf
by Kazuhito Hagio
If a crash occurs repeatedly after enabling kdump, the system goes
into a crash loop and the dump target may get filled up by vmcores.
This is likely to happen especially with early kdump.
This patch introduces 'final_action' option to kdump.conf, in order
for users to be able to power off the system even after capturing
a vmcore successfully.
Signed-off-by: Kazuhito Hagio <k-hagio(a)ab.jp.nec.com>
Cc: Dave Young <dyoung(a)redhat.com>
Cc: Lianbo Jiang <lijiang(a)redhat.com>
---
kdump-lib-initramfs.sh | 13 +++++++++++++
kdump.conf | 5 +++++
kdump.conf.5 | 6 ++++++
kdumpctl | 22 +++++++++++++++++++++-
4 files changed, 45 insertions(+), 1 deletion(-)
diff --git a/kdump-lib-initramfs.sh b/kdump-lib-initramfs.sh
index f5155a4..9f482cd 100755
--- a/kdump-lib-initramfs.sh
+++ b/kdump-lib-initramfs.sh
@@ -70,6 +70,19 @@ get_kdump_confs()
;;
esac
;;
+ final_action)
+ case $config_val in
+ reboot)
+ FINAL_ACTION="systemctl reboot -f"
+ ;;
+ halt)
+ FINAL_ACTION="halt"
+ ;;
+ poweroff)
+ FINAL_ACTION="systemctl poweroff -f"
+ ;;
+ esac
+ ;;
esac
done < $KDUMP_CONF
diff --git a/kdump.conf b/kdump.conf
index 286ad27..6643e87 100644
--- a/kdump.conf
+++ b/kdump.conf
@@ -110,6 +110,11 @@
# reboot. Useful when non-root dump target is specified.
# The default option is "reboot".
#
+# final_action <reboot | halt | poweroff>
+# - Action to perform in case dumping succeeds.
+# Each action is same as the "default" directive above.
+# The default is "reboot".
+#
# force_rebuild <0 | 1>
# - By default, kdump initrd will only be rebuilt when necessary.
# Specify 1 to force rebuilding kdump initrd every time when kdump
diff --git a/kdump.conf.5 b/kdump.conf.5
index 990076e..72995c4 100644
--- a/kdump.conf.5
+++ b/kdump.conf.5
@@ -160,6 +160,12 @@ target is specified, the default action can be set as dump_to_rootfs. That mean
dumping to target fails, dump vmcore to rootfs from initramfs context and reboot.
.RE
+.B final_action <reboot | halt | poweroff>
+.RS
+Action to perform in case dumping to the intended target succeeds. The default is
+"reboot". Each action is same as the "default" directive above.
+.RE
+
.B force_rebuild <0 | 1>
.RS
By default, kdump initrd will only be rebuilt when necessary.
diff --git a/kdumpctl b/kdumpctl
index ca47705..992aaa8 100755
--- a/kdumpctl
+++ b/kdumpctl
@@ -228,7 +228,7 @@ check_config()
case "$config_opt" in
\#* | "")
;;
- raw|ext2|ext3|ext4|minix|btrfs|xfs|nfs|ssh|sshkey|path|core_collector|kdump_post|kdump_pre|extra_bins|extra_modules|default|force_rebuild|force_no_rebuild|dracut_args|fence_kdump_args|fence_kdump_nodes)
+ raw|ext2|ext3|ext4|minix|btrfs|xfs|nfs|ssh|sshkey|path|core_collector|kdump_post|kdump_pre|extra_bins|extra_modules|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" ] && {
@@ -248,6 +248,7 @@ check_config()
done < $KDUMP_CONFIG_FILE
check_default_config || return 1
+ check_final_action_config || return 1
check_fence_kdump_config || return 1
@@ -954,6 +955,25 @@ check_default_config()
fi
}
+check_final_action_config()
+{
+ local final_action
+
+ final_action=$(awk '$1 ~ /^final_action$/ {print $2;}' $KDUMP_CONFIG_FILE)
+ if [ -z "$final_action" ]; then
+ return 0
+ else
+ case "$final_action" in
+ reboot|halt|poweroff)
+ return 0
+ ;;
+ *)
+ echo $"Usage kdump.conf: final_action {reboot|halt|poweroff}"
+ return 1
+ esac
+ fi
+}
+
start()
{
check_dump_feasibility
--
2.18.0
4 years, 4 months
[PATCH v3 0/3] Handle inconsitance of kernel version when updrading kernel
by Kairui Song
Update from V2:
- Add more sanitize checking and add warn to let the user aware of the
risk
- Split into multiple patches
Kairui Song (3):
earlykdump: generate symlink with stable name to kernel image and
iniramfs
earlykdump: add more sanitize check when generating initramfs
earlykdump: warn when installed kernel version differs from dracut
target
dracut-early-kdump-module-setup.sh | 21 ++++++++++++++++++++-
dracut-early-kdump.sh | 13 ++-----------
2 files changed, 22 insertions(+), 12 deletions(-)
--
2.20.1
4 years, 4 months
[PATCH v2] earlykdump: generate symlink with stable name to kernel image and iniramfs
by Kairui Song
There is currently a problem with earlykdump image building, when a user
is upgrading kernel, dracut will generate new initramfs for the new
kernel, and earlykdump will install currently running version of kernel
into the initramfs, and remain the version based kernel image naming
untouched. But after a reboot the new kernel is running, and it
will try to load the image corresponding to the new kernel version by
file naming.
This patch fixes the problem by creating a symlink with unified stable
naming to the installed kernel image and initramfs, and use the symlink
instand so it will always work despite the kernel version number change.
Signed-off-by: Kairui Song <kasong(a)redhat.com>
---
Update from V1:
- Use a symlink as stable reference of installed kernel and initramfs
and keep the installation naming same untouched, so user could know
the installed kernel version easily.
dracut-early-kdump-module-setup.sh | 5 +++++
dracut-early-kdump.sh | 13 ++-----------
2 files changed, 7 insertions(+), 11 deletions(-)
diff --git a/dracut-early-kdump-module-setup.sh b/dracut-early-kdump-module-setup.sh
index 7613fbc..bd83ad6 100755
--- a/dracut-early-kdump-module-setup.sh
+++ b/dracut-early-kdump-module-setup.sh
@@ -22,11 +22,13 @@ depends() {
prepare_kernel_initrd() {
KDUMP_BOOTDIR=$(check_boot_dir "${KDUMP_BOOTDIR}")
+
if [ -z "$KDUMP_KERNELVER" ]; then
kdump_kver=`uname -r`
else
kdump_kver=$KDUMP_KERNELVER
fi
+
KDUMP_KERNEL="${KDUMP_BOOTDIR}/${KDUMP_IMG}-${kdump_kver}${KDUMP_IMG_EXT}"
KDUMP_INITRD="${KDUMP_BOOTDIR}/initramfs-${kdump_kver}kdump.img"
}
@@ -41,4 +43,7 @@ install() {
prepare_kernel_initrd
inst_binary "$KDUMP_KERNEL"
inst_binary "$KDUMP_INITRD"
+
+ ln_r "$KDUMP_KERNEL" "${KDUMP_BOOTDIR}/${KDUMP_IMG}-earlykdump${KDUMP_IMG_EXT}"
+ ln_r "$KDUMP_INITRD" "${KDUMP_BOOTDIR}/initramfs-earlykdump.img"
}
diff --git a/dracut-early-kdump.sh b/dracut-early-kdump.sh
index 34a9909..69a34eb 100755
--- a/dracut-early-kdump.sh
+++ b/dracut-early-kdump.sh
@@ -18,17 +18,8 @@ prepare_parameters()
EARLY_KDUMP_CMDLINE=$(prepare_cmdline "${KDUMP_COMMANDLINE}" "${KDUMP_COMMANDLINE_REMOVE}" "${KDUMP_COMMANDLINE_APPEND}")
KDUMP_BOOTDIR=$(check_boot_dir "${KDUMP_BOOTDIR}")
- #make early-kdump kernel string
- if [ -z "$KDUMP_KERNELVER" ]; then
- EARLY_KDUMP_KERNELVER=`uname -r`
- else
- EARLY_KDUMP_KERNELVER=$KDUMP_KERNELVER
- fi
-
- EARLY_KDUMP_KERNEL="${KDUMP_BOOTDIR}/${KDUMP_IMG}-${EARLY_KDUMP_KERNELVER}${KDUMP_IMG_EXT}"
-
- #make early-kdump initrd string
- EARLY_KDUMP_INITRD="${KDUMP_BOOTDIR}/initramfs-${EARLY_KDUMP_KERNELVER}kdump.img"
+ EARLY_KDUMP_KERNEL="${KDUMP_BOOTDIR}/${KDUMP_IMG}-earlykdump${KDUMP_IMG_EXT}"
+ EARLY_KDUMP_INITRD="${KDUMP_BOOTDIR}/initramfs-earlykdump.img"
}
early_kdump_load()
--
2.20.1
4 years, 4 months