0

I am setting up a DHCP server running on my wireless interface.

During boot the following messages show up in /var/log/syslog:

Nov 28 07:56:48 pi-w isc-dhcp-server[503]: Launching IPv4 server only.
Nov 28 07:56:51 pi-w isc-dhcp-server[503]: Starting ISC DHCPv4 server: dhcpdcheck syslog for diagnostics. ... failed!
Nov 28 07:56:51 pi-w isc-dhcp-server[503]:  failed!
Nov 28 07:56:51 pi-w systemd[1]: isc-dhcp-server.service: Control process exited, code=exited, status=1/FAILURE
Nov 28 07:56:51 pi-w systemd[1]: isc-dhcp-server.service: Failed with result 'exit-code'.

/etc/default/isc-dhcp-server is:

# Defaults for isc-dhcp-server (sourced by /etc/init.d/isc-dhcp-server)

# Path to dhcpd's config file (default: /etc/dhcp/dhcpd.conf).
#DHCPDv4_CONF=/etc/dhcp/dhcpd.conf
#DHCPDv6_CONF=/etc/dhcp/dhcpd6.conf

# Path to dhcpd's PID file (default: /var/run/dhcpd.pid).
#DHCPDv4_PID=/var/run/dhcpd.pid
#DHCPDv6_PID=/var/run/dhcpd6.pid

# Additional options to start dhcpd with.
#       Don't use options -cf or -pf here; use DHCPD_CONF/ DHCPD_PID instead
#OPTIONS=""

# On what interfaces should the DHCP server (dhcpd) serve DHCP requests?
#       Separate multiple interfaces with spaces, e.g. "eth0 eth1".

INTERFACESv4="wlan0"
#INTERFACESv6=""

Excerpt from /etc/dhcp/dhcpd.conf:

subnet 192.168.1.0 netmask 255.255.255.0 {
  range 192.168.1.50 192.168.1.115;
  option subnet-mask 255.255.255.0;
  option domain-name-servers 192.168.1.254, 10.128.254.254;
  option domain-name “example.com”;
  option routers 192.168.1.1;
}

wlan0 is set to a static IP in /etc/dhcpcd.conf:

interface wlan0
static ip_address=192.168.1.22/24
static routers=192.168.1.1
static domain_name_servers=127.0.0.1
static domain_search=

When I run sudo systemctl start isc-dhcp-server it is successful:

Nov 28 08:09:39 pi-w isc-dhcp-server[627]: Launching IPv4 server only.
Nov 28 08:09:41 pi-w isc-dhcp-server[627]: Starting ISC DHCPv4 server: dhcpd.

sudo systemctl status isc-dhcp-server.service:

● isc-dhcp-server.service - LSB: DHCP server
   Loaded: loaded (/etc/init.d/isc-dhcp-server; generated)
   Active: failed (Result: exit-code) since Sat 2020-11-28 17:18:15 PST; 1min 26s ago
     Docs: man:systemd-sysv-generator(8)
  Process: 474 ExecStart=/etc/init.d/isc-dhcp-server start (code=exited, status=1/FAILURE)

Nov 28 17:18:13 pi-w dhcpd[594]: bugs on either our web page at www.isc.org or in the README file
Nov 28 17:18:13 pi-w dhcpd[594]: before submitting a bug.  These pages explain the proper
Nov 28 17:18:13 pi-w dhcpd[594]: process and the information we find helpful for debugging.
Nov 28 17:18:13 pi-w dhcpd[594]:
Nov 28 17:18:13 pi-w dhcpd[594]: exiting.
Nov 28 17:18:15 pi-w isc-dhcp-server[474]: Starting ISC DHCPv4 server: dhcpdcheck syslog for diagnostics. ... failed!
Nov 28 17:18:15 pi-w isc-dhcp-server[474]:  failed!
Nov 28 17:18:15 pi-w systemd[1]: isc-dhcp-server.service: Control process exited, code=exited, status=1/FAILURE
Nov 28 17:18:15 pi-w systemd[1]: isc-dhcp-server.service: Failed with result 'exit-code'.
Nov 28 17:18:15 pi-w systemd[1]: Failed to start LSB: DHCP server.

