[systemd-devel] Systemd-nspawn: cannot add interfaces with --network-interface flag

James Lott james at lottspot.com
Thu Oct 9 15:14:18 PDT 2014


Hi Lennart!

Thanks for your response! I observed this issue on Arch Linux ARM running 
systemd-216-3, which it appears uses sources from about a week before that 
patch was committed. Thanks for pointing out the commit! I'll compile from 
HEAD and test again 

On Wednesday 08 October 2014 14:08:07 Lennart Poettering wrote:
> On Fri, 03.10.14 10:58, James Lott (james at lottspot.com) wrote:
> > Hello,
> > 
> > A little bit back I wrote in about having some difficulties adding network
> > devices to containers. With some help from the list, I figured out how to
> > add my network devices to an already running container using 'iw phy' and
> > 'ip link'.
> > 
> > However, I have not yet successfully added an interface to a container by
> > way of the --network-interface flag. Attempting to add any ethernet
> > devices by this method meets with the error:
> > 
> > [root at host01 lanvpn]# systemd-nspawn --network-interface=eth1
> > Spawning container lanvpn on /home/lanvpn.
> > Press ^] three times within 1s to kill container.
> > Failed to move interface eth1 to namespace: File exists
> > 
> > According to the systemd-nspawn documentation, it seems like this
> > invocation should work
> > 
> >        --network-interface=
> >        
> >            Assign the specified network interface to the container. This
> >            will
> > 
> > remove the specified interface from the calling namespace and place it in
> > the container.
> > 
> >            When the container terminates, it is moved back to the host
> > 
> > namespace. Note that --network-interface= implies --private-network. This
> > option may be used more
> > 
> >            than once to add multiple network interfaces to the container.
> > 
> > If I'm doing something wrong, then it seems like the documentation may
> > desire revisiting. If I'm not, then this could be unintended behavior.
> 
> Which version of systemd-nspawn are you trying this with? Note that
> there was a recent fix in the code handling --network-interface=, that
> might make work what you are trying to do:
> 
> http://cgit.freedesktop.org/systemd/systemd/commit/src/nspawn/nspawn.c?id=31
> 25b3ef5db70d45882c7d6f617705802c5f939e
> 
> Lennart



More information about the systemd-devel mailing list