如果你在Ubuntu 18.04 LTS系统中遇到提示E: The package cache file is corrupted, it has the wrong hash的错误(E:包缓存文件已损坏,它有错误的哈希值),请采用本文介绍的方法修复。
前言
我尝试更新Ubuntu 18.04 LTS桌面中的存储库列表(参考:Ubuntu存储库的定义及启用和禁用Ubuntu存储库的方法),并收到一条错误消息:E: The package cache file is corrupted, it has the wrong hash,下面是我从终端及其输出中运行的内容:
$ sudo apt update
参考:在Debian/Ubuntu系统上手动安装安全更新的三种方法。
样本输出:
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
从上图中可以看出,这次它有效,说明问题已经被修复,成功解决了问题。
- 1 centos安装好mysql但是无法启动问题(Job for mysqld.service failed because the control process exited with error code.)
- 2 Ubuntu缺少libncurses.so.5的解决办法
- 3 给原版的openwrt安装Passwall
- 4 统信UOS 20个人版授权激活的方法:使用激活码在线/离线激活
- 5 玩客云刷armbian架设nginx php mysql 及可道私有云总结
- 6 exsi报错Error: [$rootScope:inprog]
- 7 RHEL 8 安装 Oracle 19c 提示缺少 libnsl.so.1
- 8 There was a problem importing one of the Python modules 另类解决办法
- 9 Grafana之Gauge和Bar Gauge使用(第十一篇)
- 10 在银河麒麟操作系统中使用QQ、微信接收文件和文件发送的方法
精彩评论