Skip to main content
“Temporary failure in name resolution” means Linux couldn’t turn a name such as example.com into an IP address. Either the server has no working network, no working DNS resolver is configured, the local resolver (systemd-resolved on Ubuntu) is stopped, or a firewall blocks DNS. Test with ping -c 3 1.1.1.1 and resolvectl status, then set working DNS servers in your network configuration.

Before you start

  • A DNS resolver is the server that answers “which IP belongs to this name?”. Your server asks the resolvers in its network settings.
  • If the message starts with sudo: unable to resolve host, jump to Cause 4 below: only your server’s own name is missing.
  • If SSH stopped working too, use the VNC console.
  • Commands use sudo. As root, leave it out.

Step 1: Is it DNS or the whole network?

Cause 1: No working DNS servers configured

An edit to Netplan, NetworkManager or /etc/resolv.conf can leave the server with no resolvers, or with ones that no longer answer. Check:
Each network interface should show DNS Servers: with at least one address. /etc/resolv.conf shows nameserver 127.0.0.53: that is the local resolver, which forwards to those servers. That line is correct; don’t replace it.
Fix: set resolvers where your network tool stores them, for example 1.1.1.1 and 9.9.9.9. On Ubuntu that is the nameservers block in Netplan, on AlmaLinux and Rocky it is NetworkManager. Step-by-step instructions for each system are in change DNS resolvers on Linux. The VPS Panel DNS resolver setting only takes effect if your server uses the panel’s network configuration.

Cause 2: systemd-resolved is stopped (Ubuntu)

If /etc/resolv.conf points to 127.0.0.53 but the service behind it doesn’t run, every lookup fails. Check:
Fix:
If you replaced /etc/resolv.conf with your own file and then stopped the service, either keep your file and leave the service off, or restore the link:

Cause 3: A firewall blocks outgoing DNS

DNS uses port 53 over UDP and TCP. If you set your firewall to deny outgoing traffic, lookups fail. Check:
Default: deny (incoming), allow (outgoing) is normal. deny (outgoing) needs an exception for DNS.
Fix (UFW with outgoing denied):

Cause 4: Your own hostname isn’t in /etc/hosts

After you change the hostname, sudo prints unable to resolve host before it runs your command. Only the server’s own name is missing. Check:
Fix: add the hostname to /etc/hosts. On Ubuntu and Debian, use 127.0.1.1:
Replace web01 with the output of hostname. The change works immediately.

How to check it worked

An IP address followed by the name means lookups work. On Ubuntu, resolvectl query example.com also shows which server answered.

Frequently asked questions

Why is it called “temporary” if it never fixes itself?

It is the standard text for the EAI_AGAIN error, which the resolver library returns when no DNS server gave an answer and a retry might work. It doesn’t mean the problem will go away on its own.

Can I just edit /etc/resolv.conf?

On Ubuntu, systemd-resolved or Netplan overwrites it. On AlmaLinux and Rocky, NetworkManager does. Make the change in the tool that owns the file, as in Cause 1.

Apt says “Temporary failure resolving”. Is the mirror down?

Usually not. That message comes from your server’s DNS, not the mirror. Fix DNS first, then see apt and dnf repository errors if apt update still fails.

VPS and dedicated server guides

Every guide in this section.

Change DNS resolvers

Set resolvers on every distribution.

Static IP with Netplan

Fix a broken Ubuntu network config.

Change the hostname

Rename the server and update /etc/hosts.

apt and dnf repository errors

When package updates fail.

Checked against the official systemd resolvectl and systemd-resolved manuals and the Ubuntu Server networking guide on 4 November 2026; the ping, curl, apt and sudo errors and the /etc/hosts fix were reproduced with an empty resolver configuration on Ubuntu 24.04 LTS. Service restarts and the firewalld check were not tested.

Need Extra Help?

If you encounter any issues, our support team is ready to assist:

Save on Your Hosting

Ready to upgrade your hosting? Use code KB20 at checkout for 20% off your first order!

Last Updated: November 2026