Dnsmasq error reading /var/db/dhcpd.leases



  • On recent snapshots I've been getting this error (02-19,02-20)

    dnsmasq[46274]: failed to access /var/db/dhcpd.leases: No such file or directory

    and on the more recent 02-22 I get:

    dnsmasq[46274]: failed to access /var/dhcpd/dhcpd.leases: No such file or directory

    I think I found the problem on line 563 of /etc/inc/services.inc

    it reads in 02-19:

    $args .= " -l {$g['vardb_path']}/dhcpd.leases" .

    and in 02-22 it reads:

    $args .= " -l {$g['dhcpd_chroot_path']}/dhcpd.leases" .

    I changed it to:

    $args .= " -l {$g['dhcpd_chroot_path']}/var/db/dhcpd.leases" .

    on my system and it seems to work!



  • This was fixed recently.  Check cvstrac.



  • Okay, thanks!

    In cvstrac the most recent releng_1 service.inc I find is 1.72.2.24 which reads $args .= " -l {$g['dhcpd_chroot_path']}/dhcpd.leases" . on line 563

    but of course my experience is limited and I probably don't know the right place to look, or I'm even looking at the wrong file…can you point me to the right place?



  • That is correct.



  • Okay, thanks!

    Maybe my system is messed up or something, but with services.inc version 1.72.2.24, and with DNS Forwarder running, I get the error in the system logs

    dnsmasq[<pid>]: failed to access /var/dhcpd/dhcpd.leases: No such file or directory

    here's the results of searching for dhcpd.leases, etc:

    # ls -l /var/dhcpd/
    total 539
    dr-xr-xr-x  4 dhcpd  _dhcp     512 Feb 22 23:14 dev
    -rwxr-xr-x  1 dhcpd  _dhcp  521718 Feb 15 18:02 dhcpd
    drwxr-xr-x  2 dhcpd  _dhcp     512 Feb 11 09:03 etc
    drwxr-xr-x  2 dhcpd  _dhcp     512 Feb 11 09:03 lib
    drwxr-xr-x  2 dhcpd  _dhcp     512 Feb 11 09:03 run
    drwxr-xr-x  3 dhcpd  _dhcp     512 Feb 11 09:03 usr
    drwxr-xr-x  4 dhcpd  _dhcp     512 Feb 11 09:03 var
    # find / -iname dhcpd.leases
    /var/dhcpd/var/db/dhcpd.leases
    # cat /etc/inc/globals.inc | grep dhcpd_chroot_path
        "dhcpd_chroot_path" => "/var/dhcpd",
    # cat /etc/inc/services.inc | grep dhcpd_chroot_path
            $status = `mount | grep "{$g['dhcpd_chroot_path']}/dev"`;
            fwrite($fd, "mkdir -p {$g['dhcpd_chroot_path']}\n");
            fwrite($fd, "mkdir -p {$g['dhcpd_chroot_path']}/dev\n");
            fwrite($fd, "mkdir -p {$g['dhcpd_chroot_path']}/etc\n");
            fwrite($fd, "mkdir -p {$g['dhcpd_chroot_path']}/usr/local/sbin\n");
            fwrite($fd, "mkdir -p {$g['dhcpd_chroot_path']}/var/db\n");
            fwrite($fd, "mkdir -p {$g['dhcpd_chroot_path']}/usr\n");
            fwrite($fd, "mkdir -p {$g['dhcpd_chroot_path']}/lib\n");
            fwrite($fd, "mkdir -p {$g['dhcpd_chroot_path']}/run\n");
            fwrite($fd, "chown -R dhcpd:_dhcp {$g['dhcpd_chroot_path']}/*\n");
            fwrite($fd, "cp /lib/libc.so.6 {$g['dhcpd_chroot_path']}/lib/\n");
            fwrite($fd, "cp /usr/local/sbin/dhcpd {$g['dhcpd_chroot_path']}/usr/local/sbin/\n");
            fwrite($fd, "chmod a+rx {$g['dhcpd_chroot_path']}/usr/local/sbin/dhcpd\n");
                    fwrite($fd, "mount_devfs devfs {$g['dhcpd_chroot_path']}/dev\n");
            $fd = fopen("{$g['dhcpd_chroot_path']}/etc/dhcpd.conf", "w");
            touch("{$g['dhcpd_chroot_path']}/var/db/dhcpd.leases");
            mwexec("/usr/local/sbin/dhcpd -user dhcpd -group _dhcp -chroot {$g['dhcpd_chroot_path']} -cf {$g['dhcpd_chroot_path']}/etc/dhcpd.conf " .
                            $args .= " -l {$g['dhcpd_chroot_path']}/dhcpd.leases" .
    

    Am I missing something or is my dhcpd.leases being written to the wrong place? It seems to me that the last line there (from the dnsmasq section) is looking for the dhcpd.leases file in /var/dhcpd/dhcpd.leases, but dhcpd is writing the file to /var/dhcpd/var/db/dhcpd.leases…

    TIA</pid>



  • Yep, its missing a /var/db/, I overlooked that.  Will fix shortly.



  • Cool, thanks!!

    I actually added that into mine, and that made it work a-ok!!  8)


Locked