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

家里的台式机吃灰很久了,担心坏掉,近期花了点时间重新插好线,晚上下班用来查查资料,写写笔记。
当前主要使用ubuntu系统,近期更新软件包时,发现总是会报错,如下:

$ 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中的配置相关,如下:

$ 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来自于前述报错信息。

$ 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) " 3 new signatures
gpg: key 7721F63BD38B4796: "Google Inc. (Linux Packages Signing Authority) " 2 new subkeys
gpg: Total number processed: 1
gpg:            new subkeys: 2
gpg:         new signatures: 3

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

$ 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

世界又美好了。

你可能感兴趣的:(ubuntu,linux)