[问题]apt无法正常使用[已解决][附解决方法]

系统安装、升级讨论
版面规则
我们都知道新人的确很菜,也喜欢抱怨,并且带有浓厚的Windows习惯,但既然在这里询问,我们就应该有责任帮助他们解决问题,而不是直接泼冷水、简单的否定或发表对解决问题没有任何帮助的帖子。乐于分享,以人为本,这正是Ubuntu的精神所在。
回复
头像
monnand
帖子: 104
注册时间: 2007-02-16 1:23

[问题]apt无法正常使用[已解决][附解决方法]

#1

帖子 monnand » 2008-01-31 19:06

[问题描述]
前几天执行apt相关命令(如apt-get update),都会长时间停在``等待报头'',超时后,显示连接超时。
换了快速指南上提到的所有源,但是依然没有效果

今天执行的时候,打印出了如下信息:

代码: 全选

$ sudo apt-get update
错误 http://archive.ubuntu.com gutsy Release.gpg
  无法连接上 localhost:4001 (127.0.0.1)。 - connect (111 Connection refused)
错误 http://archive.ubuntu.com gutsy/main Translation-zh_CN
  无法连接上 localhost:4001 (127.0.0.1)。 - connect (111 Connection refused)
错误 http://archive.ubuntu.com gutsy/restricted Translation-zh_CN
  无法连接上 localhost:4001 (127.0.0.1)。 - connect (111 Connection refused)
错误 http://archive.ubuntu.com gutsy/universe Translation-zh_CN
  无法连接上 localhost:4001 (127.0.0.1)。 - connect (111 Connection refused)
错误 http://archive.ubuntu.com gutsy/multiverse Translation-zh_CN
  无法连接上 localhost:4001 (127.0.0.1)。 - connect (111 Connection refused)
错误 http://archive.ubuntu.com gutsy-security Release.gpg
  无法连接上 localhost:4001 (127.0.0.1)。 - connect (111 Connection refused)
错误 http://archive.ubuntu.com gutsy-security/main Translation-zh_CN
  无法连接上 localhost:4001 (127.0.0.1)。 - connect (111 Connection refused)
错误 http://archive.ubuntu.com gutsy-security/restricted Translation-zh_CN
  无法连接上 localhost:4001 (127.0.0.1)。 - connect (111 Connection refused)
错误 http://archive.ubuntu.com gutsy-security/universe Translation-zh_CN
  无法连接上 localhost:4001 (127.0.0.1)。 - connect (111 Connection refused)
错误 http://archive.ubuntu.com gutsy-security/multiverse Translation-zh_CN
  无法连接上 localhost:4001 (127.0.0.1)。 - connect (111 Connection refused)
错误 http://archive.ubuntu.com gutsy-updates Release.gpg
  无法连接上 localhost:4001 (127.0.0.1)。 - connect (111 Connection refused)
错误 http://archive.ubuntu.com gutsy-updates/main Translation-zh_CN
  无法连接上 localhost:4001 (127.0.0.1)。 - connect (111 Connection refused)
错误 http://archive.ubuntu.com gutsy-updates/restricted Translation-zh_CN
  无法连接上 localhost:4001 (127.0.0.1)。 - connect (111 Connection refused)
错误 http://archive.ubuntu.com gutsy-updates/universe Translation-zh_CN
  无法连接上 localhost:4001 (127.0.0.1)。 - connect (111 Connection refused)
错误 http://archive.ubuntu.com gutsy-updates/multiverse Translation-zh_CN
  无法连接上 localhost:4001 (127.0.0.1)。 - connect (111 Connection refused)
错误 http://archive.ubuntu.com gutsy-proposed Release.gpg
  无法连接上 localhost:4001 (127.0.0.1)。 - connect (111 Connection refused)
错误 http://archive.ubuntu.com gutsy-proposed/main Translation-zh_CN
  无法连接上 localhost:4001 (127.0.0.1)。 - connect (111 Connection refused)
错误 http://archive.ubuntu.com gutsy-proposed/restricted Translation-zh_CN
  无法连接上 localhost:4001 (127.0.0.1)。 - connect (111 Connection refused)
