apt get update无法正常使用解决方案(转载)
2024-10-19 23:29:51
apt get update无法正常使用
解决方法参考博客
[问题描述]
前几天执行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_proxy
或
HTTP_PROXY
的行
最新文章
- mysql登录不了及修改密码
- extJS起步
- InterBase数据库迁移到MySQL(数据导出)
- 学习mongo系列(八)密码与权限
- (转载)iOS系统Crash文件分析方法
- kFreeBSD当前可以做的和不能做的
- SQL server数据类型、增删改查
- Windows 7无线网卡启用wifi共享蓝屏!
- OPENSSL安装 以及使用openssl中的AES加密和解密
- 偶遇mysql外键不好使
- HW2.14
- config 数据库字符串的读取、修改 分类: WebForm 2014-12-16 10:24 203人阅读 评论(0) 收藏
- WPF中的布局控件(转)
- python idle 错误 subprocess didn&;#39;t make connection
- Request.UrlReferrer为空的问题
- java 10 中 var关键字用法
- angularjs简单介绍和特点
- Linux命令(九)查找文件find
- 编译openwrt时报错:fstools-2018-01-02-11efbf3b/libfstools/overlay.c: At top level: cc1: error: unrecognized command line option '-Wno-format-truncation' [-Werror]
- mysql 优化2