在Ubuntu修复'E:包缓存文件已损坏,它有错误的哈希'错误

时间:2020-03-21 11:43:49  来源:igfitidea点击:

今天,我试图更新我的ubuntu18.04lts桌面上的存储库列表,结果出现了一个错误,上面写着 E:包缓存文件已损坏,它的哈希值错误
E: The package cache file is corrupted, it has the wrong hash
。以下是我从终端运行的内容及其输出:

$sudo apt update

示例输出:

Hit:1 http://it-mirrors.evowise.com/ubuntu bionic InRelease
Hit:2 http://it-mirrors.evowise.com/ubuntu bionic-updates InRelease 
Hit:3 http://it-mirrors.evowise.com/ubuntu bionic-backports InRelease 
Hit:4 http://it-mirrors.evowise.com/ubuntu bionic-security InRelease 
Hit:5 http://ppa.launchpad.net/alessandro-strada/ppa/ubuntu bionic InRelease 
Hit:7 http://ppa.launchpad.net/leaeasy/dde/ubuntu bionic InRelease 
Hit:8 http://ppa.launchpad.net/rvm/smplayer/ubuntu bionic InRelease 
Ign:6 https://dl.bintray.com/etcher/debian stable InRelease 
Get:9 https://dl.bintray.com/etcher/debian stable Release [3,674 B]
Fetched 3,674 B in 3s (1,196 B/s) 
Reading package lists... Done
E: The package cache file is corrupted, it has the wrong hash

撰写谷歌搜索后,我发现解决了解决这个错误的方法。

如果我们遇到过此错误,请不要恐慌。
只需运行以下命令以修复它。

在运行以下命令之前,请在结束时添加""。
在此命令结束时添加
非常重要。
如果我们不添加它,它将删除/var/lib/apt/lists /目录,并且无法将其带回。
你被警告了!

$sudo rm -rf /var/lib/apt/lists/*

现在我再次尝试使用命令更新系统:

$sudo apt update