Article 6FZ65 rc.dhcpd has an odd error.

rc.dhcpd has an odd error.

by
Richard Cranium
from LinuxQuestions.org on (#6FZ65)
This hasn't come up because who the devil restarts their dhcpd while the system is running? (At least that's my story and I'm sticking to it.)

It turns out I've been doing that while attempting to fix a dynamic DNS issue. The issue comes about because the dhcpd binary looks for the pid file and won't start if it finds one.

For example, the first time you run restart:

Code:root@testbed:~# /etc/rc.d/rc.dhcpd restart
Shutting down dhcpd:
Starting dhcpd: /usr/sbin/dhcpd Internet Systems Consortium DHCP Server 4.4.3-P1
Copyright 2004-2022 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/
Config file: /etc/dhcpd.conf
Database file: /var/state/dhcp/dhcpd.leases
PID file: /var/run/dhcpd.pid
There's already a DHCP server running.

If you think you have received this message due to a bug rather
than a configuration issue please read the section on submitting
bugs on either our web page at www.isc.org or in the README file
before submitting a bug. These pages explain the proper
process and the information we find helpful for debugging.

exiting.

root@testbed:~#...but the second time you run that command, you get...

Code:root@testbed:~# /etc/rc.d/rc.dhcpd restart
Shutting down dhcpd: dhcpd: no process found

Starting dhcpd: /usr/sbin/dhcpd Internet Systems Consortium DHCP Server 4.4.3-P1
Copyright 2004-2022 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/
Config file: /etc/dhcpd.conf
Database file: /var/state/dhcp/dhcpd.leases
PID file: /var/run/dhcpd.pid
Wrote 0 deleted host decls to leases file.
Wrote 0 new dynamic host decls to leases file.
Wrote 1 leases to leases file.
Listening on LPF/virbr0/52:54:00:0a:3c:64/192.168.122.0/24
Sending on LPF/virbr0/52:54:00:0a:3c:64/192.168.122.0/24
Listening on LPF/eth0/b4:2e:99:4c:f8:21/10.10.0.0/24
Sending on LPF/eth0/b4:2e:99:4c:f8:21/10.10.0.0/24
Listening on LPF/eth1/00:13:3b:0e:d0:9e/172.16.0.0/24
Sending on LPF/eth1/00:13:3b:0e:d0:9e/172.16.0.0/24
Sending on Socket/fallback/fallback-net

root@testbed:~#There are a couple of ways to fix the issue:
  1. You can make "--no-pid" a default DHCPD_OPTIONS value, so there won't be a pid file to check
  2. You can add "rm /var/run/dhcpd.pid" in the stop() block
I don't have an opinion upon which option is superior. The stop() bit of the script doesn't bother to look at /var/run/dhcpd.pid but instead just kills everything named dhcpd.
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments