Software & AppsOperating SystemLinux

Fixing “Temporary failure in name resolution” on Ubuntu Server 18.04

Ubuntu 19

In this article, we will be addressing a common issue encountered by many Ubuntu Server 18.04 users: the “Temporary failure in name resolution” error. This issue typically arises due to a DNS configuration problem. We will guide you through several methods to diagnose and resolve this issue.

Understanding the Issue

The “Temporary failure in name resolution” error is a DNS-related issue. DNS, or Domain Name System, is responsible for translating human-friendly domain names into their corresponding IP addresses. When this system fails, your server cannot resolve domain names, leading to the error message.

Checking Internet Connectivity

Before delving into more complex solutions, it’s essential to ensure your server has a working internet connection. You can do this by running the ping command:

ping 8.8.8.8

The ping command sends a network request to a specified IP address (in this case, 8.8.8.8, which is a public DNS server operated by Google). If you receive a response, your connection is fine. If not, you may need to troubleshoot your internet connection.

Verifying DNS Configuration

If your internet connection is working, the next step is to check your DNS settings. You can try editing the /etc/resolv.conf file and adding the IP address of your DNS server:

sudo nano /etc/resolv.conf

Add the following line, replacing dns_server_ip with the IP address of your DNS server:

nameserver dns_server_ip

Save and exit the file. If /etc/resolv.conf is a symbolic link, this method may not work.

Checking for resolvconf

The resolvconf program is used to manage the /etc/resolv.conf file. Run the following command to see if it is installed:

dpkg -l resolvconf

If it is not installed, you can install it using the following command:

sudo apt-get install resolvconf

Configuring netplan

Ubuntu Server 18.04 uses netplan for network configuration. You can try configuring netplan to use your chosen DNS client by following the instructions in the Ubuntu Server Guide on Name Resolution.

Temporary Workaround

If none of the above solutions work, you can use a temporary workaround. First, run sudo bash to become root. Then, remove the existing /etc/resolv.conf file and create a symbolic link to /run/resolvconf/resolv.conf:

sudo bash
rm /etc/resolv.conf
ln -s /run/resolvconf/resolv.conf /etc/resolv.conf

Please note that this is a temporary solution and may not be a permanent fix. It could also potentially cause loss of connection.

Conclusion

The “Temporary failure in name resolution” error on Ubuntu Server 18.04 can be frustrating, but with a bit of troubleshooting and the right configuration adjustments, it can be resolved. Remember to identify the specific issue before applying any solution. With the steps outlined in this guide, you should be well-equipped to tackle this problem.

How do I know if my server has a working internet connection?

You can check your internet connection by running the ping command followed by an IP address, such as ping 8.8.8.8. If you receive a response, it means your server has a working internet connection.

How can I edit the `/etc/resolv.conf` file?

You can edit the /etc/resolv.conf file by using a text editor such as nano. Open a terminal and run the command sudo nano /etc/resolv.conf to open the file in the nano editor. Make the necessary changes, save the file, and exit the editor.

What should I do if `/etc/resolv.conf` is a symbolic link?

If /etc/resolv.conf is a symbolic link, editing it directly may not work. Instead, you can try editing the file it points to. To do this, use the command sudo nano /run/resolvconf/resolv.conf to open the file in the nano editor. Make the necessary changes, save the file, and exit the editor.

How can I install the `resolvconf` program?

You can install the resolvconf program by running the command sudo apt-get install resolvconf in a terminal. This will download and install the program on your Ubuntu Server 18.04.

Where can I find instructions for configuring netplan?

You can find instructions for configuring netplan in the Ubuntu Server Guide on Name Resolution. This guide provides detailed steps and explanations for configuring netplan on your Ubuntu Server 18.04.

Is the temporary workaround a permanent solution?

No, the temporary workaround of creating a symbolic link to /run/resolvconf/resolv.conf is not a permanent solution. It is a temporary fix that can be used to resolve the "Temporary failure in name resolution" error. However, it may not be a long-term solution and could potentially cause loss of connection. It is recommended to identify and address the root cause of the issue for a permanent fix.

Leave a Comment

Your email address will not be published. Required fields are marked *