错误 http://archive.ubuntu.com gutsy-proposed/universe Translation-zh_CN
  无法连接上 localhost:4001 (127.0.0.1)。 - connect (111 Connection refused)
错误 http://archive.ubuntu.com gutsy-proposed/multiverse Translation-zh_CN
  无法连接上 localhost:4001 (127.0.0.1)。 - connect (111 Connection refused)
错误 http://packages.medibuntu.org gutsy Release.gpg
  无法连接上 localhost:4001 (127.0.0.1)。 - connect (111 Connection refused)
错误 http://packages.medibuntu.org gutsy/free Translation-zh_CN
  无法连接上 localhost:4001 (127.0.0.1)。 - connect (111 Connection refused)
错误 http://packages.medibuntu.org gutsy/non-free Translation-zh_CN
  无法连接上 localhost:4001 (127.0.0.1)。 - connect (111 Connection refused)
错误 http://archive.ubuntu.com gutsy-backports Release.gpg
  无法连接上 localhost:4001 (127.0.0.1)。 - connect (111 Connection refused)
错误 http://archive.ubuntu.com gutsy-backports/main Translation-zh_CN
  无法连接上 localhost:4001 (127.0.0.1)。 - connect (111 Connection refused)
错误 http://archive.ubuntu.com gutsy-backports/restricted Translation-zh_CN
  无法连接上 localhost:4001 (127.0.0.1)。 - connect (111 Connection refused)
错误 http://archive.ubuntu.com gutsy-backports/universe Translation-zh_CN
  无法连接上 localhost:4001 (127.0.0.1)。 - connect (111 Connection refused)
错误 http://archive.ubuntu.com gutsy-backports/multiverse Translation-zh_CN
  无法连接上 localhost:4001 (127.0.0.1)。 - connect (111 Connection refused)
