From 0933429e859a34ed6726abfc752e1783069ff060 Mon Sep 17 00:00:00 2001 From: Daniel Hilst <392820+dhilst@users.noreply.github.com> Date: Mon, 9 Nov 2026 04:33:35 -0300 Subject: [PATCH] fix(xcat-core): the Ubuntu 26.04 netboot initramfs never gets a lease On Ubuntu 26.04 a stateless node fetches kernel and initrd and then enters dracut emergency mode. Kea sees no DHCP from the initramfs and httpd sees no request for rootimg.cpio.gz. systemd-network-generator turns BOOTIF= into 70-BOOTIF.network with no DHCP setting. That file exists, so dracut's networkd-config.sh does not install its DHCP default, and the boot NIC stays unconfigured. Also, xcat-cmdline.sh wrote its finished condition to /initqueue-finished and /lib/dracut/hooks, which dracut 110 does not read. With an empty initqueue/finished, dracut-initqueue ends before networkd-run.sh calls the online hook and /sbin/netroot. The module now installs a drop-in that sets DHCP=ipv4 for 70-BOOTIF.network, and xcat-cmdline.sh writes the finished condition to $hookdir/initqueue/finished. ubuntu_netboot_initqueue.bats fails without this change. Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com> (cherry picked from commit 29cfd1c0182631e2f91c1a37be7b34860f80742a) Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com> --- xCAT-server/share/xcat/netboot/imgutils/imgutils.pm | 2 +- .../share/xcat/netboot/ubuntu/dracut/install.netboot | 1 + .../share/xcat/netboot/ubuntu/dracut/xcat-bootif-dhcp.conf | 4 ++++ .../share/xcat/netboot/ubuntu/dracut/xcat-cmdline.sh | 7 +++---- 4 files changed, 9 insertions(+), 5 deletions(-) create mode 100644 xCAT-server/share/xcat/netboot/ubuntu/dracut/xcat-bootif-dhcp.conf diff --git a/xCAT-server/share/xcat/netboot/imgutils/imgutils.pm b/xCAT-server/share/xcat/netboot/imgutils/imgutils.pm index 68724c2fdb..bcbfea0994 100644 --- a/xCAT-server/share/xcat/netboot/imgutils/imgutils.pm +++ b/xCAT-server/share/xcat/netboot/imgutils/imgutils.pm @@ -305,7 +305,7 @@ sub stage_dracut_module { my ($srcdir, $moduledir, $mode) = @_; my %files = ( statelite => [qw(xcat-prepivot.sh)], - stateless => [qw(xcat-cmdline.sh xcat-online.sh xcatroot installkernel)], + stateless => [qw(xcat-cmdline.sh xcat-online.sh xcat-bootif-dhcp.conf xcatroot installkernel)], ); die("Error: the mode $mode is not supported by genimage\n") unless $files{$mode}; my $install = $mode eq 'statelite' ? 'install.statelite' : 'install.netboot'; diff --git a/xCAT-server/share/xcat/netboot/ubuntu/dracut/install.netboot b/xCAT-server/share/xcat/netboot/ubuntu/dracut/install.netboot index 0e57309108..c241e290f8 100755 --- a/xCAT-server/share/xcat/netboot/ubuntu/dracut/install.netboot +++ b/xCAT-server/share/xcat/netboot/ubuntu/dracut/install.netboot @@ -23,3 +23,4 @@ fi # network-legacy, so on 26.04 nothing reaches /sbin/xcatroot. Call it from the online hook, # which systemd-networkd and NetworkManager both reach. inst_hook initqueue/online 90 "$moddir/xcat-online.sh" +inst_simple "$moddir/xcat-bootif-dhcp.conf" /etc/systemd/network/70-BOOTIF.network.d/xcat-bootif-dhcp.conf diff --git a/xCAT-server/share/xcat/netboot/ubuntu/dracut/xcat-bootif-dhcp.conf b/xCAT-server/share/xcat/netboot/ubuntu/dracut/xcat-bootif-dhcp.conf new file mode 100644 index 0000000000..7ce5083555 --- /dev/null +++ b/xCAT-server/share/xcat/netboot/ubuntu/dracut/xcat-bootif-dhcp.conf @@ -0,0 +1,4 @@ +# systemd-network-generator writes 70-BOOTIF.network from BOOTIF= with no DHCP setting, and +# dracut then does not install its own DHCP default. +[Network] +DHCP=ipv4 diff --git a/xCAT-server/share/xcat/netboot/ubuntu/dracut/xcat-cmdline.sh b/xCAT-server/share/xcat/netboot/ubuntu/dracut/xcat-cmdline.sh index 937d74cf59..a1d65cc17c 100644 --- a/xCAT-server/share/xcat/netboot/ubuntu/dracut/xcat-cmdline.sh +++ b/xCAT-server/share/xcat/netboot/ubuntu/dracut/xcat-cmdline.sh @@ -1,7 +1,6 @@ root=1 rootok=1 netroot=xcat -for HDIR in "" "/lib/dracut/hooks"; do - [ -d "${HDIR}/initqueue-finished" ] || continue - echo '[ -e $NEWROOT/proc ]' > ${HDIR}/initqueue-finished/xcatroot.sh -done +# dracut-initqueue ends at once while initqueue/finished is empty, before the settled hook that +# brings the root online runs. +echo '[ -e $NEWROOT/proc ]' > "$hookdir/initqueue/finished/xcatroot.sh"