How to solve Problem update ubuntu server 18.04

rangkaian@dhcp:~$ sudo apt-get update
Err:1 Index of /ubuntu bionic InRelease
Temporary failure resolving ‘us.archive.ubuntu.com
Err:2 Index of /ubuntu bionic-security InRelease
Temporary failure resolving ‘security.ubuntu.com
Err:3 Index of /ubuntu bionic-updates InRelease
Temporary failure resolving ‘us.archive.ubuntu.com
Reading package lists… Done
W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/bionic/InRelease Temporary failure resolving ‘us.archive.ubuntu.com
W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/bionic-updates/InRelease Temporary failure resolving ‘us.archive.ubuntu.com
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/bionic-security/InRelease Temporary failure resolving ‘security.ubuntu.com
W: Some index files failed to download. They have been ignored, or old ones used instead.
rangkaian@dhcp:~$

1 Like

Temporary failure in name resolve? Sounds like a DNS issue to me. Was there such a change on your network?

2 Likes

I thought the same as @abhishek, but apparently your internet works.

In any case, before being too alarmed, I’d try again. You could also try to ping us.archive.ubuntu.com.

1 Like

“internet” can still work when DNS is broken…

This smells like a DNS issue…

A) Try pinging “google.com”…
B) if that doesn’t work, trying pinging 8.8.8.8…

If A doesn’t work, but B does, your problem isn’t internet, it’s DNS.

This happened to me recently, on Ubuntu 21.04… Can’t remember how I solved it now… I think I might have done a “sudo systemctl restart NetworkManager.service”, made sure my WiFi / Ethernet was connected - and then tried “ping google.com” and when that worked - I was able to update / upgrade…

1 Like

thank you for helping…Indeed a problem like this … I have tried “sudo systemctl restart systemd-networkd” but still A doesn’t work. There are other methods for me to fix this DNS problem

as far as I remember, i never made any change… This problem started to occur when I did not update for a long time…

So “A)” pinging google fails, but, does “B)” ping 8.8.8.8?

Can you ping 8.8.8.8 (IP address of Google’s DNS resolver servers)

ping -c4 8.8.8.8
(only ping them 4 times - let me know your result - if it’s successful, then you have a DNS issue that needs resolving)

And also BTW (by the way) - it’s :

sudo systemctl restart NetworkManager.service
not
sudo systemctl restart systemd-networkd

I’ve NO IDEA what that 2nd one does, I’ve never run that before, but it looks a bit more “drastic” than simply restarting NetworkManager.

If you can’t resolve ANY names (e.g. like Google) - then your problem is more widespread than just updating… I’m assuming you have another computer with a working internet connection? Or are you using your phone?

Note : besided DNS - there could be another issue that your country may be blocking access to the US Ubuntu repositories? I always set mine, at install time, to local, for my country, in my country, Australia I use au.archive.ubuntu.com (which is really just a CNAME to mirror.aarnet.edu.au). I also set that for Ubuntu servers I deploy for customers…

root@dhcp:/home/rangkaian# ping google.com
ping: google.com: Temporary failure in name resolution
root@dhcp:/home/rangkaian# ping 8.8.8.8
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
64 bytes from 8.8.8.8: icmp_seq=1 ttl=112 time=12.0 ms
64 bytes from 8.8.8.8: icmp_seq=2 ttl=112 time=11.8 ms
64 bytes from 8.8.8.8: icmp_seq=3 ttl=112 time=11.7 ms
64 bytes from 8.8.8.8: icmp_seq=4 ttl=112 time=11.7 ms
64 bytes from 8.8.8.8: icmp_seq=5 ttl=112 time=11.7 ms
64 bytes from 8.8.8.8: icmp_seq=6 ttl=112 time=11.7 ms
64 bytes from 8.8.8.8: icmp_seq=7 ttl=112 time=11.7 ms
^C
— 8.8.8.8 ping statistics —
7 packets transmitted, 7 received, 0% packet loss, time 6010ms
rtt min/avg/max/mdev = 11.739/11.812/12.003/0.103 ms
root@dhcp:/home/rangkaian# ping -c4 8.8.8.8
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
64 bytes from 8.8.8.8: icmp_seq=1 ttl=112 time=17.4 ms
64 bytes from 8.8.8.8: icmp_seq=2 ttl=112 time=11.8 ms
64 bytes from 8.8.8.8: icmp_seq=3 ttl=112 time=11.7 ms
64 bytes from 8.8.8.8: icmp_seq=4 ttl=112 time=11.7 ms

— 8.8.8.8 ping statistics —
4 packets transmitted, 4 received, 0% packet loss, time 3005ms
rtt min/avg/max/mdev = 11.748/13.207/17.475/2.466 ms
root@dhcp:/home/rangkaian#

root@dhcp:/home/rangkaian# sudo systemctl restart NetworkManager.service
Failed to restart NetworkManager.service: Unit NetworkManager.service not found.
root@dhcp:/home/rangkaian#

OK - I assume then this is some cloud hosted VPS instance of Ubuntu Server?

Take a look at what’s in /etc/netplan/

Maybe something like 10-cloud-init.yaml or something like that?

Paste the contents here… You may need to modify this file with correct DNS settings - however this is getting pretty complex and I usually get paid for helping out with issues like this…

On my workstation (20.04, but it started life as 18.04) netplan is instructed to use NetworkManager (and that file is the ONLY one in /etc/netplan/) :

╭─x@titan ~  
╰─➤  ls -al /etc/netplan/
total 20
drwxr-xr-x   2 root root  4096 Aug  7  2020 .
drwxr-xr-x 172 root root 12288 Sep 20 08:45 ..
-rw-r--r--   1 root root   104 Aug  7  2020 01-network-manager-all.yaml
╭─x@titan ~  
╰─➤  cat /etc/netplan/01-network-manager-all.yaml 
# Let NetworkManager manage all devices on this system
network:
  version: 2
  renderer: NetworkManager

Below is a fake one I knocked up similar to one I have deployed for Ubuntu 18.04 server in a VMware environment :

administrator@server:~$ ls -al /etc/netplan/01-netcfg.yaml 
-rw-r--r-- 1 root root 395 Jul  2  2020 /etc/netplan/01-netcfg.yaml
# This file describes the network interfaces available on your system
# For more information, see netplan(5).
network:
  version: 2
  renderer: networkd
  ethernets:
    ens160:
      addresses: [ 10.10.10.10/24 ]
      gateway4: 10.10.10.1
      nameservers:
          search: [ some.fakedomain.com ]
          addresses:
              - "8.8.8.8"
              - "8.8.4.4"

There’s a chance your VPS provider changed DNS servers used by the hosting service? Maybe they emailed you and you ignored it or took no action?

The values under nameservers: under “addresses:” are your name servers. Those ones in the example are for google’s DNS servers. Your VPS hosting service may not let you use them - you probably have to use something your VPS hosting provider recommends.

I’m mainly posting this for the benefit of others and sharing, per above, I normally get paid for this stuff.

Thank you … I have found the cause … i “/etc/resolv.conf - DNS ip changed” the problem is solved … thanks to those who helped