文章内容

2017/12/16 15:29:09,作 者: 黄兵

apt-get update cannot find ubuntu servers

Running sudo apt-get update fails on my server (that has a 'net connection). Are the servers temporarily broken, or is my apt misconfigured and using old servers? In short, how do I fix this?

Here's the output:

~$ uname -a
Linux nematode 2.6.28-19-server #66-Ubuntu SMP Sat Oct 16 18:41:24 UTC 2010 i686 GNU/Linux

~$ sudo apt-get update
Err http://us.archive.ubuntu.com jaunty Release.gpg
  Could not resolve 'us.archive.ubuntu.com'
Err http://us.archive.ubuntu.com jaunty/main Translation-en_US
  Could not resolve 'us.archive.ubuntu.com'
Err http://us.archive.ubuntu.com jaunty/restricted Translation-en_US
  Could not resolve 'us.archive.ubuntu.com'
Err http://us.archive.ubuntu.com jaunty/universe Translation-en_US
  Could not resolve 'us.archive.ubuntu.com'
Err http://us.archive.ubuntu.com jaunty/multiverse Translation-en_US
  Could not resolve 'us.archive.ubuntu.com'
Err http://us.archive.ubuntu.com jaunty-updates Release.gpg
  Could not resolve 'us.archive.ubuntu.com'
Err http://us.archive.ubuntu.com jaunty-updates/main Translation-en_US
  Could not resolve 'us.archive.ubuntu.com'
Err http://us.archive.ubuntu.com jaunty-updates/restricted Translation-en_US
  Could not resolve 'us.archive.ubuntu.com'
Err http://us.archive.ubuntu.com jaunty-updates/universe Translation-en_US
  Could not resolve 'us.archive.ubuntu.com'
Err http://us.archive.ubuntu.com jaunty-updates/multiverse Translation-en_US
  Could not resolve 'us.archive.ubuntu.com'
Err http://security.ubuntu.com jaunty-security Release.gpg
  Could not resolve 'security.ubuntu.com'
Err http://security.ubuntu.com jaunty-security/main Translation-en_US
  Could not resolve 'security.ubuntu.com'
Err http://security.ubuntu.com jaunty-security/restricted Translation-en_US
  Could not resolve 'security.ubuntu.com'
Err http://security.ubuntu.com jaunty-security/universe Translation-en_US
  Could not resolve 'security.ubuntu.com'
Err http://security.ubuntu.com jaunty-security/multiverse Translation-en_US
  Could not resolve 'security.ubuntu.com'
Reading package lists... Done
W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/jaunty/Release.gpg  Could not resolve 'us.archive.ubuntu.com'

W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/jaunty/main/i18n/Translation-en_US.bz2  Could not resolve 'us.archive.ubuntu.com'

W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/jaunty/restricted/i18n/Translation-en_US.bz2  Could not resolve 'us.archive.ubuntu.com'

W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/jaunty/universe/i18n/Translation-en_US.bz2  Could not resolve 'us.archive.ubuntu.com'

W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/jaunty/multiverse/i18n/Translation-en_US.bz2  Could not resolve 'us.archive.ubuntu.com'

W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/jaunty-updates/Release.gpg  Could not resolve 'us.archive.ubuntu.com'

W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/jaunty-updates/main/i18n/Translation-en_US.bz2  Could not resolve 'us.archive.ubuntu.com'

W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/jaunty-updates/restricted/i18n/Translation-en_US.bz2  Could not resolve 'us.archive.ubuntu.com'

W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/jaunty-updates/universe/i18n/Translation-en_US.bz2  Could not resolve 'us.archive.ubuntu.com'

W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/jaunty-updates/multiverse/i18n/Translation-en_US.bz2  Could not resolve 'us.archive.ubuntu.com'

W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/jaunty-security/Release.gpg  Could not resolve 'security.ubuntu.com'

W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/jaunty-security/main/i18n/Translation-en_US.bz2  Could not resolve 'security.ubuntu.com'

W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/jaunty-security/restricted/i18n/Translation-en_US.bz2  Could not resolve 'security.ubuntu.com'

W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/jaunty-security/universe/i18n/Translation-en_US.bz2  Could not resolve 'security.ubuntu.com'

W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/jaunty-security/multiverse/i18n/Translation-en_US.bz2  Could not resolve 'security.ubuntu.com'

W: Some index files failed to download, they have been ignored, or old ones used instead.
W: You may want to run apt-get update to correct these problems

Can you resolve any of those hosts from the command line?

jinx:775 Z$ ping us.archive.ubuntu.com
PING us.archive.ubuntu.com (91.189.92.171) 56(84) bytes of data.
64 bytes from cassava.canonical.com (91.189.92.171): icmp_seq=1 ttl=128 time=104 ms

If not, next step is to try host -v:

jinx:776 Z$ host -v us.archive.ubuntu.com
Trying "us.archive.ubuntu.com"
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 14243
;; flags: qr rd ra; QUERY: 1, ANSWER: 8, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;us.archive.ubuntu.com.         IN      A

;; ANSWER SECTION:
us.archive.ubuntu.com.  592     IN      A       91.189.88.31
us.archive.ubuntu.com.  592     IN      A       91.189.88.40
us.archive.ubuntu.com.  592     IN      A       91.189.88.45
us.archive.ubuntu.com.  592     IN      A       91.189.88.46
us.archive.ubuntu.com.  592     IN      A       91.189.92.169
us.archive.ubuntu.com.  592     IN      A       91.189.92.170
us.archive.ubuntu.com.  592     IN      A       91.189.92.171
us.archive.ubuntu.com.  592     IN      A       91.189.88.30

Received 167 bytes from 10.211.55.1#53 in 37 ms
Trying "us.archive.ubuntu.com"
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 50130
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 0

;; QUESTION SECTION:
;us.archive.ubuntu.com.         IN      AAAA

;; AUTHORITY SECTION:
ubuntu.com.             1800    IN      SOA     ns1.canonical.com. hostmaster.canonical.com. 2011030301 10800 3600 604800 3600

Received 100 bytes from 10.211.55.1#53 in 65 ms
Trying "us.archive.ubuntu.com"
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 54875
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 0

;; QUESTION SECTION:
;us.archive.ubuntu.com.         IN      MX

It sounds like a DNS issue. To fix it, you need to ensure that

/etc/resolv.conf

has good entries for DNS servers.

Google has public DNS servers that you can use.

So for example, you could add the following 2 lines to the top of your /etc/resolv.conf file (these point at the Google DNS servers) as detailed above:

nameserver 8.8.8.8 
nameserver 8.8.4.4

Of course you'd need to be root to change this file, and make a backup before making any changes!

分享到:

发表评论

评论列表