canonical / canonical/cloud-init
network-config doesn't apply on first boot with integrated ethernet controller
- Dominant language
- Python
- Stars
- 3.8k
- Forks
- 1.1k
- Avg merge
- 2d 23h
- Merged PRs (30d)
- 18
Description
# Bug report
During an OEM/QA run, one checkbox test is failing on one of our devices because it is using an integrated ethernet controller. Thus it automatically gets named `eth0` and not something predictable like `enP8p1s0`.
The image we are testing is a preinstalled server image running cloud-init: https://git.launchpad.net/ubuntu-images/tree/ubuntu-server-tegra-igx.yaml?h=jammy
In order to circumvent this issue we wanted to implement a cloud-init network-config to match the interface to the driver and rename it manually to `eno1`. This works, but **not** on the first boot. On the first boot, the interface is still named `eth0` and does not get an IP address even though cloud-init seems to have correctly generated the file `/etc/netplan/50-cloud-init.yaml` and then netplan generated `/run/systemd/network/10-netplan-eth0.link` and `/run/systemd/network/10-netplan-eth0.network`.
I found 3 ways to have the interface named correctly:
1. reboot the device
2. execute `netplan apply` which renames interfaces according to the netplan config either through `udevadm test` or `ip link set dev `
3. `ip link set down dev eth0; systemctl restart systemd-udev-trigger.service; ip link set up dev eno1`
I also noticed that with the network not configured, it takes around 1 minute after the log in screen appears, for cloud-init to have finished setting up the configured user/password combination but this might be a separate issue.
## Steps to reproduce the problem
Add the following lines to the image definition file above, rebuild, flash and execute first boot:
```
network-config: |
network:
ethernets:
eth0:
dhcp4: true
dhcp6: true
match:
driver: nvethernet
set-name: eno1
version: 2
```
## Environment details
- Cloud-init version: 24.1.3-0ubuntu1~22.04.5
- Operating System Distribution: jammy
- Cloud provider, platform or installer type: NoCloud (I think)
## cloud-init logs
[cloud-init.tar.gz](https://github.com/user-attachments/files/16778550/cloud-init.tar.gz)
Contributor guide
Assessment
This issue has not been assessed yet.