[systemd-devel] systemd-nspawn: cannot join existing macvlan

Kai Krakow hurikhan77 at gmail.com
Fri May 1 10:26:17 PDT 2015


Hello!

I'm not sure about this but I suspect that I cannot start a second nspawn 
container with --network-macvlan when another nspawn instance has created it 
before:

# systemd-nspawn -b --network-macvlan=enp4s0
Spawning container gentoo-mysql-base on /var/lib/machines/gentoo-mysql-base.
Press ^] three times within 1s to kill container.
Failed to add new macvlan interfaces: File exists

To my surprise it works when adding machines to machines.target. While you 
cannot start them through means of systemd because of the same error, it 
works during boot of the whole system: All containers boot up properly - but 
stop one and you cannot restart it.

So it looks like there's an unintentional race condition during boot which 
allows to create this interface but when the system is up, it no longer 
works because the race condition is no longer present.

systemd-nspawn should probably just allow joining existing macvlan bridges. 
I would fix it in the code but I don't know the implications why this check 
is in there in the first place.

A second fix should maybe do something about such race conditions if it is 
such one. I suspect there are cases where the interface presence check makes 
actually sense.

-- 
Replies to list only preferred.



More information about the systemd-devel mailing list