解决apt update执行时因签名而运行失败的问题

家里的台式机吃灰很久了,担心坏掉,近期花了点时间重新插好线,晚上下班用来查查资料,写写笔记。

当前主要使用ubuntu系统,近期更新软件包时,发现总是会报错,如下:

shell 复制代码
$ sudo apt-get update
[sudo] password for jackie:
Get:1 http://dl.google.com/linux/chrome/deb stable InRelease [1,825 B]
Hit:2 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal InRelease
Get:3 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-updates InRelease [114 kB]
Get:4 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-backports InRelease [108 kB]
Get:5 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-security InRelease [114 kB]
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
Get:6 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-updates/main amd64 DEP-11 Metadata [275 kB]
Get:7 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-updates/universe amd64 DEP-11 Metadata [414 kB]
Get:8 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-updates/multiverse amd64 DEP-11 Metadata [944 B]
Get:9 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-backports/main amd64 DEP-11 Metadata [7,956 B]
Get:10 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-backports/universe amd64 DEP-11 Metadata [30.5 kB]
Get:11 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-security/main amd64 DEP-11 Metadata [59.8 kB]
Get:12 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-security/universe amd64 DEP-11 Metadata [96.5 kB]
Get:13 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-security/multiverse amd64 DEP-11 Metadata [940 B]
Fetched 1,221 kB in 1s (935 kB/s)
Reading package lists... Done
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.

经过搜索,发现报错信息和/etc/apt/sources.list.d/google-chrome.list中的配置相关,如下:

shell 复制代码
$ cat /etc/apt/sources.list.d/google-chrome.list
### THIS FILE IS AUTOMATICALLY CONFIGURED ###
# You may comment out this entry, but any other modifications may be lost.
deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main

参考网友的帖子,在命令行执行如下命令。注意4EB27DB2A3B88B8B来自于前述报错信息。

shell 复制代码
$ sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 4EB27DB2A3B88B8B
Executing: /tmp/apt-key-gpghome.PLpUkfs0hN/gpg.1.sh --keyserver keyserver.ubuntu.com --recv-keys 4EB27DB2A3B88B8B
gpg: key 7721F63BD38B4796: 2 duplicate signatures removed
gpg: key 7721F63BD38B4796: "Google Inc. (Linux Packages Signing Authority) <linux-packages-keymaster@google.com>" 3 new signatures
gpg: key 7721F63BD38B4796: "Google Inc. (Linux Packages Signing Authority) <linux-packages-keymaster@google.com>" 2 new subkeys
gpg: Total number processed: 1
gpg:            new subkeys: 2
gpg:         new signatures: 3

此时再次执行更新操作,报错信息消失,命令成功执行结束,如下:

shell 复制代码
$ sudo apt-get update
Get:1 http://dl.google.com/linux/chrome/deb stable InRelease [1,825 B]
Hit:2 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal InRelease
Hit:3 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-updates InRelease
Hit:4 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-backports InRelease
Hit:5 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-security InRelease
Get:6 http://dl.google.com/linux/chrome/deb stable/main amd64 Packages [1,079 B]
Fetched 1,079 B in 1s (1,299 B/s)
Reading package lists... Done

世界又美好了。

相关推荐
ac.char4 分钟前
在 Ubuntu 系统上安装 npm 环境以及 nvm(Node Version Manager)
linux·ubuntu·npm
肖永威10 分钟前
CentOS环境上离线安装python3及相关包
linux·运维·机器学习·centos
tian2kong12 分钟前
Centos 7 修改YUM镜像源地址为阿里云镜像地址
linux·阿里云·centos
布鲁格若门16 分钟前
CentOS 7 桌面版安装 cuda 12.4
linux·运维·centos·cuda
C-cat.24 分钟前
Linux|进程程序替换
linux·服务器·microsoft
dessler24 分钟前
云计算&虚拟化-kvm-扩缩容cpu
linux·运维·云计算
怀澈12226 分钟前
高性能服务器模型之Reactor(单线程版本)
linux·服务器·网络·c++
DC_BLOG28 分钟前
Linux-Apache静态资源
linux·运维·apache
学Linux的语莫29 分钟前
Ansible Playbook剧本用法
linux·服务器·云计算·ansible