如何修复APT错误“W:无法获取哈希和不匹配”?

我真的不知道发生了什么,重新启动后我得到了很多崩溃消息,如果我打开Firefox或Synaptic,它们会崩溃. Synaptic返回:

E: Encountered a section with no Package: header
E: Problem with MergeList /var/lib/apt/lists/security.ubuntu.com_ubuntu_dists_raring-security_main_i18n_Translation-en
E: The package lists or status file could not be parsed or opened.
E: _cache->open() failed, please report.

然后出现顶部面板上的崩溃图标,并且有关于mergelist的一些错误.我用谷歌搜索,发现这个sudo rm / var / lib / apt / lists / * -vf sudo apt-get update这不起作用.为了能够在浏览器中工作,我删除了/ var / lib / apt / lists中的所有文件.如果我尝试sudo apt-get update,我会得到这个:

W: Failed to fetch gzip:/var/lib/apt/lists/partial/ua.archive.ubuntu.com_ubuntu_dists_raring_main_source_Sources Hash Sum mismatch
W: Failed to fetch gzip:/var/lib/apt/lists/partial/ua.archive.ubuntu.com_ubuntu_dists_raring_restricted_source_Sources Hash Sum mismatch
W: Failed to fetch gzip:/var/lib/apt/lists/partial/ua.archive.ubuntu.com_ubuntu_dists_raring_universe_source_Sources Hash Sum mismatch
W: Failed to fetch gzip:/var/lib/apt/lists/partial/security.ubuntu.com_ubuntu_dists_raring-security_main_source_Sources Hash Sum mismatch
W: Failed to fetch gzip:/var/lib/apt/lists/partial/security.ubuntu.com_ubuntu_dists_raring-security_universe_source_Sources Hash Sum mismatch
W: Failed to fetch gzip:/var/lib/apt/lists/partial/security.ubuntu.com_ubuntu_dists_raring-security_main_binary-i386_Packages Hash Sum mismatch
W: Failed to fetch gzip:/var/lib/apt/lists/partial/security.ubuntu.com_ubuntu_dists_raring-security_universe_binary-i386_Packages Hash Sum mismatch
E: Some index files failed to download. They have been ignored, or old ones used instead.

我不想重新安装系统.我怎么能解决这个问题?谢谢.

那里有一些照片.我无法制作截图,它崩溃了:Photo 1 Photo 2

最佳答案
问题是你删除了递归/ var / lib / apt / lists,这也删除了部分目录.因此,重新创建目录应该可以解决问题:

sudo mkdir -p /var/lib/apt/lists/partial
sudo chmod 755 /var/lib/apt/lists/partial

此外,您使用的镜子可能存在问题.选择另一个镜像并再次更新.

转载注明原文:如何修复APT错误“W:无法获取哈希和不匹配”? - 代码日志