Ubuntu:解決非官方源導致的GPG error
| [日期:2010-03-30] |
來源:Ubuntu社區 作者:Ubuntu |
[字型:大 中 小] |
當我們在/etc/apt/sources.list中加入非Ubuntu官方源來安裝、更新部分軟體時,sudo apt-get update會有錯誤提示
下面以我使用的ibus非官方源作為樣本,錯誤提示如下:
W: GPG error: http://ppa.launchpad.net jaunty Release: The following signatures couldn’t be verified because the public key is not available: NO_PUBKEY 21C022AA985E0E11
W: You may want to run apt-get update to correct these problems
也就是這個非官方源是不可信任的,解決辦法是匯入該源的公開金鑰。
因為平時我們是使用sudo來管理系統的,所以有些地方要注意,不然很容易出現錯誤。
先把這個源的公開金鑰從公開金鑰伺服器匯入到目前使用者的公開金鑰庫
$gpg –keyserver wwwkeys.eu.pgp.net –recv-keys 21C022AA985E0E11
此處沒有必要用sudo來運行,把公開金鑰匯入目前使用者即可,使用了反而有可能提示錯誤
gpg: WARNING: unsafe ownership on configuration file `/home/username/.gnupg/gpg.conf’
gpg: external program calls are disabled due to unsafe options file permissions
gpg: keyserver communications error: general error
gpg: keyserver receive failed: general error
因為這樣會導致gpg.conf的所有者與運行程式的使用者不一致,當然如果你在root使用者下運行則不存在這個問題,因為公開金鑰匯入到了root使用者的密鑰庫。
公開金鑰匯入成功後會有如些提示:
gpg: requesting key 985E0E11 from hkp server wwwkeys.eu.pgp.net
gpg: key 985E0E11: public key “Launchpad PPA for ibus-dev” imported
gpg: Total number processed: 1
gpg: imported: 1 (RSA: 1)
下一步是讓apt-get 來使用這個公開金鑰
$gpg –armor –export 985E0E11| sudo apt-key add -
注意apt-key add要用特權使用者來運行才可以,也就是要用sudo來運行,不然有如下錯誤提示:
gpg: no writable keyring found: eof
gpg: error reading `-’: general error
gpg: import from `-’ failed: general error
匯入成功後sudo apt-get update就不會有錯誤提示了。
原文網址:http://www.coder4.com/archives/1445