** Description changed:

+ ### Netplan fails to automatically configure DHCP on first boot when
+ installed with NIC disabled then enabled
+ 
+ ---
+ 
  ### Description
  
  When installing Ubuntu (versions 26.04 and 26.10) inside a Virtual
  Machine with the Network Interface Card (NIC) disabled during
  installation, powering off the VM, cloning it, and subsequently turning
  on the NIC in the clone results in a system where internet connectivity
- does not initialize automatically at boot because Subiquity generates a
- hardware-tied configuration:
+ does not initialize automatically at boot.
+ 
+ When the NIC is disabled during installation, Subiquity generates a
+ hardware-tied configuration omitting the DHCP directives:
  
  ```yaml
  # This is the network config written by 'subiquity'
  network:
-   ethernets:
-     enp1s0:
-       match:
-         macaddress: XX:XX:XX:XX:XX:XX
-       set-name: enp1s0
-   version: 2
- 
- ```
- 
- In contrast, Ubuntu MATE 26.10 handles this scenario correctly and
- internet connectivity works out of the box when the NIC is enabled on
- the clone, even though its default configuration does not explicitly
- contain a `dhcp4` directive and looks like this:
- 
- ```yaml
- # This is the network config written by 'subiquity'
- network:
-   ethernets: {}
-   version: 2
+   ethernets:
+     enp1s0:
+       match:
+         macaddress: XX:XX:XX:XX:XX:XX
+       set-name: enp1s0
+   version: 2
  
  ```
  
  ---
  
  ### Steps to Reproduce
  
  1. Create a Virtual Machine with the NIC disabled or disconnected.
  2. Complete the installation of Ubuntu 26.04 or 26.10 inside the VM.
  3. Power off the Virtual Machine and create a clone of it.
  4. Enable the NIC on the cloned VM, then power it on.
  5. Check if internet connectivity connects automatically at boot.
  
  ---
  
  ### Expected Result
  
  Internet connectivity should connect automatically at boot once the NIC
  is turned on in the cloned VM, consistent with the behavior observed in
- Ubuntu MATE.
+ Ubuntu MATE and standard installations where the NIC is enabled from the
+ start.
  
  ---
  
  ### Actual Result
  
  Internet connectivity does not connect automatically at boot when booted
  with the NIC enabled on standard Ubuntu installations.
  
  ---
  
  ### Additional Information / Workaround
  
- Unlike standard Ubuntu, Ubuntu MATE 26.10 works seamlessly out of the
- box regardless of whether the NIC was on or off during installation,
- without requiring manual Netplan adjustments.
+ Unlike standard Ubuntu, **Ubuntu MATE 26.10 works seamlessly out of the
+ box** regardless of whether the NIC was on or off during installation,
+ handling clones correctly without requiring manual Netplan adjustments.
+ Its default configuration does not explicitly contain a `dhcp4`
+ directive and looks like this:
  
