Posts Tagged ‘GPG’
debian下apt-get update时出现GPG error的解决方案
将我的t43本子从ubuntu换成debian etch之后,原本/etc/apt/sources.list源中的很多server连接都提示出现GPG error错误,sudo apt-get update时候无法通过。具体来说,比如我这里显示的错误:
W: GPG error: http://dl.google.com stable Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY A040830F7FAC5991
W: GPG error: http://dl.google.com testing Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY A040830F7FAC5991
W: GPG error: http://rh-mirror.linux.iastate.edu etch-cran/ Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 06F90DE5381BA480
W: GPG error: http://cran.r-project.org etch-cran/ Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 06F90DE5381BA480
W: You may want to run apt-get update to correct these problems
大致看了看,主要是找不到该源相对应的public key。这句话里的PUBKEY A040830F7FAC5991,应该是解决问题的出发点。找到相应的keyserver,在keyserver上查到A040830F7FAC5991对应的key,注入,应该就能解决问题了。以下是简要说明:
1.找到对应的gpg keys
注意:以下工作必须要在su状态下,即以root身份登录才可以。
sudo su
#gpg --keyserver wwwkeys.eu.pgp.net --recv-keys A040830F7FAC5991
在我的debian etch下,弹出如下提示:
gpg: directory `/root/.gnupg' created
gpg: new configuration file `/root/.gnupg/gpg.conf' created
gpg: WARNING: options in `/root/.gnupg/gpg.conf' are not yet active during this run
gpg: keyring `/root/.gnupg/secring.gpg' created
gpg: keyring `/root/.gnupg/pubring.gpg' created
gpg: requesting key 7FAC5991 from hkp server wwwkeys.eu.pgp.net
gpg: /root/.gnupg/trustdb.gpg: trustdb created
gpg: key 7FAC5991: public key "Google, Inc. Linux Package Signing Key
" imported
gpg: no ultimately trusted keys found
gpg: Total number processed: 1
gpg: imported: 1
2.查看key
#gpg --edit-key A040830F7FAC5991
terminal下弹出的信息如下:
gpg (GnuPG) 1.4.9; Copyright (C) 2008 Free Software Foundation, Inc.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
pub 1024D/7FAC5991 created: 2007-03-08 expires: never usage: SC
trust: unknown validity: unknown
sub 2048g/C07CB649 created: 2007-03-08 expires: never usage: E
[ unknown] (1). Google, Inc. Linux Package Signing Key
Command>
在Command>的地方,需要输入save。具体的细节我也不是很理解,反正照葫芦画瓢吧,保存之后就可以退出回到bash了。
Command> save
Key not changed so no update needed.
3.添加该key
gpg --armor --export A040830F7FAC5991 | apt-key add -
bash的提示是
simon-t43:~# gpg --armor --export A040830F7FAC5991 | apt-key add - OK
simon-t43:~#
OK,退出su状态。
4.测试apt-get update
看看是不是好用吧。