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
...

没有更多推荐了,返回首页