sudo apt-key adv fails intermittently - circleci

I am following the instructions for installing Yarn on CircleCI, but CircleCI is showing these errors when trying to check the key server:
sudo apt-key adv --keyserver pgp.mit.edu --recv D101F7899D41F3C3
Executing: gpg --ignore-time-conflict --no-options --no-default-keyring --secret-keyring /tmp/tmp.j5q2IRFiKK --trustdb-name /etc/apt/trustdb.gpg --keyring /etc/apt/trusted.gpg --primary-keyring /etc/apt/trusted.gpg --keyring /etc/apt/trusted.gpg.d//apt.postgresql.org.gpg --keyserver pgp.mit.edu --recv D101F7899D41F3C3
gpg: requesting key 9D41F3C3 from hkp server pgp.mit.edu
gpgkeys: key D101F7899D41F3C3 not found on keyserver
gpg: no valid OpenPGP data found.
gpg: Total number processed: 0
sudo apt-key adv --keyserver pgp.mit.edu --recv D101F7899D41F3C3 returned exit code 2
Action failed: sudo apt-key adv --keyserver pgp.mit.edu --recv D101F7899D41F3C3

The error message means that GPG couldn't load the public GPG key used to verify the package signatures. Try doing this instead:
sudo apt-key adv --fetch-keys http://dl.yarnpkg.com/debian/pubkey.gpg
The issue is that the pgp.mit.edu keyserver sometimes has outages, which results in the error message you're seeing. Loading the GPG key via URL should be more reliable.

Related

Can I use another gpg keyserver when all given gpg keyserver are not available?

I'm trying to build a docker image with given dockerfiles: https://github.com/31z4/storm-docker/blob/4c2804fa4365f62c3b6009d3496661542e4d446a/2.2.0/Dockerfile
But docker build command occurs an error as below:
gpg --keyserver ha.pool.sks-keyservers.net --recv-key 79B03D059E628478FC9F1D8B152CAD0C46E87B61 gpg: keybox
'/tmp/tmp.r0rdSZG7mG/pubring.kbx' created gpg: keyserver receive
failed: Connection timed out
gpg --keyserver pgp.mit.edu --recv-keys 79B03D059E628478FC9F1D8B152CAD0C46E87B61 gpg: keyserver receive
failed: Connection timed out
gpg --keyserver keyserver.pgp.com --recv-keys 79B03D059E628478FC9F1D8B152CAD0C46E87B61 gpg: keyserver receive
failed: Connection timed out
I'm not familiar to gpg keyserver, but it seems that some keyserver addresses are exchangeable.
Can I find another gpg keyserver that can replace the existing keyservers?
I wrote a bash script that allows you to check upon multiple sources:
https://github.com/duxsco/gpg-config-and-scripts#pull-public-keys
You could also do:
gpg --auto-key-locate clear,dane,wkd,pka,cert,hkps://keys.openpgp.org,hkps://keys.mailvelope.com,hkps://keys.gentoo.org,hkps://keyserver.ubuntu.com --locate-external-keys <KeyID>

Gpg key server showing 'gpg: keyserver receive failed: No dirmngr' while installing rvm

I am trying to install rvm in my Ubuntu 18.04.2 LTS and am getting error while installing gpg keys.
Command:
gpg --keyserver hkp://pool.sks-keyservers.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
Error:
gpg: connecting dirmngr at '/run/user/1000/gnupg/S.dirmngr' failed: IPC connect call failed
gpg: keyserver receive failed: No dirmngr
dirmngr is installed.
You can run the same key using Sudo Command I am Sure the run and perfectly wrok
sudo apt-key adv --recv-keys --keyserver hkp://p80.pool.sks-keyservers.net:80 7638D0442B90D010

Why does this apt-key adv command give an error?

