14

Just got a new VPS running Ubuntu 11.04 and tried to update it. I got this error. I get the same error whenever using apt-get

login as: root
root@199.193.248.80's password:
Welcome to Ubuntu 11.04 (GNU/Linux 2.6.38-8-generic-pae i686)

 * Documentation:  https://help.ubuntu.com/
Last login: Mon May  7 19:55:45 2012 from 108.192.44.54
root@Rx:~# apt-get update
Err http://security.ubuntu.com natty-security InRelease

Err http://archive.ubuntu.com natty InRelease

Err http://security.ubuntu.com natty-security Release.gpg
  Temporary failure resolving 'security.ubuntu.com'
Err http://archive.ubuntu.com natty-updates InRelease

Err http://archive.ubuntu.com natty Release.gpg
  Temporary failure resolving 'archive.ubuntu.com'
Err http://archive.ubuntu.com natty-updates Release.gpg
  Temporary failure resolving 'archive.ubuntu.com'
Reading package lists... Done
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/natty/InRelease

W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/natty-updates/InRelease

W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/natty-security/InRelease

W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/natty-security/Release.gpg  Temporary failure resolving 'security.ubuntu.com'

W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/natty/Release.gpg  Temporary failure resolving 'archive.ubuntu.com'

W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/natty-updates/Release.gpg  Temporary failure resolving 'archive.ubuntu.com'

W: Some index files failed to download. They have been ignored, or old ones used instead.
root@Rx:~#

If needed, here is my /etc/apt/sources.list

root@Rx:/etc# more /etc/apt/sources.list
deb http://archive.ubuntu.com/ubuntu natty main
deb http://archive.ubuntu.com/ubuntu natty-updates main
deb http://security.ubuntu.com/ubuntu natty-security main
deb http://archive.ubuntu.com/ubuntu natty universe
deb http://archive.ubuntu.com/ubuntu natty-updates universe

And if needed, I did a ping test:

root@Rx:~# ping -n 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_req=1 ttl=56 time=13.3 ms
64 bytes from 8.8.8.8: icmp_req=2 ttl=56 time=13.2 ms
64 bytes from 8.8.8.8: icmp_req=3 ttl=56 time=13.4 ms
64 bytes from 8.8.8.8: icmp_req=4 ttl=56 time=13.3 ms
^C
--- 8.8.8.8 ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3005ms
rtt min/avg/max/mdev = 13.243/13.326/13.428/0.066 ms
root@Rx:~#

This is /etc/resolv.conf

root@Rx:~# more /etc/resolv.conf
nameserver 199.193.248.1
dukevin
  • 1,630
  • 3
  • 18
  • 25
  • This is a DNS problem. What's in your /etc/resolv.conf? – NathanG May 08 '12 at 02:26
  • @NathanG updated my question – dukevin May 08 '12 at 02:29
  • Try adding a line in resolv.conf with `nameserver 8.8.8.8`. – NathanG May 08 '12 at 02:37
  • I did get these messages when running `apt-get upgrade` `cryptsetup: WARNING: failed to detect canonical device of /dev/xvda1` `cryptsetup: WARNING: could not determine root device from /etc/fstab` but otherwise it seems to work good – dukevin May 08 '12 at 02:41
  • For me it's my company's VPN every single time, and every time I forget. – geneorama Jun 29 '20 at 17:17
  • The answers above are very helpful! In spite of adding the line nameserver 8.8.8.8 to the /etc/resolv.conf file, the issue persisted. After trying a bunch of other solutions that didn't seem to help, I noticed in the comments section here that it might be because of the company's **VPN connection**. Once I disconnected the VPN, the network issue was resolved. Thank you! @ geneorama – Annie Johnson Mar 03 '21 at 14:55

3 Answers3

30

The problem is that the DNS server you had originally isn't responding to your queries. You can add another one to the list to check. 8.8.8.8 (provided by Google) is the easiest to remember.

Add the line nameserver 8.8.8.8 to your /etc/resolv.conf to query that server.

If the original server is one that the VPS provider gave you, you may want to bring this up with their support team - it's possible there's some sort of management tool that depends on it. Other than that, you can use 8.8.8.8 as your primary DNS forever.

NathanG
  • 1,356
  • 10
  • 14
  • I don't know much about this but the IP address of my VPS is different from the one in resolv.conf, is this a problem as well? – dukevin May 08 '12 at 02:52
  • 2
    The address(es) in your `/etc/resolv.conf` are your DNS resolvers. They have little to no relation to the IP address of your server. – EEAA May 08 '12 at 02:53
  • > Add the line nameserver 8.8.8.8 to your /etc/resolv.conf to query that server. sudoedit /etc/resolv.conf Thank you!!! This worked perfectly. –  Sep 22 '12 at 16:50
-2

The official comment in /etc/resolv.conf clearly stated that the file shouldn't be edit. In newer Ubuntu server, you should check the file in /etc/netplan. Check the network gateway configuration in there, especially if you don't use dhcp.

AreRex14
  • 1
  • 1
  • 1
    This answer will go over better if there is specific advice in it. Such as how to use netplan to view configuration, and what to look for in the files to make changes. – sysadmin1138 Jun 02 '21 at 17:11
-2

Seems to be DNS resolving is not working. You can do this:

ping 199.193.248.1
nslookup any_site_name 199.193.248.1

P.S. In Ubuntu 18.04 /etc/resolv.conf file managed by systemd-resolved and must not be edited. You must add right nameserver, for example (8.8.8.8) to /etc/netplan/*.yaml here:

nameservers:
    addresses: [..., 8.8.8.8]

Manually, or by this oneliner, if string "addresses:" is only one in the file

    sed -r 's/(addresses: \[.*)\]/\1, 8.8.8.8\]/g' /etc/netplan/01-netcfg.yaml | 
    sudo tee /etc/netplan/01-netcfg.yaml && 
    sudo netplan apply

(This is ubuntu server and one file 01-netcfg.yaml)

Of course, if you work in organization, you must not use 8.8.8.8, use your own DNS servers.

  • 2
    be careful with such replace actions, it could replace more IP addresses in the file than you want, rendering your system useless. If you explained why it is better to configure the DNS server in the netplan config file in newer versions of Ubuntu this could be come a good answer. – Gerald Schneider Feb 28 '19 at 12:49