Authenticating and adding public key for apt

13,736

Solution 1

gpg is probably using a port that's blocked by your (or an upstream) firewall. From this page which I found by googling 'keyserver.ubuntu.com: Connection refused':

Ubuntu Personal Package Archives (PPA) are an easy way for developers to make their source packages available to the common user (like myself) through APT, Debian's great package manager. Packages from the default repositories are often out of date, where the developer has published newer versions that may have fixed serious bugs. In order to ensure that the ppa is trusted, an encrypted connection over gpg is used. However, apt by default connects via port 11371, likely to be blocked if you are behind a corporate firewall.

The bug is fixed by default in 11.04, and the author references a couple of possible interim fixes. If that's not it, then maybe keyserver.ubuntu.com was down for some reason?

Solution 2

sudo apt-get add k.txt

should be

sudo apt-key add k.txt

Share:
13,736

Related videos on Youtube

highBandWidth
Author by

highBandWidth

Updated on September 18, 2022

Comments

  • highBandWidth
    highBandWidth over 1 year

    I was trying to get the official mongodb for Ubuntu, following the instructions at http://www.mongodb.org/display/DOCS/Ubuntu+and+Debian+packages

    After adding the deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen line in my sources, I need to add the pgp key since synaptic says

    W: GPG error: http://downloads-distro.mongodb.org dist Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 9ECBEC467F0CEB10
    

    Again following instructions, I did sudo apt-key adv --keyserver keyserver.ubuntu.com --recv 7F0CEB10

    this says

    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 7F0CEB10
    gpg: requesting key 7F0CEB10 from hkp server keyserver.ubuntu.com
    ?: keyserver.ubuntu.com: Connection refused
    gpgkeys: HTTP fetch error 7: couldn't connect: Connection refused
    gpg: no valid OpenPGP data found.
    gpg: Total number processed: 0
    

    Interestingly, I also get

    $ apt-key list
    gpg: fatal: /home/myname/.gnupg: directory does not exist!
    secmem usage: 0/0 bytes in 0/0 blocks of pool 0/32768
    

    How can I get apt to use this source? Update Just copying the key on the webpage at http://www.mongodb.org/display/DOCS/Ubuntu+and+Debian+packages to, say k.txt and then doing

    sudo apt-key add k.txt
    

    works! Also, the apt-key list needed a sudo.

    However, that still doesn't tell me why apt-get cant get keys from keyserver.ubuntu.com