Ubuntu:解決非官方源導致的GPG error

來源:互聯網
上載者:User
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

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.