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).
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.