當使用apt-get update更新源時,出現下面“Hash Sum mismatch”的報錯,具體如下:
root@localhost:~# apt-get update
......
......
W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/precise/main/source/Sources Hash Sum mismatch
W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/precise/restricted/source/Sources Hash Sum mismatch
W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/precise/universe/source/Sources Hash Sum mismatch
W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/precise/multiverse/source/Sources Hash Sum mismatch
W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/precise/main/binary-amd64/Packages Hash Sum mismatch
W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/precise/restricted/binary-amd64/Packages Hash Sum mismatch
W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/precise/universe/binary-amd64/Packages Hash Sum mismatch
W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/precise/multiverse/binary-amd64/Packages Hash Sum mismatch
W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/precise/main/binary-i386/Packages Hash Sum mismatch
W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/precise/restricted/binary-i386/Packages Hash Sum mismatch
W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/precise/universe/binary-i386/Packages Hash Sum mismatch
W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/precise/multiverse/binary-i386/Packages Hash Sum mismatch
E: Some index files failed to download. They have been ignored, or old ones used instead.
產生原因:
所使用的網路供應商,有些會設定一些透明快取,以增加網路內部速度,減少出口的流量,所獲取的某些檔案不是源伺服器上的真正檔案,是從快取中獲取的,當快取中獲取的一些校驗資訊跟源中不一致的時候,自然提示校驗失敗,無法繼續更新。
解決辦法:
1)刪掉/var/lib/apt/lists 這個目錄下的東西
sudo rm -fR /var/lib/apt/lists/*
2)新建相應資料夾
sudo mkdir /var/lib/apt/lists/partial
3)重新update
sudo apt-get update