There is a problem with dns/nsd startup script.
This script reads pidfile location from configfile.
However if NSD is started in chrooted environemnent
then startup script can't locate pidfile and stop the daemon.
I tried to configure pidfile location to /var/run/nsd in nsd.conf
and then created this directory under relative path to chroot directory
but it didn't help as nsd-checkconf checks whether pidfile is
relative to chroot or no:
[root@ns348344 ~]# /usr/local/sbin/nsd-checkconf -o pidfile /usr/local/etc/nsd/nsd.conf
/usr/local/etc/nsd/nsd.conf: pidfile /var/run/nsd/nsd.pid is not relative to chroot /usr/local/etc/nsd/.
/usr/local/etc/nsd/nsd.conf: 1 semantic errors in 1 zones, 1 keys.
The best would be read to variable from config if chroot is in use by issuing
/usr/local/sbin/nsd-checkconf -o chroot /usr/local/etc/nsd/nsd.conf
and then concatenate this path to pidfile location to get the real path.
Also I found out that removing pidfile variable from startup script solves the problem and pidfiles are automatically discovered. It seems that /etc/rc.subr does some magic over that.
Omitting the pidfile causes subr.rc to hunt with ps for the PID.
A workaround is to specify the full path, including the chroot directory of the pidifle in the nsd.conf, so that will be with these parameters
I'll send a patch for the script ASAP
Just Released nsd 4.1.1 (See https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=197291) which should fix this problem.
Fixed in the update to 4.1.1