[PATCH] fadump: avoid status check while starting in fadump mode
by Hari Bathini
With kernel commit 607451ce0aa9b ("powerpc/fadump: register for fadump
as early as possible"), 'kdumpctl start' prematurely returns with the
below message:
"Kdump already running: [WARNING]"
instead of setting default initrd with dump capture capability as
required for fadump. Skip status check in fadump mode to avoid this
problem.
Signed-off-by: Hari Bathini <hbathini(a)linux.ibm.com>
---
kdumpctl | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kdumpctl b/kdumpctl
index 03c91f3..d6fb7bd 100755
--- a/kdumpctl
+++ b/kdumpctl
@@ -1059,7 +1059,7 @@ start()
return 1
fi
- if check_current_status; then
+ if [[ $DEFAULT_DUMP_MODE == "kdump" ]] && check_current_kdump_status; then
dwarn "Kdump already running: [WARNING]"
return 0
fi
--
2.38.1
1 year
[PATCH v2 0/3] fadump improvements
by Hari Bathini
This set tries to do a few improvements to fadump. The 1st patch makes
'zstd' as the default compression method for fadump. The next patch
fixes the default initrd backup/restore logic. The 3rd patch ensures
fadump initramfs is cleaned up on kernel uninstall.
Changes in v2:
* Improve changelog on why 'zstd' is used for fadump in patch#1.
* Patch#2: A new patch to fix default initrd backup/restore logic.
* Patch#3: Cleaning up kernel version based checksum file.
Hari Bathini (3):
fadump: use 'zstd' as the default compression method
fadump: fix default initrd backup and restore logic
fadump: add a kernel install hook to clean up fadump initramfs
60-fadump.install | 32 ++++++++++++++++++++++++++++++++
kdumpctl | 8 ++++----
kexec-tools.spec | 3 +++
mkfadumprd | 6 ++----
4 files changed, 41 insertions(+), 8 deletions(-)
create mode 100755 60-fadump.install
--
2.38.1
1 year
[PATCHv2] unit tests: adapt check_config to gen-kdump-conf.sh
by Pingfan Liu
Now, kdump.conf is generated by gen-kdump-conf.sh, hence adapting
check_config to run that script firstly then check the generated file.
Signed-off-by: Pingfan Liu <piliu(a)redhat.com>
---
spec/kdumpctl_general_spec.sh | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/spec/kdumpctl_general_spec.sh b/spec/kdumpctl_general_spec.sh
index 5a3ce1c..00f76dc 100644
--- a/spec/kdumpctl_general_spec.sh
+++ b/spec/kdumpctl_general_spec.sh
@@ -178,6 +178,7 @@ Describe 'kdumpctl'
bad_kdump_conf=$(mktemp -t bad_kdump_conf.XXXXXXXXXX)
cleanup() {
rm -f "$bad_kdump_conf"
+ rm -f kdump.conf
}
AfterAll 'cleanup'
@@ -189,8 +190,11 @@ Describe 'kdumpctl'
The stderr should include 'Invalid kdump config option blabla'
End
+ Parameters:value aarch64 ppc64le s390x x86_64
+
It 'should be happy with the default kdump.conf'
- # shellcheck disable=SC2034
+ ./gen-kdump-conf.sh $1 > kdump.conf
+ # shellcheck disable=SC2034
# override the KDUMP_CONFIG_FILE variable
KDUMP_CONFIG_FILE=./kdump.conf
When call parse_config
--
2.31.1
1 year
[PATCH] Don't run kdump_check_setup_iscsi in a subshell in order to collect needed network interfaces
by Coiby Xu
Currently, dumping to iSCSI target fails because the global array
(unique_netifs) that stores the network interfaces needed by kdump is
empty. The root cause is change of the array made in a subshell (a child
process) is inaccessible to the parent process. So don't run
kdump_check_setup_iscsi in a subshell.
Fixes: 63c3805c ("Set up kdump network by directly copying NM connection profile to initrd")
Signed-off-by: Coiby Xu <coxu(a)redhat.com>
---
dracut-module-setup.sh | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh
index 0cac3bde..1fa2a789 100755
--- a/dracut-module-setup.sh
+++ b/dracut-module-setup.sh
@@ -809,7 +809,7 @@ kdump_check_iscsi_targets() {
# If our prerequisites are not met, fail anyways.
type -P iscsistart > /dev/null || return 1
- kdump_check_setup_iscsi() (
+ kdump_check_setup_iscsi() {
local _dev
_dev=$1
@@ -819,7 +819,7 @@ kdump_check_iscsi_targets() {
cd ..
done
[[ -d iscsi_session ]] && kdump_setup_iscsi_device "$PWD"
- )
+ }
[[ $hostonly ]] || [[ $mount_needs ]] && {
for_each_host_dev_and_slaves_all kdump_check_setup_iscsi
--
2.38.1
1 year
[PATCH] Skip reset_crashkernel_after_update during package install
by Coiby Xu
Currently, kexec-tools tries to reset crashkernel when using anaconda to
install the system. But grubby isn't ready and complains that,
10:34:17,014 INF packaging: Configuring (running scriptlet for): kexec-tools-2.0.23-9.el9.x86_64 1646034766 53ff7158f8808774f4e3c3c87e504aa7a6d677b537754dac86c87925c8f0a397
10:34:17,205 INF dnf.rpm: grep: /boot/grub2/grubenv: No such file or directory
grep: /boot/grub2/grubenv: No such file or directory
grep: /boot/grub2/grubenv: No such file or directory
kexec-tools is supposed to update the kernel crashkernel parameter after
package upgrade. Unfortunately, the posttrans RPM scriptlet doesn't
distinguish between package install and upgrade. This patch skips
reset_crashkernel_after_update as similar to e218128e ("Only try to
reset crashkernel for osbuild during package install").
Reported-by: Jan Stodola <jstodola(a)redhat.com>
Signed-off-by: Coiby Xu <coxu(a)redhat.com>
---
kdumpctl | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/kdumpctl b/kdumpctl
index 7caaae56..b82d8694 100755
--- a/kdumpctl
+++ b/kdumpctl
@@ -1657,6 +1657,10 @@ reset_crashkernel_after_update()
local _kernel _crashkernel _dump_mode _fadump_val _old_default_crashkernel _new_default_crashkernel
declare -A _crashkernel_vals
+ if _is_package_install; then
+ return
+ fi
+
_crashkernel_vals[old_kdump]=$(cat /tmp/old_default_crashkernel 2> /dev/null)
_crashkernel_vals[old_fadump]=$(cat /tmp/old_default_crashkernel_fadump 2> /dev/null)
_crashkernel_vals[new_kdump]=$(get_default_crashkernel kdump)
--
2.38.1
1 year
[PATCH v2] kdumpctl: Optimize _find_kernel_path_by_release regex string
by Lichen Liu
Currently _find_kernel_path_by_release uses grubby and grep to
find the kernel path, if both the normal kernel and it's debug
varient exist, the grep will give more than one kernel strings.
```
kernel="/boot/vmlinuz-5.14.0-139.kpq0.el9.s390x+debug"
kernel="/boot/vmlinuz-5.14.0-139.kpq0.el9.s390x"
```
This will cause an error when installing debug kernel.
```
The param "/boot/vmlinuz-5.14.0-139.kpq0.el9.s390x+debug
/boot/vmlinuz-5.14.0-139.kpq0.el9.s390x" is incorrect
```
Fixes: 945cbbd ("add helper functions to get kernel path by kernel release and the path of current running kernel")
Signed-off-by: Lichen Liu <lichliu(a)redhat.com>
Reviewed-by: Philipp Rudo <prudo(a)redhat.com>
---
kdumpctl | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kdumpctl b/kdumpctl
index 7caaae5..63c78b0 100755
--- a/kdumpctl
+++ b/kdumpctl
@@ -1353,7 +1353,7 @@ _filter_grubby_kernel_str()
_find_kernel_path_by_release()
{
local _release="$1" _grubby_kernel_str _kernel_path
- _grubby_kernel_str=$(grubby --info ALL | grep "^kernel=.*$_release")
+ _grubby_kernel_str=$(grubby --info ALL | grep "^kernel=.*$_release\"$")
_kernel_path=$(_filter_grubby_kernel_str "$_grubby_kernel_str")
if [[ -z $_kernel_path ]]; then
derror "kernel $_release doesn't exist"
--
2.37.3
1 year
[PATCHv2] 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>
Reviewed-by: Philipp Rudo <prudo(a)redhat.com>
---
kdump.conf => gen-kdump-conf.sh | 38 +++++++++++++++++++++++++++++++++
kexec-tools.spec | 5 +++--
2 files changed, 41 insertions(+), 2 deletions(-)
rename kdump.conf => gen-kdump-conf.sh (95%)
mode change 100644 => 100755
diff --git a/kdump.conf b/gen-kdump-conf.sh
old mode 100644
new mode 100755
similarity index 95%
rename from kdump.conf
rename to gen-kdump-conf.sh
index e598a49..b71257d
--- a/kdump.conf
+++ b/gen-kdump-conf.sh
@@ -1,3 +1,12 @@
+#!/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.
#
@@ -192,3 +201,32 @@ core_collector makedumpfile -l --message-level 7 -d 31
#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
1 year
[PATCH] unit tests: adapt check_config to gen-kdump-conf.sh
by Pingfan Liu
Now, kdump.conf is generated by gen-kdump-conf.sh, hence adapting
check_config to run that script firstly then check the generated file.
Signed-off-by: Pingfan Liu <piliu(a)redhat.com>
---
spec/kdumpctl_general_spec.sh | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/spec/kdumpctl_general_spec.sh b/spec/kdumpctl_general_spec.sh
index 5a3ce1c..44294a5 100644
--- a/spec/kdumpctl_general_spec.sh
+++ b/spec/kdumpctl_general_spec.sh
@@ -178,6 +178,7 @@ Describe 'kdumpctl'
bad_kdump_conf=$(mktemp -t bad_kdump_conf.XXXXXXXXXX)
cleanup() {
rm -f "$bad_kdump_conf"
+ rm -f kdump.conf
}
AfterAll 'cleanup'
@@ -189,8 +190,16 @@ Describe 'kdumpctl'
The stderr should include 'Invalid kdump config option blabla'
End
+ Parameters
+ aarch64
+ ppc64le
+ s390x
+ x86_64
+ End
+
It 'should be happy with the default kdump.conf'
# shellcheck disable=SC2034
+ ./gen-kdump-conf.sh x86_64 > kdump.conf
# override the KDUMP_CONFIG_FILE variable
KDUMP_CONFIG_FILE=./kdump.conf
When call parse_config
--
2.31.1
1 year
[PATCH] kdumpctl: Optimize _find_kernel_path_by_release regex string
by Lichen Liu
Currently _find_kernel_path_by_release uses grubby and grep to
find the kernel path, if both the normal kernel and it's debug
varient exist, the grep will give more than one kernel strings.
```
kernel="/boot/vmlinuz-5.14.0-139.kpq0.el9.s390x+debug"
kernel="/boot/vmlinuz-5.14.0-139.kpq0.el9.s390x"
```
On the s390x arch, which uses zipl but not grub as bootloader,
this will cause an error when installing debug kernel.
```
The param "/boot/vmlinuz-5.14.0-139.kpq0.el9.s390x+debug
/boot/vmlinuz-5.14.0-139.kpq0.el9.s390x" is incorrect
```
Signed-off-by: Lichen Liu <lichliu(a)redhat.com>
---
kdumpctl | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kdumpctl b/kdumpctl
index 7caaae5..63c78b0 100755
--- a/kdumpctl
+++ b/kdumpctl
@@ -1353,7 +1353,7 @@ _filter_grubby_kernel_str()
_find_kernel_path_by_release()
{
local _release="$1" _grubby_kernel_str _kernel_path
- _grubby_kernel_str=$(grubby --info ALL | grep "^kernel=.*$_release")
+ _grubby_kernel_str=$(grubby --info ALL | grep "^kernel=.*$_release\"$")
_kernel_path=$(_filter_grubby_kernel_str "$_grubby_kernel_str")
if [[ -z $_kernel_path ]]; then
derror "kernel $_release doesn't exist"
--
2.37.3
1 year
[PATCH 0/2] fadump improvements
by Hari Bathini
This set tries to do a couple of improvements to fadump. The 1st patch
ensures fadump initramfs is cleaned up on kernel uninstall. The 2nd
patch makes 'zstd' as the default compression method for fadump.
Hari Bathini (2):
fadump: add a kernel install hook to clean up fadump initramfs
fadump: use 'zstd' as the default compression method
60-fadump.install | 30 ++++++++++++++++++++++++++++++
kexec-tools.spec | 3 +++
mkfadumprd | 6 ++----
3 files changed, 35 insertions(+), 4 deletions(-)
create mode 100755 60-fadump.install
--
2.38.1
1 year