添加软件包的 deb 源后,如何修复 apt-get 缺少密钥错误?

添加软件包的 deb 源后,如何修复 apt-get 缺少密钥错误?

我正在使用 Mint Linux 17。我尝试通过将存储库添加到我的源列表来安装 debian 包,如下所示:

# add heroku repository to apt
echo "deb http://toolbelt.heroku.com/ubuntu ./" > /etc/apt/sources.list.d/heroku.list

# install heroku's release key for package verification
wget -O- https://toolbelt.heroku.com/apt/release.key | apt-key add -

(实际上这是软件包供应商提供的脚本)。但是,执行此操作并运行后,apt-get update我收到 GPG 密钥错误:

Reading package lists... Error!
W: GPG error: http://download.opensuse.org  Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY D54CC349F42D5F07
E: Encountered a section with no Package: header
E: Problem with MergeList /var/lib/apt/lists/packages.linuxmint.com_dists_qiana_import_i18n_Translation-en
E: The package lists or status file could not be parsed or opened.
Reading package lists... Error!
E: Encountered a section with no Package: header
E: Problem with MergeList /var/lib/apt/lists/packages.linuxmint.com_dists_qiana_import_i18n_Translation-en
E: The package lists or status file could not be parsed or opened.

因此在谷歌搜索后我尝试:

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys D54CC349F42D5F07

现在我得到:

Reading package lists... Error!
W: GPG error: http://download.opensuse.org  Release: The following signatures were invalid: KEYEXPIRED 1307152882
E: Encountered a section with no Package: header
E: Problem with MergeList /var/lib/apt/lists/packages.linuxmint.com_dists_qiana_import_i18n_Translation-en
E: The package lists or status file could not be parsed or opened.

因为密钥已过期。现在 apt-get update 总是失败并出现此错误。

那么,我该如何修复现在损坏的软件包系统呢?我不太在意保留新的源列表。我只想重新能够运行apt-get update

编辑

这样做apt-key list揭示了以下问题的关键:

pub   1024D/F42D5F07 2009-03-26 [expired: 2011-06-04]
uid                  home:felfert OBS Project <home:[email protected]>

我跑步apt-key del F42D5F07,但是现在跑步时apt-get update我回到:

W: GPG error: http://download.opensuse.org  Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY D54CC349F42D5F07

答案1

sudo apt-key list
sudo apt-key del [bad key]

查看您的密钥并找出哪一个或哪些是坏的并将其删除,然后再次尝试 apt-get 更新。

相关内容