canonical / canonical/cloud-init

[Bug]: DataSourceVMware silently ignores network config when specified interface does not exist

Open
#6,832 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
3.8k
Forks
1.1k
Avg merge
2d 23h
Merged PRs (30d)
18

Description

# Bug Report: DataSourceVMware silently ignores network config when specified interface does not exist

---

## Summary

When `DataSourceVMware` successfully reads network configuration from `guestinfo.metadata`, but the specified network interface does not exist on the guest OS, `cloud-init` **silently ignores the entire network configuration block without emitting any warning, error, or log entry**. The VM boots with no IP address, and there is no indication in any log file as to why.

---

## Environment

| Component | Version / Value |
|---|---|
| **cloud-init version** | `25.3-0ubuntu1~22.04.1` |
| **OS** | Ubuntu 22.04 LTS (Jammy) |
| **Image** | Ubuntu 22.04 Jammy Cloud Image OVA |
| **Hypervisor** | VMware ESXi 6.0 (standalone, no vCenter) |
| **VMware Hardware Version** | v10 (`ESXi 5.5 and later`) |
| **DataSource detected** | `DataSourceVMware [seed=guestinfo]` |

---

## Steps to Reproduce

1. Deploy Ubuntu 22.04 Jammy Cloud Image OVA to VMware ESXi via `ovftool`
2. Configure `guestinfo.metadata` with a network config specifying interface `ens160`:
```yaml
network:
version: 2
ethernets:
ens160: # <-- assumed interface name for VMware (HW v11)
dhcp4: false
addresses: [192.168.57.99/24]
gateway4: 192.168.57.1
```
3. Power on the VM

**Observed:** VM boots, hostname set correctly, but no IP assigned. Interface `ens32` stays `DOWN`. Zero log output about the failure.

**Expected:** A `WARNING` in `/var/log/cloud-init.log` that interface `ens160` was not found.

---

## Forensic Evidence

### DataSource was detected and read successfully
```
detail: DataSourceVMware [seed=guestinfo]
errors: []
```
```json
{ "v1": { "datasource": "DataSourceVMware [seed=guestinfo]", "errors": [] } }
```
`ds-identify.log`: `Found single datasource: VMware`

**Verdict:** Datasource detection worked perfectly.

### No network-disabling files present
`/etc/cloud/cloud.cfg.d/` contained only `05_logging.cfg` and `90_dpkg.cfg`.
No `subiquity-disable-cloudinit-networking.cfg`. The cloud image OVA was clean.
This rules out the known Subiquity installer artifact as a cause.

### `/var/log/cloud-init.log` — Network section produces ZERO output
```bash
grep -i "network|datasource|vmware|guestinfo|disabled|skip" \
/var/log/cloud-init.log | tail -40
# Output: (completely empty)
```
**This is the critical finding.** cloud-init read the datasource, processed it, referenced `ens160` which does not exist — and produced **no log output whatsoever**.

### Actual vs assumed interface name
```
2: ens32: state DOWN # actual name on HW v10
```
`ens160` is the correct name for VMware HW v11+. On HW v10 (ESXi 5.5/6.0), the interface is named `ens32`. cloud-init emits no warning about this mismatch.

---

## Root Cause

When cloud-init processes `network: version: 2` from a datasource and the specified interface name(s) do not match any physical interface, the network module completes silently:
- `status: done`
- `errors: []`
- No WARNING in `/var/log/cloud-init.log`
- No entry in `result.json`

This makes diagnosis **impossible** without deep external investigation.

---

## Impact

Any user deploying Ubuntu 22.04 Cloud OVA to VMware ESXi HW v10 who specifies `ens160` will experience a completely silent networking failure. Particularly severe in IaC environments (e.g., Terraform) where operators cannot access the VM console.

---

## VMware Interface Name Reference (Missing from cloud-init docs)

| VMware HW Version | ESXi Version | NIC Type | Interface Name |
|---|---|---|---|
| v10 | ESXi 5.5 and later | e1000 | `ens32` |
| v11 | ESXi 6.0 and later | vmxnet3 | `ens160` |
| v13+ | ESXi 6.5 and later | vmxnet3 | `ens192` |

---

## Proposed Fix

When the network config specifies an interface that does not exist, emit:
```
WARNING: Network config specified interface 'ens160' but it was not found.
Available interfaces: ['lo', 'ens32'].
Network configuration was NOT applied.
```
And set `status: warning` in `result.json` rather than `status: done`.

---

## Confirmed Workaround

Use `match:` with a wildcard pattern instead of a hardcoded name:
```yaml
network:
version: 2
ethernets:
all_nics:
match:
name: "e*"
set-name: eth0
dhcp4: false
addresses: [192.168.57.99/24]
gateway4: 192.168.57.1
```

---

## Pre-Filing Checklist

- [x] cloud-init version confirmed: `25.3-0ubuntu1~22.04.1`
- [x] DataSource detected correctly: `DataSourceVMware [seed=guestinfo]`
- [x] NO `subiquity-disable-cloudinit-networking.cfg` present
- [x] Network log is completely empty (proves silent failure, not blocked failure)
- [x] Workaround confirmed working
- [x] No exact duplicate found for the **silent failure** aspect
- [x] Reproducible from a clean OVA deployment

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.