2.1-RC2 (amd64) dhcpd/dhcpleases no pid error



  • My logs have quite a few of the following errors. For the most part I can just ignore it; but I have been troubleshooting random drops on one of my computers that has a dhcp static mapping. I found this thread that seems to be similar. But the resolution was to update to the latest version, which I have done.

    Sep  8 01:15:23 router dhcpleases: kqueue error: unkown
    Sep  9 12:57:54 router dhcpleases: Could not deliver signal HUP to process because its pidfile does not exist, No such process.
    Sep  9 13:23:15 router dhcpleases: Could not deliver signal HUP to process because its pidfile does not exist, No such file or directory.
    
    ps uaxwww | grep dhcp
    _dhcp  17310  0.0  0.0  6872  1680  ??  Is    1:23PM   0:00.00 dhclient: em0 (dhclient)
    root   38170  0.0  0.1  5780  2288  ??  Ss    1:23PM   0:00.37 /usr/local/sbin/dhcpleases -l /var/dhcpd/var/db/dhcpd.leases -d domain.net -p /var/run/dnsmasq.pid -h /var/etc/hosts
    root   68110  0.0  0.0  6956  1620  ??  Ss    1:23PM   0:00.23 /usr/sbin/syslogd -s -c -c -l /var/dhcpd/var/run/log -f /var/etc/syslog.conf
    dhcpd  69581  0.0  0.3 17104 12576  ??  Ss    1:37PM   0:00.04 /usr/local/sbin/dhcpd -user dhcpd -group _dhcp -chroot /var/dhcpd -cf /etc/dhcpd.conf -pf /var/run/dhcpd.pid em1
    
    ls -l /var/run/dhc*
    -rw-------  1 root  wheel  5 Sep  9 13:23 /var/run/dhclient.em0.pid
    -rwSr-S---  1 root  wheel  6 Sep  9 13:49 /var/run/dhcpleases.pid
    
    2.1-RC2 (amd64) 
    built on Sun Sep 8 21:25:42 EDT 2013 
    FreeBSD 8.3-RELEASE-p10
    

    EDIT:
    Ok, I should have done this first, but searching for the dhcpd.pid I found it in /var/dhcpd/var/run/ along with dhcpdv6.pid. If I sym link them to /var/run it doesn't survive a reboot. Is this a bug, or is there a workaround that I can apply to get this fixed?



  • @djroketboy:

    EDIT:
    Ok, I should have done this first, but searching for the dhcpd.pid I found it in /var/dhcpd/var/run/ along with dhcpdv6.pid. If I sym link them to /var/run it doesn't survive a reboot. Is this a bug, or is there a workaround that I can apply to get this fixed?

    Possibly a typo, but why do you think your action on dhcpd.pid and dhcpdv6.pid will affect the report about the pid file for dhcpleases? I suspect the command to start dhcpleases is wrong: the pid file probably maybe should be written to a different directory and maybe should be called dhcpleases.pid rather than dnsmasq.pid.

    A bit of research on my system shows:
    /etc/inc/system.inc: if (file_exists("{$g['varrun_path']}/dhcpleases.pid")) {
    /etc/inc/system.inc: sigkillbypid("{$g['varrun_path']}/dhcpleases.pid", "TERM");
    /etc/inc/system.inc: @unlink("{$g['varrun_path']}/dhcpleases.pid");

    /etc/inc/system.inc: if (isvalidpid("{$g['varrun_path']}/dhcpleases.pid"))
    /etc/inc/system.inc: sigkillbypid("{$g['varrun_path']}/dhcpleases.pid", "HUP");
    /etc/inc/system.inc: mwexec("/usr/local/sbin/dhcpleases -l {$g['dhcpd_chroot_path']}/var/db/dhcpd.leases -d  $config['system']['domain']} -p {$g['varrun_path']}/dnsmasq.pid -h {$g['varetc_path']}/hosts");
    /etc/inc/system.inc: sigkillbypid("{$g['varrun_path']}/dhcpleases.pid", "TERM");
    /etc/inc/system.inc: @unlink("{$g['varrun_path']}/dhcpleases.pid");

    which suggests dhcpleases is started writing its pid to /var/run/dnsmasq.pid but when its time to kill it the different file /var/run/dhcpleases.pid is looked up to find the pid.



  • @wallabybob:

    but why do you think your action on dhcpd.pid and dhcpdv6.pid will affect the report about the pid file for dhcpleases?

    I came to that conclustion from this line:

    dhcpd  69581  0.0  0.3 17104 12576  ??  Ss    1:37PM   0:00.04 /usr/local/sbin/dhcpd -user dhcpd -group _dhcp -chroot /var/dhcpd -cf /etc/dhcpd.conf -pf /var/run/dhcpd.pid em1
    

    If I symlink dhcpd.pid from /var/dhcpd/var/run/ the error stops appearing in the logs. So I think you are correct, it is a typo.

    @wallabybob:

    which suggests dhcpleases is started writing its pid to /var/run/dnsmasq.pid but when its time to kill it the different file /var/run/dhcpleases.pid is looked up to find the pid.

    I honestly didn't catch the dnsmasq.pid until you pointed it out. But in looking at it, I believe they are parsing dns because I have DNS forwarder enabled. Including options "Register DHCP leases in DNS forwarder" and "Register DHCP static mappings in DNS forwarder".  So it writes my hosts from DHCP leases to the hosts file.



  • Normally the pid file is used after the chroot so your change should be wrong!
    Also your log messages are not related to dhcpd but to dhcpleases which is saying that dnsmasq is not running and could nto be reloaded!



  • Ahh, I totally see it now. I removed the bad reply so no one would follow bad advice.

    Thank you guys!


Log in to reply