3.0 - LXC network bridge setup failing with dnsmasq already running

Linux server 4.15.0-22-generic #24-Ubuntu SMP Wed May 16 12:15:17 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
LXC 3.0
dnsmasq 2.79

Having had dnsmasq installed and running prior installing LXC produced the below error during the installation of LXC. The workaround been then stopping dnsmasq and starting lxc-net.

service lxc-net status -l
● lxc-net.service - LXC network bridge setup
Loaded: loaded (/lib/systemd/system/lxc-net.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Wed 2018-05-23 08:39:47 CEST; 57s ago
Main PID: 14229 (code=exited, status=1/FAILURE)

May 23 08:39:46 server systemd[1]: Starting LXC network bridge setup…
May 23 08:39:47 server lxc-net[14229]: /usr/lib/x86_64-linux-gnu/lxc/lxc-net: 162: /usr/lib/x86_64-linux
May 23 08:39:47 server lxc-net[14229]: dnsmasq: failed to create listening socket for 127.0.0.1: Address
May 23 08:39:47 server dnsmasq[14303]: failed to create listening socket for 127.0.0.1: Address already
May 23 08:39:47 server dnsmasq[14303]: FAILED to start up
May 23 08:39:47 server lxc-net[14229]: Failed to setup lxc-net.
May 23 08:39:47 server lxc-net[14229]: Failed to setup lxc-net.
May 23 08:39:47 server systemd[1]: lxc-net.service: Main process exited, code=exited, status=1/FAILURE
May 23 08:39:47 server systemd[1]: lxc-net.service: Failed with result ‘exit-code’.
May 23 08:39:47 server systemd[1]: Failed to start LXC network bridge setup.

That’s normal. Your system-wide dnsmasq is binding port 53 on all addresses, preventing lxc-net from binding port 53 on the bridge interface.

You’ll either want to remove your system wide dnsmasq (if not used) or at least configure it to only listen on the interfaces you actually need it on.

That is my preference in general, i.e. curtail sockets from spawning systemwide on 0.0.0.0

dnsmasq was set prior to installing LXD

listen-address=127.0.0.1
bind-interfaces
local-service
localise-queries
rebind-localhost-ok

Thus I did not expect LXC causing this error during installation. Running /etc/init.d/dnsmasq start/restart or systemctl start/restart dnsmasq is neither causing such error.

When hitting the error, what does netstat -lnp show?

Since lxc been installed already it was not possible to recreate the exact environment of a vanilla lxc installation. Tried with apt purge lxc lxc-templates and apt install install lxc but the error did not reproduce.