Thursday, February 10, 2011

Ubuntu Keyserver not accessible

Don't you hate it when this happens?

root@hakan-pc:~# sudo add-apt-repository ppa:libreoffice/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 --keyserver keyserver.ubuntu.com --recv 36E81C9267FD1383FCC4490983FBA1751378B444
gpg: requesting key 1378B444 from hkp server keyserver.ubuntu.com
gpgkeys: HTTP fetch error 7: couldn't connect to host


This usually happens because the keyserver port is blocked by a corporate firewall. You can use an other machine to fetch the keys and load them.

Sample here for the libreoffice ppa:

Grab the fingerprint from the ppa page, i.e., 36E81C9267FD1383FCC4490983FBA1751378B444

gpg --keyserver keyserver.ubuntu.com --recv 36E81C9267FD1383FCC4490983FBA1751378B444
gpg --export --armor 36E81C9267FD1383FCC4490983FBA1751378B444 > libreoffice_ppa.key
scp libreoffice_ppa.key targetserver:~/

on the target server,

cat libreoffice_ppa.key | sudo apt-key add -
apt-get update

All done.