This is a snippet of a Dockerfile that is exhibiting an error that I don't understand:
FROM dorowu/ubuntu-desktop-lxde-vnc
LABEL maintainer "bpinaya#wpi.edu"
# Adding keys for ROS
RUN sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
RUN apt-key adv --keyserver hkp://ha.pool.sks-keyservers.net:80 --recv-key 421C365BD9FF1F717815A3895523BAEEB01FA116
Gives this result
RUN apt-key adv --keyserver hkp://ha.pool.sks-keyservers.net:80 --recv-key 421C365BD9FF1F717815A3895523BAEEB01FA116
---> Running in 7bb30729ec87
Warning: apt-key output should not be parsed (stdout is not a terminal)
Executing: /tmp/apt-key-gpghome.HkofyyhjvI/gpg.1.sh --keyserver hkp://ha.pool.sks-keyservers.net:80 --recv-key 421C365BD9FF1F717815A3895523BAEEB01FA116
gpg: failed to start the dirmngr '/usr/bin/dirmngr': No such file or directory
gpg: connecting dirmngr at '/tmp/apt-key-gpghome.HkofyyhjvI/S.dirmngr' failed: No such file or directory
gpg: keyserver receive failed: No dirmngr
The command '/bin/sh -c apt-key adv --keyserver hkp://ha.pool.sks-keyservers.net:80 --recv-key 421C365BD9FF1F717815A3895523BAEEB01FA116' returned a non-zero code: 2
According to this post here, you need to install dirmngr. I also needed to install gnupg in order to get this to work on my local docker container when testing.
I updated your Dockerfile code below with my changes:
FROM dorowu/ubuntu-desktop-lxde-vnc
LABEL maintainer "bpinaya#wpi.edu"
# Update
RUN apt-get update && \
apt-get upgrade -y
# Install required packages
RUN apt-get install -y \
dirmngr \
gnupg
# Adding keys for ROS
RUN sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
RUN apt-key adv --keyserver hkp://ha.pool.sks-keyservers.net --recv-key 421C365BD9FF1F717815A3895523BAEEB01FA116
This gave me the following output on the last step:
Step 6/6 : RUN apt-key adv --keyserver hkp://pgp.mit.edu:80 --recv-key 421C365BD9FF1F717815A3895523BAEEB01FA116
---> Running in a0cfb3588173
Warning: apt-key output should not be parsed (stdout is not a terminal)
Executing: /tmp/apt-key-gpghome.USze27holj/gpg.1.sh --keyserver hkp://pgp.mit.edu:80 --recv-key 421C365BD9FF1F717815A3895523BAEEB01FA116
gpg: key 5523BAEEB01FA116: public key "ROS Builder <rosbuild#ros.org>" imported
gpg: Total number processed: 1
gpg: imported: 1
Occasionally this reports back with the following error:
gpg: keyserver receive failed: Cannot assign requested address
That error doesn't seem consistent though, so it could be something with my own network connection.
I wanted to comment but don't have enough reputation to. Please consider my answer as an appendix to #brian-elliott 's answer. Dirmngr seems to have some strange default setup to use tor or some non-standard DNS. So make sure you have something like this:
standard-resolver
keyserver keyserver.ubuntu.com
keyserver keys.gnupg.net
in your ~/.gnupg/dirmngr.conf

Docker - Failing to get PGP Keys

