Score:1

Ubuntu 20.04 temporary failure in name resolution for wired

ru flag

I am getting the following error from ubuntu 20.04 terminal, connected via wired ethernet connection: When I type the following command which I am using in a bash script:

ping -c 1 google.com

for a health check to ensure it has access, I get the following error:

ping: google.com: Temporary failure in name resolution

Some background

I overwrote my older gaming rig to be a ubuntu multi purpose server (including smart home automation) in my home network. It used to be windows 10, but I formatted the drive and installed ubuntu on it.

I have not yet been able to access the internet with ubuntu, however, I do know that the equipment works because I left the internet wired in, I actually downloaded ubuntu via that machine onto the usb before installing.

Now I cannot see or connect to the ubuntu server from other devices and cannot reach the internet to download even basic tools like netstat.

At this point, I feel like I've bashed my head against a wall and scoured the internet (and lots of other stack overflow threads) and tried a bunch of things that didn't work.

Any help would be greatly appreciated!

Edit: As requested in comments, I am attaching a screenshot, since I am not able access the computer via any network. Only via hdmi.

enter image description here

Edit 2: Second screenshot as requested.

enter image description here

chili555 avatar
cn flag
Pease edit your question to show the result of these terminal commands: `ip addr show` and also: `cat /etc/netplan/*.yaml`
ru flag
I don't have access to it, so i took a pic with my phone and just commented out some personal naming stuff
chili555 avatar
cn flag
One more, please: `ls -al /etc/resolv.conf` Thanks.
ru flag
Ty for taking the time to help me! :-)
chili555 avatar
cn flag
Is IPv6 enabled in Network Manager? Is this a static IP address you set in Network Manager? Is the reult the same if you do: `ping4 -c1 www.google.com` So far, everything looks fine.
ru flag
yeah, same error if i do that command. I didn't explicitly set it.. this is the vanila ubuntu 20.04 i downloaded today from the website.. didn't do anything other than try to get the network to even do a simple `apt-get update` lol
chili555 avatar
cn flag
Let us [continue this discussion in chat](https://chat.stackexchange.com/rooms/128602/discussion-between-chili555-and-zedd).
Score:3
in flag

It's likely your default DNS server is pointing to an IP address that is not capable of resolving DNS queries. You should check the DNS settings in the file that /etc/resolv.conf is pointing to. When you go to that file (/var/run/systemd/resolve/resolve.conf), look at the IP that is right next to the keyword namespace. You should set it to your router's IP address (which can be found with the command route -n. Look for the gateway column and take the one that's not 0.0.0.0) or you can also set it to a public DNS server such as 1.1.1.1, 8.8.8.8 etc.

EDIT: Please follow these instructions:

Execute sudo rm /etc/resolv.conf

Execute sudo touch /etc/resolv.conf

Edit the file with sudo nano /etc/resolv.conf

Add this line to the file: nameserver 1.1.1.1

Press ctrl + s to save and ctrl + x to exit

Then try to access the internet again. If it still doesn't work, reboot the system and try again. That should solve your problem.

chili555 avatar
cn flag
"cat: /var/run/systemd/resolve/resolve.conf: No such file or directory"
ru flag
impossible to do what you are asking since the commands you are asking me to execute are not installed and i have no internet access.
Muhammed Özen avatar
in flag
route and nano are basic commands that are in every linux distributions. I guess I understand the problem now. If you're getting this error "cat: /var/run/systemd/resolve/resolve.conf: No such file or directory", then it means you dont have any DNS server configured for your OS at all. The file that is supposed to contain DNS settings is not even present. We can fix this if you follow my instructions. I'll include them in my answer in just a little bit since I have character limitation here. Check out the answer please.
Muhammed Özen avatar
in flag
I just saw your answer. I didnt know you'd solved the problem. Awsome work. But the problem was you didnt have and DNS config file. If you run into any problem like that again, you can try the steps I explained above
ru flag
Thank you so much Muahammed! yeah it was weird, it didn't even have ifconfig installed, let alone route lol And I can't take credit for the awesome work, it was all @chili555
Muhammed Özen avatar
in flag
You're welcome Zedd. Wow that must have been tough. I'm glad you solved it. Then thanks are for @chili555
Stephen Punwasi avatar
iq flag
Good temporary fix to update packages in an emergency, but it gets overwritten by the system eventually. But definitely a quick fix to get updates and packages installed to resolve the issue.
chized avatar
gd flag
I had same issue, I followed your steps, each step worked except when I tried to restart the service. It gave an error message. Then I restarted the OS and boom, everything started working. I also shutdown the OS running on my VMware station before the OS restart
us flag
Do not do this. It is by design that /etc/resolv.conf always points the user to systemd-resolved running locally. If systemd-resolved has the wrong DNS servers configured, then you should address that by modifying the configuration of systemd-resolved via /etc/systemd/resolved.conf.
Score:1
gy flag

Adding to the discussion here, I had a similar issue with my Xubutu 22.10 + gnome today.

In the past, recreating resolv.conf had helped me for a similar issue, but today it did not.

Ultimately I realised that I had a VPN client (windscribe) installed that I had switched off recently. As soon as I used the .Deb file to uninstall the package, my internet came back.

I'm leaving this resolution here for others who might have a similar issue.

Score:1
ru flag

Firstly, I have to give a shout out to @chili555 for spending literally hours last night helping me troubleshoot.

After many hours of troubleshooting, the simplest answer was the solution. Something must have gone wrong during installation, because after a reinstall from the same usb flash drive, my computer is on the network and accessing the internet.

I still don't know the true cause, but my server is up and running.

Thanks @chili555!

chili555 avatar
cn flag
Awesome! Glad it's working as expected.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.