Public bug reported:

On Ubuntu xenial,

        $ lsb_release -rd
        Description:    Ubuntu 16.04 LTS
        Release:        16.04
        $ apt-cache policy systemd
        systemd:
          Installed: 229-4ubuntu4
          Candidate: 229-4ubuntu4
          Version table:
         *** 229-4ubuntu4 500
                500 http://apt/ubuntu xenial/main amd64 Packages
                100 /var/lib/dpkg/status

The systemd-nspawn manpage states that the existing --network-interface=
device should be returned to the host's namespace on exit:

       --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.

However, this does not appear to be the case for a VLAN interface
(created using systemd-networkd):

        $ ip link
        1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN 
mode DEFAULT group default qlen 1
            link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
        2: eno1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP 
mode DEFAULT group default qlen 1000
            link/ether 00:26:b9:5a:45:03 brd ff:ff:ff:ff:ff:ff
        3: eno2: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN mode 
DEFAULT group default qlen 1000
            link/ether 00:26:b9:5a:45:04 brd ff:ff:ff:ff:ff:ff
        6: vlan-terom-dev@eno1: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state 
DOWN mode DEFAULT group default qlen 1000
            link/ether 66:c9:35:09:49:74 brd ff:ff:ff:ff:ff:ff
        $ sudo systemd-nspawn -M obelix-terom-dev 
--network-interface=vlan-terom-dev bash
        Spawning container obelix-terom-dev on 
/var/lib/machines/.#machine.obelix-terom-devfc1e2f39f5df67dd.
        Press ^] three times within 1s to kill container.
        mount(/var/lib/machines/obelix-terom-dev/sys/fs/selinux) failed, 
ignoring: No such file or directory
        mount(/var/lib/machines/obelix-terom-dev/sys/fs/selinux) failed, 
ignoring: Invalid argument
        /etc/localtime is not a symlink, not updating container timezone.
        root@obelix-terom-dev:/# ip link
        1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN 
mode DEFAULT group default qlen 1
            link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
        6: vlan-terom-dev@if2: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state 
DOWN mode DEFAULT group default qlen 1000
            link/ether 66:c9:35:09:49:74 brd ff:ff:ff:ff:ff:ff link-netnsid 0
        root@obelix-terom-dev:/# exit
        Container obelix-terom-dev exited successfully.
        $ ip link
        1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN 
mode DEFAULT group default qlen 1
            link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
        2: eno1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP 
mode DEFAULT group default qlen 1000
            link/ether 00:26:b9:5a:45:03 brd ff:ff:ff:ff:ff:ff
        3: eno2: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN mode 
DEFAULT group default qlen 1000
            link/ether 00:26:b9:5a:45:04 brd ff:ff:ff:ff:ff:ff
        $ sudo systemd-nspawn -M obelix-terom-dev 
--network-interface=vlan-terom-dev bash
        Spawning container obelix-terom-dev on 
/var/lib/machines/obelix-terom-dev.
        Press ^] three times within 1s to kill container.
        Failed to resolve interface vlan-terom-dev: No such device
        mount(/var/lib/machines/obelix-terom-dev/sys/fs/selinux) failed, 
ignoring: No such file or directory
        mount(/var/lib/machines/obelix-terom-dev/sys/fs/selinux) failed, 
ignoring: Invalid argument
        /etc/localtime is not a symlink, not updating container timezone.
        $ 

Possibly related upstream mailing list thread, including workarounds:

        https://lists.freedesktop.org/archives/systemd-
devel/2015-April/030934.html

Is this just a documentation bug in the man page?

** Affects: systemd (Ubuntu)
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1580192

Title:
  systemd-nspawn --network-interface= disappears when container exits

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/systemd/+bug/1580192/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to