[Bug 1770082] Re: systemd-networkd not renaming devices on boot

Nicorac 1770082 at bugs.launchpad.net
Wed Oct 24 13:02:32 UTC 2018


Still not working on my side (plain vanilla Ubuntu Server 18.04, fully
updated, no cloud).

The renaming regression of 0.40.1~18.04.1 has been fixed, but it's still
not applying IP address just after boot.

A manual "netplan apply" correctly configures the network interface.

-----------------------------------------------------
root at test:~# dpkg -s netplan.io | grep Version
Version: 0.40.1~18.04.2
-----------------------------------------------------

=======================
=== Just after boot ===
=======================

root at test:~# ifconfig -a
eth_lan: flags=4098<BROADCAST,MULTICAST>  mtu 1500
        ether 08:00:27:6b:d8:91  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  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
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 6  bytes 318 (318.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 6  bytes 318 (318.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

-----------------------------------------------------
root at test:~# cat /etc/netplan/01-netcfg.yaml
# This file describes the network interfaces available on your system
# For more information, see netplan(5).
network:
  version: 2
  renderer: networkd
  ethernets:
    id0:
      match:
        macaddress: 08:00:27:6b:d8:91
      set-name: eth_lan
      addresses: [ 192.168.1.10/24 ]
      gateway4: 192.168.1.1
      nameservers:
          addresses: [ 8.8.4.4 ]

-----------------------------------------------------
root at test:~# cat /run/systemd/network/10-netplan-id0.link
[Match]
MACAddress=08:00:27:6b:d8:91

[Link]
Name=eth_lan
WakeOnLan=off

-----------------------------------------------------
root at test:~# cat /run/systemd/network/10-netplan-id0.network
[Match]
MACAddress=08:00:27:6b:d8:91
Name=eth_lan

[Network]
LinkLocalAddressing=ipv6
Address=192.168.1.10/24
Gateway=192.168.1.1
DNS=8.8.4.4

-----------------------------------------------------

====================================
=== After manual "netplan apply" ===
====================================

root at test:~# ifconfig -a
eth_lan: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.1.10  netmask 255.255.255.0  broadcast 192.168.1.255
        inet6 fe80::a00:27ff:fe6b:d891  prefixlen 64  scopeid 0x20<link>
        ether 08:00:27:6b:d8:91  txqueuelen 1000  (Ethernet)
        RX packets 277  bytes 51263 (51.2 KB)
        RX errors 0  dropped 128  overruns 0  frame 0
        TX packets 13  bytes 946 (946.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
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 20  bytes 1470 (1.4 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 20  bytes 1470 (1.4 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

-----------------------------------------------------
root at test:~# cat /etc/netplan/01-netcfg.yaml
# This file describes the network interfaces available on your system
# For more information, see netplan(5).
network:
  version: 2
  renderer: networkd
  ethernets:
    id0:
      match:
        macaddress: 08:00:27:6b:d8:91
      set-name: eth_lan
      addresses: [ 192.168.1.10/24 ]
      gateway4: 192.168.1.1
      nameservers:
          addresses: [ 8.8.4.4 ]

-----------------------------------------------------
root at test:~# cat /run/systemd/network/10-netplan-id0.link
[Match]
MACAddress=08:00:27:6b:d8:91

[Link]
Name=eth_lan
WakeOnLan=off

-----------------------------------------------------
root at test:~# cat /run/systemd/network/10-netplan-id0.network
[Match]
MACAddress=08:00:27:6b:d8:91
Name=eth_lan

[Network]
LinkLocalAddressing=ipv6
Address=192.168.1.10/24
Gateway=192.168.1.1
DNS=8.8.4.4

-----------------------------------------------------

Please let me know if you need further info...


** Tags removed: verification-needed-bionic
** Tags added: verification-failed-bionic

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

Title:
  systemd-networkd not renaming devices on boot

Status in netplan:
  Fix Released
Status in cloud-init package in Ubuntu:
  Confirmed
Status in netplan.io package in Ubuntu:
  Fix Committed
Status in nplan package in Ubuntu:
  Fix Released
Status in systemd package in Ubuntu:
  Confirmed
Status in nplan source package in Xenial:
  Fix Released
Status in netplan.io source package in Bionic:
  Fix Committed
Status in netplan.io source package in Cosmic:
  Fix Committed

Bug description:
  [Impact]
  Systems relying on renaming network interfaces at boot and when 'netplan apply' is run.

  [Test case]
  - Write a new netplan YAML (adjusting for current system as necessary):
  network:
      version: 2
      ethernets:
          ens3:
              dhcp4: true
              match:
                  macaddress: 52:54:00:de:bd:f6
              set-name: myif0

  - Run 'netplan apply'
  - Verify that the device is correctly renamed to 'myif0'.
  - Reboot.
  - Make sure the device is correctly renamed to 'myif0'.

  [Regression potential]
  Changes in rename logic to add udev rules may otherwise impact applying different settings to the network interfaces. Changes in settings on network interfaces, missing parameters (especially on bonds, bridges) should be investigated as potential regressions. Other failures to apply network settings might also happen if there's a race between applying renames via the udev rules, and using the new names to apply configuration changes to the interfaces.

  === systemd issue ===

  Renaming devices doesn't seem to work.

  If I disable all other network configuration and create
  /etc/systemd/network/10-network.link with:

  [Match]
  MACAddress=52:54:00:c1:c9:bb

  [Link]
  Name=myiface3

  I expect this to cause the device with that MAC address to be renamed
  to  myiface3. However, when I reboot, I instead see:

  $ ip l
  1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
      link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
  2: ens3: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000
      link/ether 52:54:00:c1:c9:bb brd ff:ff:ff:ff:ff:ff

  The device is not renamed.

  This link file is pretty much identical to Example 2 in
  https://www.freedesktop.org/software/systemd/man/systemd.link.html.

  The renaming does work if I boot with net.ifnames=0, and oddly, it
  also works if I unbind the device and rebind it as netplan apply does.
  No setting of NamePolicy seems to help.

  === Original Bug ==

  'set-name:' doesn't change the name of a network interface on boot, it
  only works when you do netplan apply.

  Say I take this 50-cloud-init.yaml file:

  # This file is generated from information provided by
  # the datasource.  Changes to it will not persist across an instance.
  # To disable cloud-init's network configuration capabilities, write a file
  # /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg with the following:
  # network: {config: disabled}
  network:
      version: 2
      ethernets:
          ens3:
              dhcp4: true
              match:
                  macaddress: 52:54:00:de:bd:f6
              set-name: ens3

  Say I change set-name to 'myiface3' and reboot. I expect that the
  device will be called myiface3 and brought up fine with dhcp. However,
  instead I see:

  $ ip a
  1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
      link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
      inet 127.0.0.1/8 scope host lo
         valid_lft forever preferred_lft forever
      inet6 ::1/128 scope host
         valid_lft forever preferred_lft forever
  2: ens3: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
      link/ether 52:54:00:de:bd:f6 brd ff:ff:ff:ff:ff:ff

  The name has not been changed, and the device has not been brought up.

  If I run netplan apply however, I see the following:

  1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
      link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
      inet 127.0.0.1/8 scope host lo
         valid_lft forever preferred_lft forever
      inet6 ::1/128 scope host
         valid_lft forever preferred_lft forever
  3: myiface3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
      link/ether 52:54:00:de:bd:f6 brd ff:ff:ff:ff:ff:ff
      inet 192.168.122.151/24 brd 192.168.122.255 scope global dynamic myiface3
         valid_lft 3575sec preferred_lft 3575sec
      inet6 fe80::5054:ff:fede:bdf6/64 scope link
         valid_lft forever preferred_lft forever

  So names are successfully changed with netplan apply.

  This seems to be some udev-related timing or priority issue that I'm
  still trying to hunt down.

  This breaks some forms of migration in certain cloud environments.

To manage notifications about this bug go to:
https://bugs.launchpad.net/netplan/+bug/1770082/+subscriptions



More information about the foundations-bugs mailing list