While following the official Samba4 HOWTO I found out that bind would not start giving me the following error (taken from my syslog):
Loading ‘AD DNS Zone’ using driver dlopen
unsupported DLZ database driver ‘dlopen’. AD DNS Zone not loaded.
If you want some technical background as to what dlopen is read this blog post, but in short, Samba4 needs some features only available in Bind 9.8 and above. If you are getting the error I described above, you either have an earlier version or your binary version of Bind 9.8 or above was not compiled with support for dlz drivers.
To fix it I backported Bind9 from SID. This was the first time I ever did such a thing so I am no expert… if you know a better way to accomplish this please leave a comment.
Note: whenever Bing 9.8 gets backported it will become much easier to install, you will only have to follow the steps described here. For now, follow the instructions below.
Let’s remove the old version of bind first:
sudo apt-get remove bind9
Install required packages:
sudo apt-get install devscripts build-essential libkrb5-dev debhelper libssl-dev libtool bison libdb-dev libldap2-dev libxml2-dev libpcap2-dev hardening-wrapper libgeoip-dev dpkg-dev
Download bind9 .dsc file (check here for the latest link to the .dsc file):
mkdir bind9 cd bind9 dget -x http://ftp.de.debian.org/debian/pool/main/b/bind9/bind9_9.8.1.dfsg-1.dsc
Now unpack bind:
tar xvzf bind9_9.8.1.dfsg.orig.tar.gz cd bind9_9.8.1.dfsg/
Note: I will skip applying the .diff file from sid. When I tried applying it the source would not compile and, most importantly, it stopped recognising the –with-dlz-dlopen parameter which is the reason why I had to do this in the first place.
Configure and then compile Bind9 source code:
fakeroot ./configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --sysconfdir=/etc/bind --localstatedir=/var --enable-threads --enable-largefile --with-libtool --enable-shared --enable-static --with-openssl=/usr --with-gssapi=/usr --with-gnu-ld --with-dlz-postgres=no --with-dlz-mysql=no --with-dlz-bdb=yes --with-dlz-filesystem=yes --with-dlz-ldap=yes --with-dlz-stub=yes --with-dlz-dlopen=yes --with-geoip=/usr --enable-ipv6 CFLAGS=-fno-strict-aliasing
If you are using bind9 9.8.1 you may find a compilation error which can be fixed with the patch described here. You can apply the patch manually, all you have to do is edit the file contrib/dlz/drivers/sdlz_helper.c and remove the “#ifdef DLZ” line and the “#endif” line at the end of the file.
Now let’s compile and install bind9:
Last step, we need to manually create the /var/cache/bind directory:
sudo mkdir /var/cache/bind
Start the service:
sudo /etc/init.d bind9 start
Hopefully, bind9 will start just fine.
Congratulations, bind9 should be working now. If you are following the Samba4 HOWTO like I was, make sure you run the provisioning steps again with bind9 running.
Let me know if this was helpful to you!