APT Hash sum mismatch错误的常见解决方法总结
LINUX报这个错误的时候,有很多的原因,通常是出现在使用
apt-get update
的时候, apt 的全称是Advanced Packaging Tool。在apt版本1.2.0之前,它是有BUG的,后续版本修正了,或许可以通过直接升级apt版本解决。问题原因五花八门,中外网友们的解决办法也是多种多样。
Hash sum mismatch这个错误是什么意思?
apt repository metadata is organized in such a way that a top level file contains the checksums of other pieces of repository metadata.
The “Hash sum mismatch” error indicates to the user that apt has run a checksum against the repository metadata it has downloaded and the checksum apt computed does not match the checksum listed in the top level file.
Unfortunately, due to a bug in apt, metadata files compressed with lzma (.xz files) are occasionally downloaded (and in some cases) decompressed incorrectly resulting in a broken file. As a result, the checksum of the broken file will be incorrect and cause apt to produce the “Hash sum mismatch” error.
Hash sum mismatch 为何产生?
There are at least 3 ways this can happen for most Ubuntu and Debian based systems today:
Stale metadata cached between the client and server. This is unlikely in most cases and not possible if SSL is used.
The metadata does not match because of a bug during the extraction of the metadata.
The repository is being updated while an apt-get update is run, or apt has cached a stale Release file.
Users can avoid all 3 cases by: (如何避免?)
Using SSL.
Disabling XZ compressed metadata, or ensuring a newer version of APT is used.
Using the new Acquire-by-hash featur