Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue importing gpg key: gpg: keyserver receive failed: Cannot assign requested address #9

Closed
jcalfee opened this issue Jun 27, 2018 · 15 comments
Assignees

Comments

@jcalfee
Copy link

jcalfee commented Jun 27, 2018

I'm having an issue importing the key:

Step 4/8 : RUN gpg --keyserver hkp://keys.gnupg.net --recv-keys 38DBBDC86092693E
 ---> Running in 857af6ee308a
gpg: directory '/root/.gnupg' created
gpg: keybox '/root/.gnupg/pubring.kbx' created
gpg: keyserver receive failed: Cannot assign requested address

Environment:

FROM debian:stretch

RUN apt update
RUN apt install -y bc binfmt-support bzip2 fakeroot gcc gcc-arm-linux-gnueabihf git gnupg make parted qemu-user-static wget xz-utils zip debootstrap
RUN gpg --keyserver hkp://keys.gnupg.net --recv-keys 38DBBDC86092693E
RUN gpg --keyserver hkp://keys.gnupg.net --recv-keys 87F9F635D31D7652

RUN git clone https://github.com/inversepath/usbarmory-debian-base_image.git
WORKDIR /usbarmory-debian-base_image
RUN make all

But it works with gpg2:

RUN apt install -y gnupg2
RUN gpg2 --keyserver hkp://keys.gnupg.net --recv-keys 38DBBDC86092693E

Related: rvm/rvm#3544

Feel free to close this issue. I'm mostly documenting the error.

@andrejro
Copy link
Contributor

andrejro commented Jul 2, 2018

Hi!

I think this is only a Debian 8 related issue where gnupg binds to gnupg1. On Debian 9,
which is the one we support, the gnupg binds to gnupg2.
Instead, we found that dirmngr package should be added to the list of dependancies.

Can you just confirm that you are using Debian 8?

@jcalfee
Copy link
Author

jcalfee commented Jul 3, 2018

It is debian:stretch (Debian 9)

FROM debian:stretch
...

@andrejro
Copy link
Contributor

andrejro commented Jul 4, 2018

Sorry, I missed that.
But in Debian 9 the gpg binary is gpg2:

/usr/bin/gpg --version
gpg (GnuPG) 2.1.18
libgcrypt 1.7.6-beta
Copyright (C) 2017 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later https://gnu.org/licenses/gpl.html
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Home: /root/.gnupg
Supported algorithms:
Pubkey: RSA, ELG, DSA, ECDH, ECDSA, EDDSA
Cipher: IDEA, 3DES, CAST5, BLOWFISH, AES, AES192, AES256, TWOFISH,
CAMELLIA128, CAMELLIA192, CAMELLIA256
Hash: SHA1, RIPEMD160, SHA256, SHA384, SHA512, SHA224
Compression: Uncompressed, ZIP, ZLIB, BZIP2

Not sure what happen in your case, maybe for some reason dirmngr was not installed and the installation of gnupg2 package installed it as a dependence. Now we have documented the dirmngr requirement explicitly.

Thanks.

@mildsunrise
Copy link

This just happened to me in an unrelated container (docker/php; same setup, stretch and gnupg installed), and enabling IPv6 support in Docker allows GPG to bind and succeed even if you don't have IPv6 internet.

(Commenting here mainly because this is the first Google result for the error)

@lentschi
Copy link

lentschi commented Jan 5, 2019

For me adding the following to the Dockerfile did the trick:

RUN mkdir ~/.gnupg
RUN echo "disable-ipv6" >> ~/.gnupg/dirmngr.conf

The advantage to jmendeth's solution is that this doesn't require reconfiguring docker itself, saving users of the Dockerfile to take this extra preinstallation step. (The disadvantage is obvious: The Dockerfile needs to be changed.)

See https://rvm.io/rvm/security#ipv6-issues

