LXD: Network interfaces get renamed, container restart fails

I did find evidence of interface name changes on my failing LXD 5.0 box.
I have just 1 NIC that I use (also a WiFi, but it was never configured in Netplan).

I got this (and then some) problems after a host reboot for maintenance. Now I’m getting a bunch of different errors on Ubuntu 20.04 with LXD 5.0 and containers can’t start.

I am using snapd with latest/stable; this was the first orderly restart after (unexpected) upgrade of LXD to 5.0 by snapd (I shouldn’t have used latest/stable, 4.0 worked fine before).

Anyway, as far as one of the issues - the network interface name change - is concerned, I see this in syslog:

Apr 15 06:42:45 server kernel: [   43.465960] device vethe34f7be2 entered promiscuous mode
Apr 15 06:42:45 server zed: eid=15 class=history_event pool_guid=0x7FA2A2DA6C8B7235  
Apr 15 06:42:45 server zed: eid=16 class=history_event pool_guid=0x7FA2A2DA6C8B7235  
Apr 15 06:42:45 server zed: eid=17 class=history_event pool_guid=0x7FA2A2DA6C8B7235  
Apr 15 06:42:45 server kernel: [   43.582430] audit: type=1400 audit(1650004965.651:61): apparmor="STATUS" operation="profile_load" profile="unconfined" name="lxd-mycont </var/snap/lxd/common/lxd>" pid=14896 comm="apparmor_parser"
Apr 15 06:42:45 server kernel: [   43.660602] physi2Ry4Y: renamed from vetha32d6312
Apr 15 06:42:45 server kernel: [   43.684939] eth0: renamed from physi2Ry4Y
Apr 15 06:42:45 server systemd-networkd[1579]: vethe34f7be2: Gained carrier
Apr 15 06:42:45 server kernel: [   43.709518] lxdbr0: port 2(vethe34f7be2) entered blocking state
Apr 15 06:42:45 server kernel: [   43.709520] lxdbr0: port 2(vethe34f7be2) entered forwarding state
Apr 15 06:42:48 server systemd[1]: systemd-hostnamed.service: Succeeded.

I looked around and it seems this could be related to systemd (current version 250, current version in Ubuntu 20.04 is 245 and at that time they still didn’t publish change logs so it’s hard to figure out what changed in 246 or 247, for example). I also looked at udev rules, but didn’t find any unusual, the same with networkd-dispatcher (running with in verbose mode revealed nothing new).

I also tried configuring systemd-network to start after udev. No difference.

[Unit]
After=systemd-udev-settle.service

My last try was to change default bridge to br0 and bring br0 up via Netplan rather than leave it to LXD, but that doesn’t help.

Does this fix it?

In /usr/lib/systemd/network/99-default.link

Remove ‘keep’ from NamePolicy.

[Match]
OriginalName=*

[Link]
NamePolicy=kernel database onboard slot path
AlternativeNamesPolicy=database onboard slot path
MACAddressPolicy=persistent

3 Likes

Sorry for replying to an old topic. I had the same trouble as the poster of this topic.
And today I am very lucky. I found this thread.

@Pieter I followed your advice and my container rebooted successfully.

I am a beginner in both Linux and LDX (and English), so I didn’t even know how to look for tips to solve the problem. Unfortunately, I don’t even really understand what the settings I made this time mean.
Regardless, I am so full of gratitude to you and all the people on this thread that I immediately created an account on this forum.

Thank you very much and have a nice weekend.

1 Like