首页 技术 正文
技术 2022年11月16日
0 收藏 466 点赞 3,801 浏览 2684 个字

$ 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 问题的真正原因,以及解决方案,希望对各位朋友有所帮助。

相关推荐
python开发_常用的python模块及安装方法
adodb:我们领导推荐的数据库连接组件bsddb3:BerkeleyDB的连接组件Cheetah-1.0:我比较喜欢这个版本的cheeta…
日期:2022-11-24 点赞:878 阅读:9,088
Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process题目连接:http://www.codeforces.com/contest/660/problem/CDes…
日期:2022-11-24 点赞:807 阅读:5,565
下载Ubuntn 17.04 内核源代码
zengkefu@server1:/usr/src$ uname -aLinux server1 4.10.0-19-generic #21…
日期:2022-11-24 点赞:569 阅读:6,413
可用Active Desktop Calendar V7.86 注册码序列号
可用Active Desktop Calendar V7.86 注册码序列号Name: www.greendown.cn Code: &nb…
日期:2022-11-24 点赞:733 阅读:6,186
Android调用系统相机、自定义相机、处理大图片
Android调用系统相机和自定义相机实例本博文主要是介绍了android上使用相机进行拍照并显示的两种方式,并且由于涉及到要把拍到的照片显…
日期:2022-11-24 点赞:512 阅读:7,822
Struts的使用
一、Struts2的获取  Struts的官方网站为:http://struts.apache.org/  下载完Struts2的jar包,…
日期:2022-11-24 点赞:671 阅读:4,905