From cdb7c4b80a0286d11ceb56880d0bc515aecd87e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vin=C3=ADcius=20Ferr=C3=A3o?= <2031761+viniciusferrao@users.noreply.github.com> Date: Tue, 18 Aug 2026 13:37:08 -0300 Subject: [PATCH] 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. --- xCAT/postscripts/enablekdump | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/xCAT/postscripts/enablekdump b/xCAT/postscripts/enablekdump index 5e9127372..f52fb414c 100755 --- a/xCAT/postscripts/enablekdump +++ b/xCAT/postscripts/enablekdump @@ -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