sudo apt-get update出现错误

使用sudo apt-get install update时,出现如下错误:

`E: Some index files failed to download. They have been ignored, or old ones used instead.`

具体错误内容为:

...
...
Ign http://hk.archive.ubuntu.com trusty/restricted Translation-en_HK           
Ign http://hk.archive.ubuntu.com trusty/universe Translation-en_HK             
Fetched 2,580 kB in 9s (269 kB/s)                                              
W: Failed to fetch http://hk.archive.ubuntu.com/ubuntu/dists/trusty-updates/main/source/Sources  Hash Sum mismatch

W: Failed to fetch http://hk.archive.ubuntu.com/ubuntu/dists/trusty-updates/universe/source/Sources  Hash Sum mismatch

W: Failed to fetch http://hk.archive.ubuntu.com/ubuntu/dists/trusty-updates/main/binary-amd64/Packages  Hash Sum mismatch

W: Failed to fetch http://hk.archive.ubuntu.com/ubuntu/dists/trusty-updates/universe/binary-amd64/Packages  Hash Sum mismatch

W: Failed to fetch http://hk.archive.ubuntu.com/ubuntu/dists/trusty-updates/main/binary-i386/Packages  Hash Sum mismatch

W: Failed to fetch http://hk.archive.ubuntu.com/ubuntu/dists/trusty-updates/universe/binary-i386/Packages  Hash Sum mismatch

W: Failed to fetch http://hk.archive.ubuntu.com/ubuntu/dists/trusty-backports/universe/source/Sources  Hash Sum mismatch

W: Failed to fetch http://hk.archive.ubuntu.com/ubuntu/dists/trusty-backports/universe/binary-amd64/Packages  Hash Sum mismatch

W: Failed to fetch http://hk.archive.ubuntu.com/ubuntu/dists/trusty-backports/universe/binary-i386/Packages  Hash Sum mismatch

E: Some index files failed to download. They have been ignored, or old ones used instead.

原因及解决办法:

所使用的源镜像地址被墙掉了,换个国内的镜像地址。
方法:
修改/etc/apt/sources.list,将其中的hk.archive.ubuntu.com替换成cn.archive.ubuntu.com(电信服务器,ubuntu中国官方镜像,maintained by Shanghai Linux User Group)

sudo vim /etc/apt/sources.list
:%s/hk.archive/cn.archive/g

也可以换为其他镜像源,比如:
mirrors.163.com
mirrors.sohu.com
ftp.sjtu.edu.cn #上海交通大学服务器
debian.ustc.edu.cn #中科大
mirror9.net9.org #清华
mirror.rootguide.org #上海电信
...
(各个镜像在速度上有所差别,校园网用户推荐使用教育网镜像。)

试过的其他解决办法,对于我的情况来说都无效,但有部分网友回复可以顺利解决他们的问题:

方法1:
sudo rm /var/lib/apt/lists/* -vf
sudo apt-get update

方法2:
gpg –keyserver keyserver.ubuntu.com –recv 3E5C1192
gpg –export –armor 3E5C1192 | sudo apt-key add -
sudo apt-get update

方法3:
sudo sh -c "echo 'Dir::Ignore-Files-Silently:: \"(.save|.distupgrade)$\";' > /etc/apt/apt.conf.d/99ignoresave"

方法4:
Go into Software Sources > Other Software and remove the conflicting ppa's.
(我用的服务器,没图形界面,这个方法就不知道有效没了,见评论里说是有效的。)

方法5:
sudo apt-get -f install
...
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值