networkd not applying config - missing events?
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
netplan.io (Ubuntu) |
Invalid
|
Undecided
|
Unassigned | ||
systemd (Ubuntu) |
Invalid
|
Undecided
|
Unassigned |
Bug Description
Hi,
TL;DR:
- networkd config written by netplan
- it seems we can eliminate netplan from this and still have the issue
- networkd seems to miss the event of the devices and therefore consider them unmanaged
- rebinding them makes it work
- the way to trigger this I found so far are q35 KVM guests (PCIe), but
there might be more
---
I miss some hidden trigger of "netplan apply" to understand the following case.
I have kvm guests, you can spawn your own one to reproduce via:
$ uvt-simplestrea
$ uvt-kvm create --password ubuntu bionic-netplan arch=amd64 release=bionic label=daily
So far all is good, but I wanted to run on q35 type guests (that means PCIe instead of PCI) based and more modern. To do so:
1. shut down your guest
2. run virsh edit bionic-netplan
2.1 replace pc-i440fx-bionic -> pc-q35-bionic
2.2 replace pci-root with pcie-root
2.3 replace piix3-uhci -> piix4-uhci
3. start the guest again
virsh start bionic-netplan
It won't get network connection, this is where I started debugging.
I thought the devices might be wrong now or anything like it, but it is more puzzling.
First I realized that the device names changed from ens3 -> enp0s3 (the kernel naming).
So I thought this entry might have a problem:
ethernets:
ens3:
dhcp4: true
match:
I tried to name these enp0s3 to match,but it didn't matter and also according to the netplan man page:
If there are match: rules, then the ID field is a purely opaque name which is only being used
for references from definitions of compound devices in the config
And I found it works just fine when I run "sudo netplan apply".
This was odd, so to summarize up to here:
- PCIe based virt guest
- netplan egenrated config not working after (re)boot
- "netplan apply" makes it working
I disabled any cloud init things as recommended by the comment
/etc/
network: {config: disabled}
So that I can rely on my netplan yaml to stay as is.
I tried various things but so far can't find what magic "netplan apply" does which is missing to my boot.
I checked after reboot the devices are considered unmanaged by networkctl
$ networkctl list
IDX LINK TYPE OPERATIONAL SETUP
1 lo loopback carrier unmanaged
2 enp0s3 ether off unmanaged
But the config was generated:
$ ll /run/systemd/
total 32
drwxr-xr-x 2 root root 200 Jun 7 09:02 ./
drwxr-xr-x 22 root root 500 Jun 7 09:02 ../
-rw-r--r-- 1 root root 69 Jun 7 09:02 10-netplan-
-rw-r--r-- 1 root root 104 Jun 7 09:02 10-netplan-
I checked the log and saw that apply restarts networkd.
So I thought might just restart networkd, so I ran
$ sudo systemctl restart systemd-
But things stayed as-is without the config being picked up.
With some nice discussion and help on IRC I also tried to disable netplan and check if this is networkd only.
# make this static networkd
$ sudo cp /run/systemd/
# no netplan config
$ sudo mv /etc/netplan/* /root
That was supposed to show if networkd itself (or its config files) had issues.
And with that it still did not work, so is the error in networkd instead?
If so what magic thing does "netplan apply" do to fix it?
Since it might be networkd as well I added a bug task for it.