apt update 最后报错

$ sudo apt update
报错

......
91 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://repo.mysql/apt/ubuntu focal InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 467B942D3A79BD29
W: Failed to fetch http://repo.mysql/apt/ubuntu/dists/focal/InRelease  The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 467B942D3A79BD29

重点:
NO_PUBKEY 467B942D3A79BD29

缺少公钥?

重新获取公钥并加入到 apt 信任密钥

  1. 获取 gpg 公钥
    $ sudo gpg --keyserver keyserver.ubuntu --recv-keys 467B942D3A79BD29

     gpg: key 467B942D3A79BD29: public key "MySQL Release Engineering <mysql-build@oss.oracle>" imported
     gpg: Total number processed: 1
     gpg:               imported: 1
    

    重复执行多次不会改变,也不影响
    $ sudo gpg --keyserver keyserver.ubuntu --recv-keys 467B942D3A79BD29

     gpg: key 467B942D3A79BD29: "MySQL Release Engineering <mysql-build@oss.oracle>" not changed
     gpg: Total number processed: 1
     gpg:              unchanged: 1
    
  2. 导出公钥,加入到 apt 信任密钥
    $ sudo gpg --export --armor 467B942D3A79BD29 | sudo apt-key add -
    OK

  3. 再来 update
    $ sudo apt update

     ......
     Reading package lists... Done
     Building dependency tree       
     Reading state information... Done
     98 packages can be upgraded. Run 'apt list --upgradable' to see them.
    

    不再报错了!

4 确认:查询一下被信任密钥

$ apt-key list

......
pub   rsa4096 2021-12-14 [SC] [expires: 2023-12-14]
      859B E8D7 C586 F538 430B  19C2 467B 942D 3A79 BD29
uid           [ unknown] MySQL Release Engineering <mysql-build@oss.oracle>
sub   rsa4096 2021-12-14 [E] [expires: 2023-12-14]

更多推荐

报错:The following signatures couldn‘t be verified because the public key is not a