ifdown -a fails with vlans on bonded interface

Bug #1295304 reported by Chris J Arges on 2014-03-20
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
ifupdown (Ubuntu)
High
Chris J Arges

Bug Description

This has been observed in trusty:
ii ifupdown 0.7.47.2ubuntu1 amd64 high level tools to configure network interfaces

VLAN interfaces are unable to be brought down properly with ifdown -a:

$ sudo ifdown -av
run-parts --verbose /etc/network/if-down.d
run-parts: executing /etc/network/if-down.d/resolvconf
run-parts: executing /etc/network/if-down.d/upstart
Configuring interface bond0.205=bond0.205 (inet)
run-parts --verbose /etc/network/if-down.d
run-parts: executing /etc/network/if-down.d/resolvconf
run-parts: executing /etc/network/if-down.d/upstart

ip -4 addr flush dev bond0.205 label bond0.205
run-parts --verbose /etc/network/if-post-down.d
run-parts: executing /etc/network/if-post-down.d/bridge
run-parts: executing /etc/network/if-post-down.d/ifenslave
+ BOND_PARAMS=/sys/class/net/bond0.205/bonding
+ IFSTATE=/run/network/ifstate
+ [ -f /sys/class/net/bond0.205/master/bonding/slaves ]
+ [ ! -f /sys/class/net/bond0.205/bonding/slaves ]
+ exit
run-parts: executing /etc/network/if-post-down.d/vlan
Removed VLAN -:bond0.205:-
ip link del bond0.205
Cannot find device "bond0.205"
run-parts --verbose /etc/network/if-post-down.d
run-parts: executing /etc/network/if-post-down.d/bridge
run-parts: executing /etc/network/if-post-down.d/ifenslave
+ BOND_PARAMS=/sys/class/net/--all/bonding
+ IFSTATE=/run/network/ifstate
+ [ -f /sys/class/net/--all/master/bonding/slaves ]
+ [ ! -f /sys/class/net/--all/bonding/slaves ]
+ exit
run-parts: executing /etc/network/if-post-down.d/vlan

$ ifconfig
bond0 Link encap:Ethernet HWaddr 52:54:00:ae:24:cf
          inet addr:192.168.122.207 Bcast:192.168.122.255 Mask:255.255.255.0
          UP BROADCAST RUNNING MASTER MULTICAST MTU:1500 Metric:1
          RX packets:114 errors:0 dropped:53 overruns:0 frame:0
          TX packets:61 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:7630 (7.6 KB) TX bytes:5102 (5.1 KB)

bond0.201 Link encap:Ethernet HWaddr 52:54:00:ae:24:cf
          inet addr:192.168.201.10 Bcast:192.168.201.255 Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:0 (0.0 B) TX bytes:42 (42.0 B)

eth0 Link encap:Ethernet HWaddr 52:54:00:ae:24:cf
          UP BROADCAST RUNNING SLAVE MULTICAST MTU:1500 Metric:1
          RX packets:56 errors:0 dropped:53 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:3170 (3.1 KB) TX bytes:0 (0.0 B)

eth1 Link encap:Ethernet HWaddr 52:54:00:ae:24:cf
          UP BROADCAST RUNNING SLAVE MULTICAST MTU:1500 Metric:1
          RX packets:58 errors:0 dropped:0 overruns:0 frame:0
          TX packets:61 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:4460 (4.4 KB) TX bytes:5102 (5.1 KB)

lo Link encap:Local Loopback
          inet addr:127.0.0.1 Mask:255.0.0.0
          UP LOOPBACK RUNNING MTU:65536 Metric:1
          RX packets:16 errors:0 dropped:0 overruns:0 frame:0
          TX packets:16 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:1184 (1.1 KB) TX bytes:1184 (1.1 KB)

We'd expect that all interfaces come down with 'ifdown -a', but we get this error.

[Test Case]

Create a Trusty VM with two network interfaces, or have hardware with two network interfaces.

Change /etc/network/interfaces to the following:
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet manual
        bond-master bond0

auto eth1
iface eth1 inet manual
        bond-master bond0

auto bond0
iface bond0 inet dhcp
        bond-slaves none
        bond-primary eth0
        bond-mode 1
        bond-miimon 100
        bond-updelay 200
        bond-downdelay 200

auto bond0.201
iface bond0.201 inet static
        address 192.168.201.10
        netmask 255.255.255.0

auto bond0.205
iface bond0.205 inet static
        address 192.168.205.10
        netmask 255.255.255.0

--

ProblemType: Bug
DistroRelease: Ubuntu 14.04
Package: ifupdown 0.7.47.2ubuntu1
ProcVersionSignature: User Name 3.13.0-17.37-generic 3.13.6
Uname: Linux 3.13.0-17-generic x86_64
ApportVersion: 2.13.3-0ubuntu1
Architecture: amd64
Date: Thu Mar 20 18:16:49 2014
ProcEnviron:
 TERM=vt102
 PATH=(custom, no user)
 XDG_RUNTIME_DIR=<set>
 LANG=en_US.UTF-8
 SHELL=/bin/bash
