Temporary failure in name resolution
This error occurs when the system cannot resolve a domain name to an IP address due to missing, corrupted, or unreachable DNS configurations.
Usually happens because:
- ☑ DNS configuration file /etc/resolv.conf is empty or corrupt
- ☑ Active network interfaces are offline, blocking routing
- ☑ WSL environment auto-generated resolver is out of sync
🔍 Quick Checklist:
What is Temporary failure in name resolution?
The 'Temporary failure in name resolution' error (EAI_AGAIN) is returned by the name resolution subsystem (getaddrinfo) when it cannot map a domain name (like github.com) to an IP address. This indicates that the system DNS configuration files (e.g. '/etc/resolv.conf') are missing valid nameservers, local networking is offline, or the upstream DNS servers are unreachable.
Common Causes
- Missing or incorrect DNS nameservers: The '/etc/resolv.conf' configuration lacks working name servers.
- Unreachable network interfaces: The local network interface is down, blocking outward internet routing.
- Docker DNS resolution limits: Containers running on networks that do not propagate DNS servers properly, leaving them with blank resolvers.
| Cause | Frequency |
|---|---|
| Corrupt or blank /etc/resolv.conf | ⭐⭐⭐⭐⭐ |
| Network routing interface offline (down) | ⭐⭐⭐⭐ |
| Docker container network bridge DNS mismatch | ⭐⭐⭐ |
Common Mistakes
- Editing `/etc/resolv.conf` directly on systems where dynamic managers (like `resolvconf` or `systemd-resolved`) run, which silently wipes manual changes on next reboot.
- Forgetting that firewall blocks on egress port 53 (UDP/TCP) will trigger name resolution failures even if nameservers are configured correctly.
How to Fix
Linux Operations & Verification
Manually seed active DNS resolvers inside the resolv.conf file using administrative privileges.
# 1. Write public nameservers to resolv.conf (using pipe tee to escape redirects limits)
$ echo -e "nameserver 8.8.8.8\nnameserver 1.1.1.1" | sudo tee /etc/resolv.conf
# 2. Test resolution with nslookup query
$ nslookup github.com
Server: 8.8.8.8
Address: 8.8.8.8#53
Non-authoritative answer:
Name: github.com
Address: 140.82.121.4Platform Specific Fixes
Trace raw name servers query routing using dig utility tools.
dig github.com +shortBest Practices
- Configure DNS addresses directly inside main interface setups (like Netplan files `/etc/netplan/*.yaml`).
- Monitor network resolver access status under automated server health checks.
Frequently Asked Questions (FAQ)
Q: What does 'Temporary failure in name resolution' mean?
It means the operating system's DNS lookup tool cannot contact a DNS server to translate a domain name into an IP address.
Q: How do I fix /etc/resolv.conf changes getting overwritten?
In modern Linux systems, NetworkManager or systemd-resolved manages resolv.conf. To prevent overrides, disable systemd-resolved or configure DNS parameters directly in Netplan or NetworkManager configurations.
Q: How do I troubleshoot DNS queries?
Use 'dig google.com' or 'nslookup google.com' to test if a specific DNS server resolves names successfully.
Q: How do I resolve DNS blocks in WSL?
Add '[network]\ngenerateResolvConf = false' to '/etc/wsl.conf', delete '/etc/resolv.conf' (which is a symlink), and create a new static file with 'nameserver 8.8.8.8'.