Ubuntu 20.04 Netplan Bridge interface fails at boot

7,244

thank you for bringing up this question and describing it in great detail!

I think what you are seeing here is that the br0 is coming up with carrier (+LOWER_UP), before eth0 is ready/up, as described here: https://bugs.launchpad.net/ubuntu/+source/systemd/+bug/1860926

Could you try if installing systemd from this PPA fixes your problem? https://launchpad.net/~ddstreet/+archive/ubuntu/lp1860926

We're in the process of implementing the fix in the real systemd package.

Best, Lukas

Share:
7,244

Related videos on Youtube

Jason
Author by

Jason

Updated on September 18, 2022

Comments

  • Jason
    Jason over 1 year

    2 new Ubuntu Server 20.04 installs (1 on Hyper-V 1 on bare metal) fail to correctly start bridge interface at boot time. running netplan apply manually will successfully start the bridge (this is currently in crontab at boot time as a workaround).

    Looks to me that the gateway on the bridge is being applied before the IP is applied or carrier is up and thus erroring out? purely speculation, but given it works fine when applying post boot certainly seems like a race condition of some kind.

    Any help would be appreciated. netplan config and outputs below.

    /etc/netplan/50-netinit-config.yaml

    network:
      version: 2
      renderer: networkd
      ethernets:
        eth0:
          dhcp4: no
      bridges:
        br0:
          interfaces: [eth0]
          dhcp4: no
          addresses: [192.168.1.220/24]
          gateway4: 192.168.1.1
          nameservers:
            addresses: [8.8.8.8, 8.8.4.4]
            search: [blah.net.au]
    

    ifconfig -a

    br0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
            ether 00:15:5d:86:b8:01  txqueuelen 1000  (Ethernet)
            RX packets 1406  bytes 136275 (136.2 KB)
            RX errors 0  dropped 581  overruns 0  frame 0
            TX packets 0  bytes 0 (0.0 B)
            TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
    
    eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
            ether 00:15:5d:86:b8:01  txqueuelen 1000  (Ethernet)
            RX packets 1918  bytes 213299 (213.2 KB)
            RX errors 0  dropped 190  overruns 0  frame 0
            TX packets 0  bytes 0 (0.0 B)
            TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
    
    lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
            inet 127.0.0.1  netmask 255.0.0.0
            loop  txqueuelen 1000  (Local Loopback)
            RX packets 560  bytes 43120 (43.1 KB)
            RX errors 0  dropped 0  overruns 0  frame 0
            TX packets 560  bytes 43120 (43.1 KB)
            TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
    

    netstat -rn

    Kernel IP routing table
    Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
    

    networkctl -a status

     1: lo
                 Link File: /usr/lib/systemd/network/99-default.link
              Network File: n/a
                      Type: loopback
                     State: carrier (unmanaged)
                       MTU: 65536
      Queue Length (Tx/Rx): 1/1
                   Address: 127.0.0.1
    
     2: eth0
                 Link File: /usr/lib/systemd/network/99-default.link
              Network File: /run/systemd/network/10-netplan-eth0.network
                      Type: ether
                     State: enslaved (configured)
                      Path: acpi-VMBUS:00
                    Driver: hv_netvsc
                HW Address: 00:15:5d:86:b8:01 (Microsoft Corporation)
                       MTU: 1500 (min: 68, max: 65521)
      Queue Length (Tx/Rx): 64/64
          Auto negotiation: no
                     Speed: 1Gbps
                    Duplex: full
    
    May 03 21:25:55 seraph-test systemd-networkd[759]: eth0: Link UP
    May 03 21:25:56 seraph-test systemd-networkd[759]: eth0: Gained carrier
    
     3: br0
                   Link File: /usr/lib/systemd/network/99-default.link
                Network File: /run/systemd/network/10-netplan-br0.network
                        Type: bridge
                       State: carrier (failed)
                      Driver: bridge
                  HW Address: 00:15:5d:86:b8:01 (Microsoft Corporation)
                         MTU: 1500 (min: 68, max: 65535)
               Forward Delay: 15s
                  Hello Time: 2s
                     Max Age: 20s
                 Ageing Time: 5min
                    Priority: 32768
                         STP: no
      Multicast IGMP Version: 2
        Queue Length (Tx/Rx): 1/1
                         DNS: 8.8.8.8
                              8.8.4.4
              Search Domains: teese.net.au
    
    May 03 21:25:55 seraph-test systemd-udevd[502]: br0: Could not generate persistent MAC: No data available
    May 03 21:25:55 seraph-test systemd-networkd[759]: br0: netdev ready
    May 03 21:25:55 seraph-test systemd-networkd[759]: br0: Link UP
    May 03 21:25:55 seraph-test systemd-networkd[759]: br0: Gained carrier
    May 03 21:25:55 seraph-test systemd-networkd[759]: br0: Lost carrier
    May 03 21:25:55 seraph-test systemd-networkd[759]: br0: Could not set route: Nexthop has invalid gateway. Network is unreachable
    May 03 21:25:55 seraph-test systemd-networkd[759]: br0: Failed
    May 03 21:25:56 seraph-test systemd-networkd[759]: br0: Gained carrier
    
  • Jason
    Jason about 4 years
    Thanks Lukas. Have tested on my Hyper-V instance and this certainly explains and fixes the issue. Will probably keep the crontab hack on my main box for now pending a proper release, but at least I can explain it now.