canonical / canonical/cloud-init
Scaleway DataSource on IPv6-only VM raises exception when trying EphemeralDHCPv4
- Dominant language
- Python
- Stars
- 3.8k
- Forks
- 1.1k
- Avg merge
- 2d 23h
- Merged PRs (30d)
- 18
Description
# Bug report
Scaleway DataSource on IPv6-only VM raises exception when trying EphemeralDHCPv4
[NOTE: I am not the person encountering this issue, I helped him with analysing the problem]
dhcpcd is being used as the DHCP client. ds-identify is **not** in use and so cloud-init searches through its list of DataSources checking each in turn.
When cloud-init tries the Scaleway DS a InvalidDHCPLeaseFileError exception is raised and cloud-init.log shows the following:
```
handlers.py[DEBUG]: start: init-local/search-Scaleway: searching for local data from DataSourceScaleway
sources[DEBUG]: Seeing if we can get any data from
sources[DEBUG]: Update datasource metadata and network config due to events: boot-new-instance
dmi.py[DEBUG]: querying dmi data /sys/class/dmi/id/sys_vendor
sources[DEBUG]: Detected DataSourceScaleway
subp.py[DEBUG]: Running command ['ip', '--json', 'addr'] with allowed return codes [0] (shell=False, capture=True)
ephemeral.py[DEBUG]: No connectivity URLs provided. Skipping connectivity check before ephemeral network setup.
dhcp.py[DEBUG]: Performing a dhcp discovery on eth0
subp.py[DEBUG]: Running command ['ip', 'link', 'set', 'dev', 'eth0', 'up'] with allowed return codes [0] (shell=False, capture=True)
util.py[DEBUG]: Reading from /sys/class/net/eth0/type (quiet=False)
util.py[DEBUG]: Reading 2 bytes from /sys/class/net/eth0/type
subp.py[DEBUG]: Running command ['dhcpcd', '--ipv4only', '--waitip', '--persistent', '--noarp', '--script=/bin/true', 'eth0'] with allowed return codes [0] (shell=False, capture=True)
subp.py[DEBUG]: Running command ['dhcpcd', '--dumplease', '--ipv4only', 'eth0'] with allowed return codes [0] (shell=False, capture=True)
dhcp.py[DEBUG]: Parsing dhcpcd lease for interface eth0: ''
dhcp.py[ERROR]: No valid DHCP lease configuration found in dhcpcd lease: ''
log_util.py[WARNING]: No valid DHCP lease configuration found in dhcpcd lease: ''
log_util.py[DEBUG]: No valid DHCP lease configuration found in dhcpcd lease: ''
Traceback (most recent call last):
File "/usr/lib/python3.12/site-packages/cloudinit/sources/DataSourceScaleway.py", line 269, in _get_data
with EphemeralDHCPv4(
^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/site-packages/cloudinit/net/ephemeral.py", line 308, in __enter__
return self.obtain_lease()
^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/site-packages/cloudinit/net/ephemeral.py", line 331, in obtain_lease
self.lease = maybe_perform_dhcp_discovery(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/site-packages/cloudinit/net/dhcp.py", line 107, in maybe_perform_dhcp_discovery
return distro.dhcp_client.dhcp_discovery(interface, dhcp_log_func, distro)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/site-packages/cloudinit/net/dhcp.py", line 674, in dhcp_discovery
lease = self.get_newest_lease(interface)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/site-packages/cloudinit/net/dhcp.py", line 862, in get_newest_lease
return self.parse_dhcpcd_lease(
^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/site-packages/cloudinit/net/dhcp.py", line 822, in parse_dhcpcd_lease
raise InvalidDHCPLeaseFileError(msg % lease_dump)
cloudinit.net.dhcp.InvalidDHCPLeaseFileError: No valid DHCP lease configuration found in dhcpcd lease: ''
```
What is more confusing is that cloud-init tried the GCE DS earlier which also didn't get any lease information and yet no InvalidDHCPLeaseFileError exception was raised:
```
handlers.py[DEBUG]: start: init-local/search-GCELocal: searching for local data from DataSourceGCELocal
sources[DEBUG]: Seeing if we can get any data from
sources[DEBUG]: Update datasource metadata and network config due to events: boot-new-instance
sources[DEBUG]: Detected DataSourceGCELocal
util.py[DEBUG]: Reading from /sys/class/net/eth0/name_assign_type (quiet=False)
util.py[DEBUG]: Reading 2 bytes from /sys/class/net/eth0/name_assign_type
net[DEBUG]: Found unstable nic names: ['eth0']; calling udevadm settle
util.py[DEBUG]: Reading from /sys/class/net/lo/address (quiet=False)
util.py[DEBUG]: Reading 18 bytes from /sys/class/net/lo/address
util.py[DEBUG]: Reading from /sys/class/net/lo/device/device (quiet=False)
util.py[DEBUG]: Reading from /sys/class/net/eth0/address (quiet=False)
util.py[DEBUG]: Reading 18 bytes from /sys/class/net/eth0/address
util.py[DEBUG]: Reading from /sys/class/net/eth0/device/device (quiet=False)
util.py[DEBUG]: Reading 7 bytes from /sys/class/net/eth0/device/device
util.py[DEBUG]: Reading from /sys/class/net/eth0/carrier (quiet=False)
net[DEBUG]: Interface has no carrier: eth0
util.py[DEBUG]: Reading from /sys/class/net/eth0/dormant (quiet=False)
util.py[DEBUG]: Reading from /sys/class/net/eth0/operstate (quiet=False)
util.py[DEBUG]: Reading 5 bytes from /sys/class/net/eth0/operstate
DataSourceGCE.py[DEBUG]: Looking for the primary NIC in: ['eth0']
subp.py[DEBUG]: Running command ['ip', '--json', 'addr'] with allowed return codes [0] (shell=False, capture=True)
performance.py[DEBUG]: Running ['ip', '--json', 'addr'] took 0.011 seconds
ephemeral.py[DEBUG]: No connectivity URLs provided. Skipping connectivity check before ephemeral network setup.
distros[DEBUG]: DHCP client selected: dhcpcd
dhcp.py[DEBUG]: Performing a dhcp discovery on eth0
subp.py[DEBUG]: Running command ['ip', 'link', 'set', 'dev', 'eth0', 'up'] with allowed return codes [0] (shell=False, capture=True)
util.py[DEBUG]: Reading from /sys/class/net/eth0/type (quiet=False)
util.py[DEBUG]: Reading 2 bytes from /sys/class/net/eth0/type
subp.py[DEBUG]: Running command ['dhcpcd', '--ipv4only', '--waitip', '--persistent', '--noarp', '--script=/bin/true', 'eth0'] with allowed return codes [0] (shell=False, capture=True)
performance.py[DEBUG]: Running ['dhcpcd', '--ipv4only', '--waitip', '--persistent', '--noarp', '--script=/bin/true', 'eth0'] took 30.038 seconds
subp.py[DEBUG]: Running command ['dhcpcd', '--dumplease', '--ipv4only', 'eth0'] with allowed return codes [0] (shell=False, capture=True)
dhcp.py[DEBUG]: Parsing dhcpcd lease for interface eth0: ''
dhcp.py[ERROR]: No valid DHCP lease configuration found in dhcpcd lease: ''
DataSourceGCE.py[DEBUG]: Unable to obtain a DHCP lease for eth0
```
## Steps to reproduce the problem
Provision a IPv6-only VM on Scaleway using the Alpine 3.23.4 *generic* cloud image ("https://dl-cdn.alpinelinux.org/alpine/v3.23/releases/cloud/generic_alpine-3.23.4-x86_64-bios-tiny-r0.qcow2").
## Environment details
- Cloud-init version: 25.3
- Operating System Distribution: Alpine Linux 3.23.4
- Cloud provider, platform or installer type: Scaleway
## cloud-init logs
[cloud-init.log.gz](https://github.com/user-attachments/files/28687061/cloud-init.log.gz)
Contributor guide
Assessment
This issue has not been assessed yet.