AdguardHome_address already in use error when trying to install on Ubuntu

时间:2023-5-4 06:37     作者:IronMan     分类: 知识

This happens because the port 53 on localhost, which is used for DNS, is already taken by another program. Ubuntu comes with a local DNS called systemd-resolved, which uses the address and thus prevents AdGuard Home from binding to You can see that by running:

sudo lsof -i :53
The output should be similar to:

systemd-r 14542 systemd-resolve 13u IPv4 86178 0t0 UDP
systemd-r 14542 systemd-resolve 14u IPv4 86179 0t0 TCP
To fix this, you need to either disable the systemd-resolved daemon or choose a different network interface and bind to an accessible IP address on it, for instance, the IP address of your router inside your network. But if you do need to listen on localhost, there are several solutions.

Firstly, AdGuard Home can detect such configurations and disable systemd-resolved for you if you press the “Fix” button, which is shown near the address already in use message on the installation screen.

Secondly, if that doesn't work, follow the guide below. Note that if you're using AdGuard Home with docker or snap, you'll have to do it yourself.

Create the /etc/systemd/resolved.conf.d directory, if necessary:

sudo mkdir -p /etc/systemd/resolved.conf.d
Deactivate DNSStubListener and update DNS server address. To do that, create a new file, /etc/systemd/resolved.conf.d/adguardhome.conf, with the following content:

Specifying as DNS server address is necessary because otherwise the nameserver will be which doesn't work without DNSStubListener.

Activate another resolv.conf file:

sudo mv /etc/resolv.conf /etc/resolv.conf.backup
sudo ln -s /run/systemd/resolve/resolv.conf /etc/resolv.conf
Restart DNSStubListener:

sudo systemctl reload-or-restart systemd-resolved
After that, systemd-resolved shouldn't be shown in the output of lsof, and AdGuard Home should be able to bind to