Unbound initially was not able to start for me in chroot using rc scripts.
After reading the manuals, my interpretation was to set an
unbound_chrootdir in the rc.conf, which I guess is read as part of the
precmd, and maybe an unbound_chrootdir flag is needed to specify the
absolute path to the conf in chroot (as well as the chrootdir parameter in
the unbound.conf).

# rc.conf snippet
unbound=YES
unbound_chrootdir="/var/chroot/unbound"
unbound_flags="-c /var/chroot/unbound/etc/unbound/unbound.conf"

# ls -la /var/chroot/unbound/etc/unbound/
total 48
drwxr-xr-x  2 _unbound  _unbound    512 Sep 22 21:33 .
drwxr-xr-x  3 _unbound  _unbound    512 Jul 17 22:07 ..
-rw-r--r--  1 _unbound  _unbound    280 Sep 22 23:07 unbound.conf

I could get unbound to start in chroot if I just launched unbound from the
command line, but using the rc start command gave me this error:

# /etc/rc.d/unbound start
/etc/rc.d/unbound: WARNING: /etc/unbound/unbound.conf is not readable.

I later made some progress when I copied the unbound.conf outside the
chroot into /etc/unbound, and then used rc start to run it normally. (I was
compromising until I could figure out the chroot.) The rc script has a
migration function the copied the /etc files again to the chroot dir and
now unbound with chroot works now with rc!  But I thought I already had the
files in the right place to begin with.  :^/

# /etc/rc.d/unbound start
Migrating /etc/unbound to /var/chroot/unbound/etc/unbound

Starting unbound.

I don’t understand why it would not work with the chroot paths already
there, until I simply copied the conf file to the non-chroot etc.  I’m a
little new and feel like I may be misunderstanding how the man pages and
example conf is describing how this should works, so I would appreciate any
guidance.

Thanks in advance!

Reply via email to