2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2026-11-28 21:32:20 +00:00

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>
This commit is contained in:
Daniel Hilst
2026-11-09 04:33:35 -03:00
parent 9273a68368
commit 0933429e85
4 changed files with 9 additions and 5 deletions
@@ -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';
@@ -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
@@ -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
@@ -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"