Hi Lichen,
On Wed, 17 Jan 2024 11:11:39 +0800
Lichen Liu <lichliu(a)redhat.com> wrote:
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
+
Besides what Dave already mentioned. I've noticed that according to
man 5 systemd.unit both Conflicts= and Before= accept a space separated-list of
unit names as arguments. But your regex only applies when
initrd-cleanup.service is the only service. So if we stick with your
original approach we need to improve the regex.
In a simple test the following worked for me
-e "/^Before=/ { \
s/initrd-cleanup.service//; \
s/ / /; \
s/= /=/; \
/^Before=$/d; \
}"
i.e. on a line that starts with Before= remove the service, cleanup
left over spaces and, remove the line if there is no more service left.
Thanks
Philipp
# Save more memory by dropping switch root capability
dracut_no_switch_root
}