Bug 771003 - Systemd doesn't wait for the legacy network.service to finish before starting dhcpd.service
Summary: Systemd doesn't wait for the legacy network.service to finish before starting...
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Fedora
Classification: Fedora
Component: systemd
Version: 15
Hardware: i686
OS: Linux
unspecified
high
Target Milestone: ---
Assignee: systemd-maint
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-12-30 23:30 UTC by Michal Růžička
Modified: 2011-12-31 03:20 UTC (History)
6 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2011-12-31 03:20:09 UTC
Type: ---


Attachments (Terms of Use)

Description Michal Růžička 2011-12-30 23:30:42 UTC
Description of problem:
I have a bridge interface configured and I want to run DHCP server on that interface. But the dhcpd server fails to start during boot with the following error message:
No subnet declaration for br0 (no IPv4 addresses).
Which means it could not find the IP address of the br0 interface. It seems that the configuration of the br0 interface performed by the legacy network.service (/etc/init.d/network) is not finished by the time dhcpd.service is started by systemd - despite me explicitly adding:
    Requires=network.service
    After=network.service
to /lib/systemd/system/dhcpd.service
The status of the network.service at the time the dhcpd.service is being started by systemd typically looks similar to the following:
network.service - LSB: Bring up/down networking
          Loaded: loaded (/etc/rc.d/init.d/network)
          Active: activating (start) since Fri, 30 Dec 2011 22:25:08 +0100; 15s ago
         Control: 837 (network)
          CGroup: name=systemd:/system/network.service
                  ├  837 /bin/bash /etc/rc.d/init.d/network start
                  ├ 1041 /bin/bash /etc/sysconfig/network-scripts/ifup-eth ...
                  ├ 1079 /bin/bash /etc/sysconfig/network-scripts/ifup-eth ...
                  └ 1080 /bin/bash /etc/sysconfig/network-scripts/ifup-eth ...


Version-Release number of selected component (if applicable):
systemd-26-13.fc15.i686
initscripts-9.30.1-1.fc15.i686
dhcp-4.2.1-11.P1.fc15.i686

How reproducible:
- it fails for me invariably during boot
- when I attempt to simulate the problem at any later time the dhcpd.service is successfully started, although occasionally the network.service's status at the time the dhcpd.service is being started by systemd looks similar to the following:
network.service - LSB: Bring up/down networking
          Loaded: loaded (/etc/rc.d/init.d/network)
          Active: active (running) since Fri, 30 Dec 2011 23:48:19 +0100; 485ms ago
         Process: 3718 ExecStop=/etc/rc.d/init.d/network stop (code=exited, status=0/SUCCESS)
         Process: 4259 ExecStart=/etc/rc.d/init.d/network start (code=exited, status=0/SUCCESS)
          CGroup: name=systemd:/system/network.service
                  ├ 4578 /bin/bash /etc/sysconfig/network-scripts/ifup-eth ...
                  └ 4580 sleep 2

Steps to Reproduce:
1. create a bridge configuration by editing ifcfg-* files as appropriate; configure a static IP for the bridge interface, mark it for activation at boot time
2. create a dhcpd configuration including a subnet declaration for the subnet connected through the bridge interface configured in the previous step 
3. add the following lines to the /lib/systemd/system/dhcpd.service:
    Requires=network.service
    After=network.service
4. systemctl enable dhcpd.service network.service
5. reboot the system

Actual results:
after the system finishes booting the bridge interface is configured but dhcpd is not running/listening on that interface; an error message similar to the following one can be found in the logs:
No subnet declaration for br0 (no IPv4 addresses).
** Ignoring requests on br0. ...

Expected results:
after the system finishes booting the bridge interface is configured and dhcpd runs/listens on that interface

Additional info:
Note that it is possible to start the dhcpd.service at any time after the /etc/init.d/network has finished (and thus the br0 has been fully configured).

Comment 1 Michal Růžička 2011-12-31 03:20:09 UTC
By further debugging I discovered that the problem in not in systemd but rather in dhcpd. I logged a separate issue [1] for that to be able to provide more accurate description.
Sorry for the noise.

[1] https://bugzilla.redhat.com/show_bug.cgi?id=771009


Note You need to log in before you can comment on or make changes to this bug.