I'm having an issue with isc-dhcp-server. When I reboot I can see that it loads because it says "Starting LSB: DHCP server ...". However when trying to connect a PXE node to the server it does not work and I need to exectute "sudo service isc-dhcp-server restart". I have another PXE server that I've set up successfully that, for whatever reason, does not exhibit this issue. This is all on Raspbian Jessie. I also want to add that upon installation of isc-dhcp-server I get:

Job for isc-dhcp-server.service failed. See 'systemctl status isc-
dhcp-server.service' and 'journalctl -xn' for details.
invoke-rc.d: initscript isc-dhcp-server, action "start" failed.

Which is strange because in the past I've never had problems installing isc-dhcp-server. And I'm talking a week maybe two weeks in the past. So it seems like some sort of package update has borked it?

This the output of the command requested in the comments.

● isc-dhcp-server.service - LSB: DHCP server
Loaded: loaded (/etc/init.d/isc-dhcp-server)
Active: failed (Result: exit-code) since Mon 2017-07-31 07:59:29 EDT; 
17min ago

Jul 31 07:59:27 raspberrypi dhcpd[11899]: 
Jul 31 07:59:27 raspberrypi dhcpd[11899]: No subnet declaration for 
eth0 (10.0.0.73).
Jul 31 07:59:27 raspberrypi dhcpd[11899]: ** Ignoring requests on 
eth0.  If this is not what
Jul 31 07:59:27 raspberrypi dhcpd[11899]: you want, please write a 
subnet declaration
Jul 31 07:59:27 raspberrypi dhcpd[11899]: in your dhcpd.conf file for 
the network segment
Jul 31 07:59:29 raspberrypi isc-dhcp-server[11891]: Starting ISC DHCP 
server: dhcpdcheck syslog for diagnostics. ... failed!
Jul 31 07:59:29 raspberrypi isc-dhcp-server[11891]: failed!
Jul 31 07:59:29 raspberrypi systemd[1]: isc-dhcp-server.service: 
control process exited, code=exited status=1
Jul 31 07:59:29 raspberrypi systemd[1]: Failed to start LSB: DHCP 
server.
Jul 31 07:59:29 raspberrypi systemd[1]: Unit isc-dhcp-server.service 
entered failed state.

Can someone please help? Thanks!

  • What does sudo systemctl -l isc-dhcp-server say? Does the ISC DHCP server stop because it cannot find any subnets (yet) to serve? – TheDiveO Jul 31 '17 at 5:39
  • It says unknown operation 'isc-dhcp-server' . Did you mean sudo systemctl status isc-dhcp-server? Because that doesn't give much information other than the service failed to start. Also, when installing the program i get Job for isc-dhcp-server.service failed. See 'systemctl status isc-dhcp-server.service' and 'journalctl -xn' for details. invoke-rc.d: initscript isc-dhcp-server, action "start" failed. – chaoticslacker Jul 31 '17 at 12:04
  • sorry, I forgot the operation, so it's sudo systemctl status -l isc-dhcp-server. This gives the status of the service, as well as the messages it logged. – TheDiveO Jul 31 '17 at 12:05
  • Jul 31 07:59:27 raspberrypi dhcpd[11899]: Jul 31 07:59:27 raspberrypi dhcpd[11899]: No subnet declaration for eth0 (10.0.0.73). Jul 31 07:59:27 raspberrypi dhcpd[11899]: ** Ignoring requests on eth0. If this is not what Jul 31 07:59:27 raspberrypi dhcpd[11899]: you want, please write a subnet declaration Jul 31 07:59:27 raspberrypi dhcpd[11899]: in your dhcpd.conf file for the network segment Jul 31 07:59:29 raspberrypi isc-dhcp-server[11891]: Starting ISC DHCP server: dhcpdcheck syslog for diagnostics. ... failed! Jul 31 07:59:29 raspberrypi isc-dhcp-server[11891]: failed! – chaoticslacker Jul 31 '17 at 12:10
  • Ah, I should have an answer for you know... :) – TheDiveO Jul 31 '17 at 12:10

The reason why the ISC DHCPv4 server service fails is that at the time it is started the network interface configuration might not have been finished. As systemd cannot know when a service really has become ready (as opposed to have been started successfully), the usual start dependency service unit settings don't help either. Often, you'll find ugly workarounds using /etc/rc.local in combination with sleep 5 or something similar. Luckily, there's a better systemd way to do it (that is actually one of the features where I consider systemd to be better than previous init systems).

From my own experience with an Raspberry Pi 3B with an additional wlan1 USB WLAN dongle as an AP, I came up with an automatic restart of the DHCPv4 server in case it fails because it was too early.

  1. sudo cp /run/systemd/generator.late/isc-dhcp-server.service /etc/systemd/system
  2. sudo nano /etc/systemd/system/isc-dhcp-server.service
  3. Edit the [Service] section:
    • set Restart=on-failure,
    • add RestartSec=5 to instruct systemd to wait 5 seconds before restarting a failed service.
  4. Add the [Install] section which is missing, and add the follow line to it:
    • WantedBy=multi-user.target
  5. sudo systemctl daemon-reload
  6. sudo systemctl disable isc-dhcp-server
  7. sudo systemctl enable isc-dhcp-server

This tells systemd to automatically restart the ISC DHCPv4 server if it fails, but to wait 5 seconds before attempting to restart it. If this works for you, you can try to reduce the sleep time; it defaults to 100ms, which is probably much small for this situation.

  • @chaoticslacker Please note that I've updated my answer after I noticed some issues on my own installation regarding the missing [Install] section and the correct reregistering of the service. – TheDiveO Jul 31 '17 at 13:04

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.