From 6be3be68e0435eb921dea20cd3fe370db7349959 Mon Sep 17 00:00:00 2001 From: hanwenli Date: Fri, 19 Sep 2025 08:36:36 -0700 Subject: [PATCH] Instruct NetPlan to use systemd-networkd systemd-networkd is used by default with Ubuntu Server. Installing ubuntu-desktop (as part of DCV installation) installs NetworkManager. NetworkManager is more complex (with WiFi capabilities) and causes confusion to systemd-networkd. When systemd-networkd is confused, it delays the boot by 2 minutes. This commit instructs NetPlan to use systemd-networkd to manage network interfaces. The code is added at the end of DCV installation because the mitigation is strictly related to the installation of ubuntu-desktop. Always using systemd-networkd also improves consistency between how ParallelCluster handles single-nic instances vs multi-nic instances. With multi-nic instances ParallelCluster has been instructing netplan to use systemd-networkd ([code](https://github.com/aws/aws-parallelcluster-cookbook/blob/develop/cookbooks/aws-parallelcluster-environment/files/ubuntu/network_interfaces/configure_nw_interface.sh#L62)) # Technical details: ## Output of `networkctl list` ### Prior to this commit Base Ubuntu: ``` IDX LINK TYPE OPERATIONAL SETUP 1 lo loopback carrier unmanaged 2 ens5 ether routable configured 2 links listed. ``` Ubuntu with ubuntu-desktop ``` IDX LINK TYPE OPERATIONAL SETUP 1 lo loopback carrier unmanaged 2 ens5 ether routable unmanaged 2 links listed. ``` systemd-networkd got confused because it saw no network interface was setup (because NetworkManager took over control of all network interfaces) and waited until 2 minutes timeout at the beginning of system boot: ``` $ journalctl -b | grep -i "ipv6\|timeout\|waiting" ... Sep 18 14:51:23 systemd-networkd-wait-online[1602]: Timeout occurred while waiting for network connectivity. ... Sep 18 14:53:31 systemd-networkd-wait-online[1891]: Timeout occurred while waiting for network connectivity. ... ``` ### After this commit Ubuntu with ubuntu-desktop has the same output as Base Ubuntu and the delay is gone Signed-off-by: Hanwen --- .../resources/dcv/partial/_ubuntu_common.rb | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/cookbooks/aws-parallelcluster-platform/resources/dcv/partial/_ubuntu_common.rb b/cookbooks/aws-parallelcluster-platform/resources/dcv/partial/_ubuntu_common.rb index 818b83c16c..2eb8a40cce 100644 --- a/cookbooks/aws-parallelcluster-platform/resources/dcv/partial/_ubuntu_common.rb +++ b/cookbooks/aws-parallelcluster-platform/resources/dcv/partial/_ubuntu_common.rb @@ -81,4 +81,20 @@ def optionally_disable_rnd command "sed --in-place '/RANDFILE/d' /etc/ssl/openssl.cnf" end end + + def post_install + # ubuntu-desktop comes with NetworkManager. On a cloud instance NetworkManager is unnecessary and causes delay. + # Instruct Netplan to use networkd for better performance + bash 'Instruct Netplan to use networkd' do + code <<-NETPLAN + set -e + cat > /etc/netplan/95-parallelcluster-force-networkd.yaml << 'EOF' +network: + version: 2 + renderer: networkd +EOF + netplan apply + NETPLAN + end unless on_docker? + end end