我已经阅读了几乎十几个apt-get update的问题,大部分来自askubuntu.com,都是关于“failed to fetch”错误,并尝试了那里提供的解决方案。不幸的是,没有一个有效。我最近在我的笔记本电脑上安装了Ubuntu 12.04,与Windows 7双启动。当我尝试时
sudo apt-get update
在终端上,以下内容一直出现:
Err http://ph.archive.ubuntu.com precise InRelease
Err http://ph.archive.ubuntu.com precise-updates InRelease
Err http://ph.archive.ubuntu.com precise-backports InRelease
Err http://ph.archive.ubuntu.com precise Release.gpg
Unable to connect to ph.archive.ubuntu.com:http: [IP: 91.189.92.177 80]
Err http://ph.archive.ubuntu.com precise-updates Release.gpg
Unable to connect to ph.archive.ubuntu.com:http: [IP: 91.189.92.177 80]
Err http://ph.archive.ubuntu.com precise-backports Release.gpg
Unable to connect to ph.archive.ubuntu.com:http: [IP: 91.189.92.177 80]
Err http://extras.ubuntu.com precise InRelease
Err http://extras.ubuntu.com precise Release.gpg
Unable to connect to extras.ubuntu.com:http:
Err http://security.ubuntu.com precise-security InRelease
Err http://security.ubuntu.com precise-security Release.gpg
Unable to connect to security.ubuntu.com:http: [IP: 91.189.92.190 80]
Reading package lists... Done
W: Failed to fetch http://ph.archive.ubuntu.com/ubuntu/dists/precise/InRelease
W: Failed to fetch http://ph.archive.ubuntu.com/ubuntu/dists/precise-updates/InRelease
W: Failed to fetch http://ph.archive.ubuntu.com/ubuntu/dists/precise-backports/InRelease
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/precise-security/InRelease
W: Failed to fetch http://extras.ubuntu.com/ubuntu/dists/precise/InRelease
W: Failed to fetch http://ph.archive.ubuntu.com/ubuntu/dists/precise/Release.gpg Unable to connect to ph.archive.ubuntu.com:http: [IP: 91.189.92.177 80]
W: Failed to fetch http://ph.archive.ubuntu.com/ubuntu/dists/precise-updates/Release.gpg Unable to connect to ph.archive.ubuntu.com:http: [IP: 91.189.92.177 80]
W: Failed to fetch http://ph.archive.ubuntu.com/ubuntu/dists/precise-backports/Release.gpg Unable to connect to ph.archive.ubuntu.com:http: [IP: 91.189.92.177 80]
W: Failed to fetch http://extras.ubuntu.com/ubuntu/dists/precise/Release.gpg Unable to connect to extras.ubuntu.com:http:
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/precise-security/Release.gpg Unable to connect to security.ubuntu.com:http: [IP: 91.189.92.190 80]
W: Some index files failed to download. They have been ignored, or old ones used instead.
注意:
这发生在我安装了Ubuntu 12.04之后立即发生。我对Linux/Ubuntu世界非常陌生,对这些东西一窍不通。
更新管理器(和软件中心)设置中的源列表很短。它只包含两行带有"Canonical"的内容,两行带有"Independent"的内容,以及另外两行。我认为这个列表很短是因为刚刚安装的Ubuntu。
与互联网的连接似乎很好,而且我的朋友的笔记本电脑也是在我之前几乎同时安装了Ubuntu 12.04,他的更新没有问题。我们使用相同的连接,所以我认为互联网连接问题不可能是错误的原因。
尝试的解决方案:
从 here,我在/etc/resolvconf/resolv.conf.d
周围进行了探索,并在/etc/resolvconf/resolv.conf.d/head
中添加了以下内容:
nameserver 8.8.8.8
nameserver 8.8.4.4
错误仍然发生。
从这里和这里,我反复更改了更新管理器和软件源设置中要使用的镜像服务器。但是,错误仍然发生。
我还尝试编辑我的源列表,取消勾选其中带有“独立”字样的行(如建议所示)。根据这里的说明,我尝试删除源列表中的derb-src
行。然而,仍然没有成功。
最后,这个网站建议运行以下命令:
echo "nameserver 8.8.8.8" | sudo tee /etc/resolv.conf > /dev/null
or, for a permanent solution,
echo "nameserver 8.8.8.8" | sudo tee /etc/resolvconf/resolv.conf.d/base > /dev/null
遗憾的是,对我而言一无所获。在我参加的所有论坛中,与
nameserver 8.8.8.8
相关的答案似乎最常出现。请注意,我实际上并不理解这些解决方案,它们的含义或如何执行。我只是简单地按照它们的指示行事。这是
cat /etc/apt/sources.list
的输出结果:# deb cdrom:[Ubuntu 12.04 LTS _Precise Pangolin_ - Release amd64 (20120425)]/ dists/precise/main/binary-i386/
# deb cdrom:[Ubuntu 12.04 LTS _Precise Pangolin_ - Release amd64 (20120425)]/ dists/precise/restricted/binary-i386/
# deb cdrom:[Ubuntu 12.04 LTS _Precise Pangolin_ - Release amd64 (20120425)]/ precise main restricted
# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
deb http://archive.ubuntu.com/ubuntu precise main restricted
deb-src http://archive.ubuntu.com/ubuntu precise main restricted
## Major bug fix updates produced after the final release of the
## distribution.
deb http://archive.ubuntu.com/ubuntu precise-updates main restricted
deb-src http://archive.ubuntu.com/ubuntu precise-updates main restricted
## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team. Also, please note that software in universe WILL NOT receive any
## review or updates from the Ubuntu security team.
deb http://archive.ubuntu.com/ubuntu precise universe
deb-src http://archive.ubuntu.com/ubuntu precise universe
deb http://archive.ubuntu.com/ubuntu precise-updates universe
deb-src http://archive.ubuntu.com/ubuntu precise-updates universe
## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team, and may not be under a free licence. Please satisfy yourself as to
## your rights to use the software. Also, please note that software in
## multiverse WILL NOT receive any review or updates from the Ubuntu
## security team.
deb http://archive.ubuntu.com/ubuntu precise multiverse
deb-src http://archive.ubuntu.com/ubuntu precise multiverse
deb http://archive.ubuntu.com/ubuntu precise-updates multiverse
deb-src http://archive.ubuntu.com/ubuntu precise-updates multiverse
## N.B. software from this repository may not have been tested as
## extensively as that contained in the main release, although it includes
## newer versions of some applications which may provide useful features.
## Also, please note that software in backports WILL NOT receive any review
## or updates from the Ubuntu security team.
deb http://archive.ubuntu.com/ubuntu precise-backports main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu precise-backports main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu precise-security main restricted
deb-src http://archive.ubuntu.com/ubuntu precise-security main restricted
deb http://archive.ubuntu.com/ubuntu precise-security universe
deb-src http://archive.ubuntu.com/ubuntu precise-security universe
deb http://archive.ubuntu.com/ubuntu precise-security multiverse
deb-src http://archive.ubuntu.com/ubuntu precise-security multiverse
## Uncomment the following two lines to add software from Canonical's
## 'partner' repository.
## This software is not part of Ubuntu, but is offered by Canonical and the
## respective vendors as a service to Ubuntu users.
# deb http://archive.canonical.com/ubuntu precise partner
# deb-src http://archive.canonical.com/ubuntu precise partner
## This software is not part of Ubuntu, but is offered by third-party
## developers who want to ship their latest software.
deb http://extras.ubuntu.com/ubuntu precise main
deb-src http://extras.ubuntu.com/ubuntu precise main
以下是用于
cat /etc/resolv.conf
的内容:# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
# DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
nameserver 127.0.0.1
search nip.upd.edu.ph
据指出,答案在这里,但不幸的是那也没起作用。我尝试选择不同的服务器,但从来没有“选择服务器”的选项。寻找最佳服务器的结果是“没有合适的服务器”。我认为镜像服务器都没问题,而且似乎与互联网连接也没有问题。
使用
ping -c3 archive.ubuntu.com
和ping -c3 8.8.8.8
都显示0%数据包丢失
。对于8.8.8.8的ping有时会显示33%数据包丢失
,但大多数情况下是0%。输入
nslookup google.com
的结果是:Server: 127.0.0.1
Address: 127.0.0.1#53
ps aux | grep dns
的输出结果:
nobody 1761 0.0 0.0 33012 1284 ? S 17:04 0:00 /usr/sbin/dnsmasq
--no-resolv --keep-in-foreground --no-hosts --bind-interfaces --pid-file=/var
/run/sendsigs.omit.d/network-manager.dnsmasq.pid --listen-address=127.0.0.1 --conf-
file=/var/run/nm-dns-dnsmasq.conf --cache-size=0 --proxy-dnssec
joa 2197 0.0 0.0 13576 928 pts/0 S+ 17:10 0:00 grep --color=auto dns
sudo apt-get update
后的精确输出吗?另外,请包括cat /etc/apt/sources.list
和cat /etc/resolv.conf
的输出内容。还有你可以确认你能够正常浏览互联网上的网站吗? - Alaa Alinslookup google.com
的前两行,并输出ps aux | grep dns
的结果吗?此外,你是使用静态IP吗? - Alaa Alips aux | grep dns
的输出应该是一行,但我将其编辑成了更易于查看的形式。起初,我会说我使用动态 IP,因为我没有为此付费,但我使用大学的网络连接,所以很难确定我使用的 IP 是静态还是动态的。 - jowabels无法连接到ph.archive.ubuntu.com:http: [IP: 91.189.92.177 80]
,而不是之前的无法解析
,这意味着DNS查找是正常工作的!你还能ping通google.com吗?现在试试换一个不同的镜像。 - Alaa Ali/etc/resolv.conf
е’Ң/etc/apt/sources.list
зҡ„иҫ“еҮәгҖӮжҳҜзҡ„пјҢжҲ‘д»Қ然еҸҜд»ҘpingйҖҡи°·жӯҢпјҢдё”дёўеҢ…зҺҮдёә0%
пјҢдҪҶд»Қ然жүҫдёҚеҲ°еҗҲйҖӮзҡ„дёӢиҪҪжңҚеҠЎеҷЁгҖӮеҲҮжҚўеҲ°дё»жңҚеҠЎеҷЁд№ҹжІЎжңүеё®еҠ©гҖӮ - jowabelssudo apt update
,问题将会解决。 - austin