Welcome 微信登录

首页 / 操作系统 / Linux / Ubuntu:解决非官方源导致的GPG error

当我们在/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就不会有错误提示了。Ubuntu 蓝牙全攻略基础教程:Fedora/Linux下配置无线连接相关资讯      ubuntu安装  Ubuntu教程 
  • Linux系统教程:如何通过代理服务  (03月17日)
  • MacBook Air 安装 Ubuntu 双系统  (01/27/2015 16:21:32)
  • Ubuntu教程 - 使用Ubuntu拷贝CD和  (12/18/2013 14:38:16)
  • Linux系统入门教程: 当使用代理服  (11/08/2015 09:04:46)
  • Ubuntu安装到移动硬盘 & grub   (02/05/2014 19:52:51)
  • 完美安装Ubuntu 12.10最新AMD显卡  (11/27/2012 08:17:47)
本文评论 查看全部评论 (1)
表情: 姓名: 字数


评论声明
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容