GPG and Apt-Key make agents that do not read directly from the terminal set up and need to be set separately. Keyserver timed out when trying to add a GPG public key – Unix & Linux Stack Exchange
for example, the default command is:
gpg --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys SOMEKEY
apt-key adv --keyserver hkp://keyserver.ubuntu.com --recv-keys AKEYXXX
The error of not setting the agent is as follows:
root@ubuntu:/home/zhang# apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv E0C56BD4
Executing: /tmp/apt-key-gpghome.ar8g11QK0Q/gpg.1.sh --keyserver hkp://keyserver.ubuntu.com:80 --recv E0C56BD4
gpg: keyserver receive failed: Connection timed out
Set the agent as follows:
gpg --keyserver-options http-proxy=test.com:8080/" --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys SOMEKEY
apt-key adv --keyserver-options http-proxy=test.com:8080/" --keyserver hkp://keyserver.ubuntu.com --recv-keys AKEYXXX
div>