keyserver timed out when trying to add a GPG public key

This is usually caused by your firewall blocking the port 11371. You could unblock the port in your firewall. In case you don't have access to the firewall you could:

Force it to use port 80 instead of 11371

    gpg --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 94558F59

Alternatively

  • Find and open the key from the key server.
  • Copy it's contents into a text file.
  • Go to System Tool > Preferences > Software Sources > Authentication > Add key, and select the text file created. Ubuntu 14.04 and later try: Software Center -> Edit -> Software Sources -> Authentication -> Import key file

sudo gpg --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys SOMEKEY


This worked for me:

sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com --recv-keys AKEYXXX

Tags:

Bash

Ubuntu

Gpg