sudo systemctl cat isc-dhcp-server.service:

# /run/systemd/generator.late/isc-dhcp-server.service
# Automatically generated by systemd-sysv-generator

[Unit]
Documentation=man:systemd-sysv-generator(8)
SourcePath=/etc/init.d/isc-dhcp-server
Description=LSB: DHCP server
Before=multi-user.target
Before=multi-user.target
Before=multi-user.target
Before=graphical.target
After=remote-fs.target
After=network-online.target
After=slapd.service
After=nss-lookup.target
Wants=network-online.target

[Service]
Type=forking
Restart=no
TimeoutSec=5min
IgnoreSIGPIPE=no
KillMode=process
10
  • And what does 'check syslog for diagnostics' say? Ref. "Nov 28 07:56:51 pi-w isc-dhcp-server[503]: Starting ISC DHCPv4 server: dhcpdcheck syslog for diagnostics. ..." – Mats Karlsson Nov 28 '20 at 21:05
  • Please execute these two commands when the service has failed (after boot) and add their output to the question: systemctl status isc-dhcp-server.service and systemctl cat isc-dhcp-server.service. – Ingo Nov 28 '20 at 23:36
  • @MatsKarlsson everything that is in the syslog is in my description – islandlinux Nov 29 '20 at 1:15
  • @Ingo added the output from systemctl status isc-dhcp-server.service and systemctl cat isc-dhcp-server.service to my question – islandlinux Nov 29 '20 at 1:24
  • Thanks. I wanted to see if it is started in SysV emulation mode and if it is started After= networking is started. Yes, it is and it is started in SysV emulation mode (shown in the first lines of the status). Emulation mode makes it more error prone. The problem is that dhcpd is very uncommunicative about errors. I'm just looking to set debug output. The -d option cannot be used because the daemon isn't forked to the background then (Type=forking, required for systemd emulation). – Ingo Nov 29 '20 at 2:16
2

The problem is that the daemon dhcpd is still managed by old style SysV init scripts, but must be emulated by systemd with its service isc-dhcp-server.service. This makes it more error prone and mixed up management of both init systems. Usually you find (error)messages in the systemd journal with journalctl, with SysV you have to look at /var/log/syslog. Now you will find some uncompleted messages in the journal and some more detailed messages in /var/log/syslog. This was confusing me.

So look at /var/log/syslog if you find more detailed information why the service isn't started by systemd on boot up. I used

rpi ~$ grep dhcpd /var/log/syslog
2

Overview

Wait for network at boot solved my problem.

My syslog (see syslog section below) showed:

  1. dhcpcd starts and forks
  2. isc-dhcp-server starts
  3. dhcpcd wlan0 fails to acquire a blank access point
  4. dhcpd fails with "No subnet declaration for wlan0"
  5. isc-dhcp-server.service fails with result 'exit-code'
  6. dhcpcd wlan0 successfully acquires a static IP address from my access point

Solution

From a command terminal run:

sudo raspi-config
  1. select option 4 Wait for network at boot
  2. select Slow Wait for network connection before completing boot
  3. click Ok
  4. click Finish

or run the following from the command line:

sudo raspi-config nonint do_boot_wait 0

syslog