- As a temporary workaround for standard Ubuntu installations, the
- following script can be used to resolve the issue:
+ ```yaml
+ # This is the network config written by 'subiquity'
+ network:
+   ethernets: {}
+   version: 2
+ 
+ ```
+ 
+ For standard Ubuntu, a normal installation with the NIC enabled during
+ installation, or running the workaround script below, ensures internet
+ works and produces a Netplan configuration with explicit DHCP
+ directives:
+ 
+ ```yaml
+ network:
+   version: 2
+   ethernets:
+     enp1s0:
+       match:
+         macaddress: "XX:XX:XX:XX:XX:XX"
+       dhcp4: true
+       dhcp6: true
+       set-name: "enp1s0"
+ 
+ ```
+ 
+ As a temporary workaround for standard Ubuntu installations where the
+ NIC was disabled, the following script can be used to resolve the issue:
  
  ```bash
  if grep -q '^ID=ubuntu' /etc/os-release && \
-    grep -q '^VERSION_ID="26\.' /etc/os-release && \
-    grep -Eq '^Ubuntu [0-9]' /var/log/installer/media-info 2>/dev/null; then
-     IFACE=$(ip -4 route show default | awk '{print $5}' | head -n1)
-     [ -z "$IFACE" ] && IFACE="enp1s0"
+    grep -q '^VERSION_ID="26\.' /etc/os-release && \
+    grep -Eq '^Ubuntu [0-9]' /var/log/installer/media-info 2>/dev/null; then
+     IFACE=$(ip -4 route show default | awk '{print $5}' | head -n1)
+     [ -z "$IFACE" ] && IFACE="enp1s0"
  
-     # Check if DHCP is already configured
-     DHCP4_SET=$(netplan get ethernets."$IFACE".dhcp4 2>/dev/null)
-     DHCP6_SET=$(netplan get ethernets."$IFACE".dhcp6 2>/dev/null)
+     # Check if DHCP is already configured
+     DHCP4_SET=$(netplan get ethernets."$IFACE".dhcp4 2>/dev/null)
+     DHCP6_SET=$(netplan get ethernets."$IFACE".dhcp6 2>/dev/null)
  
-     if [ "$DHCP4_SET" != "true" ] || [ "$DHCP6_SET" != "true" ]; then
-         sudo netplan set ethernets."$IFACE".dhcp4=true
-         sudo netplan set ethernets."$IFACE".dhcp6=true
-         sudo netplan generate
-         sudo netplan apply
+     if [ "$DHCP4_SET" != "true" ] || [ "$DHCP6_SET" != "true" ]; then
+         sudo netplan set ethernets."$IFACE".dhcp4=true
+         sudo netplan set ethernets."$IFACE".dhcp6=true
+         sudo netplan generate
+         sudo netplan apply
  
-        # Wait for WAN and DNS so premature apt runs don't fail InRelease 
checks
-        until wget -q --spider --timeout=1 http://archive.ubuntu.com; do
-            sleep 1
-        done
-     fi
+        # Wait for WAN and DNS so premature apt runs don't fail InRelease 
checks
+        until wget -q --spider --timeout=1 http://archive.ubuntu.com; do
+            sleep 1
+        done
+     fi
  
-     sudo apt-get update
+     sudo apt-get update
  fi
  
  ```
  
- Applying this workaround updates `/etc/netplan/00-installer-config.yaml`
- to the following structure:
+ ---
  
- ```yaml
- network:
-   version: 2
-   ethernets:
-     enp1s0:
-       match:
-         macaddress: "XX:XX:XX:XX:XX:XX"
-       dhcp4: true
-       dhcp6: true
-       set-name: "enp1s0"
- 
- ```
- 
- Note to triage team: Please consider setting Importance to High, as this
- defect impacts all users and automated testing pipelines performing
+ *Note to triage team: Please consider setting Importance to High, as
+ this defect impacts all users and automated testing pipelines performing
  default ISO installations with the NIC intentionally disabled to prevent
- unwanted automatic background package downloads during setup.
+ unwanted automatic background package downloads during setup.*

** Description changed:

