How to Fix ‘Job for systemd-resolved.service failed’ in Ubuntu

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, or unbound) listening on 0.0.0.0:53 or 127.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-resolve system 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.

  1. Open your terminal and query recent journal entries for the unit:
    sudo journalctl -u systemd-resolved.service -e --no-pager
  2. 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.

  1. Identify which process is currently holding port 53:
    sudo ss -tulpn | grep :53
  2. Review the output to find the conflicting process name (e.g., dnsmasq, named, or unbound):
    • If dnsmasq is 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
  3. Once the conflicting service is halted, restart systemd-resolved:
    sudo systemctl restart systemd-resolved.service
  4. 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.

  1. Open the configuration file in a text editor:
    sudo nano /etc/systemd/resolved.conf
  2. 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
  3. Save changes (press Ctrl + O followed by Enter) and exit nano (Ctrl + X).
  4. 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.

  1. Check if /etc/resolv.conf is currently a symlink or static file:
    ls -l /etc/resolv.conf
  2. If it is a static file or broken link, remove it:
    sudo rm -f /etc/resolv.conf
  3. Recreate the proper canonical symlink pointing to the systemd stub:
    sudo ln -sf /run/systemd/resolve/stub-resolv.conf /etc/resolv.conf
  4. 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.

  1. Check the status and active DNS servers using resolvectl:
    resolvectl status
  2. Ensure that active network interfaces (e.g. eth0 or wlan0) have assigned DNS servers.
  3. Perform a DNS query lookup test:
    resolvectl query google.com
  4. Test a standard network ping:
    ping -c 3 digitash.com
  5. 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.

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.