码迷,mamicode.com
首页 > 系统相关 > 详细

apt-get update 更新 ubuntu时出现Hash sum mismatch的原因及解决方法

时间:2017-08-19 23:38:16      阅读:668      评论:0      收藏:0      [点我收藏+]

标签:同步   rem   special   ogr   err   led   设计   无线上网   ges   

 

$ sudo apt-get update

......
Hit http://mirrors.163.com trusty/main Sources                                 
Hit http://mirrors.163.com trusty/restricted Sources                           
Get:17 http://mirrors.163.com trusty/universe Sources [6,399 kB]               
Hit http://mirrors.163.com trusty/multiverse Sources                           
Err http://mirrors.163.com trusty-security/main i386 Packages                  
  404  Not Found [IP: 123.58.190.235 80]
Fetched 41.0 MB in 1min 3s (643 kB/s)                                          
W: Failed to fetch http://mirrors.163.com/ubuntu/dists/trusty-security/main/binary-amd64/Packages  Hash Sum mismatch
W: Failed to fetch http://mirrors.163.com/ubuntu/dists/trusty-security/main/binary-i386/Packages  404  Not Found [IP: 123.58.190.235 80]
W: Failed to fetch http://mirrors.163.com/ubuntu/dists/trusty-security/restricted/binary-i386/Packages  Hash Sum mismatch
W: Failed to fetch http://mirrors.163.com/ubuntu/dists/trusty-updates/restricted/source/Sources  Hash Sum mismatch
W: Failed to fetch http://mirrors.163.com/ubuntu/dists/trusty-updates/main/binary-amd64/Packages  Hash Sum mismatch
W: Failed to fetch http://mirrors.163.com/ubuntu/dists/trusty-updates/restricted/binary-amd64/Packages  Hash Sum mismatch

......

我估计很多人遇到过此问题,搜索半天发现国内所有中文描述此问题的解决方案的没有一个是靠谱可用的。

随查询英文,方得到正解,为了避免更多人疑惑,很少发帖的我决定把此问题的真正原因告知大家。

先引用 askubuntu.com上面关于此问题的原文解释,

给出正解的人叫做Robie Basak

引用:
This is a known issue, and is exacerbated for clients behind proxy caches. Some large organisations and ISPs (especially in remote parts of the world) have transparent caches of which you may not be aware.

The fundamental issue is that the apt repository format is subject to race conditions when a mirror is updated. This problem particularly affects repositories that change rapidly, such as the development release.

You can track progress on the fix for this in this bug (please mark yourself as "affects me too" in the bug) and this blueprint. But be aware that it is a complex issue and may take more than one release to resolve.
shareimprove this answer

answered Jul 5 ‘12 at 22:21



大意是:

你所使用的网络供应商,有些会设置一些透明缓存,以增加网络内部速度,减少出口的流量,你获取的某些文件不是源服务器上的真正文件,是从缓存中获取的,当缓存中获取的一些校验信息跟源中不一致的时候,自然提示校验失败,无法继续更新。

此问题实际上跟apt软件仓库的格式设计有关。新发布的版本的软件仓库更新比较频繁,按道理缓存中的文件应该同步更新,可惜因为多个镜像站点的有快慢,因此造成了缓存无法保证一致性。
当网络提供商足够有实力,不设至透明缓存时,这个问题是不存在的。这就是为什么有些人反馈使用无线上网卡(移动、联通的3g网络)就一切OK,一单换回长城宽带、或者宽带通就不行了。

以上就是问题出现的真正原因。

我的家中网络是宽带通,毫无疑问这种网络ISP肯定会设置透明缓存。
解决方案很简单,绕过缓存直接访问站点即可。
如何绕过ISP设置的这种缓存,方法跟绕过长城防火墙一样。
我找了格免费的ssh服务代理,
再安装一个proxychains,在/etc/proxychians.conf 中设置好你的代理
使用proxychains sudo apt-get update

更新正常(无论你更新哪一个源,国内或国外)

如果你觉得代理不够快,只要更新完源索引,安装软件时直接sudo apt-ge install xxx,即可。在软件中心中安装各类软件也没问题。


这问题根本解决跟apt repository的格式设计有关。
不过欧美的ISP似乎网络足够好,设置缓存的较少,反正提此问题的人并不多。因此他们是不是会进行改进设计真是无法预知。

还有一种情况会自然解决,就是等源索引渐渐稳定下来后,你的ISP的缓存也就跟真实数据保持一致了,此时更新就自然没问题。
新版本发布时更新肯定很频繁,估计大部分新版控无法等待。


以上就是关于引起更新源索引时Hash Sum mismatch问题的真正原因,以及解决方案,希望对各位朋友有所帮助。

 

apt-get update 更新 ubuntu时出现Hash sum mismatch的原因及解决方法

标签:同步   rem   special   ogr   err   led   设计   无线上网   ges   

原文地址:http://www.cnblogs.com/gaowengang/p/7398100.html

(0)
(1)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!