无法下载 http://archive.ubuntu.com/ubuntu/dists/gutsy/Release.gpg  无法连接上 localhost:4001 (127.0.0.1)。 - connect (111 Connection refused)
无法下载 http://archive.ubuntu.com/ubuntu/dists/gutsy/main/i18n/Translation-zh_CN.bz2  无法连接上 localhost:4001 (127.0.0.1)。 - connect (111 Connection refused)
无法下载 http://archive.ubuntu.com/ubuntu/dists/gutsy/restricted/i18n/Translation-zh_CN.bz2  无法连接上 localhost:4001 (127.0.0.1)。 - connect (111 Connection refused)
无法下载 http://archive.ubuntu.com/ubuntu/dists/gutsy/universe/i18n/Translation-zh_CN.bz2  无法连接上 localhost:4001 (127.0.0.1)。 - connect (111 Connection refused)
无法下载 http://archive.ubuntu.com/ubuntu/dists/gutsy/multiverse/i18n/Translation-zh_CN.bz2  无法连接上 localhost:4001 (127.0.0.1)。 - connect (111 Connection refused)
无法下载 http://archive.ubuntu.com/ubuntu/dists/gutsy-security/Release.gpg  无法连接上 localhost:4001 (127.0.0.1)。 - connect (111 Connection refused)
无法下载 http://archive.ubuntu.com/ubuntu/dists/gutsy-security/main/i18n/Translation-zh_CN.bz2  无法连接上 localhost:4001 (127.0.0.1)。 - connect (111 Connection refused)
无法下载 http://archive.ubuntu.com/ubuntu/dists/gutsy-security/restricted/i18n/Translation-zh_CN.bz2  无法连接上 localhost:4001 (127.0.0.1)。 - connect (111 Connection refused)
无法下载 http://archive.ubuntu.com/ubuntu/dists/gutsy-security/universe/i18n/Translation-zh_CN.bz2  无法连接上 localhost:4001 (127.0.0.1)。 - connect (111 Connection refused)
无法下载 http://archive.ubuntu.com/ubuntu/dists/gutsy-security/multiverse/i18n/Translation-zh_CN.bz2  无法连接上 localhost:4001 (127.0.0.1)。 - connect (111 Connection refused)
无法下载 http://archive.ubuntu.com/ubuntu/dists/gutsy-updates/Release.gpg  无法连接上 localhost:4001 (127.0.0.1)。 - connect (111 Connection refused)
无法下载 http://archive.ubuntu.com/ubuntu/dists/gutsy-updates/main/i18n/Translation-zh_CN.bz2  无法连接上 localhost:4001 (127.0.0.1)。 - connect (111 Connection refused)
无法下载 http://archive.ubuntu.com/ubuntu/dists/gutsy-updates/restricted/i18n/Translation-zh_CN.bz2  无法连接上 localhost:4001 (127.0.0.1)。 - connect (111 Connection refused)
无法下载 http://archive.ubuntu.com/ubuntu/dists/gutsy-updates/universe/i18n/Translation-zh_CN.bz2  无法连接上 localhost:4001 (127.0.0.1)。 - connect (111 Connection refused)
无法下载 http://archive.ubuntu.com/ubuntu/dists/gutsy-updates/multiverse/i18n/Translation-zh_CN.bz2  无法连接上 localhost:4001 (127.0.0.1)。 - connect (111 Connection refused)
无法下载 http://archive.ubuntu.com/ubuntu/dists/gutsy-proposed/Release.gpg  无法连接上 localhost:4001 (127.0.0.1)。 - connect (111 Connection refused)
无法下载 http://archive.ubuntu.com/ubuntu/dists/gutsy-proposed/main/i18n/Translation-zh_CN.bz2  无法连接上 localhost:4001 (127.0.0.1)。 - connect (111 Connection refused)
无法下载 http://archive.ubuntu.com/ubuntu/dists/gutsy-proposed/restricted/i18n/Translation-zh_CN.bz2  无法连接上 localhost:4001 (127.0.0.1)。 - connect (111 Connection refused)
无法下载 http://archive.ubuntu.com/ubuntu/dists/gutsy-proposed/universe/i18n/Translation-zh_CN.bz2  无法连接上 localhost:4001 (127.0.0.1)。 - connect (111 Connection refused)
无法下载 http://archive.ubuntu.com/ubuntu/dists/gutsy-proposed/multiverse/i18n/Translation-zh_CN.bz2  无法连接上 localhost:4001 (127.0.0.1)。 - connect (111 Connection refused)
无法下载 http://archive.ubuntu.com/ubuntu/dists/gutsy-backports/Release.gpg  无法连接上 localhost:4001 (127.0.0.1)。 - connect (111 Connection refused)
无法下载 http://archive.ubuntu.com/ubuntu/dists/gutsy-backports/main/i18n/Translation-zh_CN.bz2  无法连接上 localhost:4001 (127.0.0.1)。 - connect (111 Connection refused)
无法下载 http://archive.ubuntu.com/ubuntu/dists/gutsy-backports/restricted/i18n/Translation-zh_CN.bz2  无法连接上 localhost:4001 (127.0.0.1)。 - connect (111 Connection refused)
无法下载 http://archive.ubuntu.com/ubuntu/dists/gutsy-backports/universe/i18n/Translation-zh_CN.bz2  无法连接上 localhost:4001 (127.0.0.1)。 - connect (111 Connection refused)
无法下载 http://archive.ubuntu.com/ubuntu/dists/gutsy-backports/multiverse/i18n/Translation-zh_CN.bz2  无法连接上 localhost:4001 (127.0.0.1)。 - connect (111 Connection refused)
无法下载 http://packages.medibuntu.org/dists/gutsy/Release.gpg  无法连接上 localhost:4001 (127.0.0.1)。 - connect (111 Connection refused)
无法下载 http://packages.medibuntu.org/dists/gutsy/free/i18n/Translation-zh_CN.bz2  无法连接 上 localhost:4001 (127.0.0.1)。 - connect (111 Connection refused)
无法下载 http://packages.medibuntu.org/dists/gutsy/non-free/i18n/Translation-zh_CN.bz2  无法 连接上 localhost:4001 (127.0.0.1)。 - connect (111 Connection refused)
正在读取软件包列表... 完成
W: 有一些索引文件不能下载,它们可能被忽略了,也可能转而使用了旧的索引文件。
$  
上网google,发现了类似的问题:
viewtopic.php?t=80237&sid=a94bef5d612a8 ... 2c437fce7f

