修復(fù)Ubuntu中 “E: The package cache file is corrupted, it has the wrong hash”
今天,我嘗試更新我的 Ubuntu 18.04 LTS 的倉(cāng)庫(kù)列表,但收到了一條錯(cuò)誤消息:“E: The package cache file is corrupted, it has the wrong hash”。這是我在終端運(yùn)行的命令以及輸出:
$ 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
Ubuntu 中的 “The package cache file is corrupted, it has the wrong hash” 錯(cuò)誤
經(jīng)過(guò)一番谷歌搜索,我找到了解決此錯(cuò)誤的方法。
如果你遇到過(guò)這個(gè)錯(cuò)誤,不要驚慌。只需運(yùn)行下面的命令修復(fù)。
在運(yùn)行命令之前,請(qǐng)?jiān)俅未_認(rèn)你在最后加入了 *
。在命令最后加上 *
很重要。如果你沒(méi)有添加,它會(huì)刪除 /var/lib/apt/lists/
*目錄,而且無(wú)法恢復(fù)。我提醒過(guò)你了!
$ sudo rm -rf /var/lib/apt/lists/*
現(xiàn)在我再次使用下面的命令更新系統(tǒng):
$ sudo apt update
現(xiàn)在好了!希望它有幫助。