我无意中删除了允许更新系统的密钥,现在当我尝试使用 sudo apt update 进行更新时,我得到以下终端输出
Get:1 file:/var/lib/preinstalled-pool focal InRelease
Ign:1 file:/var/lib/preinstalled-pool focal InRelease
Get:2 file:/var/lib/preinstalled-pool focal Release [3,949 B]
Get:2 file:/var/lib/preinstalled-pool focal Release [3,949 B]
Get:3 file:/var/lib/preinstalled-pool focal Release.gpg [455 B]
Get:3 file:/var/lib/preinstalled-pool focal Release.gpg [455 B]
Ign:3 file:/var/lib/preinstalled-pool focal Release.gpg
Hit:4 http://archive.ubuntu.com/ubuntu focal InRelease
Get:5 http://security.ubuntu.com/ubuntu focal-security InRelease [109 kB]
Hit:6 https://cloud.r-project.org/bin/linux/ubuntu focal-cran40/ InRelease
Hit:7 http://ppa.launchpad.net/webupd8team/y-ppa-manager/ubuntu focal InRelease
Get:8 http://archive.neon.kde.org/user focal InRelease [166 kB]
Get:9 http://archive.ubuntu.com/ubuntu focal-updates InRelease [114 kB]
Get:10 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 Packages [844 kB]
Get:11 http://archive.ubuntu.com/ubuntu focal-updates/universe amd64 Packages [750 kB]
Reading package lists... Done
W: GPG error: file:/var/lib/preinstalled-pool focal Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY E5231016A6508C17
E: The repository 'file:/var/lib/preinstalled-pool focal Release' 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
正如您所怀疑的,从其他已安装的操作系统中获取密钥,位于该目录中。
zeus@buster-raspi:~$ ll /etc/apt/trusted.gpg.d/
debian-archive-buster-automatic.gpg
debian-archive-buster-security-automatic.gpg
debian-archive-buster-stable.gpg
答案2
感谢 KDE 论坛上的用户 dbergstein,这个问题现已得到解决https://forum.kde.org/viewtopic.php?f=309&t=170366。
解决方案很简单:
apt-key export E5231016A6508C17 > key-data
在安装了密钥的机器上,复制到没有密钥的机器上,然后
sudo apt-key add key-data
其中 key-data 是所复制文件的名称。