解决ubuntu更新时key不能用的问题

Table of Contents

问题

今天在使用 apt-get update 时报i3的key不能用,提示一个 gpg error :

W: An error occurred during the signature verification. The repository
is not updated and the previous index files will be used. GPG error:
http://debian.sur5r.net trusty InRelease: The following signatures
couldn't be verified because the public key is not available:
NO_PUBKEY E3CA1A89941C42E6

修复方法

在命令行下输入如下命令:

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E3CA1A89941C42E6

注意,上面命令中的 –recv-keys E3CA1A89941C42E6 对应的参数值可以在 错误信息 里找到。下面是控制台输出的信息:

Executing: gpg --ignore-time-conflict --no-options
--no-default-keyring --homedir /tmp/tmp.zpnomUvFOa
--no-auto-check-trustdb --trust-model always --keyring
/etc/apt/trusted.gpg --primary-keyring /etc/apt/trusted.gpg
--keyserver keyserver.ubuntu.com --recv-keys E3CA1A89941C42E6 gpg:
requesting key 941C42E6 from hkp server keyserver.ubuntu.com gpg: key
941C42E6: public key "debian.sur5r.net Archive Automatic Signing Key
2015 (sur5r) <debian@sur5r.net>" imported gpg: Total number processed:
1 gpg: imported: 1 (RSA: 1)