【Ubuntu升级报错】“the following signatures couldn’t be verified because the public key is not available”

升级Python时第一步apt-get update报错

报错界面

在ubuntu中运行apt-get update时,有时会出现如下报错

ubuntu@ubuntu-virtual-machine:~$ sudo apt update
[sudo] password for ubuntu: 
Get:1 http://dl.google.com/linux/chrome/deb stable InRelease [1,811 B]
Hit:2 http://packages.microsoft.com/repos/code stable InRelease                
Err:1 http://dl.google.com/linux/chrome/deb stable InRelease
  The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 4EB27DB2A3B88B8B
Hit:3 http://id.archive.ubuntu.com/ubuntu bionic InRelease
Hit:4 http://id.archive.ubuntu.com/ubuntu bionic-updates InRelease             
Hit:5 http://id.archive.ubuntu.com/ubuntu bionic-backports InRelease           
Hit:6 http://security.ubuntu.com/ubuntu bionic-security InRelease              
Hit:7 http://packages.ros.org/ros/ubuntu bionic InRelease                      
Reading package lists... Done                        
Building dependency tree       
Reading state information... Done
468 packages can be upgraded. Run 'apt list --upgradable' to see them.
W: An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: http://dl.google.com/linux/chrome/deb stable InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 4EB27DB2A3B88B8B
W: Failed to fetch http://dl.google.com/linux/chrome/deb/dists/stable/InRelease  The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 4EB27DB2A3B88B8B
W: Some index files failed to download. They have been ignored, or old ones used instead.

如果不去解决,无法继续进行后续的升级操作

ubuntu@ubuntu-virtual-machine:~$ sudo apt upgrade
E: Could not get lock /var/lib/dpkg/lock-frontend - open (11: Resource temporarily unavailable)
E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), is another process using it?

这是由apt包系统的安全机制引起的问题,有时系统无法包含所有的key。此处有快速修复的办法,即将缺少的key加进去即可。
观察里面的报错,其实是4EB27DB2A3B88B8B(请注意,每个人的KEY会不一样,所以需要从自己的报错信息中找出对应的值,替换到下面的指令,如果是多个key,相应的发送多条指令即可),这个key缺失,因此只要将其加入即可,可使用如下指令:

ubuntu@ubuntu-virtual-machine:~$ sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 4EB27DB2A3B88B8B
Executing: /tmp/apt-key-gpghome.6DtlfeE5p7/gpg.1.sh --keyserver keyserver.ubuntu.com --recv-keys 4EB27DB2A3B88B8B
gpg: key 7721F63BD38B4796: "Google Inc. (Linux Packages Signing Authority) <linux-packages-keymaster@google.com>" 1 new signature
gpg: key 7721F63BD38B4796: "Google Inc. (Linux Packages Signing Authority) <linux-packages-keymaster@google.com>" 1 new subkey
gpg: key 7721F63BD38B4796: "Google Inc. (Linux Packages Signing Authority) <linux-packages-keymaster@google.com>" 2 signatures cleaned
gpg: Total number processed: 1
gpg:            new subkeys: 1
gpg:         new signatures: 1
gpg:     signatures cleaned: 2

后续即可正常进行升级操作

  • 2
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值