[PATCH] spec: only install mkfadumprd for ppc
by Kairui Song
From: Kairui Song <kasong(a)tencent.com>
fadump is a ppc only feature, mkfadumprd is only needed for fadump, drop
it for other arch.
Signed-off-by: Kairui Song <kasong(a)tencent.com>
---
kexec-tools.spec | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/kexec-tools.spec b/kexec-tools.spec
index dffcce0..566a257 100644
--- a/kexec-tools.spec
+++ b/kexec-tools.spec
@@ -187,7 +187,6 @@ SYSCONFIG=$RPM_SOURCE_DIR/kdump.sysconfig.%{_target_cpu}
install -m 644 $SYSCONFIG $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/kdump
install -m 755 %{SOURCE7} $RPM_BUILD_ROOT/usr/sbin/mkdumprd
-install -m 755 %{SOURCE32} $RPM_BUILD_ROOT/usr/sbin/mkfadumprd
install -m 644 %{SOURCE8} $RPM_BUILD_ROOT%{_sysconfdir}/kdump.conf
install -m 644 kexec/kexec.8 $RPM_BUILD_ROOT%{_mandir}/man8/kexec.8
install -m 644 %{SOURCE12} $RPM_BUILD_ROOT%{_mandir}/man8/mkdumprd.8
@@ -196,6 +195,7 @@ install -m 755 %{SOURCE20} $RPM_BUILD_ROOT%{_prefix}/lib/kdump/kdump-lib.sh
install -m 755 %{SOURCE23} $RPM_BUILD_ROOT%{_prefix}/lib/kdump/kdump-lib-initramfs.sh
install -m 755 %{SOURCE31} $RPM_BUILD_ROOT%{_prefix}/lib/kdump/kdump-logger.sh
%ifarch ppc64 ppc64le
+install -m 755 %{SOURCE32} $RPM_BUILD_ROOT/usr/sbin/mkfadumprd
install -m 755 %{SOURCE35} $RPM_BUILD_ROOT%{_prefix}/lib/kdump/kdump-migrate-action.sh
install -m 755 %{SOURCE36} $RPM_BUILD_ROOT%{_prefix}/lib/kdump/kdump-restart.sh
%endif
@@ -351,8 +351,10 @@ done
%ifarch %{ix86} x86_64 ppc64 s390x ppc64le aarch64
/usr/sbin/makedumpfile
%endif
-/usr/sbin/mkdumprd
+%ifarch ppc64 ppc64le
/usr/sbin/mkfadumprd
+%endif
+/usr/sbin/mkdumprd
/usr/sbin/vmcore-dmesg
%{_bindir}/*
%{_datadir}/kdump
--
2.34.1
2 years, 3 months
[PATCH 1/2] selftest: run-test.sh: wait for subprocess instead of kill it
by Tao Liu
When run tests with 2 VMs, for example nfs/ssh kdump tests, client VM will do the
crash and dump, server VM will do vmcore saving and if-vmcore-exists
check.
Previously, when client VM finishes running, run-test.sh will kill the lead background
process, and then check if server VM has outputted "TEST PASSED" or "TEST FAILED" string.
However it didn't wait for server VM to finish. As a result, the server VM's final
outputs are not collected and checked, leaving the test result as "TEST RESULT NOT FOUND"
sometimes.
For example, the following is the pstree status of $(jobs -p) before it
gets killed. We can see the server VM is still running:
run-test.sh,172455 /root/kexec-tools/tests/scripts/run-test.sh --console nfs-early-kdump
└─run-test.sh,172457 /root/kexec-tools/tests/scripts/run-test.sh --console...
└─timeout,172480 --foreground 10m /root/kexec-tools/tests/scripts/run-qemu...
└─qemu-system-x86,172481 -enable-kvm -cpu host -nodefaults...
├─{qemu-system-x86},172489
├─{qemu-system-x86},172492
├─{qemu-system-x86},172493
├─{qemu-system-x86},172628
└─{qemu-system-x86},172629
In this patch, we will wait for $(jobs -p) to finish, in order to get
the complete output of test results.
Signed-off-by: Tao Liu <ltao(a)redhat.com>
---
tests/scripts/run-test.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tests/scripts/run-test.sh b/tests/scripts/run-test.sh
index c3e94a3..1501db4 100755
--- a/tests/scripts/run-test.sh
+++ b/tests/scripts/run-test.sh
@@ -140,7 +140,7 @@ for test_case in $testcases; do
if [ $console -eq 1 ]; then
run_test_sync $script | tee $(get_test_console_file $script)
- [ -n "$(jobs -p)" ] && kill $(jobs -p)
+ [ -n "$(jobs -p)" ] && wait $(jobs -p)
else
$(run_test_sync $script > $(get_test_console_file $script)) &
watch_test_outputs $test_outputs
--
2.33.1
2 years, 3 months
[PATCH] fix the error of parsing the container environ variable for osbuild
by Coiby Xu
The environment variable entries in /proc/[pid]/environ are separated by
null bytes instead of by spaces. Update the sed regex to fix this issue.
Note this patch also fixes a issue which is kdumpctl would try to reset
crashkernel even osbuild has provided custom crashkernel value.
Fixes: ddd428a ("set up kernel crashkernel for osbuild in kernel hook")
Signed-off-by: Coiby Xu <coxu(a)redhat.com>
---
kdumpctl | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/kdumpctl b/kdumpctl
index 8107487..b32fac0 100755
--- a/kdumpctl
+++ b/kdumpctl
@@ -1578,7 +1578,7 @@ reset_crashkernel_after_update()
_is_osbuild()
{
- [[ $(sed -n -E 's/.*(^|\s)container=(\S*).*/\2/p' < /proc/1/environ) == bwrap-osbuild ]]
+ [[ $(sed -n -E 's/.*(^|\x00)container=([^\x00]*).*/\2/p' < /proc/1/environ) == bwrap-osbuild ]]
}
reset_crashkernel_for_installed_kernel()
@@ -1590,8 +1590,10 @@ reset_crashkernel_for_installed_kernel()
exit 1
fi
- if _is_osbuild && ! grep -qs crashkernel= /etc/kernel/cmdline; then
- reset_crashkernel "--kernel=$_installed_kernel"
+ if _is_osbuild; then
+ if ! grep -qs crashkernel= /etc/kernel/cmdline; then
+ reset_crashkernel "--kernel=$_installed_kernel"
+ fi
return
fi
--
2.31.1
2 years, 3 months
[PATCH] logger: save log after all kdump progress finished
by Kairui Song
From: Kairui Song <kasong(a)tencent.com>
Make log saving the last step of kdump.sh, so it can catch more info, for
example, the output of post.d hooks will be covered by the log now.
Signed-off-by: Kairui Song <kasong(a)tencent.com>
---
dracut-kdump.sh | 27 +++++++++++++++------------
1 file changed, 15 insertions(+), 12 deletions(-)
diff --git a/dracut-kdump.sh b/dracut-kdump.sh
index b69bc98..b221eab 100755
--- a/dracut-kdump.sh
+++ b/dracut-kdump.sh
@@ -15,6 +15,8 @@ fi
KDUMP_PATH="/var/crash"
KDUMP_LOG_FILE="/run/initramfs/kexec-dmesg.log"
+KDUMP_LOG_DEST=""
+KDUMP_LOG_OP=""
CORE_COLLECTOR=""
DEFAULT_CORE_COLLECTOR="makedumpfile -l --message-level 7 -d 31"
DMESG_COLLECTOR="/sbin/vmcore-dmesg"
@@ -119,6 +121,10 @@ save_log()
journalctl -ab >> $KDUMP_LOG_FILE
fi
chmod 600 $KDUMP_LOG_FILE
+
+ dinfo "saving the $KDUMP_LOG_FILE to $KDUMP_LOG_DEST/"
+
+ eval "$KDUMP_LOG_OP"
}
# $1: dump path, must be a mount point
@@ -159,6 +165,9 @@ dump_fs()
save_opalcore_fs "$_dump_fs_path"
dinfo "saving vmcore"
+ KDUMP_LOG_DEST=$_dump_fs_path/
+ KDUMP_LOG_OP="mv '$KDUMP_LOG_FILE' '$KDUMP_LOG_DEST/'"
+
$CORE_COLLECTOR /proc/vmcore "$_dump_fs_path/vmcore-incomplete"
_dump_exitcode=$?
if [ $_dump_exitcode -eq 0 ]; then
@@ -167,12 +176,6 @@ dump_fs()
dinfo "saving vmcore complete"
else
derror "saving vmcore failed, exitcode:$_dump_exitcode"
- fi
-
- dinfo "saving the $KDUMP_LOG_FILE to $_dump_fs_path/"
- save_log
- mv "$KDUMP_LOG_FILE" "$_dump_fs_path/"
- if [ $_dump_exitcode -ne 0 ]; then
return 1
fi
@@ -395,8 +398,12 @@ dump_ssh()
ssh -q $_ssh_opt "$2" mkdir -p "$_ssh_dir" || return 1
save_vmcore_dmesg_ssh "$DMESG_COLLECTOR" "$_ssh_dir" "$_ssh_opt" "$2"
+
dinfo "saving vmcore"
+ KDUMP_LOG_DEST=$2:$_ssh_dir/
+ KDUMP_LOG_OP="scp -q $_ssh_opt '$KDUMP_LOG_FILE' '$_scp_address:$_ssh_dir/'"
+
save_opalcore_ssh "$_ssh_dir" "$_ssh_opt" "$2" "$_scp_address"
if [ "${CORE_COLLECTOR%%[[:blank:]]*}" = "scp" ]; then
@@ -421,12 +428,6 @@ dump_ssh()
derror "saving vmcore failed, exitcode:$_ret"
fi
- dinfo "saving the $KDUMP_LOG_FILE to $2:$_ssh_dir/"
- save_log
- if ! scp -q $_ssh_opt $KDUMP_LOG_FILE "$_scp_address:$_ssh_dir/"; then
- derror "saving log file failed, _exitcode:$_ret"
- fi
-
return $_ret
}
@@ -576,6 +577,8 @@ if ! do_kdump_post $DUMP_RETVAL; then
derror "kdump_post script exited with non-zero status!"
fi
+save_log
+
if [ $DUMP_RETVAL -ne 0 ]; then
exit 1
fi
--
2.34.1
2 years, 3 months
[PATCHv2] move variable FENCE_KDUMP_SEND from kdump-lib.sh to kdump-lib-initramfs.sh
by Pingfan Liu
Since kdump-lib-initramfs.sh is included by kdump-lib.sh, and
FENCE_KDUMP_SEND is used by both 1st and 2nd kernel, moving
FENCE_KDUMP_SEND from kdump-lib.sh to kdump-lib-initramfs.sh.
Signed-off-by: Pingfan Liu <piliu(a)redhat.com>
---
kdump-lib-initramfs.sh | 2 ++
kdump-lib.sh | 2 --
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/kdump-lib-initramfs.sh b/kdump-lib-initramfs.sh
index c1fd75f..9be0fe9 100755
--- a/kdump-lib-initramfs.sh
+++ b/kdump-lib-initramfs.sh
@@ -5,6 +5,8 @@
DEFAULT_PATH="/var/crash/"
KDUMP_CONFIG_FILE="/etc/kdump.conf"
+FENCE_KDUMP_CONFIG_FILE="/etc/sysconfig/fence_kdump"
+FENCE_KDUMP_SEND="/usr/libexec/fence_kdump_send"
# Read kdump config in well formated style
kdump_read_conf()
diff --git a/kdump-lib.sh b/kdump-lib.sh
index ca086d7..0e64f22 100755
--- a/kdump-lib.sh
+++ b/kdump-lib.sh
@@ -5,8 +5,6 @@
. /usr/lib/kdump/kdump-lib-initramfs.sh
-FENCE_KDUMP_CONFIG_FILE="/etc/sysconfig/fence_kdump"
-FENCE_KDUMP_SEND="/usr/libexec/fence_kdump_send"
FADUMP_ENABLED_SYS_NODE="/sys/kernel/fadump_enabled"
is_fadump_capable()
--
2.31.1
2 years, 3 months
[PATCH] spec: add hostname.rpm into Recommends list
by Pingfan Liu
kexec-tools runs hostname binary in the case of fence_kdump. Since this
is a trival dependency and should not block the kexec-tools installation
if non-existent, using weak-dependency to resolve it.
Signed-off-by: Pingfan Liu <piliu(a)redhat.com>
---
kexec-tools.spec | 1 +
1 file changed, 1 insertion(+)
diff --git a/kexec-tools.spec b/kexec-tools.spec
index 7419723..ab9666b 100644
--- a/kexec-tools.spec
+++ b/kexec-tools.spec
@@ -72,6 +72,7 @@ Requires: dracut-squash >= 050
Requires: ethtool
Recommends: zstd
Recommends: grubby
+Recommends: hostname
BuildRequires: make
BuildRequires: zlib-devel elfutils-devel glib2-devel bzip2-devel ncurses-devel bison flex lzo-devel snappy-devel libzstd-devel
BuildRequires: pkgconfig intltool gettext
--
2.31.1
2 years, 3 months
[PATCH] Failback to default compression method if zstd fails
by Tao Liu
zstd is set as the default compression method. "--compress zstd"
will make dracut to decide: a) if dracut module squash is added,
libzstd will be used, b) otherwise cmd zstd will be used. However in
kexec-tools we cannot guarantee dracut module squash is added, for
example users can set omit_dracutmodules in dracut.conf and etc, so
is_squash_available is not able to check is libzstd or cmd zstd
been used at runtime.
This patch will give "--compress zstd" a try first, if fails, it will
just proceed the default compression method.
Fixes: 7de4a0d ("Set zstd as recommented for kexec-tools")
Signed-off-by: Tao Liu <ltao(a)redhat.com>
---
kdump-lib.sh | 5 -----
mkdumprd | 21 ++++++++++++---------
mkfadumprd | 7 ++++---
3 files changed, 16 insertions(+), 17 deletions(-)
diff --git a/kdump-lib.sh b/kdump-lib.sh
index 2ea51be..6415dda 100755
--- a/kdump-lib.sh
+++ b/kdump-lib.sh
@@ -31,11 +31,6 @@ is_squash_available()
done
}
-is_zstd_command_available()
-{
- [[ -x "$(command -v zstd)" ]]
-}
-
perror_exit()
{
derror "$@"
diff --git a/mkdumprd b/mkdumprd
index 593ec77..10398ef 100644
--- a/mkdumprd
+++ b/mkdumprd
@@ -431,15 +431,6 @@ done <<< "$(kdump_read_conf)"
handle_default_dump_target
-if ! have_compression_in_dracut_args; then
- # Here zstd is set as the default compression method. If squash module
- # is available for dracut, libzstd will be used by mksquashfs. If
- # squash module is unavailable, command zstd will be used instead.
- if is_squash_available || is_zstd_command_available; then
- add_dracut_arg "--compress" "zstd"
- fi
-fi
-
if [[ -n $extra_modules ]]; then
add_dracut_arg "--add-drivers" "$extra_modules"
fi
@@ -457,6 +448,18 @@ if ! is_fadump_capable; then
add_dracut_arg "--no-hostonly-default-device"
fi
+if ! have_compression_in_dracut_args; then
+ # Here we will first try to compress in zstd, if fails we will proceed
+ # the default compress method.
+ dracut "${dracut_args[@]}" "--compress" "zstd" "$@" 2>/dev/null
+ _rc=$?
+
+ if [[ $_rc -eq 0 ]]; then
+ sync
+ exit $_rc
+ fi
+fi
+
dracut "${dracut_args[@]}" "$@"
_rc=$?
diff --git a/mkfadumprd b/mkfadumprd
index 86dfcee..f3cfe8a 100644
--- a/mkfadumprd
+++ b/mkfadumprd
@@ -64,9 +64,10 @@ fi
# Same as setting zstd in mkdumprd
if ! have_compression_in_dracut_args; then
- if is_squash_available || is_zstd_command_available; then
- _dracut_isolate_args+=(--compress zstd)
- fi
+ dracut --force --quiet "${_dracut_isolate_args[@]}" "--compress" "zstd" "$@" "$TARGET_INITRD" 2>/dev/null
+ _rc=$?
+
+ [[ $_rc -eq 0 ]] && exit $_rc
fi
if ! dracut --force --quiet "${_dracut_isolate_args[@]}" "$@" "$TARGET_INITRD"; then
--
2.33.1
2 years, 3 months
[PATCH] Set zstd as the default compression method for dumping vmcore
by Tao Liu
Currently zstd has been supported both for makedumpfile and crash
utility. So let's use zstd as the default vmcore compression method
instead of lzo.
Signed-off-by: Tao Liu <ltao(a)redhat.com>
---
kdump.conf | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kdump.conf b/kdump.conf
index dea2e94..502730e 100644
--- a/kdump.conf
+++ b/kdump.conf
@@ -171,7 +171,7 @@
#ssh user@2001:db8::1:2:3:4
#sshkey /root/.ssh/kdump_id_rsa
path /var/crash
-core_collector makedumpfile -l --message-level 7 -d 31
+core_collector makedumpfile -z --message-level 7 -d 31
#core_collector scp
#kdump_post /var/crash/scripts/kdump-post.sh
#kdump_pre /var/crash/scripts/kdump-pre.sh
--
2.33.1
2 years, 3 months
[PATCH] move variable FENCE_KDUMP_SEND from kdump-lib.sh to kdump-lib-initramfs.sh
by Pingfan Liu
Since kdump-lib-initramfs.sh is included by kdump-lib.sh, and
FENCE_KDUMP_SEND is used by both 1st and 2nd kernel, moving
FENCE_KDUMP_SEND from kdump-lib.sh to kdump-lib-initramfs.sh.
Signed-off-by: Pingfan Liu <piliu(a)redhat.com>
---
kdump-lib-initramfs.sh | 1 +
kdump-lib.sh | 1 -
2 files changed, 1 insertion(+), 1 deletion(-)
diff --git a/kdump-lib-initramfs.sh b/kdump-lib-initramfs.sh
index c1fd75f..e309ed2 100755
--- a/kdump-lib-initramfs.sh
+++ b/kdump-lib-initramfs.sh
@@ -5,6 +5,7 @@
DEFAULT_PATH="/var/crash/"
KDUMP_CONFIG_FILE="/etc/kdump.conf"
+FENCE_KDUMP_SEND="/usr/libexec/fence_kdump_send"
# Read kdump config in well formated style
kdump_read_conf()
diff --git a/kdump-lib.sh b/kdump-lib.sh
index ca086d7..8581650 100755
--- a/kdump-lib.sh
+++ b/kdump-lib.sh
@@ -6,7 +6,6 @@
. /usr/lib/kdump/kdump-lib-initramfs.sh
FENCE_KDUMP_CONFIG_FILE="/etc/sysconfig/fence_kdump"
-FENCE_KDUMP_SEND="/usr/libexec/fence_kdump_send"
FADUMP_ENABLED_SYS_NODE="/sys/kernel/fadump_enabled"
is_fadump_capable()
--
2.31.1
2 years, 3 months
[PATCH v2] Set zstd as recommented for kexec-tools
by Tao Liu
This patch will make zstd as recommended instead of required for
kexec-tools. If zstd command/package is unavaliable, it can failback to invoke
gzip when making kdump initramfs.
Fixes: 0311f6e ("Set zstd as the default compression method for kdump initrd")
Signed-off-by: Tao Liu <ltao(a)redhat.com>
---
v1 -> v2: Add code comment. Code refactor in mkfadumprd.
---
kdump-lib.sh | 5 +++++
kexec-tools.spec | 2 +-
mkdumprd | 7 ++++++-
mkfadumprd | 5 ++++-
4 files changed, 16 insertions(+), 3 deletions(-)
diff --git a/kdump-lib.sh b/kdump-lib.sh
index 6415dda..2ea51be 100755
--- a/kdump-lib.sh
+++ b/kdump-lib.sh
@@ -31,6 +31,11 @@ is_squash_available()
done
}
+is_zstd_command_available()
+{
+ [[ -x "$(command -v zstd)" ]]
+}
+
perror_exit()
{
derror "$@"
diff --git a/kexec-tools.spec b/kexec-tools.spec
index 90f9355..367929a 100644
--- a/kexec-tools.spec
+++ b/kexec-tools.spec
@@ -71,7 +71,7 @@ Requires: dracut >= 050
Requires: dracut-network >= 050
Requires: dracut-squash >= 050
Requires: ethtool
-Requires: zstd
+Recommends: zstd
Recommends: grubby
BuildRequires: make
BuildRequires: zlib-devel elfutils-devel glib2-devel bzip2-devel ncurses-devel bison flex lzo-devel snappy-devel libzstd-devel
diff --git a/mkdumprd b/mkdumprd
index 9c26ecc..593ec77 100644
--- a/mkdumprd
+++ b/mkdumprd
@@ -432,7 +432,12 @@ done <<< "$(kdump_read_conf)"
handle_default_dump_target
if ! have_compression_in_dracut_args; then
- add_dracut_arg "--compress" "zstd"
+ # Here zstd is set as the default compression method. If squash module
+ # is available for dracut, libzstd will be used by mksquashfs. If
+ # squash module is unavailable, command zstd will be used instead.
+ if is_squash_available || is_zstd_command_available; then
+ add_dracut_arg "--compress" "zstd"
+ fi
fi
if [[ -n $extra_modules ]]; then
diff --git a/mkfadumprd b/mkfadumprd
index 16fdacc..86dfcee 100644
--- a/mkfadumprd
+++ b/mkfadumprd
@@ -62,8 +62,11 @@ if is_squash_available; then
_dracut_isolate_args+=(--add squash)
fi
+# Same as setting zstd in mkdumprd
if ! have_compression_in_dracut_args; then
- _dracut_isolate_args+=(--compress zstd)
+ if is_squash_available || is_zstd_command_available; then
+ _dracut_isolate_args+=(--compress zstd)
+ fi
fi
if ! dracut --force --quiet "${_dracut_isolate_args[@]}" "$@" "$TARGET_INITRD"; then
--
2.33.1
2 years, 3 months