2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2026-08-27 09:06:39 +00:00

fix(enablekdump): drop any stale root= before adding the per-node one

The per-node root= was inserted after the opening quote of
KDUMP_COMMANDLINE_APPEND, keeping whatever the line already held. On a
RHEL 7 node configured by the previous script that leaves the legacy
shared-root value in place after the new one, and dracut takes the last
root= on the command line, so the stale shared root kept winning and the
crash initrd still pointed at the export root. Re-running also stacked a
duplicate per-node token each time.

Strip any existing root= token from the line before inserting this
node's own, so re-running enablekdump migrates a legacy config and is
idempotent. The strip anchors on the same opening quote as the insert
and honors word boundaries, so options such as rootflags=nofail from
the stock RHEL 7 file are left alone.
This commit is contained in:
Vinícius Ferrão
2026-08-18 13:37:08 -03:00
parent eec50e14a2
commit cdb7c4b80a
+5 -1
View File
@@ -263,7 +263,11 @@ EOF
# names a valid filesystem, checked by dracut-cmdline at crash
# time, so give this node's subdir a dummy /proc for it.
[ -e $MOUNTPATH/$NODE/proc ] || echo "xCAT: dummy /proc so RHEL7 dracut-cmdline accepts root=" > $MOUNTPATH/$NODE/proc
sed -i "s#^[\t ]*KDUMP_COMMANDLINE_APPEND=\"#KDUMP_COMMANDLINE_APPEND=\"root=nfs:$KDIP:$KDPATH/$NODE #" /etc/sysconfig/kdump
# Drop any root= a previous run left behind before adding this
# node's own: dracut takes the last root= on the command line,
# so a stale shared-root value would win over the new one.
sed -i -e '/^[\t ]*KDUMP_COMMANDLINE_APPEND="/s/\broot=[^ \t"]*[ \t]*//g' \
-e "s#^[\t ]*KDUMP_COMMANDLINE_APPEND=\"#KDUMP_COMMANDLINE_APPEND=\"root=nfs:$KDIP:$KDPATH/$NODE #" /etc/sysconfig/kdump
fi
[ -f /etc/dracut.conf ] && mv /etc/dracut.conf /tmp/dracut.conf
restartservice kdump