Skip to content

[networkd] ConfigureWithoutCarrier makes the DHCP server fail (-EBUSY) when carrier gained #9479

Closed

Description

@hvenev

I've tested this with systemd 238, but it should be the same in master.

This happens when the .network file specifies ConfigureWithoutCarrier=yes:

[Match]
Name=eth0

[Network]
Address=10.123.42.1/24
ConfigureWithoutCarrier=yes
DHCPServer=yes

When ConfigureWithoutCarrier, addresses are set (link_enter_set_addresses). This also starts the DHCP server.

Then, the carrier appears. link_carrier_gained sees that the link is in one of the following states:

  • LINK_STATE_SETTING_ADDRESSES if the kernel is very slow to set them
  • LINK_STATE_SETTING_ROUTES if link-local addresses still haven't been set
  • LINK_STATE_CONFIGURED if everything has been set properly and a few seconds have passed

link_carrier_gained calls link_acquire_conf (again) and link_enter_set_addresses (again). The problem is that link_enter_set_addresses tries to start the already running DHCP server, which fails with -EBUSY:

Failed to read $container of PID 1, ignoring: Permission denied
Found container virtualization none.
Failed to open configuration file '/etc/systemd/networkd.conf': Success
timestamp of '/etc/systemd/network' changed
Ignoring /etc/systemd/network/10-eth0.link, because it's not a regular file with suffix .netdev.
Ignoring /etc/systemd/network/10-eth0.network, because it's not a regular file with suffix .netdev.
Ignoring /usr/lib/systemd/network/80-container-host0.network, because it's not a regular file with suffix .netdev.
Ignoring /usr/lib/systemd/network/99-default.link, because it's not a regular file with suffix .netdev.
Ignoring /usr/lib/systemd/network/80-container-ve.network, because it's not a regular file with suffix .netdev.
Ignoring /usr/lib/systemd/network/80-container-vz.network, because it's not a regular file with suffix .netdev.
Ignoring /etc/systemd/network/10-eth0.link, because it's not a regular file with suffix .network.
Ignoring /usr/lib/systemd/network/99-default.link, because it's not a regular file with suffix .network.
eth0: Flags change: +UP +MULTICAST +BROADCAST
eth0: Link 4 added
eth0: udev initialized link
eth0: Saved original MTU: 1500
eth0: Adding address: fe80::dead:beff:feef:0001/64 (valid forever)
eth0: Gained IPv6LL
eth0: Adding address: 10.123.42.1/24 (valid forever)
rtnl: received address with invalid family 129, ignoring
rtnl: received address with invalid family 128, ignoring
Enumeration completed
sd-netlink: ignored message with unknown type: 2
sd-netlink: ignored message with unknown type: 2
sd-netlink: ignored message with unknown type: 2
sd-netlink: ignored message with unknown type: 2
Successfully acquired requested service name.
eth0: Link state is up-to-date
eth0: found matching network '/etc/systemd/network/10-eth0.network'
LLDP: Started LLDP client
eth0: Started LLDP.
eth0: Discovering IPv6 routers
NDISC: Started IPv6 Router Solicitation client
eth0: Not emitting DNS server information on link, couldn't find suitable uplink.
eth0: Not emitting NTP server information on link, couldn't find suitable uplink.
DHCP SERVER: STARTED
eth0: Offering DHCPv4 leases
eth0: Setting addresses
NDISC: Sent Router Solicitation, next solicitation in 3s
eth0: Removing address: 10.123.42.1/24 (valid forever)
eth0: Adding address: 10.123.42.1/24 (valid forever)
eth0: Addresses set
NDISC: Sent Router Solicitation, next solicitation in 7s
NDISC: Sent Router Solicitation, next solicitation in 14s
NDISC: No RA received before link confirmation timeout
NDISC: Invoking callback for 't'.
eth0: Configured

Carrier appears

eth0: Flags change: +LOWER_UP +RUNNING
eth0: Gained carrier
eth0: Discovering IPv6 routers
eth0: Not emitting DNS server information on link, couldn't find suitable uplink.
eth0: Not emitting NTP server information on link, couldn't find suitable uplink.
Assertion '!server->receive_message' failed at ../src/libsystemd-network/sd-dhcp-server.c:1026, function sd_dhcp_server_start(). Ignoring.
eth0: Could not start DHCPv4 server instance: Device or resource busy
eth0: Failed
NDISC: Stopping IPv6 Router Solicitation client

I haven't tested the behaviour of the DHCP client, but I'm not sure if it will behave well because link_acquire_conf is also called twice.

Activity

  1. added
    bug 🐛
    on Jul 4, 2018
  2. added this to the v240 milestone on Jul 4, 2018
  3. poettering commented on Jul 4, 2018

    @poettering
    Member
  4. ssahani commented on Jul 5, 2018

    @ssahani
    Contributor

    @poettering we can skip start of the DHCP server till the carrier gain. I guess that would be the right approach.

  5. added a commit that references this issue on Jul 9, 2018
    3d7f4cc
  6. added a commit that references this issue on Aug 23, 2018
    708c425
  7. added a commit that references this issue on Oct 31, 2018
    d15e704
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug 🐛dhcpnetwork

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions