Ubuntu 服务器更新问题

Ubuntu 服务器更新问题

我正在运行 Ubuntu 服务器 (x86),最近我注意到“sudo apt-get *”停止工作。例如,如果我尝试运行“sudo apt-get update”,它会返回:

Err http://archive.ubuntu.com intrepid Release.gpg
  Could not resolve 'archive.ubuntu.com'
Err http://archive.ubuntu.com intrepid/main Translation-en_US
  Could not resolve 'archive.ubuntu.com'
Err http://archive.ubuntu.com intrepid/restricted Translation-en_US
  Could not resolve 'archive.ubuntu.com'
Err http://archive.ubuntu.com intrepid/universe Translation-en_US
  Could not resolve 'archive.ubuntu.com'
Err http://archive.ubuntu.com intrepid/multiverse Translation-en_US
  Could not resolve 'archive.ubuntu.com'
Err http://archive.ubuntu.com intrepid-updates Release.gpg
  Could not resolve 'archive.ubuntu.com'
Err http://archive.ubuntu.com intrepid-updates/main Translation-en_US
  Could not resolve 'archive.ubuntu.com'
Err http://archive.ubuntu.com intrepid-updates/restricted Translation-en_US
  Could not resolve 'archive.ubuntu.com'
Err http://archive.ubuntu.com intrepid-updates/universe Translation-en_US
  Could not resolve 'archive.ubuntu.com'
Err http://archive.ubuntu.com intrepid-updates/multiverse Translation-en_US
  Could not resolve 'archive.ubuntu.com'
Err http://archive.ubuntu.com intrepid-security Release.gpg
  Could not resolve 'archive.ubuntu.com'
Err http://archive.ubuntu.com intrepid-security/main Translation-en_US
  Could not resolve 'archive.ubuntu.com'
Err http://archive.ubuntu.com intrepid-security/restricted Translation-en_US
  Could not resolve 'archive.ubuntu.com'
Err http://archive.ubuntu.com intrepid-security/universe Translation-en_US
  Could not resolve 'archive.ubuntu.com'
Err http://archive.ubuntu.com intrepid-security/multiverse Translation-en_US
  Could not resolve 'archive.ubuntu.com'
Reading package lists... Done
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/intrepid/Release.gpg  Could not resolve 'archive.ubuntu.com'

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

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

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

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

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

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

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

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

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

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

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

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

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

W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/intrepid-security/multiverse/i18n/Translation-en_US.bz2  Could not resolve 'archive.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

起初这看起来像是一个 DNS 问题,但我可以毫无问题地 ping “archive.ubuntu.com”。

PING archive.ubuntu.com (91.189.88.46) 56(84) bytes of data.
64 bytes from lithium.canonical.com (91.189.88.46): icmp_seq=1 ttl=45 time=123 ms
64 bytes from lithium.canonical.com (91.189.88.46): icmp_seq=2 ttl=45 time=124 ms
64 bytes from lithium.canonical.com (91.189.88.46): icmp_seq=3 ttl=45 time=158 ms

对于这个问题或者如何解决它有什么想法吗?

答案1

听起来这可能是代理问题。您是否设置了 HTTP_PROXY 环境变量,或者您是否在 /etc/apt/* 文件中设置了任何“代理”设置(检查 /etc/apt/apt.conf.d/)?

答案2

以下命令的输出是什么?

dig archive.ubuntu.com

curl 'http://archive.ubuntu.com/'

cat /etc/resolv.conf

另外,如果以 root 身份运行这些命令,结果会有什么不同吗?(即sudo dig archive.ubuntu.com

答案3

尝试将 URL 更改为http://us.archive.ubuntu.com在 /etc/apt/sources.list 中。来自南非http://archive.ubuntu.com解析到与您需要使用的服务器不同的服务器。但是http://us.archive.ubuntu.com确实解析为 91.189.88.46。

在 /etc/resolv.conf 中使用不同的 DNS 服务器也可以解决该问题。

答案4

挖掘返回:

; <<>> DiG 9.4.2 <<>> archive.ubuntu.com
;; global options:  printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 19419
;; flags: qr rd ra; QUERY: 1, ANSWER: 7, AUTHORITY: 0, ADDITIONAL: 0

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

;; ANSWER SECTION:
archive.ubuntu.com.     532     IN      A       91.189.88.30
archive.ubuntu.com.     532     IN      A       91.189.88.134
archive.ubuntu.com.     532     IN      A       91.189.88.135
archive.ubuntu.com.     532     IN      A       91.189.88.31
archive.ubuntu.com.     532     IN      A       91.189.88.40
archive.ubuntu.com.     532     IN      A       91.189.88.46
archive.ubuntu.com.     532     IN      A       91.189.88.45

;; Query time: 71 msec
;; SERVER: 192.168.0.1#53(192.168.0.1)
;; WHEN: Wed Nov  4 16:19:27 2009
;; MSG SIZE  rcvd: 148

/etc/resolv.conf 包含:nameserver 129.168.0.1

ifconfig:

eth0      Link encap:Ethernet  HWaddr 00:14:6c:76:69:89
          inet addr:192.168.0.197  Bcast:192.168.0.255  Mask:255.255.255.0
          inet6 addr: fe80::214:6cff:fe76:6989/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:19964625 errors:0 dropped:789 overruns:0 frame:0
          TX packets:11729444 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:2505013589 (2.3 GB)  TX bytes:446515595 (425.8 MB)
          Interrupt:16 Base address:0xcc00

ham0      Link encap:Ethernet  HWaddr 00:ff:cb:59:46:25
          inet addr:5.217.20.154  Bcast:5.255.255.255  Mask:255.0.0.0
          UP BROADCAST RUNNING MULTICAST  MTU:1200  Metric:1
          RX packets:436 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1412 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:500
          RX bytes:92667 (90.4 KB)  TX bytes:355745 (347.4 KB)

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:1290 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1290 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:69088 (67.4 KB)  TX bytes:69088 (67.4 KB)

我无法“curl”任何东西,因为它没有安装(&我无法安装它因为apt-get不工作:-/)此时我正在考虑重新安装该操作系统,无论如何我们都在考虑迁移到OpenSolaris。

相关内容