Ubuntu:解决非官方源导致的GPG error

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

转载于:https://my.oschina.net/victorlovecode/blog/344305

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值