[PATCH 1/2] Try to install PHY and MDIO bus drivers explicitly
by Coiby Xu
Resolves: https://issues.redhat.com/browse/RHEL-7028
Currently, nfs dumping fails on some machines that has a dedicated PHY
driver (dealing with the physical layer) or MDIO bus (connecting the MAC
to PHY devices) driver. This is because kexec-tools doesn't install
dedicated PHY or MDIO driver explicitly and the NIC driver don't specify
the dependency on the needed PHY or MDIO driver. So when the dependency
on a PHY driver or MDIO driver is not found by dracut's instmods, the
PHY or MDIO driver won't be installed.
This patch passes =drivers/net/phy and =drivers/net/mdio to dracut's
instmods which will only install in-use PHY or MDIO driver(s).
Note ideally we should find out which PHY driver is used by a NIC but
unfortunately currently no universal way can be found
(/sys/class/net/NIC_NAME/device/driver/module can be used to find the
name of the PHY driver for some NICs but it doesn't exist for some NICs
like Qualcomm Atheros AR8031). So is it for a MDIO bus driver.
Fortunately currently no huge memory consumption is found for a PHY or
MDIO driver.
Fixes: a65dde2d ("Reduce kdump memory consumption by only installing needed NIC drivers")
Reported-by: Doreen Alongi <dalongi(a)redhat.com>
Signed-off-by: Coiby Xu <coxu(a)redhat.com>
---
dracut-module-setup.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh
index ff53d084..905e6fbd 100755
--- a/dracut-module-setup.sh
+++ b/dracut-module-setup.sh
@@ -381,7 +381,7 @@ _get_hpyerv_physical_driver() {
kdump_install_nic_driver() {
local _netif _driver _drivers
- _drivers=()
+ _drivers=('=drivers/net/phy' '=drivers/net/mdio')
for _netif in $1; do
[[ $_netif == lo ]] && continue
--
2.41.0
1 week, 2 days
[PATCH] Get rid of "grep: warning: stray \ before /"
by Coiby Xu
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2242185
grep (3.8) warnings when running the unit tests or running
"kdumpctl reset-crashkernel" on >= F39,
# unit tests
Examples:
1) kdumpctl _find_kernel_path_by_release() returns the kernel path for the given release
When call _find_kernel_path_by_release vmlinuz-6.2.11-200.fc37.x86_64
1.1) WARNING: There was output to stderr but not found expectation
stderr: grep: warning: stray \ before /
# spec/kdumpctl_general_spec.sh:169-172
# kdumpctl reset-crashkernel
grep: warning: stray \ before /
kdump: Updated crashkernel=1G-4G:192M,4G-64G:256M,64G-:512M for kernel=/boot/vmlinuz-6.6.8-200.fc39.x86_64. Please reboot the system for the change to take effect.
This warning can be reproduced by
echo 'kernel="/boot/vmlinuz-6.4.6-200.fc38.x86_64"' | grep -E "^kernel=.*$_release(\/\w+)?\"$"
This patch removes unneeded backslash. It also adds a test for
systemd-boot path. And for simplification, Parameters:dynamic is now
used to generate test data dynamically.
Fixes: 8af05dc4 ("kdumpctl: Add support for systemd-boot paths")
Signed-off-by: Coiby Xu <coxu(a)redhat.com>
---
kdumpctl | 2 +-
spec/kdumpctl_general_spec.sh | 21 +++++++++++++++------
2 files changed, 16 insertions(+), 7 deletions(-)
diff --git a/kdumpctl b/kdumpctl
index 45277a79..30eb27dd 100755
--- a/kdumpctl
+++ b/kdumpctl
@@ -1412,7 +1412,7 @@ _find_kernel_path_by_release()
# Insert '/' before '+' to cope with grep's EREs
_release=${_release//+/\\+}
- _grubby_kernel_str=$(grubby --info ALL | grep -E "^kernel=.*$_release(\/\w+)?\"$")
+ _grubby_kernel_str=$(grubby --info ALL | grep -E "^kernel=.*$_release(/\w+)?\"$")
_kernel_path=$(_filter_grubby_kernel_str "$_grubby_kernel_str")
if [[ -z $_kernel_path ]]; then
ddebug "kernel $_release doesn't exist"
diff --git a/spec/kdumpctl_general_spec.sh b/spec/kdumpctl_general_spec.sh
index 243aeca3..f69924f6 100644
--- a/spec/kdumpctl_general_spec.sh
+++ b/spec/kdumpctl_general_spec.sh
@@ -156,16 +156,25 @@ Describe 'kdumpctl'
End
Describe '_find_kernel_path_by_release()'
+ # When the array length changes, the Parameters:dynamic should change as well
+ kernel_paths=(/boot/vmlinuz-6.2.11-200.fc37.x86_64 /boot/vmlinuz-5.14.0-316.el9.aarch64+64k /boot/vmlinuz-5.14.0-322.el9.aarch64 /boot/efi/36b54597c46383/6.4.0-0.rc0.20230427git6e98b09da931.5.fc39.aarch64/linux)
+ kernels=(vmlinuz-6.2.11-200.fc37.x86_64 vmlinuz-5.14.0-316.el9.aarch64+64k vmlinuz-5.14.0-322.el9.aarch64 6.4.0-0.rc0.20230427git6e98b09da931.5.fc39.aarch64)
+
grubby() {
- echo -e 'kernel="/boot/vmlinuz-6.2.11-200.fc37.x86_64"\nkernel="/boot/vmlinuz-5.14.0-322.el9.aarch64"\nkernel="/boot/vmlinuz-5.14.0-316.el9.aarch64+64k"'
+ for key in "${!kernel_paths[@]}"; do
+ echo "kernel=\"${kernel_paths[$key]}\""
+ done
}
- Parameters
- # parameter answer
- vmlinuz-6.2.11-200.fc37.x86_64 /boot/vmlinuz-6.2.11-200.fc37.x86_64
- vmlinuz-5.14.0-322.el9.aarch64 /boot/vmlinuz-5.14.0-322.el9.aarch64
- vmlinuz-5.14.0-316.el9.aarch64+64k /boot/vmlinuz-5.14.0-316.el9.aarch64+64k
+ Parameters:dynamic
+ # Due to a bug [1] in shellspec, hardcode the loop number instead of using the
+ # array length
+ # [1] https://github.com/shellspec/shellspec/issues/259
+ for key in {0..3}; do
+ %data "${kernels[$key]}" "${kernel_paths[$key]}"
+ done
End
+
It 'returns the kernel path for the given release'
When call _find_kernel_path_by_release "$1"
The output should equal "$2"
--
2.43.0
2 months, 3 weeks
[PATCH] kdump-dep-generator: source kdump-lib-initramfs.sh instead
by Kairui Song
From: Kairui Song <kasong(a)tencent.com>
Currently kdump-dep-generator will source kdump-lib.sh. Notice
kdump-dep-generator have #!/bin/sh so it should be POSIX, but
kdump-lib.sh is a non-POSIX bash script. When Bash is configured to run
in POSIX mode for #!/bin/sh scripts, it will fail with:
/usr/lib/kdump/kdump-lib.sh: line 1042: syntax error near unexpected token `<'
/usr/lib/kdump/kdump-lib.sh: line 1042: ` done < <( _crashkernel_parse "$ck")'
This subshell call is easy to convert into a pipe but we should just
source kdump-lib-initramfs.sh here, the only thing kdump-dep-generator
needs is is_ssh_dump_target which is in kdump-lib-initramfs.sh, also
prevents further POSIX violations.
Signed-off-by: Kairui Song <kasong(a)tencent.com>
---
kdump-dep-generator.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kdump-dep-generator.sh b/kdump-dep-generator.sh
index f48c8f688e39..70ae62135395 100644
--- a/kdump-dep-generator.sh
+++ b/kdump-dep-generator.sh
@@ -3,7 +3,7 @@
# More details about systemd generator:
# http://www.freedesktop.org/wiki/Software/systemd/Generators/
-. /usr/lib/kdump/kdump-lib.sh
+. /usr/lib/kdump/kdump-lib-initramfs.sh
. /usr/lib/kdump/kdump-logger.sh
# If invokded with no arguments for testing purpose, output to /tmp to
--
2.43.0
2 months, 3 weeks
[PATCH v2] dracut-module-setup: Skip initrd-cleanup and initrd-parse-etc in kdump
by Lichen Liu
When using multipath devices as the target for kdump, if user_friendly_name
is also specified, devices default to names like "mpath*", e.g., mpatha.
In dracut, we obtain a persistent device name via get_persistent_dev. However,
dracut currently believes using /dev/mapper/mpath* could cause issues, thus
alternatively names are used, here it's /dev/disk/by-uuid/<FS_UUID>.
During the kdump boot progress, the /dev/disk/by-uuid/<FS_UUID> will exist as
soon as one of the path devices exists, but it won't be usable by systemd,
since multipathd will claim that device as a path device. Then multipathd will
get stopped before it can create the multipath device.
Without user_friendly_name, /dev/mapper/<WWID> is considered a persistent
device name, avoiding the issue.
The exit of multipathd is due to two dependencies in the current dracut module
90multipath/multipathd.service, "Before=initrd-cleanup.service" and
"Conflicts=initrd-cleanup.service".
As per man 5 systemd.unit, if A.service has "Conflicts=B.service", starting
B.service will stop A.service.
This is useful during normal boot. However, we will never switch-root after
capturing vmcore in kdump.
We need to ensure that multipathd is not killed due to such dependency issue.
Without modifying multipathd.service, we add ConditionPathExists=!/proc/vmcore
to skip initrd-cleanup.service in kdump. This approach is beneficial as
it avoid the potential termination of other services that conflict with
initrd-cleanup.service. Also skip initrd-parse-etc.service as it will try to
start initrd-cleanup.service. Both of these services are used for switch root,
so they can be safely skipped in kdump.
Suggested-by: Benjamin Marzinski <bmarzins(a)redhat.com>
Suggested-by: Dave Young <dyoung(a)redhat.com>
Signed-off-by: Lichen Liu <lichliu(a)redhat.com>
---
dracut-module-setup.sh | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh
index 1dc88dc..0a901c2 100755
--- a/dracut-module-setup.sh
+++ b/dracut-module-setup.sh
@@ -1089,6 +1089,15 @@ install() {
's/\(^[[:space:]]*reserved_memory[[:space:]]*=\)[[:space:]]*[[:digit:]]*/\1 1024/' \
"${initdir}/etc/lvm/lvm.conf" &> /dev/null
+ # Skip initrd-cleanup.service and initrd-parse-etc.service becasue we don't
+ # need to switch root. Instead of removing them, we use ConditionPathExists
+ # to check if /proc/vmcore exists to determine if we are in kdump.
+ sed -i '/\[Unit\]/a ConditionPathExists=!\/proc\/vmcore' \
+ "${initdir}/${systemdsystemunitdir}/initrd-cleanup.service" &> /dev/null
+
+ sed -i '/\[Unit\]/a ConditionPathExists=!\/proc\/vmcore' \
+ "${initdir}/${systemdsystemunitdir}/initrd-parse-etc.service" &> /dev/null
+
# Save more memory by dropping switch root capability
dracut_no_switch_root
}
--
2.43.0
3 months
[PATCH] Print error msg when forget to specify user for ssh target
by Lichen Liu
Resolves: https://issues.redhat.com/browse/FC-1046
We require that <user> be explicitly specified in 'ssh <user>@<hostname>'. When
forgetting to specify, such as 'ssh 192.168.10.2', a useful error log should be
printed instead of exiting directly.
Signed-off-by: Lichen Liu <lichliu(a)redhat.com>
---
kdumpctl | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/kdumpctl b/kdumpctl
index 3da5fff..45277a7 100755
--- a/kdumpctl
+++ b/kdumpctl
@@ -748,7 +748,12 @@ check_ssh_config()
[[ "${OPT[_fstype]}" == ssh ]] || return 0
target=$(ssh -G "${OPT[_target]}" | sed -n -e "s/^hostname[[:space:]]\+\([^[:space:]]*\).*$/\1/p")
- [[ ${OPT[_target]} =~ .*@.* ]] || return 1
+
+ if [[ ${OPT[_target]} != *@* ]]; then
+ derror "Please verify that $KDUMP_CONFIG_FILE contains 'ssh <user>@<host>' and that it is properly formatted."
+ return 1
+ fi
+
if [[ ${OPT[_target]#*@} != "$target" ]]; then
derror "Invalid ssh destination ${OPT[_target]} provided."
return 1
--
2.43.0
3 months
[PATCH] dracut-module-setup: Remove dependency on initrd-cleanup for multipathd
by Lichen Liu
When using multipath devices as the target for kdump, if user_friendly_name
is also specified, devices default to names like "mpath*", e.g., mpatha.
In dracut, we obtain a persistent device name via get_persistent_dev. However,
dracut currently believes using /dev/mapper/mpath* could cause issues, thus
alternatively names are used, here it's /dev/disk/by-uuid/<FS_UUID>.
During the kdump boot progress, the /dev/disk/by-uuid/<FS_UUID> will exist as
soon as one of the path devices exists, but it won't be usable by systemd,
since multipathd will claim that device as a path device. Then multipathd will
get stopped before it can create the multipath device.
Without user_friendly_name, /dev/mapper/<WWID> is considered a persistent
device name, avoiding the issue.
The exit of multipathd is due to two dependencies in the current dracut module
90multipath/multipathd.service, "Before=initrd-cleanup.service" and
"Conflicts=initrd-cleanup.service".
As per man 5 systemd.unit, if A.service has "Conflicts=B.service", starting
B.service will stop A.service.
This is useful during normal boot. However, in kdump, after capturing vmcore,
we don't proceed with steps like switch-root. Therefore, removing these
dependencies to keep multipathd running during kdump is safe.
Suggested-by: Benjamin Marzinski <bmarzins(a)redhat.com>
Signed-off-by: Lichen Liu <lichliu(a)redhat.com>
---
dracut-module-setup.sh | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh
index 1dc88dc..6d2176f 100755
--- a/dracut-module-setup.sh
+++ b/dracut-module-setup.sh
@@ -1089,6 +1089,14 @@ install() {
's/\(^[[:space:]]*reserved_memory[[:space:]]*=\)[[:space:]]*[[:digit:]]*/\1 1024/' \
"${initdir}/etc/lvm/lvm.conf" &> /dev/null
+ # For the multipath target under kdump, we can safely remove
+ # "Before=initrd-cleanup.service" and "Conflicts=initrd-cleanup.service"
+ # from multipathd.service to keep multipathd running under kdump.
+ sed -i \
+ -e '/^Before=initrd-cleanup.service$/d' \
+ -e '/^Conflicts=initrd-cleanup.service$/d' \
+ "${initdir}/${systemdsystemunitdir}/multipathd.service" &> /dev/null
+
# Save more memory by dropping switch root capability
dracut_no_switch_root
}
--
2.43.0
3 months
[PATCH] dracut-module-setup: Remove dependency on initrd-cleanup for multipathd
by Lichen Liu
When using multipath devices as the target for kdump, if user_friendly_name
is also specified, devices default to names like "mpath*", e.g., mpatha.
In dracut, we obtain a persistent device name via get_persistent_dev. However,
dracut currently believes using /dev/mapper/mpath* could cause issues, thus
alternatively names are used, here it's /dev/disk/by-uuid/<FS_UUID>.
During the kdump boot progress, the /dev/disk/by-uuid/<FS_UUID> will exist as
soon as one of the path devices exists, but it won't be usable by systemd,
since multipathd will claim that device as a path device. Then multipathd will
get stopped before it can create the multipath device.
Without user_friendly_name, /dev/mapper/<WWID> is considered a persistent
device name, avoiding the issue.
The exit of multipathd is due to two dependencies in the current dracut module
90multipath/multipathd.service, "Before=initrd-cleanup.service" and
"Conflicts=initrd-cleanup.service".
As per man 5 systemd.unit, if A.service has "Conflicts=B.service", starting
B.service will stop A.service.
This is useful during normal boot. However, in kdump, after capturing vmcore,
we don't proceed with steps like switch-root. Therefore, removing these
dependencies to keep multipathd running during kdump is safe.
Suggested-by: Benjamin Marzinski <bmarzins(a)redhat.com>
Signed-off-by: Lichen Liu <lichliu(a)redhat.com>
---
dracut-module-setup.sh | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh
index 1dc88dc..6d2176f 100755
--- a/dracut-module-setup.sh
+++ b/dracut-module-setup.sh
@@ -1089,6 +1089,14 @@ install() {
's/\(^[[:space:]]*reserved_memory[[:space:]]*=\)[[:space:]]*[[:digit:]]*/\1 1024/' \
"${initdir}/etc/lvm/lvm.conf" &> /dev/null
+ # For the multipath target under kdump, we can safely remove
+ # "Before=initrd-cleanup.service" and "Conflicts=initrd-cleanup.service"
+ # from multipathd.service to keep multipathd running under kdump.
+ sed -i \
+ -e '/^Before=initrd-cleanup.service$/d' \
+ -e '/^Conflicts=initrd-cleanup.service$/d' \
+ "${initdir}/${systemdsystemunitdir}/multipathd.service" &> /dev/null
+
# Save more memory by dropping switch root capability
dracut_no_switch_root
}
--
2.43.0
3 months, 1 week
[PATCH v2 0/2] consolidated s390 device configuration
by Steffen Maier
Consolidate the persistent and dynamic configuration of s390-specific
network devices by delegating the configuration to the existing framework
zdev from s390-tools.
This is part of a larger consolidation comprising:
https://github.com/ibm-s390-linux/s390-tools/pull/158
https://github.com/dracutdevs/dracut/pull/2534
https://github.com/storaged-project/blivet/pull/1162
https://github.com/rhinstaller/anaconda/pull/5250
https://github.com/steffen-maier/s390utils/pull/1
However, there are no dependencies on these other pull requests, so the
change here can go in independently. It only depends on zdev from
s390-tools, which exists since years.
Zdev's job is to perform low-level configuration after which the user gets
architecture-independent objects such as network interfaces. Those can and
should in turn be configured with existing common code mechanisms. So
there's a clear separated layering for configuration duties.
In particular, the s390-specific network devices currently are: ZNET
representing channel-attached network (QETH incl. OSA and HiperSockets,
LCS, CTC). Zdev has a stable command line user interface and abstracts from
sysfs and from a persistent configuration representation. Zdev encapsulates
configuration details. Systems management code can simply delegate
configuration to zdev and thus reduce architecture-specific code.
This improves user experience, serviceability, maintainability, and reduces
test effort.
Changes since v1:
Addressed review comments from Philipp:
* Replaced first paragraph (dracut commit reference) of patch 1 description
with a summary of this cover letter providing URLs to 2 pull requests
for dracut and s390utils with relevant commit titles.
* Put temp file under subdir ${_DRACUT_KDUMP_NM_TMP_DIR}.
My own changes:
* Patch 2 description now also references the s390utils pull request
with relevant commit title to provide further information regarding
migration of znet persistent config from the old to the new scheme.
Steffen Maier (2):
dracut-module-setup: consolidate s390 network device config (#1937048)
dracut-module-setup: remove old s390 network device config (#1937048)
dracut-module-setup.sh | 53 ++++++++++++++----------------------------
1 file changed, 17 insertions(+), 36 deletions(-)
base-commit: 5058cef90c2e24ff3a17a9c5560e16363e3281f5
--
2.39.3
3 months, 1 week