Error: Failed to run: dnsmasq - Address already in use

I have a system that has Bind (nameserver) running on the interface I’d like to setup LXD on.
Bind cannot be removed as it is my company’s internal nameserver.

This is the error from sudo lxd init

error: Failed to run: dnsmasq --strict-order --bind-interfaces --pid-file=/var/snap/lxd/common/lxd/networks/lxdbr0/dnsmasq.pid --except-interface=lo --interface=lxdbr0 --quiet-dhcp --quiet-dhcp6 --quiet-ra --listen-address=10.67.35.1 --dhcp-no-override --dhcp-authoritative --dhcp-leasefile=/var/snap/lxd/common/lxd/networks/lxdbr0/dnsmasq.leases --dhcp-hostsfile=/var/snap/lxd/common/lxd/networks/lxdbr0/dnsmasq.hosts --dhcp-range 10.67.35.2,10.67.35.254,1h --listen-address=fd42:7f70:908e:e58b::1 --enable-ra --dhcp-range ::,constructor:lxdbr0,ra-stateless,ra-names -s lxd -S /lxd/ --conf-file=/var/snap/lxd/common/lxd/networks/lxdbr0/dnsmasq.raw -u lxd: dnsmasq: failed to create listening socket for 10.67.35.1: Address already in use

As you can see and from what I gathered dnsmasq issues, dnsmasq expects to run on port 53, but it can’t because of bind.

Is there a way to use LXD on a system that already has a nameserver running on it?

Cheers

Hello,

You need to specify the listen-on bind ip so it does not bind on 0.0.0.0:53 .

I’m sorry, you need to be specific as to how to do that.

I looked at /usr/bin/lxd and it’s a binary, not a shell script I can edit.
Does lxd have hooks or external scripts so that I can edit the command it executes?

Or do I run that command manually with the modification you suggest and restart lxd init?

Not sure what to do here.
Thanks

In my case i changed
listen-on { all; };
with
listen-on { 127.0.0.1; };

In /etc/bind/named.conf.options .
So Bind do not use the lxbr0 IP anymore.

Thanks for the help. I will try that at work tomorrow :slight_smile:

So to recap, I need to prevent the nameserver from running on the same interface that LXD needs to run on.

Wish me the best. I’ll report back here with results as I have them.

Erm, if this is the DNS of your company I would NOT! advise you to put the Bind nameserver to listen only on 127.0.0.1! You will be unable to answer DNS requests as this will only be listening on your loopback interface!

Thanks. I didn’t intend on do that as I was concerned that would be the case.

I ended up telling bind to listen just on the interface it needed to and was super specific in sudo lxd init about what networking interfaces I needed it to operate on, also disabling IPV6.

Cheers all
Problem resolved

1 Like