SourcePackage: ifupdown
UpgradeStatus: No upgrade log present (probably fresh install)

Chris J Arges (arges) wrote :
Changed in ifupdown (Ubuntu):
importance: Undecided → High
description: updated
Changed in ifupdown (Ubuntu):
assignee: nobody → Chris J Arges (arges)
status: New → In Progress
summary: - ifdown -a fails when we have vlans on bonded interface
+ ifdown -a fails with vlans on bonded interface
Chris J Arges (arges) wrote :

As a workaround I was able to issue 'ifdown -a' 3 times and all interfaces came down properly. Then 'ifup -a' brought all interfaces back up.

Chris J Arges (arges) wrote :

Tested with https://launchpad.net/~stgraber/+archive/experimental (0.7.47.2ubuntu2~ppa2) and it fixes this issue.

Launchpad Janitor (janitor) wrote :

This bug was fixed in the package ifupdown - 0.7.47.2ubuntu2

---------------
ifupdown (0.7.47.2ubuntu2) trusty; urgency=medium

  [ Stéphane Graber ]
  * Allow setting the MTU and HWADDR on manual interfaces. (LP: #1294807)
  * The above change also means that manual interfaces will now be
    brought up and down (ias many users expected until now).
  * Disable link.defn as it's not covering all the cases supported by
    the vlan and bridge hooks and so causes more harm than good at this
    point. (LP: #1295304)
  * Also enable network-interface-container for OpenVZ. (LP: #1294155)
  * Update networking.init to exit 1 on reload when on an upstart system.
  * Pass --force to ifdown in network-interface to silence errors on
    non-existing interfaces. (LP: #1295620)

  [ Dimitri John Ledkov ]
  * Prevent the ability to stop or restart networking service
    interactively. As that is not supported. Networking job is only stopped
    during shutdown sequence. (LP: #1072518)
 -- Stephane Graber <email address hidden> Wed, 19 Mar 2014 18:04:49 -0400

Changed in ifupdown (Ubuntu):
status: In Progress → Fix Released
Andrej Shadura (andrew.sh) wrote :

Stéphane, why haven't you forwarded this bug to me and have silently patched the code out? It's not how issues are supposed to be dealt with.

Changed in ifupdown (Ubuntu):
assignee: Chris J Arges (arges) → Andrew Shadura (andrew.sh)
Andrej Shadura (andrew.sh) wrote :

Please reopen this bug. And also please add me to a proper ACL so I can control bugs normally.

Stéphane Graber (stgraber) wrote :

Hi Andrew, my understanding from back when you introduced that support into ifupdown was that you intended for people to use ifupdown directly for bridge and vlan management rather than through the hooks provided by bridge-utils and vlan.

Since Ubuntu is doing a bit of weird magic here (compared to how things are in Debian) and the actual bridge and vlan creation is sometimes triggered from udev entirely independently of ifupdown, it seemed to me like there wouldn't be a real way of changing ifupdown to cope with this and that rather than having two piece of software try to do the same thing, turning the whole vlan and bridge support of in ifupdown seemed the right way forward.

Stéphane Graber (stgraber) wrote :

The problem specifically here is that both vlan's post-down hook and ifupdown both try to destroy the vlan, which obviously fails.
We could obviously make the deletion of the interface in ifupdown non-fatal, but I'm not convinced it's the right course of action if you intend people to use ifupdown directly for vlan management.

As for what seems to be lacking in ifupdown's own vlan implementation, from a quick look at the code, it looked like the following:
 - No way to trigger the vlan device creation when the parent device appears (from udev hook) which is required for event based network bring up in Ubuntu
 - Doesn't support all the interface name syntaxes supported by vlan's ifupdown hooks

For bridges, only the first of those two applies (we need a way for udev to create any relevant bridge when a slave first appears on the machine).

Stéphane Graber (stgraber) wrote :

As for ACLs, there's no way for me to add per-package bug management ACLs in Launchpad so I'm afraid I can't help there.

As far as this particular issue is concerned, it's been resolved in a way that we feel like we can support for the LTS and which is consistent with our existing documentation (mostly from 12.04). I would be interested in discussing ways to use ifupdown's own support for those features in the future, but would rather do that in 14.10 (though I also have to figure out how our whole network story will get impacted by the upcoming switch to systemd and how ifupdown fits in all that...).

Chris J Arges (arges) on 2014-03-25
Changed in ifupdown (Ubuntu Precise):
assignee: nobody → Chris J Arges (arges)
importance: Undecided → High
status: New → In Progress
Chris J Arges (arges) wrote :

This bug does not effect Precise when I tested it.

Changed in ifupdown (Ubuntu Precise):
importance: High → Undecided
assignee: Chris J Arges (arges) → nobody
no longer affects: ifupdown (Ubuntu Precise)
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Mathew Hodson (mhodson) on 2017-06-26
affects: ifupdown (Debian) → ubuntu
Changed in ubuntu:
status: New → Confirmed
Mathew Hodson (mhodson) on 2017-06-26
no longer affects: ubuntu
Changed in ifupdown (Ubuntu):
assignee: Andrew Shadura (andrew.sh) → Chris J Arges (arges)
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers