When an Ubuntu server or desktop system reports Failed to start Network Name Resolution or systemd-resolved.service: Failed with result 'exit-code', local DNS lookups fail across all applications. Terminal commands such as curl, apt update, and ping return immediate errors stating “Temporary failure in name resolution”, cutting off internet connectivity despite active Ethernet links.
Why Does systemd-resolved Fail to Start in Ubuntu?
The systemd-resolved daemon manages local network name resolution caching and stub listeners. Key failure triggers include:
- Port 53 Binding Conflicts: Third-party DNS or caching daemons (such as
dnsmasq, Pi-hole, or BIND9) already bound to127.0.0.53:53or0.0.0.0:53, preventing systemd-resolved from opening its listener socket. - Broken /etc/resolv.conf Symlink: Manual editing of
/etc/resolv.confreplacing the required dynamic stub symlink with an invalid static file. - Syntax Errors in resolved.conf: Unrecognised directives, invalid IP addresses, or malformed fallback DNS parameters inside
/etc/systemd/resolved.conf. - AppArmor or Permission Restrictions: Custom security profiles denying the
systemd-resolvesystem user read access to network state trees.
1. Check systemd-resolved Journal Logs for Port Conflicts
Identifying the exact error code reveals whether a syntax mistake or port collision caused the service termination.
sudo systemctl status systemd-resolved.service
To view detailed diagnostic output from the previous failed initialization:
sudo journalctl -u systemd-resolved.service -b --no-pager
If you see the error message Could not create listening socket: Address already in use, an existing process has monopolised UDP/TCP port 53.
2. Identify and Resolve Port 53 Collisions
Find out which daemon is competing for the DNS port:
sudo ss -tulpn | grep ':53 '
Common culprits include dnsmasq, named, or containerized DNS proxies.
- If running
dnsmasqalongside NetworkManager, disable dnsmasq or configure it to listen exclusively on a secondary loopback address. - Alternatively, disable the local stub listener in
systemd-resolvedby opening/etc/systemd/resolved.confand setting:[Resolve] DNSStubListener=no
3. Restore the Proper /etc/resolv.conf Symlink
Ubuntu requires /etc/resolv.conf to point directly to the systemd stub resolver file.
- Remove any corrupted or static file:
sudo rm -f /etc/resolv.conf - Recreate the standard canonical symlink pointing to systemd dynamic stub:
sudo ln -s /run/systemd/resolve/stub-resolv.conf /etc/resolv.conf
4. Restart systemd-resolved and Verify Resolution
Once configuration files and symlinks are in place, restart the resolution service and test DNS queries.
sudo systemctl restart systemd-resolved.service
sudo systemctl enable systemd-resolved.service
sudo systemctl status systemd-resolved.service
Verify network name resolution by querying a public domain using resolvectl:
resolvectl query ubuntu.com
If the command returns valid IP addresses and reports Data from: network, DNS resolution is fully restored.