** Description changed:

- ### Description
+ Affected Ubuntu versions:
  
- Affected Ubuntu versions:
- - Ubuntu 26.04
- - Ubuntu 26.10
- - Ubuntu Server 26.04 (frequently used as a base image to manually deploy the 
MATE desktop environment via `sudo apt update && sudo apt install 
mate-desktop-environment-core -y`, as an official Ubuntu MATE 26.04 desktop 
flavor is unavailable)
+ * Ubuntu 26.04
+ * Ubuntu 26.10
+ * Ubuntu Server 26.04 not in its default install but when `sudo apt update && 
sudo apt install mate-desktop-environment-core -y` which is relevant as an 
official Ubuntu MATE 26.04 desktop flavor is unavailable.
+ 
+ Does not affect:
+ 
+ * Ubuntu MATE 26.10
  
  When installing Ubuntu 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 in
- /etc/netplan/00-installer-config.yaml :
+ # Steps to Reproduce
  
- ```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
- 
- ```
- 
- ---
- 
- ### 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.
+ 1. Create a Virtual Machine for any Ubuntu version and flavour.
+ 2. Disable the NIC before installation.
  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
+ # 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
+ # Actual Result
  
  Internet connectivity does not connect automatically at boot when booted
  with the NIC enabled on standard Ubuntu installations.
  
- ---
+ # Results and Workarounds
  
- ### Additional Information / Workaround
+ ## Ubuntu 26.04/26.10
  
- 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:
+ After steps to reproduce:
+ 
+ cat /etc/netplan/00-installer-config.yaml
  
  ```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
  
  ```
+ 
+ ip link says DOWN for the device.
+ 
+ ### Additional Information / Workaround: Add "    dhcp4: true"
+ 
+ Summary: Use the attached BASH script.
  
  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:
  
+ cat /etc/netplan/00-installer-config.yaml
+ 
  ```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:
+ NIC was disabled, the See the attached BASH script can be used.
  
- ```bash
- # 1. Back up the current config
- sudo cp /etc/netplan/00-installer-config.yaml 
/etc/netplan/00-installer-config.yaml.bak
+ ## Ubuntu Server 26.04 + `sudo apt update && sudo apt install mate-
+ desktop-environment-core -y`
  
- # 2. Extract keys and values cleanly without leading spaces
- IFACE_KEY=$(sudo awk '/ethernets:/ {getline; print $1}' 
/etc/netplan/00-installer-config.yaml | tr -d ':')
- MAC_VAL=$(sudo awk '/macaddress:/ {print $2}' 
/etc/netplan/00-installer-config.yaml)
- SETNAME_VAL=$(sudo awk '/set-name:/ {print $2}' 
/etc/netplan/00-installer-config.yaml)
+ With NIC disabled during install:
  
- # 3. Write the updated config with standard ASCII spaces
- sudo tee /etc/netplan/00-installer-config.yaml > /dev/null << 'EOF'
+ cat /etc/netplan/00-installer-config.yaml
+ 
+ ```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
-   renderer: NetworkManager
+ 
+ ```
+ 
+ ip link says DOWN for the device.
+ 
+ ### Additional Information / Workaround: Add "  renderer:
+ NetworkManager"
+ 
+ Tips: Use the attached BASH script.
+ 
+ `sudo apt update && sudo apt install mate-desktop-environment-core -y`
+ will modify /etc/netplan/00-installer-config.yaml by adding "dhcp4:
+ true" and "dhcp6: true":
+ 
+ cat /etc/netplan/00-installer-config.yaml
+ 
+ ```yaml
+ # This is the network config written by 'subiquity'
+ network:
    ethernets:
- EOF
- 
- # Append dynamic variables safely without messing up YAML indentation
- sudo tee -a /etc/netplan/00-installer-config.yaml > /dev/null << EOF
-     $IFACE_KEY:
-       match:
-         macaddress: $MAC_VAL
-       set-name: $SETNAME_VAL
+     enp1s0:
        dhcp4: true
        dhcp6: true
- EOF
+       match:
+         macaddress: "XX:XX:XX:XX:XX:XX"
+       set-name: enp1s0
+   version: 2
  
- # 4. Generate, apply, and wait for connectivity
- sudo netplan generate
- sudo netplan apply
- 
- while ! wget -q --spider --timeout=2 http://archive.ubuntu.com; do
-     :
- done
- 
- sudo apt update
  ```
  
+ However, when I booted MATE desktop, I found out that it could not
+ connect to the internet.
+ 
+ ip link says DOWN for the device.
+ 
+ After some research, I found out that "  renderer: NetworkManager"
+ should be added to /etc/netplan/00-installer-config.yaml (note that it
+ did not have to be added for standard Ubuntu; see the "Ubuntu
+ 26.04/26.10" section).
+ 
+ ## Ubuntu MATE 26.10 (not affected)
+ 
+ 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
+ 
+ ```
+ 
+ # Additional Notes
+ 
  Technical Notes on the Workaround:
- * Command Output Behavior: When running "sudo netplan apply" as part of the 
script, the system may output:
+ 
+ * Command Output Behavior: When running `sudo netplan apply` as part of
+ the script, the system may output:
  
  []
  Cannot find unique matching interface for enp1s0
  
- This message can be safely ignored, as it also occurs when running netplan 
apply on standard Ubuntu installations with the NIC enabled.
- * Alternative Approaches: Dynamic interface lookup via ip route and netplan 
set (such as using IFACE=$(ip -4 route show default | awk '{print $5}' | head 
-n1) followed by netplan set ethernets."$IFACE".dhcp4=true) should be avoided 
in automation scripts. It only works if a default route is already set up on 
the system. If the system is offline or has no default route yet, it will fail 
with Error in network definition: Invalid name ''. Using an explicit heredoc 
for the known interface name is significantly more reliable.
+ This message can be safely ignored, as it also occurs when running
+ netplan apply on standard Ubuntu installations with the NIC enabled.
  
+ * Alternative Approaches: Dynamic interface lookup via ip route and
+ netplan set (such as using `IFACE=$(ip -4 route show default | awk
+ '{print $5}' | head -n1)` followed by `netplan set
+ ethernets."$IFACE".dhcp4=true`) should be avoided in automation scripts.
+ It only works if a default route is already set up on the system. If the
+ system is offline or has no default route yet, it will fail with `Error
+ in network definition: Invalid name ''`. Using an explicit heredoc for
+ the known interface name is significantly more reliable.
  
  ---
  
  *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