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"