canonical / canonical/cloud-init
MAC address passthrough on network devices fails `init-local`
- Dominant language
- Python
- Stars
- 3.8k
- Forks
- 1.1k
- Avg merge
- 2d 23h
- Merged PRs (30d)
- 18
Description
# Bug report
Some [Dell](https://www.dell.com/support/kbdoc/en-us/000143263/what-is-mac-address-pass-through) and [Lenovo](https://support.lenovo.com/us/en/solutions/ht503574-mac-address-pass-through-feature-of-selected-lenovo-usb-based-docking-solutions-thinkpad) laptops support MAC address passthrough from the laptop to a docking station or USB NIC (unknown if other manufacturers do this as well). A recent [kernel commit](https://web.git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=cb6cf0820f22ca36dc8f95cf1bd196e5ec24e69d) began using `NET_ADDR_STOLEN` in [`/sys/class/net//addr_assign_type`](https://www.kernel.org/doc/Documentation/ABI/testing/sysfs-class-net) for interfaces using MAC passthrough in the `r8152` USB NIC driver. Previously, `NET_ADDR_STOLEN` was only used for bond and vlan devices (in kernel 6.8, I haven't looked at earlier versions).
cloud-init [ignores interfaces](https://github.com/canonical/cloud-init/blob/main/cloudinit/net/__init__.py#L1047) where the `addr_assign_type` is `NET_ADDR_STOLEN`. This causes the `init-local` stage to fail (see log below).
## Steps to reproduce the problem
I assume that this issue can only be reproduced using hardware which supports MAC passthrough (which I do not have access to).
The user who reported this was performing an automated Ubuntu 24.04 install using [subiquity autoinstall](https://canonical-subiquity.readthedocs-hosted.com/en/latest/intro-to-autoinstall.html) and the 24.04.2 Desktop ISO.
~~I am waiting to hear if disabling MAC passthrough in the affected machine's firmware prevents the failure; I'll update the bug when I have that information.~~
Disabling MAC passthrough on the machine in question prevents the failure.
## Environment details
- Cloud-init version: `24.4-0ubuntu1~24.04.2`
- Operating System Distribution: Ubuntu Desktop 24.04.2
- Hardware: Dell Precision 5690 (0CC8)
## Fix options
It looks to me like this behavior was originally introduced to filter out bonds and vlans which inherit their MAC from a physical device. However, using `addr_assign_type` looks like it has proven unreliable; cloud-init now filters out bonds and vlans explicitly ([LP#1682871](https://bugs.launchpad.net/cloud-init/+bug/1682871), [LP#1669860](https://bugs.launchpad.net/cloud-init/+bug/1669860), [LP#1812857](https://bugs.launchpad.net/cloud-init/+bug/1812857)).
Given that, I'm wondering if simply removing the filter for a stolen MAC would be an appropriate fix here. I'm not sure that I've quite convinced myself that it's the right approach; I'll open a PR with that change to discuss in more detail.
## cloud-init logs
```
2025-03-12 11:22:33,616 - util.py[DEBUG]: Creating symbolic link from '/run/cloud-init/network-config.json' => '/var/lib/cloud/instance/network-config.json'
2025-03-12 11:22:33,616 - util.py[DEBUG]: Reading from /usr/lib/python3/dist-packages/cloudinit/config/schemas/schema-network-config-v1.json (quiet=False)
2025-03-12 11:22:33,616 - util.py[DEBUG]: Reading 21012 bytes from /usr/lib/python3/dist-packages/cloudinit/config/schemas/schema-network-config-v1.json
2025-03-12 11:22:33,618 - stages.py[DEBUG]: Using distro class
2025-03-12 11:22:33,618 - util.py[DEBUG]: Reading from /sys/class/net/eth0/device/device (quiet=False)
2025-03-12 11:22:33,618 - util.py[DEBUG]: Reading from /sys/class/net/lo/addr_assign_type (quiet=False)
2025-03-12 11:22:33,618 - util.py[DEBUG]: Reading 2 bytes from /sys/class/net/lo/addr_assign_type
2025-03-12 11:22:33,618 - util.py[DEBUG]: Reading from /sys/class/net/lo/uevent (quiet=False)
2025-03-12 11:22:33,618 - util.py[DEBUG]: Reading 23 bytes from /sys/class/net/lo/uevent
2025-03-12 11:22:33,618 - util.py[DEBUG]: Reading from /sys/class/net/lo/address (quiet=False)
2025-03-12 11:22:33,618 - util.py[DEBUG]: Reading 18 bytes from /sys/class/net/lo/address
2025-03-12 11:22:33,618 - net[DEBUG]: ovs-vsctl not in PATH; not detecting Open vSwitch interfaces
2025-03-12 11:22:33,618 - util.py[DEBUG]: Reading from /sys/class/net/lo/device/device (quiet=False)
2025-03-12 11:22:33,618 - util.py[DEBUG]: Reading from /sys/class/net/wlp1s0f0/addr_assign_type (quiet=False)
2025-03-12 11:22:33,618 - util.py[DEBUG]: Reading 2 bytes from /sys/class/net/wlp1s0f0/addr_assign_type
2025-03-12 11:22:33,618 - util.py[DEBUG]: Reading from /sys/class/net/wlp1s0f0/uevent (quiet=False)
2025-03-12 11:22:33,618 - util.py[DEBUG]: Reading 42 bytes from /sys/class/net/wlp1s0f0/uevent
2025-03-12 11:22:33,618 - util.py[DEBUG]: Reading from /sys/class/net/wlp1s0f0/address (quiet=False)
2025-03-12 11:22:33,618 - util.py[DEBUG]: Reading 18 bytes from /sys/class/net/wlp1s0f0/address
2025-03-12 11:22:33,618 - util.py[DEBUG]: Reading from /sys/class/net/wlp1s0f0/device/device (quiet=False)
2025-03-12 11:22:33,618 - util.py[DEBUG]: Reading 7 bytes from /sys/class/net/wlp1s0f0/device/device
2025-03-12 11:22:33,618 - util.py[DEBUG]: Reading from /sys/class/net/eth0/addr_assign_type (quiet=False)
2025-03-12 11:22:33,618 - util.py[DEBUG]: Reading 2 bytes from /sys/class/net/eth0/addr_assign_type
2025-03-12 11:22:33,618 - util.py[DEBUG]: Reading from /sys/class/net/lo/type (quiet=False)
2025-03-12 11:22:33,618 - util.py[DEBUG]: Reading 4 bytes from /sys/class/net/lo/type
2025-03-12 11:22:33,618 - util.py[DEBUG]: Reading from /sys/class/net/wlp1s0f0/type (quiet=False)
2025-03-12 11:22:33,618 - util.py[DEBUG]: Reading 2 bytes from /sys/class/net/wlp1s0f0/type
2025-03-12 11:22:33,618 - networking.py[DEBUG]: net: waiting for expected net devices: {'28:00:af:0a:b4:8e'}
2025-03-12 11:22:33,619 - performance.py[DEBUG]: Waiting for settle or eth0 exists took 0.000 seconds
2025-03-12 11:22:33,619 - util.py[DEBUG]: Reading from /sys/class/net/lo/addr_assign_type (quiet=False)
2025-03-12 11:22:33,619 - util.py[DEBUG]: Reading 2 bytes from /sys/class/net/lo/addr_assign_type
2025-03-12 11:22:33,619 - util.py[DEBUG]: Reading from /sys/class/net/lo/uevent (quiet=False)
2025-03-12 11:22:33,619 - util.py[DEBUG]: Reading 23 bytes from /sys/class/net/lo/uevent
2025-03-12 11:22:33,619 - util.py[DEBUG]: Reading from /sys/class/net/lo/address (quiet=False)
2025-03-12 11:22:33,619 - util.py[DEBUG]: Reading 18 bytes from /sys/class/net/lo/address
2025-03-12 11:22:33,619 - util.py[DEBUG]: Reading from /sys/class/net/lo/device/device (quiet=False)
2025-03-12 11:22:33,619 - util.py[DEBUG]: Reading from /sys/class/net/wlp1s0f0/addr_assign_type (quiet=False)
2025-03-12 11:22:33,619 - util.py[DEBUG]: Reading 2 bytes from /sys/class/net/wlp1s0f0/addr_assign_type
2025-03-12 11:22:33,619 - util.py[DEBUG]: Reading from /sys/class/net/wlp1s0f0/uevent (quiet=False)
2025-03-12 11:22:33,619 - util.py[DEBUG]: Reading 42 bytes from /sys/class/net/wlp1s0f0/uevent
2025-03-12 11:22:33,619 - util.py[DEBUG]: Reading from /sys/class/net/wlp1s0f0/address (quiet=False)
2025-03-12 11:22:33,619 - util.py[DEBUG]: Reading 18 bytes from /sys/class/net/wlp1s0f0/address
2025-03-12 11:22:33,619 - util.py[DEBUG]: Reading from /sys/class/net/wlp1s0f0/device/device (quiet=False)
2025-03-12 11:22:33,619 - util.py[DEBUG]: Reading 7 bytes from /sys/class/net/wlp1s0f0/device/device
2025-03-12 11:22:33,619 - util.py[DEBUG]: Reading from /sys/class/net/eth0/addr_assign_type (quiet=False)
2025-03-12 11:22:33,619 - util.py[DEBUG]: Reading 2 bytes from /sys/class/net/eth0/addr_assign_type
2025-03-12 11:22:33,619 - util.py[DEBUG]: Reading from /sys/class/net/lo/type (quiet=False)
2025-03-12 11:22:33,619 - util.py[DEBUG]: Reading 4 bytes from /sys/class/net/lo/type
2025-03-12 11:22:33,619 - util.py[DEBUG]: Reading from /sys/class/net/wlp1s0f0/type (quiet=False)
2025-03-12 11:22:33,619 - util.py[DEBUG]: Reading 2 bytes from /sys/class/net/wlp1s0f0/type
2025-03-12 11:22:33,619 - networking.py[DEBUG]: net: waiting for expected net devices: {'28:00:af:0a:b4:8e'}
2025-03-12 11:22:33,619 - performance.py[DEBUG]: Waiting for settle or eth0 exists took 0.000 seconds
2025-03-12 11:22:33,619 - util.py[DEBUG]: Reading from /sys/class/net/lo/addr_assign_type (quiet=False)
2025-03-12 11:22:33,619 - util.py[DEBUG]: Reading 2 bytes from /sys/class/net/lo/addr_assign_type
2025-03-12 11:22:33,619 - util.py[DEBUG]: Reading from /sys/class/net/lo/uevent (quiet=False)
2025-03-12 11:22:33,619 - util.py[DEBUG]: Reading 23 bytes from /sys/class/net/lo/uevent
2025-03-12 11:22:33,619 - util.py[DEBUG]: Reading from /sys/class/net/lo/address (quiet=False)
2025-03-12 11:22:33,619 - util.py[DEBUG]: Reading 18 bytes from /sys/class/net/lo/address
2025-03-12 11:22:33,619 - util.py[DEBUG]: Reading from /sys/class/net/lo/device/device (quiet=False)
2025-03-12 11:22:33,619 - util.py[DEBUG]: Reading from /sys/class/net/wlp1s0f0/addr_assign_type (quiet=False)
2025-03-12 11:22:33,619 - util.py[DEBUG]: Reading 2 bytes from /sys/class/net/wlp1s0f0/addr_assign_type
2025-03-12 11:22:33,619 - util.py[DEBUG]: Reading from /sys/class/net/wlp1s0f0/uevent (quiet=False)
2025-03-12 11:22:33,619 - util.py[DEBUG]: Reading 42 bytes from /sys/class/net/wlp1s0f0/uevent
2025-03-12 11:22:33,619 - util.py[DEBUG]: Reading from /sys/class/net/wlp1s0f0/address (quiet=False)
2025-03-12 11:22:33,619 - util.py[DEBUG]: Reading 18 bytes from /sys/class/net/wlp1s0f0/address
2025-03-12 11:22:33,619 - util.py[DEBUG]: Reading from /sys/class/net/wlp1s0f0/device/device (quiet=False)
2025-03-12 11:22:33,619 - util.py[DEBUG]: Reading 7 bytes from /sys/class/net/wlp1s0f0/device/device
2025-03-12 11:22:33,619 - util.py[DEBUG]: Reading from /sys/class/net/eth0/addr_assign_type (quiet=False)
2025-03-12 11:22:33,619 - util.py[DEBUG]: Reading 2 bytes from /sys/class/net/eth0/addr_assign_type
2025-03-12 11:22:33,619 - util.py[DEBUG]: Reading from /sys/class/net/lo/type (quiet=False)
2025-03-12 11:22:33,619 - util.py[DEBUG]: Reading 4 bytes from /sys/class/net/lo/type
2025-03-12 11:22:33,619 - util.py[DEBUG]: Reading from /sys/class/net/wlp1s0f0/type (quiet=False)
2025-03-12 11:22:33,619 - util.py[DEBUG]: Reading 2 bytes from /sys/class/net/wlp1s0f0/type
2025-03-12 11:22:33,619 - networking.py[DEBUG]: net: waiting for expected net devices: {'28:00:af:0a:b4:8e'}
2025-03-12 11:22:33,619 - performance.py[DEBUG]: Waiting for settle or eth0 exists took 0.000 seconds
2025-03-12 11:22:33,619 - util.py[DEBUG]: Reading from /sys/class/net/lo/addr_assign_type (quiet=False)
2025-03-12 11:22:33,619 - util.py[DEBUG]: Reading 2 bytes from /sys/class/net/lo/addr_assign_type
2025-03-12 11:22:33,619 - util.py[DEBUG]: Reading from /sys/class/net/lo/uevent (quiet=False)
2025-03-12 11:22:33,619 - util.py[DEBUG]: Reading 23 bytes from /sys/class/net/lo/uevent
2025-03-12 11:22:33,619 - util.py[DEBUG]: Reading from /sys/class/net/lo/address (quiet=False)
2025-03-12 11:22:33,619 - util.py[DEBUG]: Reading 18 bytes from /sys/class/net/lo/address
2025-03-12 11:22:33,620 - util.py[DEBUG]: Reading from /sys/class/net/lo/device/device (quiet=False)
2025-03-12 11:22:33,620 - util.py[DEBUG]: Reading from /sys/class/net/wlp1s0f0/addr_assign_type (quiet=False)
2025-03-12 11:22:33,620 - util.py[DEBUG]: Reading 2 bytes from /sys/class/net/wlp1s0f0/addr_assign_type
2025-03-12 11:22:33,620 - util.py[DEBUG]: Reading from /sys/class/net/wlp1s0f0/uevent (quiet=False)
2025-03-12 11:22:33,620 - util.py[DEBUG]: Reading 42 bytes from /sys/class/net/wlp1s0f0/uevent
2025-03-12 11:22:33,620 - util.py[DEBUG]: Reading from /sys/class/net/wlp1s0f0/address (quiet=False)
2025-03-12 11:22:33,620 - util.py[DEBUG]: Reading 18 bytes from /sys/class/net/wlp1s0f0/address
2025-03-12 11:22:33,620 - util.py[DEBUG]: Reading from /sys/class/net/wlp1s0f0/device/device (quiet=False)
2025-03-12 11:22:33,620 - util.py[DEBUG]: Reading 7 bytes from /sys/class/net/wlp1s0f0/device/device
2025-03-12 11:22:33,620 - util.py[DEBUG]: Reading from /sys/class/net/eth0/addr_assign_type (quiet=False)
2025-03-12 11:22:33,620 - util.py[DEBUG]: Reading 2 bytes from /sys/class/net/eth0/addr_assign_type
2025-03-12 11:22:33,620 - util.py[DEBUG]: Reading from /sys/class/net/lo/type (quiet=False)
2025-03-12 11:22:33,620 - util.py[DEBUG]: Reading 4 bytes from /sys/class/net/lo/type
2025-03-12 11:22:33,620 - util.py[DEBUG]: Reading from /sys/class/net/wlp1s0f0/type (quiet=False)
2025-03-12 11:22:33,620 - util.py[DEBUG]: Reading 2 bytes from /sys/class/net/wlp1s0f0/type
2025-03-12 11:22:33,620 - networking.py[DEBUG]: net: waiting for expected net devices: {'28:00:af:0a:b4:8e'}
2025-03-12 11:22:33,620 - performance.py[DEBUG]: Waiting for settle or eth0 exists took 0.000 seconds
2025-03-12 11:22:33,620 - util.py[DEBUG]: Reading from /sys/class/net/lo/addr_assign_type (quiet=False)
2025-03-12 11:22:33,620 - util.py[DEBUG]: Reading 2 bytes from /sys/class/net/lo/addr_assign_type
2025-03-12 11:22:33,620 - util.py[DEBUG]: Reading from /sys/class/net/lo/uevent (quiet=False)
2025-03-12 11:22:33,620 - util.py[DEBUG]: Reading 23 bytes from /sys/class/net/lo/uevent
2025-03-12 11:22:33,620 - util.py[DEBUG]: Reading from /sys/class/net/lo/address (quiet=False)
2025-03-12 11:22:33,620 - util.py[DEBUG]: Reading 18 bytes from /sys/class/net/lo/address
2025-03-12 11:22:33,620 - util.py[DEBUG]: Reading from /sys/class/net/lo/device/device (quiet=False)
2025-03-12 11:22:33,620 - util.py[DEBUG]: Reading from /sys/class/net/wlp1s0f0/addr_assign_type (quiet=False)
2025-03-12 11:22:33,620 - util.py[DEBUG]: Reading 2 bytes from /sys/class/net/wlp1s0f0/addr_assign_type
2025-03-12 11:22:33,620 - util.py[DEBUG]: Reading from /sys/class/net/wlp1s0f0/uevent (quiet=False)
2025-03-12 11:22:33,620 - util.py[DEBUG]: Reading 42 bytes from /sys/class/net/wlp1s0f0/uevent
2025-03-12 11:22:33,620 - util.py[DEBUG]: Reading from /sys/class/net/wlp1s0f0/address (quiet=False)
2025-03-12 11:22:33,620 - util.py[DEBUG]: Reading 18 bytes from /sys/class/net/wlp1s0f0/address
2025-03-12 11:22:33,620 - util.py[DEBUG]: Reading from /sys/class/net/wlp1s0f0/device/device (quiet=False)
2025-03-12 11:22:33,620 - util.py[DEBUG]: Reading 7 bytes from /sys/class/net/wlp1s0f0/device/device
2025-03-12 11:22:33,620 - util.py[DEBUG]: Reading from /sys/class/net/eth0/addr_assign_type (quiet=False)
2025-03-12 11:22:33,620 - util.py[DEBUG]: Reading 2 bytes from /sys/class/net/eth0/addr_assign_type
2025-03-12 11:22:33,620 - util.py[DEBUG]: Reading from /sys/class/net/lo/type (quiet=False)
2025-03-12 11:22:33,620 - util.py[DEBUG]: Reading 4 bytes from /sys/class/net/lo/type
2025-03-12 11:22:33,620 - util.py[DEBUG]: Reading from /sys/class/net/wlp1s0f0/type (quiet=False)
2025-03-12 11:22:33,620 - util.py[DEBUG]: Reading 2 bytes from /sys/class/net/wlp1s0f0/type
2025-03-12 11:22:33,620 - networking.py[DEBUG]: net: waiting for expected net devices: {'28:00:af:0a:b4:8e'}
2025-03-12 11:22:33,620 - performance.py[DEBUG]: Waiting for settle or eth0 exists took 0.000 seconds
2025-03-12 11:22:33,620 - util.py[DEBUG]: Reading from /sys/class/net/lo/addr_assign_type (quiet=False)
2025-03-12 11:22:33,620 - util.py[DEBUG]: Reading 2 bytes from /sys/class/net/lo/addr_assign_type
2025-03-12 11:22:33,620 - util.py[DEBUG]: Reading from /sys/class/net/lo/uevent (quiet=False)
2025-03-12 11:22:33,620 - util.py[DEBUG]: Reading 23 bytes from /sys/class/net/lo/uevent
2025-03-12 11:22:33,620 - util.py[DEBUG]: Reading from /sys/class/net/lo/address (quiet=False)
2025-03-12 11:22:33,620 - util.py[DEBUG]: Reading 18 bytes from /sys/class/net/lo/address
2025-03-12 11:22:33,620 - util.py[DEBUG]: Reading from /sys/class/net/lo/device/device (quiet=False)
2025-03-12 11:22:33,620 - util.py[DEBUG]: Reading from /sys/class/net/wlp1s0f0/addr_assign_type (quiet=False)
2025-03-12 11:22:33,620 - util.py[DEBUG]: Reading 2 bytes from /sys/class/net/wlp1s0f0/addr_assign_type
2025-03-12 11:22:33,620 - util.py[DEBUG]: Reading from /sys/class/net/wlp1s0f0/uevent (quiet=False)
2025-03-12 11:22:33,620 - util.py[DEBUG]: Reading 42 bytes from /sys/class/net/wlp1s0f0/uevent
2025-03-12 11:22:33,620 - util.py[DEBUG]: Reading from /sys/class/net/wlp1s0f0/address (quiet=False)
2025-03-12 11:22:33,620 - util.py[DEBUG]: Reading 18 bytes from /sys/class/net/wlp1s0f0/address
2025-03-12 11:22:33,620 - util.py[DEBUG]: Reading from /sys/class/net/wlp1s0f0/device/device (quiet=False)
2025-03-12 11:22:33,620 - util.py[DEBUG]: Reading 7 bytes from /sys/class/net/wlp1s0f0/device/device
2025-03-12 11:22:33,620 - util.py[DEBUG]: Reading from /sys/class/net/eth0/addr_assign_type (quiet=False)
2025-03-12 11:22:33,621 - util.py[DEBUG]: Reading 2 bytes from /sys/class/net/eth0/addr_assign_type
2025-03-12 11:22:33,621 - util.py[DEBUG]: Reading from /sys/class/net/lo/type (quiet=False)
2025-03-12 11:22:33,621 - util.py[DEBUG]: Reading 4 bytes from /sys/class/net/lo/type
2025-03-12 11:22:33,621 - util.py[DEBUG]: Reading from /sys/class/net/wlp1s0f0/type (quiet=False)
2025-03-12 11:22:33,621 - util.py[DEBUG]: Reading 2 bytes from /sys/class/net/wlp1s0f0/type
2025-03-12 11:22:33,621 - networking.py[WARNING]: Not all expected physical devices present: {'28:00:af:0a:b4:8e'}
2025-03-12 11:22:33,621 - main.py[ERROR]: failed stage init
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/cloudinit/cmd/main.py", line 922, in status_wrapper
ret = functor(name, args)
^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/cloudinit/cmd/main.py", line 553, in main_init
init.apply_network_config(bring_up=bring_up_interfaces)
File "/usr/lib/python3/dist-packages/cloudinit/stages.py", line 1105, in apply_network_config
self.distro.networking.wait_for_physdevs(netcfg)
File "/usr/lib/python3/dist-packages/cloudinit/distros/networking.py", line 166, in wait_for_physdevs
raise RuntimeError(msg)
RuntimeError: Not all expected physical devices present: {'28:00:af:0a:b4:8e'}
```
Contributor guide
Assessment
This issue has not been assessed yet.