Under ubuntu, we always need to add PPA to our apt repo.but we maybe failed when add gpg key because our pc is behind a proxy:

$launchpad-update.sh
[sudo] password for dannoy:
Grabbing key 4C9D234C for archive webupd8 by ~nilarimogard
[sudo] password for dannoy:
Executing: gpg –ignore-time-conflict –no-options –no-default-keyring –secret-keyring /etc/apt/secring.gpg –trustdb-name /etc/apt/trustdb.gpg –keyring /etc/apt/trusted.gpg –primary-keyring /etc/apt/trusted.gpg –recv-keys –keyserver keyserver.ubuntu.com 4C9D234C
gpg: 下载密钥‘4C9D234C’,从 hkp 服务器 keyserver.ubuntu.com
gpgkeys: HTTP fetch error 7: couldn’t connect to host
gpg: 找不到有效的 OpenPGP 数据。
gpg: 合计被处理的数量:0
Grabbing key 484B044F for archive ppa by ~kernel-ppa
Executing: gpg –ignore-time-conflict –no-options –no-default-keyring –secret-keyring /etc/apt/secring.gpg –trustdb-name /etc/apt/trustdb.gpg –keyring /etc/apt/trusted.gpg –primary-keyring /etc/apt/trusted.gpg –recv-keys –keyserver keyserver.ubuntu.com 484B044F

And:

$ gpg –keyserver-options http-proxy=”http://172.16.55.51:808″ –ignore-time-conflict –no-options –no-default-keyring –secret-keyring /etc/apt/secring.gpg –trustdb-name /etc/apt/trustdb.gpg –keyring /etc/apt/trusted.gpg –primary-keyring /etc/apt/trusted.gpg –keyserver keyserver.ubuntu.com –recv 800AA67AE64A6D9E1859C561A8267963484B044F
gpg: 下载密钥‘484B044F’,从 hkp 服务器 keyserver.ubuntu.com
gpgkeys: HTTP fetch error 52: Empty reply from server
gpg: 找不到有效的 OpenPGP 数据。
gpg: 合计被处理的数量:0

I don’t know why http-proxy options does not work,anybody knows?

I found a resolutions to handle this:
1.Use firefox open the following url(“72D340A3″ should be replace by the copy from the command showing before):
http://keyserver.ubuntu.com:11371/pks/lookup?op=get&options=mr&search=0x72D340A3
2.copy the content to a.gpg
—–BEGIN PGP PUBLIC KEY BLOCK—–
…….
—–END PGP PUBLIC KEY BLOCK—–
3.Use the following command to import:
$ sudo gpg –keyserver-options http-proxy=”127.0.0.1:8087” –ignore-time-conflict –no-options –no-default-keyring –secret-keyring /etc/apt/secring.gpg –trustdb-name /etc/apt/trustdb.gpg –keyring /etc/apt/trusted.gpg –primary-keyring /etc/apt/trusted.gpg –import a.gpg
4.sudo apt-get udpate
5.over

Advertisements