During system boot or network adapter re-initialisation in Ubuntu, administrators may encounter a startup failure notice reporting Failed to start Network Name Resolution, referring to the failure of systemd-resolved.service. When systemd-resolved fails to start, the operating system loses the ability to resolve domain names into IP addresses: web browsers display DNS lookup failures, package managers cannot fetch updates from APT mirrors, and SSH connections to remote hostnames time out. This critical outage typically stems from broken symlinks at /etc/resolv.conf, port 53 socket conflicts with third-party DNS daemons (like dnsmasq or Pi-hole), or syntax errors in /etc/systemd/resolved.conf.
Inspect systemd-resolved Service Failure Details
Before applying configuration changes, query the system journal to verify whether the service crashed due to an address-in-use bind error or file permission denials.
- Open a terminal on your Ubuntu system.
- Check the status of the service:
systemctl status systemd-resolved.service - Examine the diagnostic journal log:
journalctl -u systemd-resolved.service -b --no-pager - Look for failure signatures such as
Failed to bind UDP socket: Address already in use,Could not create DNS stub listener: Address already in use, orFailed to parse configuration file.
Resolve Port 53 Socket Conflicts (Address Already in Use)
The most common cause of systemd-resolved failure is another DNS server daemon (such as dnsmasq, bind9, or unbound) having already bound to local port 53 (127.0.0.53:53 or 0.0.0.0:53).
- Identify which process currently occupies port 53:
sudo lsof -i :53 -P -n
(orsudo ss -ulpn | grep ':53'). - If a conflicting service such as
dnsmasqornamedis listed, determine whether it was installed intentionally. - If you rely on another local DNS server, disable the
systemd-resolvedstub listener:sudo nano /etc/systemd/resolved.conf - Uncomment or add
DNSStubListener=nounder the[Resolve]header. - Save the file and restart the service:
sudo systemctl restart systemd-resolved
Restore the Canonical /etc/resolv.conf Symlink
In modern Ubuntu versions, /etc/resolv.conf must be a dynamic symbolic link pointing to /run/systemd/resolve/stub-resolv.conf. If third-party installer scripts replaced this symlink with a static, read-only file, name resolution breaks.
- Inspect the current status of the file:
ls -l /etc/resolv.conf - If it is a regular static file or broken pointer, remove it:
sudo rm -f /etc/resolv.conf - Recreate the official systemd dynamic symlink:
sudo ln -sf /run/systemd/resolve/stub-resolv.conf /etc/resolv.conf - Restart the service:
sudo systemctl start systemd-resolved - Confirm that DNS lookups function properly:
resolvectl status
Provide Fallback Public Upstream DNS Nameservers
If local DHCP routers fail to provide upstream DNS servers, systemd-resolved can stall attempting to forward queries.
- Edit the main resolver configuration file:
sudo nano /etc/systemd/resolved.conf - Configure reliable public upstream servers:
DNS=1.1.1.1 8.8.8.8FallbackDNS=1.0.0.1 8.8.4.4 - Save the file, restart the daemon, and test resolution using
ping -c 3 google.com.