Restarting or enabling the network name resolution daemon in Ubuntu only to receive the terminal error: “Job for systemd-resolved.service failed because the control process exited with error code. See ‘systemctl status systemd-resolved.service’ and ‘journalctl -xeu systemd-resolved.service’ for details” halts internet connectivity. Applications will report Temporary failure in name resolution or Could not resolve host, preventing package updates and web browsing. In modern Ubuntu releases, systemd-resolved provides local DNS caching and stub resolution, binding to the local loopback interface on UDP port 53 (127.0.0.53:53). When third-party DNS daemons (such as dnsmasq, named/BIND, or Docker containers) bind to port 53, configuration files in /etc/systemd/resolved.conf contain syntax errors, or the /etc/resolv.conf symlink is broken, the service fails to start. This tutorial explains how to resolve port conflicts, restore the stub resolver symlink, and fix systemd-resolved.
What Causes systemd-resolved.service to Fail in Ubuntu?
Systemd-resolved manages local network name resolution. Primary causes of service failure include:
- Port 53 (DNS) Socket Conflicts: Another daemon (e.g.
dnsmasq,bind9,pi-hole, orunbound) listening on0.0.0.0:53or127.0.0.1:53, preventing systemd-resolved from opening its stub socket. - Syntax Errors in resolved.conf: Misformatted DNS server IP addresses, unrecognised directives, or improper DNSSEC parameters in
/etc/systemd/resolved.conf. - Broken or Static /etc/resolv.conf Symlink: The traditional resolver file being converted to a static text file rather than pointing to the dynamic systemd stub resolver.
- Permissions and Ownership Anomalies: The
systemd-resolvesystem user lacking read/write access to runtime run directories (/run/systemd/resolve). - Unclean Package Upgrades: Partial apt update processes leaving mismatching systemd binary libraries.
Step 1: Check Journalctl Logs for the Exact Failure Reason
Inspecting systemd journal logs pinpoints whether the service failed due to a port collision or configuration syntax error.
- Open your terminal and query recent journal entries for the unit:
sudo journalctl -u systemd-resolved.service -e --no-pager - Examine the last few lines of the output:
- If you see “Failed to bind socket: Address already in use”, another service is occupying port 53.
- If you see “Failed to parse config file”, there is a syntax error in your configuration file.
- If you see “Failed to create runtime directory”, filesystem permissions are misconfigured.
Step 2: Identify and Resolve Port 53 Socket Conflicts
If another process has bound to UDP/TCP port 53, systemd-resolved cannot initialize its local loopback listener.
- Identify which process is currently holding port 53:
sudo ss -tulpn | grep :53 - Review the output to find the conflicting process name (e.g.,
dnsmasq,named, orunbound):- If
dnsmasqis running (frequently spawned by libvirt or older NetworkManager setups), disable it:sudo systemctl stop dnsmasq sudo systemctl disable dnsmasq - If
named(BIND9) is running:sudo systemctl stop named sudo systemctl disable named
- If
- Once the conflicting service is halted, restart
systemd-resolved:sudo systemctl restart systemd-resolved.service - Check status to confirm it is active:
sudo systemctl status systemd-resolved.service
Step 3: Verify and Restore /etc/systemd/resolved.conf Configuration
Corrupted configuration directives can prevent the parser from loading service defaults.
- Open the configuration file in a text editor:
sudo nano /etc/systemd/resolved.conf - Verify that the
[Resolve]section contains valid upstream DNS IP addresses (e.g., Google or Cloudflare DNS):[Resolve] DNS=1.1.1.1 8.8.8.8 FallbackDNS=1.0.0.1 8.8.4.4 Domains=~. DNSSEC=no MulticastDNS=no DNSStubListener=yes - Save changes (press Ctrl + O followed by Enter) and exit nano (Ctrl + X).
- Test service restart:
sudo systemctl restart systemd-resolved
Step 4: Recreate the Canonical /etc/resolv.conf Symlink
Ubuntu requires /etc/resolv.conf to be a symbolic link pointing to the systemd stub listener runtime file.
- Check if
/etc/resolv.confis currently a symlink or static file:ls -l /etc/resolv.conf - If it is a static file or broken link, remove it:
sudo rm -f /etc/resolv.conf - Recreate the proper canonical symlink pointing to the systemd stub:
sudo ln -sf /run/systemd/resolve/stub-resolv.conf /etc/resolv.conf - Restart the resolution daemon:
sudo systemctl restart systemd-resolved
Step 5: Verify DNS Resolution
Testing DNS queries confirms that local applications and system utilities can resolve domain names cleanly.
- Check the status and active DNS servers using
resolvectl:resolvectl status - Ensure that active network interfaces (e.g.
eth0orwlan0) have assigned DNS servers. - Perform a DNS query lookup test:
resolvectl query google.com - Test a standard network ping:
ping -c 3 digitash.com - If response packets return without error, systemd-resolved is fully restored and operating normally.
systemd-resolved Failure Troubleshooting Matrix
| Reported Error | Primary Cause | Remediation Step |
|---|---|---|
| Address already in use (:53) | dnsmasq or BIND9 conflict | Disable competing daemon using systemctl disable |
| Failed to parse config file | Syntax error in resolved.conf | Restore clean default directives in resolved.conf |
| Temporary failure in name resolution | Broken /etc/resolv.conf link |
Re-link to /run/systemd/resolve/stub-resolv.conf |
| Stub listener disabled | DNSStubListener=no set |
Set DNSStubListener=yes in resolved.conf |
Resolving socket collisions and restoring the canonical stub resolver symlink ensures reliable, high-performance domain name resolution across Ubuntu.