[PATCH] kdump.conf: use a simple generator script to maintain
by Pingfan Liu
This commit has the same motivation as the commit 677da8a "sysconfig:
use a simple generator script to maintain".
At present, only the kdump.conf generated for s390x has a slight
difference from the other arches, where the core_collector asks the
makedumpfile to use "-c" option to compress dump data by each page using
zlib, which is more efficient than lzo on s390x.
Signed-off-by: Pingfan Liu <piliu(a)redhat.com>
---
gen-kdump-conf.sh | 232 ++++++++++++++++++++++++++++++++++++++++++++++
kexec-tools.spec | 5 +-
2 files changed, 235 insertions(+), 2 deletions(-)
create mode 100755 gen-kdump-conf.sh
diff --git a/gen-kdump-conf.sh b/gen-kdump-conf.sh
new file mode 100755
index 0000000..b71257d
--- /dev/null
+++ b/gen-kdump-conf.sh
@@ -0,0 +1,232 @@
+#!/bin/bash
+# $1: target arch
+
+
+SED_EXP=""
+
+generate()
+{
+ sed "$SED_EXP" << EOF
+# This file contains a series of commands to perform (in order) in the kdump
+# kernel after a kernel crash in the crash kernel(1st kernel) has happened.
+#
+# Directives in this file are only applicable to the kdump initramfs, and have
+# no effect once the root filesystem is mounted and the normal init scripts are
+# processed.
+#
+# Currently, only one dump target and path can be specified. If the dumping to
+# the configured target fails, the failure action which can be configured via
+# the "failure_action" directive will be performed.
+#
+# Supported options:
+#
+# auto_reset_crashkernel <yes|no>
+# - whether to reset kernel crashkernel to new default value
+# or not when kexec-tools updates the default crashkernel value and
+# existing kernels using the old default kernel crashkernel value.
+# The default value is yes.
+#
+# raw <partition>
+# - Will dd /proc/vmcore into <partition>.
+# Use persistent device names for partition devices,
+# such as /dev/vg/<devname>.
+#
+# nfs <nfs mount>
+# - Will mount nfs to <mnt>, and copy /proc/vmcore to
+# <mnt>/<path>/%HOST-%DATE/, supports DNS.
+#
+# ssh <user@server>
+# - Will save /proc/vmcore to <user@server>:<path>/%HOST-%DATE/,
+# supports DNS.
+# NOTE: make sure the user has write permissions on the server.
+#
+# sshkey <path>
+# - Will use the sshkey to do ssh dump.
+# Specify the path of the ssh key to use when dumping
+# via ssh. The default value is /root/.ssh/kdump_id_rsa.
+#
+# <fs type> <partition>
+# - Will mount -t <fs type> <partition> <mnt>, and copy
+# /proc/vmcore to <mnt>/<path>/%HOST_IP-%DATE/.
+# NOTE: <partition> can be a device node, label or uuid.
+# It's recommended to use persistent device names
+# such as /dev/vg/<devname>.
+# Otherwise it's suggested to use label or uuid.
+# Supported fs types: ext[234], xfs, btrfs, minix, virtiofs
+#
+# path <path>
+# - "path" represents the file system path in which vmcore
+# will be saved. If a dump target is specified in
+# kdump.conf, then "path" is relative to the specified
+# dump target.
+#
+# Interpretation of "path" changes a bit if the user didn't
+# specify any dump target explicitly in kdump.conf. In this
+# case, "path" represents the absolute path from root. The
+# dump target and adjusted path are arrived at automatically
+# depending on what's mounted in the current system.
+#
+# Ignored for raw device dumps. If unset, will use the default
+# "/var/crash".
+#
+# core_collector <command> <options>
+# - This allows you to specify the command to copy
+# the vmcore. The default is makedumpfile, which on
+# some architectures can drastically reduce vmcore size.
+# See /sbin/makedumpfile --help for a list of options.
+# Note that the -i and -g options are not needed here,
+# 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 7 -d 31".
+# The default core_collector for other targets is:
+# "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
+# a normal dumpfile readable with analysis tools. For example:
+# "makedumpfile -R vmcore < vmcore.flat".
+#
+# For core_collector format details, you can refer to
+# kexec-kdump-howto.txt or kdump.conf manpage.
+#
+# kdump_post <binary | script>
+# - This directive allows you to run a executable binary
+# 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.
+# All files under /etc/kdump/post.d 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 - run the final action (reboot/poweroff/halt)
+# All files under /etc/kdump/pre.d 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
+# shell scripts to be included in the kdump initrd.
+# Generally they are useful in conjunction with a kdump_post
+# or kdump_pre binary or script which depends on these extra_bins.
+#
+# extra_modules <module(s)>
+# - This directive allows you to specify extra kernel modules
+# that you want to be loaded in the kdump initrd.
+# Multiple modules can be listed, separated by spaces, and any
+# dependent modules will automatically be included.
+#
+# failure_action <reboot | halt | poweroff | shell | dump_to_rootfs>
+# - Action to perform in case dumping fails.
+# reboot: Reboot the system.
+# halt: Halt the system.
+# poweroff: Power down the system.
+# shell: Drop to a bash shell.
+# Exiting the shell reboots the system by default,
+# or perform "final_action".
+# dump_to_rootfs: Dump vmcore to rootfs from initramfs context and
+# reboot by default or perform "final_action".
+# Useful when non-root dump target is specified.
+# The default option is "reboot".
+#
+# default <reboot | halt | poweroff | shell | dump_to_rootfs>
+# - Same as the "failure_action" directive above, but this directive
+# is obsolete and will be removed in the future.
+#
+# final_action <reboot | halt | poweroff>
+# - Action to perform in case dumping succeeds. Also performed
+# when "shell" or "dump_to_rootfs" failure action finishes.
+# Each action is same as the "failure_action" 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
+# service starts.
+#
+# force_no_rebuild <0 | 1>
+# - By default, kdump initrd will be rebuilt when necessary.
+# Specify 1 to bypass rebuilding of kdump initrd.
+#
+# force_no_rebuild and force_rebuild options are mutually
+# exclusive and they should not be set to 1 simultaneously.
+#
+# override_resettable <0 | 1>
+# - Usually an unresettable block device can't be a dump target.
+# Specifying 1 when you want to dump even though the block
+# target is unresettable
+# By default, it is 0, which will not try dumping destined to fail.
+#
+# dracut_args <arg(s)>
+# - Pass extra dracut options when rebuilding kdump initrd.
+#
+# fence_kdump_args <arg(s)>
+# - Command line arguments for fence_kdump_send (it can contain
+# all valid arguments except hosts to send notification to).
+#
+# fence_kdump_nodes <node(s)>
+# - List of cluster node(s) except localhost, separated by spaces,
+# to send fence_kdump notifications to.
+# (this option is mandatory to enable fence_kdump).
+#
+
+#raw /dev/vg/lv_kdump
+#ext4 /dev/vg/lv_kdump
+#ext4 LABEL=/boot
+#ext4 UUID=03138356-5e61-4ab3-b58e-27507ac41937
+#virtiofs myfs
+#nfs my.server.com:/export/tmp
+#nfs [2001:db8::1:2:3:4]:/export/tmp
+#ssh user(a)my.server.com
+#ssh user@2001:db8::1:2:3:4
+#sshkey /root/.ssh/kdump_id_rsa
+auto_reset_crashkernel yes
+path /var/crash
+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
+#extra_bins /usr/bin/lftp
+#extra_modules gfs2
+#failure_action shell
+#force_rebuild 1
+#force_no_rebuild 1
+#dracut_args --omit-drivers "cfg80211 snd" --add-drivers "ext2 ext3"
+#fence_kdump_args -p 7410 -f auto -c 0 -i 10
+#fence_kdump_nodes node1 node2
+EOF
+}
+
+update_param()
+{
+ SED_EXP="${SED_EXP}s/^$1.*$/$1 $2/;"
+}
+
+case "$1" in
+aarch64)
+ ;;
+i386)
+ ;;
+ppc64)
+ ;;
+ppc64le)
+ ;;
+s390x)
+ update_param core_collector \
+ "makedumpfile -c --message-level 7 -d 31"
+ ;;
+x86_64)
+ ;;
+*)
+ echo "Warning: Unknown architecture '$1', using default kdump.conf template."
+ ;;
+esac
+
+generate
diff --git a/kexec-tools.spec b/kexec-tools.spec
index bfa7a5b..cc62984 100644
--- a/kexec-tools.spec
+++ b/kexec-tools.spec
@@ -12,8 +12,8 @@ Summary: The kexec/kdump userspace component
Source0: http://kernel.org/pub/linux/utils/kernel/kexec/%{name}-%{version}.tar.xz
Source1: kdumpctl
Source3: gen-kdump-sysconfig.sh
+Source4: gen-kdump-conf.sh
Source7: mkdumprd
-Source8: kdump.conf
Source9: https://github.com/makedumpfile/makedumpfile/archive/%{mkdf_ver}/makedump...
Source10: kexec-kdump-howto.txt
Source11: fadump-howto.txt
@@ -147,6 +147,7 @@ cp %{SOURCE34} .
# Generate sysconfig file
%{SOURCE3} %{_target_cpu} > kdump.sysconfig
+%{SOURCE4} %{_target_cpu} > kdump.conf
make
%ifarch %{ix86} x86_64 ppc64 s390x ppc64le aarch64
@@ -180,7 +181,7 @@ install -m 644 build/man/man8/kexec.8 $RPM_BUILD_ROOT%{_mandir}/man8/
install -m 644 build/man/man8/vmcore-dmesg.8 $RPM_BUILD_ROOT%{_mandir}/man8/
install -m 755 %{SOURCE7} $RPM_BUILD_ROOT/usr/sbin/mkdumprd
-install -m 644 %{SOURCE8} $RPM_BUILD_ROOT%{_sysconfdir}/kdump.conf
+install -m 644 kdump.conf $RPM_BUILD_ROOT%{_sysconfdir}/kdump.conf
install -m 644 kdump.sysconfig $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/kdump
install -m 644 kexec/kexec.8 $RPM_BUILD_ROOT%{_mandir}/man8/kexec.8
install -m 644 %{SOURCE12} $RPM_BUILD_ROOT%{_mandir}/man8/mkdumprd.8
--
2.31.1
4 months, 2 weeks
[PATCH v2 0/2] fadump: reduce initramfs image size
by Hari Bathini
With commit fa9201b2 ("fadump: isolate fadump initramfs image within
the default one"), initramfs image gets to hold two images, one for
production kernel boot purpose and the other for capture kernel boot.
Having separate images improved reliability for both production kernel
and capture kernel boot scenarios, but the size of initramfs image
became considerably larger.
There is scope to reduce the size requirement by avoiding squash and
hardlinking identical files, which are quite a few in this case as
two images would have almost the same binaries and libraries.
The first patch opts out of using squash and the second patch ensures
file modification time is preserved to ensure hardlinking goes through
smoothly.
Changes in v2:
* Avoid polluting is_squash_available(). Instead, modify mkfadumprd
to ensure 'squash' dracut module is not used for fadump case.
Hari Bathini (2):
fadump: do not use squash to reduce image size
fadump: preserve file modification time to help with hardlinking
mkfadumprd | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
--
2.37.3
4 months, 2 weeks
[PATCH] Don't check fs modified when dump target is lvm2 thinp
by Tao Liu
When the dump target is lvm2 thinp, if we didn't mount
the dump target first, get_fs_type_from_target will get
empty output:
Before mount:
$ get_fs_type_from_target /dev/vg00/thinlv
After mount:
$ mount /dev/vg00/thinlv /mnt
$ get_fs_type_from_target /dev/vg00/thinlv
ext4
As a result, kdumpctl start will fail with:
$ kdumpctl start
kdump: Dump target is invalid
kdump: Starting kdump: [FAILED]
This patch fix the issue by bypassing check_fs_modified
when the dump target is lvm2 thinp.
Signed-off-by: Tao Liu <ltao(a)redhat.com>
---
kdumpctl | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/kdumpctl b/kdumpctl
index 32a5458..313efd9 100755
--- a/kdumpctl
+++ b/kdumpctl
@@ -479,8 +479,9 @@ check_fs_modified()
fi
# No need to check in case of raw target.
- # Currently we do not check also if ssh/nfs/virtiofs target is specified
- if is_ssh_dump_target || is_nfs_dump_target || is_raw_dump_target || is_virtiofs_dump_target; then
+ # Currently we do not check also if ssh/nfs/virtiofs/thinp target is specified
+ if is_ssh_dump_target || is_nfs_dump_target || is_raw_dump_target ||
+ is_virtiofs_dump_target || is_lvm2_thinp_dump_target; then
return 0
fi
--
2.33.1
4 months, 2 weeks
[PATCH] tests: use .nmconnection to set up test network
by Coiby Xu
F36 has dropped support on ifcfg and as a result all network tests fail.
Use .nmconnection to set up test network instead.
Signed-off-by: Coiby Xu <coxu(a)redhat.com>
---
tests/scripts/testcases/nfs-kdump/0-server.sh | 13 +++++++------
tests/scripts/testcases/ssh-kdump/0-server.sh | 13 +++++++------
2 files changed, 14 insertions(+), 12 deletions(-)
diff --git a/tests/scripts/testcases/nfs-kdump/0-server.sh b/tests/scripts/testcases/nfs-kdump/0-server.sh
index cf54e70a..5436d3d2 100755
--- a/tests/scripts/testcases/nfs-kdump/0-server.sh
+++ b/tests/scripts/testcases/nfs-kdump/0-server.sh
@@ -16,12 +16,13 @@ on_build() {
img_run_cmd "echo dhcp-range=192.168.77.50,192.168.77.100,255.255.255.0,12h >> /etc/dnsmasq.conf"
img_run_cmd "systemctl enable dnsmasq"
- img_run_cmd 'echo DEVICE="eth0" > /etc/sysconfig/network-scripts/ifcfg-eth0'
- img_run_cmd 'echo BOOTPROTO="none" >> /etc/sysconfig/network-scripts/ifcfg-eth0'
- img_run_cmd 'echo ONBOOT="yes" >> /etc/sysconfig/network-scripts/ifcfg-eth0'
- img_run_cmd 'echo PREFIX="24" >> /etc/sysconfig/network-scripts/ifcfg-eth0'
- img_run_cmd 'echo IPADDR="192.168.77.1" >> /etc/sysconfig/network-scripts/ifcfg-eth0'
- img_run_cmd 'echo TYPE="Ethernet" >> /etc/sysconfig/network-scripts/ifcfg-eth0'
+ img_run_cmd 'echo [connection] > /etc/NetworkManager/system-connections/eth0.nmconnection'
+ img_run_cmd 'echo type=ethernet >> /etc/NetworkManager/system-connections/eth0.nmconnection'
+ img_run_cmd 'echo interface-name=eth0 >> /etc/NetworkManager/system-connections/eth0.nmconnection'
+ img_run_cmd 'echo [ipv4] >> /etc/NetworkManager/system-connections/eth0.nmconnection'
+ img_run_cmd 'echo address1=192.168.77.1/24 >> /etc/NetworkManager/system-connections/eth0.nmconnection'
+ img_run_cmd 'echo method=manual >> /etc/NetworkManager/system-connections/eth0.nmconnection'
+ img_run_cmd 'chmod 600 /etc/NetworkManager/system-connections/eth0.nmconnection'
img_add_qemu_cmd "-nic socket,listen=:8010,mac=52:54:00:12:34:56"
}
diff --git a/tests/scripts/testcases/ssh-kdump/0-server.sh b/tests/scripts/testcases/ssh-kdump/0-server.sh
index 6dfcc913..b4b84c96 100755
--- a/tests/scripts/testcases/ssh-kdump/0-server.sh
+++ b/tests/scripts/testcases/ssh-kdump/0-server.sh
@@ -17,12 +17,13 @@ on_build() {
img_run_cmd "echo dhcp-range=192.168.77.50,192.168.77.100,255.255.255.0,12h >> /etc/dnsmasq.conf"
img_run_cmd "systemctl enable dnsmasq"
- img_run_cmd 'echo DEVICE="eth0" > /etc/sysconfig/network-scripts/ifcfg-eth0'
- img_run_cmd 'echo BOOTPROTO="none >> /etc/sysconfig/network-scripts/ifcfg-eth0"'
- img_run_cmd 'echo ONBOOT="yes" >> /etc/sysconfig/network-scripts/ifcfg-eth0'
- img_run_cmd 'echo PREFIX="24" >> /etc/sysconfig/network-scripts/ifcfg-eth0'
- img_run_cmd 'echo IPADDR="192.168.77.1" >> /etc/sysconfig/network-scripts/ifcfg-eth0'
- img_run_cmd 'echo TYPE="Ethernet" >> /etc/sysconfig/network-scripts/ifcfg-eth0'
+ img_run_cmd 'echo [connection] > /etc/NetworkManager/system-connections/eth0.nmconnection'
+ img_run_cmd 'echo type=ethernet >> /etc/NetworkManager/system-connections/eth0.nmconnection'
+ img_run_cmd 'echo interface-name=eth0 >> /etc/NetworkManager/system-connections/eth0.nmconnection'
+ img_run_cmd 'echo [ipv4] >> /etc/NetworkManager/system-connections/eth0.nmconnection'
+ img_run_cmd 'echo address1=192.168.77.1/24 >> /etc/NetworkManager/system-connections/eth0.nmconnection'
+ img_run_cmd 'echo method=manual >> /etc/NetworkManager/system-connections/eth0.nmconnection'
+ img_run_cmd 'chmod 600 /etc/NetworkManager/system-connections/eth0.nmconnection'
}
# Executed when VM boots
--
2.37.3
4 months, 2 weeks
[PATCH v6 0/5] Add lvm2 thin provision support for kdump
by Tao Liu
Thin provision is a mechanism that you can allocate a lvm volume which has
a large virtual size for file systems but actually in a small physical
size. The physical size can be autoextended in use if thin pool reached a
threshold specified in /etc/lvm/lvm.conf.
There are 2 works should be handled when enable lvm2 thinp for kdump:
1) Check if the dump target device or directory is thinp device.
2) Monitor the thin pool and autoextend its size when it reached the threshold
during kdump.
According to my testing, the memory consumption procedure for lvm2 thinp is the thin pool
size-autoextend phase. For fedora and rhel9, the default crashkernel value is enough. But
for rhel8, the default crashkernel value 1G-4G:160M is not enough, so it should
be handled particularly.
v1 -> v2:
1) Modified the usage of lvs cmd when check if target is lvm2 thinp
device.
2) Removed the sync flag way of mounting for lvm2 thinp target
during kdump, use "sync -f vmcore" to force sync data, and handle
the error if fails.
v2 -> v3:
1) Removed "sync -f vmcore" patch out of the patch set, for it is
addressing an issue which is not specifically to lvm2 thinp support for
kdump.
v3 -> v4:
1) Removed lvm2-monitor.service, implemented the monitor service with
a loop function within a shell script instead.
2) Add lvm2 thinp support for dump_raw, for it is addressing the similar
issue as dump_fs.
3) Dave suggested me to implement the lvm2 thin support in dracut
modules instead of kexec-tools. If you are OK with the loop-function-shell-script
technical way, I will give a try to migrate it to dracut.
v4 -> v5:
1) A new 80lvmthinpool-monitor module [1] has been integrated in dracut.
Now we simply depend on it.
2) Add lvm2 thin provision selftest.
[1]: https://github.com/dracutdevs/dracut/pull/1842
v5 -> v6:
1) Code refactoring based on Philipp's comments.
2) Print warning if lvmthinpool-monitor module is not exist.
Tao Liu (5):
Add lvm2 thin provision dump target checker
lvm.conf should be check modified if lvm2 thinp enabled
Add dependency of dracut lvmthinpool-monitor module
selftest: Only iterate the .sh files for test execution
selftest: Add lvm2 thin provision for kdump test
dracut-module-setup.sh | 8 +++
kdump-lib-initramfs.sh | 10 ++++
kdump-lib.sh | 6 ++
kdumpctl | 1 +
tests/scripts/run-test.sh | 3 +-
.../lvm2-thinp-kdump/0-local-lvm2-thinp.sh | 59 +++++++++++++++++++
.../testcases/lvm2-thinp-kdump/lvm.conf | 5 ++
7 files changed, 90 insertions(+), 2 deletions(-)
create mode 100755 tests/scripts/testcases/lvm2-thinp-kdump/0-local-lvm2-thinp.sh
create mode 100644 tests/scripts/testcases/lvm2-thinp-kdump/lvm.conf
--
2.33.1
4 months, 4 weeks