GPG 错误:执行 apt-key 时出现未知错误

GPG 错误:执行 apt-key 时出现未知错误

首先介绍一下背景...

在 Raspberry Pi 4 上安装了 Ubuntu 20.04.2 LTS (GNU/Linux 5.4.0-1029-raspi aarch64)。(这不是 docker 容器。)首先确保语言环境和系统时钟设置正确。从 apt 获取最新更新。通过在线脚本安装了 PiHole 和 PiVPN。确保无人值守升级已正确设置,仅用于安全更新。几周来一切都运行正常。

今天,我随机去检查 PiHole Web 管理员,结果出现了 500 内部服务器错误。通过 SSH 进入 RPi,本来打算尝试重新启动,但决定先运行 apt 并查找更新。现在我们都了解了,下面是我使用过的命令及其输出。任何帮助都将不胜感激。我能找到的东西只针对 docker 容器,这里还有一篇帖子似乎存在同样的问题,但从未收到任何人的回复。希望我没有那么倒霉。

注意:为了避免看起来像垃圾邮件,我已将所有 URL 替换为 < URL >。它们原本都是http://ports.ubuntu.com/ubuntu-ports

sudo apt update

Hit:1 <URL> focal InRelease
Get:2 <URL> focal-updates InRelease [114 kB]
Err:1 <URL> focal InRelease
  Unknown error executing apt-key
Get:3 <URL> focal-backports InRelease [101 kB]
Err:2 <URL> focal-updates InRelease
  Unknown error executing apt-key
Get:4 <URL> focal-security InRelease [109 kB]
Err:3 <URL> focal-backports InRelease
  Unknown error executing apt-key
Err:4 <URL> focal-security InRelease
  Unknown error executing apt-key
Fetched 324 kB in 1s (221 kB/s)
Reading package lists... Error!
W: An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: <URL> focal InRelease: Unknown error executing apt-key
W: An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: <URL> focal-updates InRelease: Unknown error executing apt-key
W: An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: <URL> focal-backports InRelease: Unknown error executing apt-key
W: An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: <URL> focal-security InRelease: Unknown error executing apt-key
W: Failed to fetch <URL>/dists/focal/InRelease  Unknown error executing apt-key
W: Failed to fetch <URL>/dists/focal-updates/InRelease  Unknown error executing apt-key
W: Failed to fetch <URL>/dists/focal-backports/InRelease  Unknown error executing apt-key
W: Failed to fetch <URL>/dists/focal-security/InRelease  Unknown error executing apt-key
W: Some index files failed to download. They have been ignored, or old ones used instead.
E: Encountered a section with no Package: header
E: Problem with MergeList /var/lib/apt/lists/ports.ubuntu.com_ubuntu-ports_dists_focal_universe_i18n_Translation-en
E: The package lists or status file could not be parsed or opened.

sudo apt clean
sudo apt-get clean
sudo mv /var/lib/apt/lists /tmp
sudo mkdir -p /var/lib/apt/lists/partial
sudo apt clean
sudo apt update

Get:1 <URL> focal InRelease [265 kB]
Get:2 <URL> focal-updates InRelease [114 kB]
Get:3 <URL> focal-backports InRelease [101 kB]
Err:1 <URL> focal InRelease
  Unknown error executing apt-key
Get:4 <URL> focal-security InRelease [109 kB]
Err:2 <URL> focal-updates InRelease
  Unknown error executing apt-key
Err:3 <URL> focal-backports InRelease
  Unknown error executing apt-key
Err:4 <URL> focal-security InRelease
  Unknown error executing apt-key
Reading package lists... Done
W: GPG error: <URL> focal InRelease: Unknown error executing apt-key
E: The repository '<URL> focal InRelease' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
W: GPG error: <URL> focal-updates InRelease: Unknown error executing apt-key
E: The repository '<URL> focal-updates InRelease' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
W: GPG error: <URL> focal-backports InRelease: Unknown error executing apt-key
E: The repository '<URL> focal-backports InRelease' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
W: GPG error: <URL> focal-security InRelease: Unknown error executing apt-key
E: The repository '<URL> focal-security InRelease' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.

答案1

我的情况是cat文件被毁了。恢复后catapt恢复正常。

答案2

尝试sudo ldconfig /usr/bin/gpg。参见:https://unix.stackexchange.com/a/677711/114401

它对我有用。sudo apt update现在又能起作用了。

相关内容