- ### Netplan fails to automatically configure DHCP on first boot when
- installed with NIC disabled then enabled
- 
- ---
- 
  ### Description
  
  When installing Ubuntu (versions 26.04 and 26.10) inside a Virtual
  Machine with the Network Interface Card (NIC) disabled during
  installation, powering off the VM, cloning it, and subsequently turning
  on the NIC in the clone results in a system where internet connectivity
  does not initialize automatically at boot.
  
  When the NIC is disabled during installation, Subiquity generates a
  hardware-tied configuration omitting the DHCP directives:
  
  ```yaml
  # This is the network config written by 'subiquity'
  network:
-   ethernets:
-     enp1s0:
-       match:
-         macaddress: XX:XX:XX:XX:XX:XX
-       set-name: enp1s0
-   version: 2
+   ethernets:
+     enp1s0:
+       match:
+         macaddress: XX:XX:XX:XX:XX:XX
+       set-name: enp1s0
+   version: 2
  
  ```
  
  ---
  
  ### Steps to Reproduce
  
  1. Create a Virtual Machine with the NIC disabled or disconnected.
  2. Complete the installation of Ubuntu 26.04 or 26.10 inside the VM.
  3. Power off the Virtual Machine and create a clone of it.
  4. Enable the NIC on the cloned VM, then power it on.
  5. Check if internet connectivity connects automatically at boot.
  
  ---
  
  ### Expected Result
  
  Internet connectivity should connect automatically at boot once the NIC
  is turned on in the cloned VM, consistent with the behavior observed in
  Ubuntu MATE and standard installations where the NIC is enabled from the
  start.
  
  ---
  
  ### Actual Result
  
  Internet connectivity does not connect automatically at boot when booted
  with the NIC enabled on standard Ubuntu installations.
  
  ---
  
  ### Additional Information / Workaround
  
  Unlike standard Ubuntu, **Ubuntu MATE 26.10 works seamlessly out of the
  box** regardless of whether the NIC was on or off during installation,
  handling clones correctly without requiring manual Netplan adjustments.
  Its default configuration does not explicitly contain a `dhcp4`
  directive and looks like this:
  
  ```yaml
  # This is the network config written by 'subiquity'
  network:
-   ethernets: {}
-   version: 2
+   ethernets: {}
+   version: 2
  
  ```
  
  For standard Ubuntu, a normal installation with the NIC enabled during
  installation, or running the workaround script below, ensures internet
  works and produces a Netplan configuration with explicit DHCP
  directives:
  
  ```yaml
  network:
-   version: 2
-   ethernets:
-     enp1s0:
-       match:
-         macaddress: "XX:XX:XX:XX:XX:XX"
-       dhcp4: true
-       dhcp6: true
-       set-name: "enp1s0"
+   version: 2
+   ethernets:
+     enp1s0:
+       match:
+         macaddress: "XX:XX:XX:XX:XX:XX"
+       dhcp4: true
+       dhcp6: true
+       set-name: "enp1s0"
  
  ```
  
  As a temporary workaround for standard Ubuntu installations where the
  NIC was disabled, the following script can be used to resolve the issue:
  
  ```bash
  if grep -q '^ID=ubuntu' /etc/os-release && \
-    grep -q '^VERSION_ID="26\.' /etc/os-release && \
-    grep -Eq '^Ubuntu [0-9]' /var/log/installer/media-info 2>/dev/null; then
-     IFACE=$(ip -4 route show default | awk '{print $5}' | head -n1)
-     [ -z "$IFACE" ] && IFACE="enp1s0"
+    grep -q '^VERSION_ID="26\.' /etc/os-release && \
+    grep -Eq '^Ubuntu [0-9]' /var/log/installer/media-info 2>/dev/null; then
+     IFACE=$(ip -4 route show default | awk '{print $5}' | head -n1)
+     [ -z "$IFACE" ] && IFACE="enp1s0"
  
-     # Check if DHCP is already configured
-     DHCP4_SET=$(netplan get ethernets."$IFACE".dhcp4 2>/dev/null)
-     DHCP6_SET=$(netplan get ethernets."$IFACE".dhcp6 2>/dev/null)
+     # Check if DHCP is already configured
+     DHCP4_SET=$(netplan get ethernets."$IFACE".dhcp4 2>/dev/null)
+     DHCP6_SET=$(netplan get ethernets."$IFACE".dhcp6 2>/dev/null)
  
-     if [ "$DHCP4_SET" != "true" ] || [ "$DHCP6_SET" != "true" ]; then
-         sudo netplan set ethernets."$IFACE".dhcp4=true
-         sudo netplan set ethernets."$IFACE".dhcp6=true
-         sudo netplan generate
-         sudo netplan apply
+     if [ "$DHCP4_SET" != "true" ] || [ "$DHCP6_SET" != "true" ]; then
+         sudo netplan set ethernets."$IFACE".dhcp4=true
+         sudo netplan set ethernets."$IFACE".dhcp6=true
+         sudo netplan generate
+         sudo netplan apply
  
-        # Wait for WAN and DNS so premature apt runs don't fail InRelease 
checks
-        until wget -q --spider --timeout=1 http://archive.ubuntu.com; do
-            sleep 1
-        done
-     fi
+        # Wait for WAN and DNS so premature apt runs don't fail InRelease 
checks
+        until wget -q --spider --timeout=1 http://archive.ubuntu.com; do
+            sleep 1
+        done
+     fi
  
-     sudo apt-get update
+     sudo apt-get update
  fi
  
  ```
  
  ---
  
  *Note to triage team: Please consider setting Importance to High, as
  this defect impacts all users and automated testing pipelines performing
  default ISO installations with the NIC intentionally disabled to prevent
  unwanted automatic background package downloads during setup.*

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2170258

Title:
  Netplan fails to automatically configure DHCP on first boot when
  installed with NIC disabled then enabled

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+bug/2170258/+subscriptions


-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to