升级到 18.04 后 apt 更新失败

升级到 18.04 后 apt 更新失败

从 16.04 升级到 18.04 后,运行 apt-update 时出现错误。以下是输出:

Get:2 http://security.ubuntu.com/ubuntu bionic-security InRelease [83.2 kB]
Get:3 http://archive.ubuntu.com/ubuntu bionic InRelease [242 kB]
Get:5 http://archive.ubuntu.com/ubuntu bionic-updates InRelease [88.7 kB]
Get:6 http://archive.ubuntu.com/ubuntu bionic-backports InRelease [74.6 kB]
Get:7 http://archive.ubuntu.com/ubuntu bionic-security InRelease [83.2 kB]
Err:2 http://security.ubuntu.com/ubuntu bionic-security InRelease
  Unknown error executing apt-key
Err:3 http://archive.ubuntu.com/ubuntu bionic InRelease
  Unknown error executing apt-key
Err:5 http://archive.ubuntu.com/ubuntu bionic-updates InRelease
  Unknown error executing apt-key
Err:6 http://archive.ubuntu.com/ubuntu bionic-backports InRelease
  Unknown error executing apt-key
Err:7 http://archive.ubuntu.com/ubuntu bionic-security InRelease
  Unknown error executing apt-key
Reading package lists... Done
W: GPG error: http://security.ubuntu.com/ubuntu bionic-security InRelease: Unknown error executing apt-key
E: The repository 'http://security.ubuntu.com/ubuntu bionic-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.
W: GPG error: http://archive.ubuntu.com/ubuntu bionic InRelease: Unknown error executing apt-key
E: The repository 'http://archive.ubuntu.com/ubuntu bionic 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: http://archive.ubuntu.com/ubuntu bionic-updates InRelease: Unknown error executing apt-key
E: The repository 'http://archive.ubuntu.com/ubuntu bionic-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: http://archive.ubuntu.com/ubuntu bionic-backports InRelease: Unknown error executing apt-key
E: The repository 'http://archive.ubuntu.com/ubuntu bionic-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: http://archive.ubuntu.com/ubuntu bionic-security InRelease: Unknown error executing apt-key
E: The repository 'http://archive.ubuntu.com/ubuntu bionic-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.

我到处找,试了所有办法,但还是无法解决这个问题。例如,我尝试切换镜像并移动 Trusted.gpg 文件,但都不起作用。

答案1

升级到 18.04.1 Bionic 后,我遇到了完全相同的问题。还导致设置、VLC 和源无法正常工作。

问题是 gpg 库指向的是 /usr/local/lib 中的库,而不是默认库。可能是因为以前的安装。

对我来说,解决方案是将 /usr/local/lib 中所有与 GPG 相关的库移到其他地方,然后重新进行链接。

您可以通过执行以下操作来检查您的 gpg 库链接:

sudo ldd /usr/bin/gpg

修复需要在我的计算机上发出以下命令:

cd /usr/local/lib
sudo mkdir bkp
sudo mv libgcrypt* bkp
sudo mv libassuan* bkp
sudo mv libgpg* bkp
sudo ldconfig /usr/bin/gpg

这解决了我所有的问题。

对于原始发帖者来说可能已经太晚了,但我想我会发布这个解决方案以防其他人遇到这个问题。

相关内容