歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網

GPG error

日期:2017/3/3 12:42:48   编辑:Linux技術
原文章:點擊打開鏈接
當我們在/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就不會有錯誤提示了。
Copyright © Linux教程網 All Rights Reserved