[网络环境]
普通家庭网络,通过路由上网,路由器通过PPPoE与因特网连接。没有对外连接的限制。未开防火墙。没有代理

[尝试措施]
o 把source.list中的域名部分,换成了IP,即,把archive.ubuntu.com换成了91.189.88.45,症状依旧
o 禁用了IPv6,症状依旧

[相关资料]
source.list放在了附件中
如果需要其他东西,请在回帖中指明。

希望能得到各位帮助,感谢大家。

该问题已经解决,解决方案如下

[解决方案]

感谢BigSnake.NET

首先检测是否设置了http代理。检测方法:

代码: 全选

 env | grep -i proxy
如果设置了代理,会出现:

代码: 全选

$ env | grep -i proxy
http_proxy=http://localhost:4001
HTTP_PROXY=http://localhost:4001
$  
此时,删除这两个环境变量,bash下输入:

代码: 全选

unset http_proxy
unset HTTP_PROXY
最后,从配置文件里面把这两个环境变量彻底删除。通常会在/etc/environment里面

代码: 全选

sudo gedit /etc/environment
删除包含http_proxyHTTP_PROXY的行

[问题原因]
由于设置了http代理,却没有启动http代理程序。
我这次的原因,是由于安装了anon-proxy所致。

[后续问题]
我看了我的/etc/environment,从注释上看,是anon-proxy修改的配置文件。应该是软件在安装的时候默认配置的问题,不知道这个应该算是bug,还是算是特性。不过个人以为,默认设置应该相对调整一下,免得让人摸不着头脑。(在发帖前,我还特意考虑了一下,有没有装http代理。要不是BigSnake.NET的提醒,我确实没有想到会是由于前几天安装软件引起的)
附件
apt.tar.bz2
我的source.list
(506 Bytes) 已下载 176 次
上次由 monnand 在 2008-01-31 19:45,总共编辑 3 次。
头像
BigSnake.NET
帖子: 12522
注册时间: 2006-07-02 11:16
来自: 廣州
联系:

#2

帖子 BigSnake.NET » 2008-01-31 19:12

ping archive.ubuntu.com

看看
^_^ ~~~
要理解递归,首先要理解递归。

地球人都知道,理论上,理论跟实际是没有差别的,但实际上,理论跟实际的差别是相当大滴。
头像
monnand
帖子: 104
注册时间: 2007-02-16 1:23

#3

帖子 monnand » 2008-01-31 19:15

能够ping通
头像
BigSnake.NET
帖子: 12522
注册时间: 2006-07-02 11:16
来自: 廣州
联系:

#4

帖子 BigSnake.NET » 2008-01-31 19:23

monnand 写了:能够ping通
ping 到什么了, 贴出来
^_^ ~~~
要理解递归,首先要理解递归。

地球人都知道,理论上,理论跟实际是没有差别的,但实际上,理论跟实际的差别是相当大滴。
头像
monnand
帖子: 104
注册时间: 2007-02-16 1:23

#5

帖子 monnand » 2008-01-31 19:24

代码: 全选

$ 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=50 time=551 ms
64 bytes from lithium.canonical.com (91.189.88.46): icmp_seq=2 ttl=50 time=572 ms
64 bytes from lithium.canonical.com (91.189.88.46): icmp_seq=3 ttl=50 time=590 ms
64 bytes from lithium.canonical.com (91.189.88.46): icmp_seq=4 ttl=50 time=622 ms
64 bytes from lithium.canonical.com (91.189.88.46): icmp_seq=5 ttl=50 time=573 ms
64 bytes from lithium.canonical.com (91.189.88.46): icmp_seq=6 ttl=50 time=622 ms

--- archive.ubuntu.com ping statistics ---
6 packets transmitted, 6 received, 0% packet loss, time 5316ms
rtt min/avg/max/mdev = 551.884/588.863/622.275/26.118 ms
$   
头像
BigSnake.NET
帖子: 12522
注册时间: 2006-07-02 11:16
来自: 廣州
联系: