apt/apt-get:The following signatures were invalid: KEYEXPIRED

查询过期的key

sudo apt-key list | grep "expired: "

再更新这个key ,2007B954是查询出来的KEY

sudo apt-key adv --keyserver keys.gnupg.net --recv-keys 2007B954

key server可能不一定全部通用
例子

giantbranch@ubuntu:~$ sudo apt-key list | grep "expired: "
pub   4096R/2007B954 2012-12-06 [expired: 2019-09-02]
pub   4096R/473041FA 2010-08-27 [expired: 2018-03-05]
pub   4096R/B98321F9 2010-08-07 [expired: 2017-08-05]
pub   4096R/65FFB764 2012-05-08 [expired: 2019-05-07]

具体例子

giantbranch@ubuntu:~$ sudo apt-key adv --keyserver keys.gnupg.net --recv-keys 2007B954
Executing: /tmp/tmp.xtyH1a64lT/gpg.1.sh --keyserver
keys.gnupg.net
--recv-keys
2007B954
gpg: requesting key 2007B954 from hkp server keys.gnupg.net
gpg: key 2007B954: "Metasploit " 9 new signatures
gpg: Total number processed: 1
gpg:         new signatures: 9

或者一键ko

sudo apt-key list  | grep "expired: " | sed -ne 's|pub .*/\([^ ]*\) .*|\1|gp' | xargs -n1 sudo apt-key adv --keyserver keys.gnupg.net --recv-keys

你可能感兴趣的:(linux)