From 563a0836270f45332fa35d19d7da121c6d4cb747 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vin=C3=ADcius=20Ferr=C3=A3o?= <2031761+viniciusferrao@users.noreply.github.com> Date: Thu, 23 Jul 2026 21:14:01 -0300 Subject: [PATCH] fix(bmcsetup): settle after IBM port change and support long BMC passwords Two small robustness fixes for bmcsetup: - After changing the BMC network port on IBM boards (IPMIMFG 2), the BMC LAN configuration was not yet ready; add a 15s settle before continuing. Gated inside the IBM branch, so no other vendor is affected. - Set a password longer than 16 characters using ipmitool's 20-byte form, but only when the password actually exceeds 16 chars, so a BMC that supports only 16-byte passwords is never asked for a length it cannot store. Recovered from the unmerged lenovobuild branch (949532f3, 78fa7758; the password change adapted to use the 20-byte form only for long passwords). Co-authored-by: Jarrod Johnson <10814490+jjohnson42@users.noreply.github.com> --- xCAT-genesis-scripts/usr/bin/bmcsetup | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/xCAT-genesis-scripts/usr/bin/bmcsetup b/xCAT-genesis-scripts/usr/bin/bmcsetup index 9ccb147a8..1c3a144c3 100755 --- a/xCAT-genesis-scripts/usr/bin/bmcsetup +++ b/xCAT-genesis-scripts/usr/bin/bmcsetup @@ -196,6 +196,7 @@ if [ "$IPMIMFG" == 2 ]; then #IBM # Get the LAN Configuration Parameters (OEM) CURBMCPORT=`ipmitool -d $idev raw 0xc 2 1 0xc0 0 0 | awk '{print $2}'` done + sleep 15 let idev=idev+1 done unset IFS @@ -219,6 +220,7 @@ if [ "$IPMIMFG" == 2 ]; then #IBM sleep 1 CURBMCPORT=`ipmitool -d $idev raw 0xc 2 1 0xc0 0 0 | awk '{print $2}'` done + sleep 15 let idev=idev+1 done unset IFS @@ -600,8 +602,12 @@ for bmcp in $BMCPW; do if [ "$bmcp" = "" ]; then continue; fi TRIES=0 - # Set the password for the specified user - while ! ipmitool -d $idev user set password $USERSLOT "$bmcp"; do + # Set the password for the specified user. A password longer than 16 chars + # needs the 20-byte IPMI 2.0 form; shorter ones use the default so a + # 16-byte-only BMC is not asked for a length it cannot store. + PWSIZE="" + if [ ${#bmcp} -gt 16 ]; then PWSIZE=20; fi + while ! ipmitool -d $idev user set password $USERSLOT "$bmcp" $PWSIZE; do sleep 1 let TRIES=TRIES+1 if [ $TRIES -gt $TIMEOUT ]; then break; fi