[PATCH] Install nfsv4-related drivers when users specify nfs dumping via dracut_args
by Coiby Xu
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2140721
Currently, if users specify dumping to nfsv4 target via
dracut_args --mount "<NFS-server-ip>:/var/crash /mnt nfs defaults"
it fails with the following errors,
[ 5.159760] mount[446]: mount.nfs: Protocol not supported
[ 5.164502] systemd[1]: mnt.mount: Mount process exited, code=exited, status=32/n/a
[ 5.167616] systemd[1]: mnt.mount: Failed with result 'exit-code'.
[FAILED] Failed to mount /mnt.
This is because nfsv4-releted drivers are not installed to kdump initrd.
mkdumprd calls dracut with "--hostonly-mode strict". If nfsv4-related
drivers aren't loaded before calling dracut, they won't be installed.
When users specify nfs dumping via dracut_args, kexec-tools won't mount
the nfs fs beforehand hence nfsv4-related drivers won't be installed.
Note dracut only installs the nfs driver i.e. nfsv3 driver for "--mount
... nfs". So also install nfsv4-related drivers when users specify nfs
dumping via dracut_args. Since nfs_layout_nfsv41_files depends on nfsv4,
the nfsv4 driver will be installed automatically.
As for the reason why we support nfs dumping via dracut_args instead of
asking user to use the nfs directive, please refer to commit 74c6f464
("Support special mount information via 'dracut_args'").
Fixes: 4eedcae5 ("dracut-module-setup.sh: don't include multipath-hostonly")
Reported-by: rcheerla(a)redhat.com
Signed-off-by: Coiby Xu <coxu(a)redhat.com>
---
mkdumprd | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/mkdumprd b/mkdumprd
index 3e250e02..51ca4f01 100644
--- a/mkdumprd
+++ b/mkdumprd
@@ -420,6 +420,15 @@ while read -r config_opt config_val; do
verify_core_collector "$config_val"
;;
dracut_args)
+
+ # When users specify nfs dumping via dracut_args, kexec-tools won't
+ # mount nfs fs beforehand thus nfsv4-related drivers won't be installed
+ # because we call dracut with --hostonly-mode strict. So manually install
+ # nfsv4-related drivers.
+ if [[ $(get_dracut_args_fstype "$config_val") == nfs* ]]; then
+ add_dracut_arg "--add-drivers" nfs_layout_nfsv41_files
+ fi
+
while read -r dracut_arg; do
add_dracut_arg "$dracut_arg"
done <<< "$(echo "$config_val" | xargs -n 1 echo)"
--
2.38.1
3 weeks, 1 day
[PATCH 00/13] various fixes and cleanups
by Philipp Rudo
Hi everybody,
here are a few patches before I go on Christmas vacation. I'll be back in
office on Jan 9th so you don't need to hurry to review them.
Patch 3 is a little bit special as in my opinion it only highlights the problem
but doesn't really fix it. For a proper fix one would need to move all
functions dracut-early-kdump.sh uses from kdump-lib to kdump-lib-initramfs and
make them POSIX compliant...
Thanks and see you next year
Philipp
Philipp Rudo (13):
kdumpctl: simplify check_failure_action_config
dracut-early-kdump: fix shellcheck findings
dracut-early-kdump: explicitly use bash
kdumpctl: merge check_current_{kdump,fadump}_status
mkfadumprd: drop unset globals from debug output
kdump-lib: always specify version in is_squash_available
unit tests: add tests for prepare_cmdline
kdumpctl: move aws workaround to kdump-lib
kdump-lib: fix prepare_cmdline
kdumpctl: cleanup 'start'
kdumpctl: cleanup 'stop'
kdumpctl: refractor check_rebuild
kdumpctl: make do_estimate more robust
.editorconfig | 2 +-
dracut-early-kdump.sh | 7 +-
kdump-lib.sh | 226 +++++++++++++++++---------------
kdumpctl | 287 +++++++++++++++--------------------------
mkfadumprd | 2 +-
spec/kdump-lib_spec.sh | 32 +++++
6 files changed, 266 insertions(+), 290 deletions(-)
mode change 100644 => 100755 mkfadumprd
--
2.38.1
3 weeks, 1 day
[PATCH] Don't try to update crashkernel when bootloader is not installed
by Coiby Xu
Currently when using anaconda to install the OS, the following errors
occur,
INF packaging: Configuring (running scriptlet for): kernel-core-5.14.0-70.el9.x86_64 ...
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
grep: /boot/grub2/grubenv: No such file or directory
...
INF packaging: Configuring (running scriptlet for): kexec-tools-2.0.23-9.el9.x86_64 ...
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
Or for s390, the following errors occur,
INF packaging: Configuring (running scriptlet for): kernel-core-5.14.0-71.el9.s390x ...
03:37:51,232 INF dnf.rpm: grep: /etc/zipl.conf: No such file or directory
grep: /etc/zipl.conf: No such file or directory
grep: /etc/zipl.conf: No such file or directory
INF packaging: Configuring (running scriptlet for): kexec-tools-2.0.23-9_1.el9_0.s390x ...
INF dnf.rpm: grep: /etc/zipl.conf: No such file or directory
This is because when anaconda installs the packages, bootloader hasn't
been installed and /boot/grub2/grubenv or /etc/zipl.conf doesn't exist.
So don't try to update crashkernel when bootloader isn't read to avoid
the above errors.
Note this is the second attempt to fix this issue. Previously a file
/tmp/kexec_tools_package_install was created to avoid running the
related code thus to avoid the above errors but unfortunately that
approach has two issues a) somehow osbuild doesn't delete it for RHEL b)
this file could still exist if users manually remove kexec-tools.
Reported-by: Jan Stodola <jstodola(a)redhat.com>
Signed-off-by: Coiby Xu <coxu(a)redhat.com>
---
kdumpctl | 17 ++++++++---------
kexec-tools.spec | 5 -----
2 files changed, 8 insertions(+), 14 deletions(-)
diff --git a/kdumpctl b/kdumpctl
index 3cad3dd0..361bf51a 100755
--- a/kdumpctl
+++ b/kdumpctl
@@ -1611,10 +1611,13 @@ reset_crashkernel()
fi
}
-# to tell if it's package install other than upgrade
-_is_package_install()
+_is_bootloader_installed()
{
- [[ -f /tmp/kexec_tools_package_install ]]
+ if [[ $(uname -r) == s390x ]]; then
+ test -f /etc/zipl.conf
+ else
+ test -f /boot/grub2/grub.cfg
+ fi
}
# update the crashkernel value in GRUB_ETC_DEFAULT if necessary
@@ -1626,10 +1629,6 @@ update_crashkernel_in_grub_etc_default_after_update()
local _crashkernel _fadump_val
local _dump_mode _old_default_crashkernel _new_default_crashkernel
- if _is_package_install; then
- return
- fi
-
if [[ $(uname -m) == s390x ]]; then
return
fi
@@ -1659,7 +1658,7 @@ 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
+ if ! _is_bootloader_installed; then
return
fi
@@ -1715,7 +1714,7 @@ reset_crashkernel_for_installed_kernel()
# During package install, only try to reset crashkernel for osbuild
# thus to avoid calling grubby when installing os via anaconda
- if _is_package_install && ! _is_osbuild; then
+ if ! _is_bootloader_installed && ! _is_osbuild; then
return
fi
diff --git a/kexec-tools.spec b/kexec-tools.spec
index 24fad768..1ee17707 100644
--- a/kexec-tools.spec
+++ b/kexec-tools.spec
@@ -268,11 +268,6 @@ if [ ! -f /run/ostree-booted ] && [ $1 == 2 ] && grep -q get-default-crashkernel
kdumpctl get-default-crashkernel fadump > /tmp/old_default_crashkernel_fadump 2>/dev/null
%endif
fi
-# indicate it's package install so kdumpctl later will only reset crashkernel
-# value for osbuild.
-if [ $1 == 1 ]; then
- touch /tmp/kexec_tools_package_install
-fi
# don't block package update
:
--
2.38.1
1 month, 1 week
[PATCH] dracut-module-setup.sh: also install the driver of physical NIC for Hyper-V VM with accelerated networking
by Coiby Xu
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2151842
Currently, vmcore dumping to remote fs fails on Azure Hyper-V VM with
accelerated networking because it uses a physical NIC for accrelarated
networking [1]. In this case, the driver for this physical NIC should be
installed as well.
[1] https://learn.microsoft.com/en-us/azure/virtual-network/accelerated-netwo...
Fixes: a65dde2d ("Reduce kdump memory consumption by only installing needed NIC drivers")
Reported-by: Xiaoqiang Xiong <xxiong(a)redhat.com>
Signed-off-by: Coiby Xu <coxu(a)redhat.com>
---
dracut-module-setup.sh | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh
index 13e99015..d52d39df 100755
--- a/dracut-module-setup.sh
+++ b/dracut-module-setup.sh
@@ -381,6 +381,14 @@ _get_nic_driver() {
ethtool -i "$1" | sed -n -E "s/driver: (.*)/\1/p"
}
+_get_hpyerv_physical_driver() {
+ local _physical_nic
+
+ _physical_nic=$(find /sys/class/net/"$1"/ -name 'lower_*' | sed -En "s/\/.*lower_(.*)/\1/p")
+ [[ -n $_physical_nic ]] || return
+ _get_nic_driver "$_physical_nic"
+}
+
kdump_install_nic_driver() {
local _netif _driver _drivers
@@ -399,6 +407,11 @@ kdump_install_nic_driver() {
elif [[ $_driver == "team" ]]; then
# install the team mode drivers like team_mode_roundrobin.ko as well
_driver='=drivers/net/team'
+ elif [[ $_driver == "hv_netvsc" ]]; then
+ # A Hyper-V VM may have accelerated networking
+ # https://learn.microsoft.com/en-us/azure/virtual-network/accelerated-netwo...
+ # Install the driver of physical NIC as well
+ _drivers+=("$(_get_hpyerv_physical_driver "$_netif")")
fi
_drivers+=("$_driver")
--
2.38.1
1 month, 2 weeks
[PATCH] dracut-module-setup.sh: skip installing driver for loopback device
by Coiby Xu
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2151500
Currently, kdump initrd fails to be built when dumping vmcore to
localhost via ssh or nfs,
kdumpctl[3331]: Cannot get driver information: Operation not supported
kdumpctl[1991]: dracut: Failed to get the driver of lo
dracut[2020]: Failed to get the driver of lo
kdumpctl[1775]: kdump: mkdumprd: failed to make kdump initrd
kdumpctl[1775]: kdump: Starting kdump: [FAILED]
systemd[1]: kdump.service: Main process exited, code=exited, status=1/FAILURE
systemd[1]: kdump.service: Failed with result 'exit-code'.
systemd[1]: Failed to start Crash recovery kernel arming.
systemd[1]: kdump.service: Consumed 1.710s CPU time.
This is because the loopback device is used for transferring vmcore and
ethtool can't get the driver of a loopback device. In fact, once
COFNIG_NET is enabled, looback device is enabled and there is no driver
for a loopback device. So skip installing driver for loopback device.
Fixes: a65dde2d ("Reduce kdump memory consumption by only installing needed NIC drivers")
Reported-by: Martin Pitt <mpitt(a)redhat.com>
Reported-by: Rich Megginson <rmeggins(a)redhat.com>
Signed-off-by: Coiby Xu <coxu(a)redhat.com>
---
dracut-module-setup.sh | 2 ++
1 file changed, 2 insertions(+)
diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh
index 13e99015..f82349cb 100755
--- a/dracut-module-setup.sh
+++ b/dracut-module-setup.sh
@@ -387,6 +387,7 @@ kdump_install_nic_driver() {
_drivers=()
for _netif in $1; do
+ ! ip addr show "$_netif" | grep "link/loopback" || continue
_driver=$(_get_nic_driver "$_netif")
if [[ -z $_driver ]]; then
derror "Failed to get the driver of $_netif"
@@ -404,6 +405,7 @@ kdump_install_nic_driver() {
_drivers+=("$_driver")
done
+ [[ -n ${_drivers[*]} ]] || return
instmods "${_drivers[@]}"
}
--
2.38.1
1 month, 2 weeks
Re: [PATCH] dracut-module-setup.sh: skip installing driver for
loopback device
by Coiby Xu
On Thu, Dec 15, 2022 at 05:32:02PM +0100, Martin Pitt wrote:
>Hello Coiby,
>
>Coiby Xu [2022-12-15 18:46 +0800]:
>> Hi Martin,
>> Thanks for raising the above concerns! To find a simpler solution, I
>> checked linux/drivers/net/loopback.c and find there is only one loopback
>> interface and the name always "lo". So the following code would be
>> sufficient,
>>
>> [ $_netif != lo ] || continue
>
>Sure, that looks nice and clean, especially if you *don't* want to apply this
>to other virtual devices.
>
>> Btw, ip and grep are used quite often in kexec-tools. I'm curious in
>> what way do you feel they are heavy? In fact, the cost of ip and grep
>> is negligible compared with the cost of calling dracut to build
>> initramfs.
>
>It's ok, I just generally try to avoid grepping text meant for human
>consumption (this might even be translated!), and avoiding calling two programs
>and a shell when a shell builtin and proper API is available.
Thanks for the explanation! Yeah, I also prefer to avoid parsing text
using grep/sed if possible. In fact, one motivation behind the recent
network changes is also to avoid parsing NetworkManager connection
profiles.
>
>> > Hence I would recommend this instead:
>> >
>> > [ -e "/sys/class/net/$_netif/device/driver" ] || continue
>> >
>> > and rename the commit to "skip installing driver for virtual devices" or so.
>>
>> >
>> > I tested this with ssh/localhost as well. It has the added benefit of not
>> > relying on "ip show" format, is more robust, more generic, and not even a new
>> > concept: that script already looks at /sys/class/net anyway.
>>
>> Unfortunately what you propose won't work.
>>
>> 1. kexec-tools wants to only install needed drivers to save memory and
>> it's this dracut module's job to install needed drivers which may
>> include the drivers of virtual devices e.g. bond, team or vlan device
>> as well i.e. no one else will install these drivers.
>
>Right, I just meant that it might crash the same way for other virtual devices
>like veth or wireguard. I didn't test this.
Thanks for the clarification! I just checked veth has the API for
ethtool to get driver info but this is not case for wireguard. Note even
if ethtool can get driver info for wireguard, kexec-tools doesn't
support wireguard as it depends on dracut to install the necessary
binary's like the ones in wireguard-tools.
This discussion makes me realize ethtool may not be robust as I have
expected and it also inspires me to do an exhaustive test on how many
drivers supports ethtool by iterating all network drivers. So thank you!
>
>> 2. ethtool talks to the driver via the netlink interface [1]. It doesn't
>> use /sys/class/net/$_netif/device/driver to get the driver info.
>
>Ack, if that's what the dracut function uses, that sounds fine.
>
>So in summary, your `[ $_netif != lo ]` looks preferable to me (simpler, more
>obvious, and much more robust), and it seems you ruled out my generalized
>patch, so it seems we have a winner?
Glad to know that:)
>
>Cheers!
>
>Martin
>
--
Best regards,
Coiby
1 month, 2 weeks
[PATCH] dracut-module-setup.sh: stop overwriting dracut's trap handler
by Coiby Xu
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2149246
Latest Workstation live x86_64 image has an excess increase of ~300 MB
in size. This is because kdumpbase module's trap handler overwrites
dracut's handler and DRACUT_TMPDIR which has three unpacked initramfs
files fails to be cleaned up. This patch moves kdumpbase module's
temporary folder under DRACUT_TMPDIR and lets dracut's trap handler do
the cleanup instead.
Fixes: d25b1ee3 ("Add functions to copy NetworkManage connection profiles to the initramfs")
Signed-off-by: Coiby Xu <coxu(a)redhat.com>
---
dracut-module-setup.sh | 9 +--------
1 file changed, 1 insertion(+), 8 deletions(-)
diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh
index 1fa2a789..13e99015 100755
--- a/dracut-module-setup.sh
+++ b/dracut-module-setup.sh
@@ -1,6 +1,6 @@
#!/bin/bash
-_DRACUT_KDUMP_NM_TMP_DIR="/tmp/$$-DRACUT_KDUMP_NM"
+_DRACUT_KDUMP_NM_TMP_DIR="$DRACUT_TMPDIR/$$-DRACUT_KDUMP_NM"
_save_kdump_netifs() {
unique_netifs[$1]=1
@@ -10,13 +10,6 @@ _get_kdump_netifs() {
echo -n "${!unique_netifs[@]}"
}
-cleanup() {
- rm -rf "$_DRACUT_KDUMP_NM_TMP_DIR"
-}
-
-# shellcheck disable=SC2154 # known issue of shellcheck https://github.com/koalaman/shellcheck/issues/1299
-trap 'ret=$?; cleanup; exit $ret;' EXIT
-
kdump_module_init() {
if ! [[ -d "${initdir}/tmp" ]]; then
mkdir -p "${initdir}/tmp"
--
2.38.1
1 month, 4 weeks
[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 month, 4 weeks
[PATCH v3 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 v3:
* Patch#1: Added Ack-by from Tao.
* Patch#2: Updated the patch according to Philipp's inputs.
* Patch#3: Updated the patch in accordance to changes in patch#2.
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 | 31 +++++++++++++++++++++++++++++++
kdumpctl | 6 ++++--
kexec-tools.spec | 3 +++
mkfadumprd | 6 ++----
4 files changed, 40 insertions(+), 6 deletions(-)
create mode 100755 60-fadump.install
--
2.38.1
1 month, 4 weeks
[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
2 months