Ubuntu 关于引起更新源索引(apt-get update)时Hash Sum mismatch的问题

来源:互联网 发布:文明6 mac 中文 编辑:程序博客网 时间:2024/06/11 18:31

说明

首先这个问题国内出现的比较多,小宽带厂商(例如宽带通、长城、轩惠)等出现的比较多
对于此问题的描述和解决方案中文的资料很乱,且很少有从根本上解决问题的

问题分析

中文真正说出问题根本的帖子为 关于引起更新源索引时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,一单换回长城宽带、或者宽带通就不行了。

解决方案

  • 上文作者的解决方案

    proxychains加上免费SSH服务器 - 请看原文

  • 花钱买VPN

    搞不明白我国的“长城”是咋回事儿,直接访问谷歌等被屏蔽,且免费方案出一个新的他们搞乱一个新的,但是却可以用VPN来访问 – 是要我们掏钱买VPN么

  • 本文作者的解决方案

    如果是少量数据,可以用一些免费的SSH服务器啊,VPN啊都可以
    如果是网页的数据,可以用 goagent, 这也是我用的最多的工具
    本文的问题解决方案在于这是可以设置代理的

    $ sudo apt-get -o Acquire::http::proxy="http://192.168.31.122:8087/" update$ sudo apt-get -o Acquire::http::proxy="http://192.168.31.122:8087/" install default-jre

    其中的 http://192.168.31.122:8087/ 为 笔者的 goagent 的代理端口。至于为啥用 192.168.31.122,是因为提供代理的是一台Windows机器;为啥用Windows系统,因为简单,还因为有工具可以方便的找可用 google IP地址。Windows上找到的IP地址也可以给其他系统上运行的 goagent 用啊?是的,但是我不习惯。。。

参考:

http://forum.ubuntu.org.cn/viewtopic.php?f=52&t=423516
http://blog.sina.com.cn/s/blog_4a0a8b5d0101i5z7.html

0 0