Nov 29 06:22:48 pi-w systemd[1]: Starting dhcpcd on all interfaces...
Nov 29 06:22:48 pi-w dhcpcd[336]: dev: loaded udev
Nov 29 06:22:48 pi-w dhcpcd[336]: forked to background, child pid 381
Nov 29 06:22:48 pi-w systemd[1]: Started dhcpcd on all interfaces.
Nov 29 06:22:48 pi-w dhcpcd-run-hooks[473]: wlan0: starting wpa_supplicant
Nov 29 06:22:49 pi-w isc-dhcp-server[484]: Launching IPv4 server only.
Nov 29 06:22:49 pi-w dhcpcd[381]: wlan0: connected to Access Point `'
Nov 29 06:22:49 pi-w dhcpcd[381]: eth0: waiting for carrier
Nov 29 06:22:49 pi-w dhcpcd[381]: wlan0: waiting for carrier
Nov 29 06:22:49 pi-w dhcpcd[381]: wlan0: carrier acquired
Nov 29 06:22:49 pi-w dhcpcd[381]: DUID 00:01:00:01:26:32:8f:3d:32:d1:16:81:dc:a6
Nov 29 06:22:49 pi-w dhcpcd[381]: wlan0: IAID 32:8a:4f:32
Nov 29 06:22:49 pi-w dhcpcd[381]: wlan0: adding address fe80::e7b:7d30:e81c:a0bf
Nov 29 06:22:49 pi-w dhcpcd[381]: wlan0: probing address 192.168.1.2/24
Nov 29 06:22:49 pi-w dhcpcd[381]: wlan0: carrier lost
Nov 29 06:22:49 pi-w dhcpcd[381]: wlan0: deleting address fe80::e7b:7d30:e81c:a0bf
Nov 29 06:22:49 pi-w dhcpd[629]: Wrote 0 deleted host decls to leases file.
Nov 29 06:22:49 pi-w dhcpd[629]: Wrote 0 new dynamic host decls to leases file.
Nov 29 06:22:49 pi-w dhcpd[629]: Wrote 19 leases to leases file.
Nov 29 06:22:49 pi-w dhcpd[629]:
Nov 29 06:22:49 pi-w dhcpd[629]: No subnet declaration for wlan0 (no IPv4 addresses).
Nov 29 06:22:49 pi-w dhcpd[629]: ** Ignoring requests on wlan0.  If this is not what
Nov 29 06:22:49 pi-w dhcpd[629]:    you want, please write a subnet declaration
Nov 29 06:22:49 pi-w dhcpd[629]:    in your dhcpd.conf file for the network segment
Nov 29 06:22:49 pi-w dhcpd[629]:    to which interface wlan0 is attached. **
Nov 29 06:22:49 pi-w dhcpd[629]:
Nov 29 06:22:49 pi-w dhcpd[629]:
Nov 29 06:22:49 pi-w dhcpd[629]: Not configured to listen on any interfaces!
Nov 29 06:22:49 pi-w dhcpd[629]:
Nov 29 06:22:49 pi-w dhcpd[629]: If you think you have received this message due to a bug rather
Nov 29 06:22:49 pi-w dhcpd[629]: than a configuration issue please read the section on submitting
Nov 29 06:22:49 pi-w dhcpd[629]: bugs on either our web page at www.isc.org or in the README file
Nov 29 06:22:49 pi-w dhcpd[629]: before submitting a bug.  These pages explain the proper
Nov 29 06:22:49 pi-w dhcpd[629]: process and the information we find helpful for debugging.
Nov 29 06:22:49 pi-w dhcpd[629]:
Nov 29 06:22:49 pi-w dhcpd[629]: exiting.
Nov 29 06:22:52 pi-w isc-dhcp-server[484]:  failed!
Nov 29 06:22:52 pi-w systemd[1]: isc-dhcp-server.service: Control process exited, code=exited, status=1/FAILURE
Nov 29 06:22:52 pi-w systemd[1]: isc-dhcp-server.service: Failed with result 'exit-code'.
Nov 29 06:22:52 pi-w dhcpcd[381]: wlan0: carrier acquired
Nov 29 06:22:52 pi-w dhcpcd[381]: wlan0: connected to Access Point `FEEDMEDATA'
Nov 29 06:22:52 pi-w dhcpcd[381]: wlan0: IAID 32:8a:4f:32
Nov 29 06:22:52 pi-w dhcpcd[381]: wlan0: adding address fe80::e7b:7d30:e81c:a0bf
Nov 29 06:22:52 pi-w dhcpcd[381]: wlan0: probing address 192.168.1.2/24
Nov 29 06:22:53 pi-w dhcpcd[381]: wlan0: soliciting an IPv6 router
Nov 29 06:22:57 pi-w dhcpcd[381]: wlan0: using static address 192.168.1.2/24
Nov 29 06:22:57 pi-w dhcpcd[381]: wlan0: adding route to 192.168.1.0/24
Nov 29 06:22:57 pi-w dhcpcd[381]: wlan0: adding default route via 192.168.1.1
Nov 29 06:23:06 pi-w dhcpcd[381]: wlan0: no IPv6 Routers available

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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