(Like jmendeth I'm just commenting here because this was the first hit on Google. To me the error happened with a fresh FROM ubuntu:18.04 docker build)

@ericsubach
Copy link

lentschi's solution worked for me. I too was getting errors from fresh builds.

dnk8n added a commit to dnk8n/jupyter-rad that referenced this issue Jan 15, 2019
333miiko added a commit to WhenLamboMoon/docker-zen-node that referenced this issue Feb 15, 2019
Hope to fix: gpg: keyserver receive failed: Cannot assign requested address

usbarmory/usbarmory-debian-base_image#9
@ElijahLynn
Copy link

For me adding the following to the Dockerfile did the trick:

RUN mkdir ~/.gnupg
RUN echo "disable-ipv6" >> ~/.gnupg/dirmngr.conf

The advantage to jmendeth's solution is that this doesn't require reconfiguring docker itself, saving users of the Dockerfile to take this extra preinstallation step. (The disadvantage is obvious: The Dockerfile needs to be changed.)

See https://rvm.io/rvm/security#ipv6-issues

(Like jmendeth I'm just commenting here because this was the first hit on Google. To me the error happened with a fresh FROM ubuntu:18.04 docker build)

For those testing this with docker run, the rvm.io link mentions checking for existing processes. In my case I had already run the command once before so dirmngr was running which I killd then re-ran command and it worked. I was stumped as I did have the ipv6 disabling catted out.

@ElijahLynn
Copy link

ElijahLynn commented Feb 23, 2019

For me adding the following to the Dockerfile did the trick:

RUN mkdir ~/.gnupg
RUN echo "disable-ipv6" >> ~/.gnupg/dirmngr.conf

The advantage to jmendeth's solution is that this doesn't require reconfiguring docker itself, saving users of the Dockerfile to take this extra preinstallation step. (The disadvantage is obvious: The Dockerfile needs to be changed.)

See https://rvm.io/rvm/security#ipv6-issues

(Like jmendeth I'm just commenting here because this was the first hit on Google. To me the error happened with a fresh FROM ubuntu:18.04 docker build)

Since this is a top result in Google, and for newer Docker users this should really be combined into your existing RUN command if possible and at the very least squashed like this:

RUN mkdir ~/.gnupg && echo "disable-ipv6" >> ~/.gnupg/dirmngr.conf

As it will be one less cache layer and faster.

johnramsden added a commit to danboid/ALEZ that referenced this issue Mar 5, 2019
felliott added a commit to felliott/docker-library that referenced this issue Apr 2, 2019
 * gpg key verification occasionally fails due to network issues when
   attempting to fetch keys.  Combat this with two approaches:
   * Disable ipv6 testing in dirmngr.conf. [1]
   * Provide a fallback list of keyservers to pull from. [2]

 [1] usbarmory/usbarmory-debian-base_image#9 (comment)
 [2] tianon/gosu#39 (comment)
felliott added a commit to felliott/modular-file-renderer that referenced this issue Apr 2, 2019
 * gpg key verification occasionally fails due to network issues when
   attempting to fetch keys.  Combat this with two approaches:
   * Disable ipv6 testing in dirmngr.conf. [1]
   * Provide a fallback list of keyservers to pull from. [2]

 [1] usbarmory/usbarmory-debian-base_image#9 (comment)
 [2] tianon/gosu#39 (comment)
harpreetpaul added a commit to harpreetpaul/cassandra that referenced this issue Apr 19, 2019
fix gpg error. Solution reference
usbarmory/usbarmory-debian-base_image#9
fujimotodaisuke pushed a commit to RCOSDP/RDM-modular-file-renderer that referenced this issue May 13, 2019
 * gpg key verification occasionally fails due to network issues when
   attempting to fetch keys.  Combat this with two approaches:
   * Disable ipv6 testing in dirmngr.conf. [1]
   * Provide a fallback list of keyservers to pull from. [2]

 [1] usbarmory/usbarmory-debian-base_image#9 (comment)
 [2] tianon/gosu#39 (comment)
@blak3mill3r
Copy link

blak3mill3r commented Jun 5, 2019

I solved this by restarting the Docker daemon (host machine is Ubuntu Xenial)

$ sudo service docker restart

@MichaelBrenden
Copy link

As mentioned above, this worked for me also:

RUN mkdir ~/.gnupg
RUN echo "disable-ipv6" >> ~/.gnupg/dirmngr.conf

But to overcome another, intermittent problem (name resolution failure, due to slow DNS response), Dockerfile also needed this --

RUN ping -c 10 download.redis.io && ping -c 10 pool.sks-keyservers.net

@webbnh
Copy link

webbnh commented Jul 8, 2019

RUN mkdir ~/.gnupg && echo "disable-ipv6" >> ~/.gnupg/dirmngr.conf

It's subtle, but I needed the following, instead:

RUN mkdir ~/.gnupg || echo "disable-ipv6" >> ~/.gnupg/dirmngr.conf

(In my case, the container already had the directory.)

1gtm pushed a commit to appscode-images/mongo that referenced this issue Dec 1, 2024
1gtm pushed a commit to appscode-images/mongo that referenced this issue Dec 8, 2024
1gtm pushed a commit to appscode-images/mongo that referenced this issue Dec 15, 2024
1gtm pushed a commit to appscode-images/mongo that referenced this issue Dec 19, 2024
1gtm pushed a commit to appscode-images/mongo that referenced this issue Dec 21, 2024
1gtm pushed a commit to appscode-images/mongo that referenced this issue Dec 22, 2024
1gtm pushed a commit to appscode-images/mongo that referenced this issue Dec 28, 2024
1gtm pushed a commit to appscode-images/mongo that referenced this issue Dec 29, 2024
1gtm pushed a commit to appscode-images/mongo that referenced this issue Jan 4, 2025
1gtm pushed a commit to appscode-images/mongo that referenced this issue Jan 5, 2025
1gtm pushed a commit to appscode-images/mongo that referenced this issue Jan 6, 2025
1gtm pushed a commit to appscode-images/mongo that referenced this issue Jan 11, 2025
1gtm pushed a commit to appscode-images/mongo that referenced this issue Jan 12, 2025
1gtm pushed a commit to appscode-images/mongo that referenced this issue Jan 18, 2025
1gtm pushed a commit to appscode-images/mongo that referenced this issue Jan 19, 2025
1gtm pushed a commit to appscode-images/mongo that referenced this issue Jan 25, 2025
1gtm pushed a commit to appscode-images/mongo that referenced this issue Jan 26, 2025
1gtm pushed a commit to appscode-images/mongo that referenced this issue Feb 1, 2025
1gtm pushed a commit to appscode-images/mongo that referenced this issue Feb 2, 2025
1gtm pushed a commit to appscode-images/mongo that referenced this issue Feb 8, 2025
1gtm pushed a commit to appscode-images/mongo that referenced this issue Feb 9, 2025
1gtm pushed a commit to appscode-images/mongo that referenced this issue Feb 15, 2025
1gtm pushed a commit to appscode-images/mongo that referenced this issue Feb 16, 2025
1gtm pushed a commit to appscode-images/mongo that referenced this issue Feb 22, 2025
1gtm pushed a commit to appscode-images/mongo that referenced this issue Feb 23, 2025
1gtm pushed a commit to appscode-images/mongo that referenced this issue Mar 1, 2025
1gtm pushed a commit to appscode-images/mongo that referenced this issue Mar 2, 2025
1gtm pushed a commit to appscode-images/mongo that referenced this issue Mar 8, 2025
1gtm pushed a commit to appscode-images/mongo that referenced this issue Mar 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests