我在公司网络内使用 Ubuntu 12.04,64 位虚拟机,该网络显然有防火墙。当我尝试运行 sudo apt-get update 或 sudo apt-get update --fix-missing 时,出现此错误:
(假设 archive.ubuntu.com 位于 _ubuntu 之前)
W: Failed to fetch bzip2:/var/lib/apt/lists/partial/_ubuntu_dists_precise_main_source_Sources Hash Sum mismatch
W: Failed to fetch bzip2:/var/lib/apt/lists/partial/_ubuntu_dists_precise_multiverse_source_Sources Hash Sum mismatch
W: Failed to fetch bzip2:/var/lib/apt/lists/partial/_ubuntu_dists_precise_universe_source_Sources Hash Sum mismatch
W: Failed to fetch bzip2:/var/lib/apt/lists/partial
/_ubuntu_dists_precise_main_binary-amd64_Packages Hash Sum mismatch
W: Failed to fetch bzip2:/var/lib/apt/lists/partial/_ubuntu_dists_precise_restricted_binary-i386_Packages Hash Sum mismatch
W: Failed to fetch bzip2:/var/lib/apt/lists/partial/_ubuntu_dists_precise_multiverse_binary-i386_Packages Hash Sum mismatch
W: Failed to fetch bzip2:/var/lib/apt/lists/partial/_ubuntu_dists_precise_universe_binary-i386_Packages Hash Sum mismatch
W: Failed to fetch /ubuntu/dists/precise/main/i18n/Index No Hash entry in Release file /var/lib/apt/lists/partial/_ubuntu_dists_precise_main_i18n_Index
W: Failed to fetch /ubuntu/dists/precise/multiverse/i18n/Index No Hash entry in Release file /var/lib/apt/lists/partial/_ubuntu_dists_precise_multiverse_i18n_Index
W: Failed to fetch /ubuntu/dists/precise/restricted/i18n/Index No Hash entry in Release file /var/lib/apt/lists/partial/_ubuntu_dists_precise_restricted_i18n_Index
W: Failed to fetch /ubuntu/dists/precise/universe/i18n/Index No Hash entry in Release file /var/lib/apt/lists/partial/_ubuntu_dists_precise_universe_i18n_Index
W: Failed to fetch bzip2:/var/lib/apt/lists/partial
/_ubuntu_dists_precise-updates_restricted_source_Sources Hash Sum mismatch
E: Some index files failed to download. They have been ignored, or old ones used instead.
我尝试过删除/var/lib/apt/lists
其他帖子中提到的内容,但没有成功。实际问题是公司防火墙破坏了下载流量,导致哈希值不匹配。这是一个已知问题,如下图所示:
https://unix.stackexchange.com/questions/116641/how-do-you-fix-apt-get-update-hash-sum-mismatch
那么,有没有什么办法可以帮我以及公司防火墙后面的许多 Ubuntu 用户更新软件包呢?
答案1
我认为你的选择是:
从其他位置离线更新。请参阅如何在不使用 Synaptic 或 Keryx 的情况下离线更新 Ubuntu?
与您的系统管理员交谈并让他们探讨防火墙的解决方案。
答案2
如果上述解决方案不起作用,请尝试以下解决方案:
从文件夹中删除现有的受信任 GPG 密钥/etc/apt/trusted.gpg.d/
然后运行命令:
sudo apt-key update
然后尝试运行:sudo apt-get update