Linux – bind9 not working when starting bind9 service but works when explicitly starting named

binddomain-name-systemlinuxmaster-slave

I have a really odd situation I don't fully understand. I have a master and slave DNS, I've checked the configuration, and no errors are returned. if I try to start bind9 as a service, it fails to properly sync with the slave:

sudo service bind9 start

I've also tried enabling it with:

sudo systemctl enable bind9

Again, the master and slave don't sync. I was digging through and someone suggested running named in the foreground to see what the logs output. Oddly enough, when I run service bind9 stop and then run named -fg on the master and slave, suddenly they begin to sync and transfer necessary zone information.

Why would they be transferring when I explicitly run named, but not when I run bind9 as a service? I thought named and bind were just aliases of eachother, so I'm not really sure I understand the difference of what is happening in one case versus another.

Edit:

Using Raspberry Pi: Raspbian Lite
A systemctl status bind9 output looks like the following:

> shutting down: flushing changes stopping command channel on
> 127.0.0.1#953 dumping master file: /etc/bind/tmp-ew7u3atsWd: open: permission denied dumping master file: /etc/bind/tmp-CAP7c5Elmn: open:
> permission denied no longer listening on 127.0.0.1#53 no longer
> listening on 192.168.0.105#53 no longer listening on 10.1.10.29#53
> exiting bind9.service: Succeeded. Stopped BIND Domain Name Server.

Second Edit

I didn't think it was permissions because I had set the group and user ownership to bind:bind for everything except rndc.key, but it turns out it was.

After being pointed to potential permissions issues, I did the following:

  • chown bind:bind /etc/bind/named.conf
  • chown root:root /etc/bind/rndc.key
  • chmod 755 rndc.key
  • chown bind:bind /var/cache/bind/
  • chmod g+w /var/cache/bind/
  • chmod g+w /etc/bind/

Since then it looks like it is now properly updating.

Best Answer

I didn't think it was permissions because I had set the group and user ownership to bind:bind for everything except rndc.key, but it turns out it was.

After being pointed to potential permissions issues, I did the following:

  • chown bind:bind /etc/bind/named.conf
  • chown root:root /etc/bind/rndc.key
  • chmod 755 rndc.key
  • chown bind:bind /var/cache/bind/
  • chmod g+w /var/cache/bind/
  • chmod g+w /etc/bind/

Since then it looks like it is now properly updating.