From f24457cddff51ca152d08436314748f7e2a4e75a 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, 21 Jul 2026 17:11:01 -0300 Subject: [PATCH] fix(genesis): stop ethtool link-wait loops from spinning forever For each secondary NIC in NICSTOBRINGUP, doxcat backgrounds a loop that polls `ethtool $nic` until the link reports "detected: yes" before running dhclient. A NIC that is never connected keeps that loop (and its `sleep 5`) running for the life of the genesis environment, leaking background shells and needlessly churning. Add a second exit condition so each loop also stops once /tmp/netinitted exists, and touch that file once the boot NIC has completed network init. A link that never appears no longer waits indefinitely. Recovered from the unmerged lenovobuild branch (original 9ece12e4). Co-authored-by: Jarrod Johnson <10814490+jjohnson42@users.noreply.github.com> --- xCAT-genesis-scripts/usr/bin/doxcat | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/xCAT-genesis-scripts/usr/bin/doxcat b/xCAT-genesis-scripts/usr/bin/doxcat index 0bf5e360a..e1a6e53fb 100755 --- a/xCAT-genesis-scripts/usr/bin/doxcat +++ b/xCAT-genesis-scripts/usr/bin/doxcat @@ -255,8 +255,8 @@ else NICSTOBRINGUP=`ip link|grep mtu|grep -v LOOPBACK|grep -v $bootnic|grep -v usb|grep -v ,UP|awk -F: '{print $2}'` export NICSTOBRINGUP for nic in $NICSTOBRINGUP; do - (while ! ethtool $nic | grep Link\ detected|grep yes > /dev/null; do sleep 5; done; dhclient -cf /etc/dhclient.conf -pf /var/run/dhclient.$nic.pid $nic ) & - (while ! ethtool $nic | grep Link\ detected|grep yes > /dev/null; do sleep 5; done; dhclient -cf /etc/dhclient.conf -6 -pf /var/run/dhclient6.$nic.pid -lf /var/lib/dhclient/dhclient6.leases $nic ) & + (while ! ethtool $nic | grep Link\ detected|grep yes > /dev/null && [ ! -f /tmp/netinitted ]; do sleep 5; done; dhclient -cf /etc/dhclient.conf -pf /var/run/dhclient.$nic.pid $nic ) & + (while ! ethtool $nic | grep Link\ detected|grep yes > /dev/null && [ ! -f /tmp/netinitted ]; do sleep 5; done; dhclient -cf /etc/dhclient.conf -6 -pf /var/run/dhclient6.$nic.pid -lf /var/lib/dhclient/dhclient6.leases $nic ) & done gripeiter=101 @@ -270,6 +270,9 @@ else done fi fi +# secondary NICs whose link never comes up would otherwise wait forever; +# let those backgrounded loops exit once the boot NIC has finished net init +touch /tmp/netinitted openssl genrsa -out /etc/xcat/certkey.pem 4096 > /dev/null 2>&1 &