canonical / canonical/cloud-init
Cloud-Init unable to bring interface up after interface-changes
- Dominant language
- Python
- Stars
- 3.8k
- Forks
- 1.1k
- Avg merge
- 2d 23h
- Merged PRs (30d)
- 18
Description
# Bug report
Cloud-Init retains some information of the previous interface's MAC and will fail bringing up the new interface if the interfaces have been swapped out, for instance to move the machine to a new subnet/network in OpenStack.
## Steps to reproduce the problem
1. Setup NetworkA+SubnetA
2. Spin up Ubuntu 24.04 Cloud-Image
3. Observe Instance with correct first boot and accessible network
4. Shutdown Instance
5. Setup NetworkB+SubnetB
6. Add Interface to Instance to NetworkB+SubnetB
7. Remove NetworkA+SubnetA Interface from Instance
8. Start Instance
9. Observe errors in Cloud-Init and no network being set up at all
## Environment details
- Cloud-init version: 24.3.1-0ubuntu0~24.04.2
- Operating System Distribution: 24.04 / Noble
- Cloud provider, platform or installer type: OpenStack+KVM / https://cloud-images.ubuntu.com/noble/current/noble-server-cloudimg-amd64.img
## cloud-init logs
```
2024-10-11 07:57:37,423 - net[DEBUG]: Detected interfaces {'lo': {'downable': False, 'device_id': None, 'driver': None, 'mac': '00:00:00:00:00:00', 'name': 'lo', 'up': True}, 'ens3': {'downable': True, 'device_id': '0x0001', 'driver': 'virtio_net', 'mac': 'fa:16:3e:a9:e9:da', 'name': 'ens3', 'up': False}}
2024-10-11 07:57:37,423 - net[WARNING]: Unable to rename interfaces: [['fa:16:3e:f7:10:04', 'ens3', 'virtio_net', '0x0001']] due to errors: ['[nic not present] Cannot rename mac=fa:16:3e:f7:10:04 to ens3, not available.']
2024-10-11 07:57:37,423 - stages.py[WARNING]: Failed to rename devices: Failed to apply network config names: [nic not present] Cannot rename mac=fa:16:3e:f7:10:04 to ens3, not available.
```
Note the mismatch in MAC. `e9:da` is the _new_ interface from NetworkB+SubnetB whereas `10:04` is the _removed_ interface from NetworkA+SubnetA.
Contributor guide
Assessment
This issue has not been assessed yet.