Dnsmasq addn-hosts : No such file or directory

I try to specify addn-hosts for the dnsmasq of the managed lxdbr0.
Is that possible at all ?

I’ve found dnsmasq.raw on my host file system:

so I guessed that :

failed to load names from /etc/TOP_EU_US_Ads_Trackers_HOST: No such file or directory

means that dnsmasq is running in a chroot within /var/snap/lxd/common/lxd.

so I copied the file to /var/snap/lxd/common/lxd/etc , but that does not help.

My LXD start according to journalctl -xe :

lxd.daemon[17798]: t=2021-01-03T12:30:21+0000 lvl=info msg=“LXD 4.9 is starting in normal mode” path=/var/snap/lxd/common/lxd

Any ideas ?


You’ll want to use the raw.dnsmasq config key but because of the snap confinement you’ll need to work around things a bit with something like addn-hosts /var/lib/snapd/hostfs/etc/TOP_EU_US_Ads_Trackers_HOST so it reaches the right file.

Thanks for the quick reply.

Indeed, that works:

Jan 03 17:55:09 danshans.nl dnsmasq[17059]: read /etc/hosts - 1 addresses
Jan 03 17:55:09 danshans.nl dnsmasq[17059]: read /var/lib/snapd/hostfs/etc/TOP_EU_US_Ads_Trackers_HOST - 4373 addresses

(for others reading this . . . )
Now my configuration has:


while the file is on the host file system as:

~# ls -l /etc/TOP_EU_US_Ads_Trackers_HOST
-rw-r–r-- 1 root root 133345 Jan 3 17:54 /etc/TOP_EU_US_Ads_Trackers_HOST

Now I know what to look for I found a similar case, but for raw.qemu.
Running virtual machines with LXD 4.0 / 78