I am trying to run a docker build on an existing project.
I am getting this error on one of my steps
Step 3/18 : RUN set -ex && for key in 9554F04D7259F04124DE6B476D5A82AC7E37093B 94AE36675C464D64BAFA68DD7434390BDBE9B9C5 FD3A5288F042B6850C66B31F09FE44734EB7990E 71DCFD284A79C3B38668286BC97EC7A07EDE3FC1 DD8F2338BAE7501E3DD5AC78C273792F7D83545D B9AE9905FFD7803F25714661B63B535A4C206CA9 C4F0DFFF4E8C1A8236409D08E73BC641CC11F4C8 56730D5401028683275BD23C23EFEFE93C4CFFFE ; do gpg --keyserver pgp.mit.edu --recv-keys "$key" || gpg --keyserver keyserver.pgp.com --recv-keys "$key" || gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$key" ; done
---> Running in 9e13560f6a4c
+ gpg --keyserver pgp.mit.edu --recv-keys 9554F04D7259F04124DE6B476D5A82AC7E37093B
gpg: directory `/root/.gnupg' created
gpg: new configuration file `/root/.gnupg/gpg.conf' created
gpg: WARNING: options in `/root/.gnupg/gpg.conf' are not yet active during this run
gpg: keyring `/root/.gnupg/secring.gpg' created
gpg: keyring `/root/.gnupg/pubring.gpg' created
gpg: requesting key 7E37093B from hkp server pgp.mit.edu
gpg: /root/.gnupg/trustdb.gpg: trustdb created
gpg: key 7E37093B: public key "Christopher Dickinson <christopher.s.dickinson#gmail.com>" imported
gpg: no ultimately trusted keys found
gpg: Total number processed: 1
gpg: imported: 1 (RSA: 1)
+ gpg --keyserver pgp.mit.edu --recv-keys 94AE36675C464D64BAFA68DD7434390BDBE9B9C5
gpg: requesting key DBE9B9C5 from hkp server pgp.mit.edu
?: pgp.mit.edu: Host not found
gpgkeys: HTTP fetch error 7: couldn't connect: Success
gpg: no valid OpenPGP data found.
gpg: Total number processed: 0
+ gpg --keyserver keyserver.pgp.com --recv-keys 94AE36675C464D64BAFA68DD7434390BDBE9B9C5
gpg: requesting key DBE9B9C5 from hkp server keyserver.pgp.com
?: keyserver.pgp.com: Host not found
gpgkeys: HTTP fetch error 7: couldn't connect: Success
gpg: no valid OpenPGP data found.
gpg: Total number processed: 0
+ gpg --keyserver ha.pool.sks-keyservers.net --recv-keys 94AE36675C464D64BAFA68DD7434390BDBE9B9C5
gpg: requesting key DBE9B9C5 from hkp server ha.pool.sks-keyservers.net
?: ha.pool.sks-keyservers.net: Host not found
gpgkeys: HTTP fetch error 7: couldn't connect: Success
gpg: no valid OpenPGP data found.
gpg: Total number processed: 0
Service 'dr-watson' failed to build: The command '/bin/sh -c set -ex && for key in 9554F04D7259F04124DE6B476D5A82AC7E37093B 94AE36675C464D64BAFA68DD7434390BDBE9B9C5 FD3A5288F042B6850C66B31F09FE44734EB7990E 71DCFD284A79C3B38668286BC97EC7A07EDE3FC1 DD8F2338BAE7501E3DD5AC78C273792F7D83545D B9AE9905FFD7803F25714661B63B535A4C206CA9 C4F0DFFF4E8C1A8236409D08E73BC641CC11F4C8 56730D5401028683275BD23C23EFEFE93C4CFFFE ; do gpg --keyserver pgp.mit.edu --recv-keys "$key" || gpg --keyserver keyserver.pgp.com --recv-keys "$key" || gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$key" ; done' returned a non-zero code: 2
Does anyone know how to resolve this?
Thanks
Damien
I updated the servers as per github dockerfile template and this resolved the issue.

Installing rvm in ubuntu 14.04

I have trying to install rvm and I found the following message in the terminal after I typed this: curl -L https://get.rvm.io | bash -s stable
GPG signature verification failed for '/home/ephraim/.rvm/archives/rvm-1.26.3.tgz' - 'https://github.com/wayneeseguin/rvm/releases/download/1.26.3/1.26.3.tar.gz.asc'!
try downloading the signatures:
gpg --keyserver hkp://keys.gnupg.net --recv-keys D39DC0E3
or if it fails:
command curl -sSL https://rvm.io/mpapis.asc | gpg --import -
the key can be compared with:
https://rvm.io/mpapis.asc
https://keybase.io/mpapis
How can I get rid of these problems?
Follow the instructions in the error and run,
gpg --keyserver hkp://keys.gnupg.net --recv-keys D39DC0E3
You can download the signature and import manually.
Get the signature:
curl -#LO https://rvm.io/mpapis.asc
Import signature:
gpg --import mpapis.asc
This will resolve your problem.
Depending on your needs you may need to run:
gpg2 --keyserver hkp://keys.gnupg.net --recv-keys D39DC0E3
Note gpg2, not gpg as mentioned in instruction. Here more details as found. This should be helpful. Make sure you run gpg command while logged in as the same OS user who makes rvm installation.

Resources