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

gpg: keyserver receive failed: No route to host #4215

Closed
DanielViglione opened this issue Oct 28, 2017 · 32 comments
Closed

gpg: keyserver receive failed: No route to host #4215

DanielViglione opened this issue Oct 28, 2017 · 32 comments
Assignees
Milestone

Comments

@DanielViglione
Copy link

This is not directly related to RVM. But if you look at your instructions page, it gives the following commands:

gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB

I have GPG (GNU Privacy Guard) installed on my Mac OSX Sierra via Homebrew. When I run this command, this it result:

$ gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
gpg: directory '/Users/viggy/.gnupg' created
gpg: keybox '/Users/viggy/.gnupg/pubring.kbx' created
gpg: keyserver receive failed: No route to host

How to resolve?

@DanielViglione
Copy link
Author

This worked, presumably providing an IPv4 compatible host:

gpg-connect-agent --dirmngr 'keyserver --hosttable'
gpg --keyserver hkp://b4ckbone.de --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB

@y00rb
Copy link

y00rb commented Nov 20, 2017

@DanielViglione please watching this document.
you should running before installation that instead of gpg --keyserver...:

curl -sSL https://rvm.io/mpapis.asc | gpg --import -

@pdeka
Copy link

pdeka commented Dec 28, 2017

Thanks, that seems to work for me.

benoittgt added a commit to benoittgt/travis-rubies that referenced this issue Feb 28, 2018
Build that was failing:
https://travis-ci.org/travis-ci/travis-rubies/jobs/347426899

Error:
```
The command "unset JRUBY_OPTS" exited with 0.
3.61s$ ./build.sh
update rvm
2.29s$ rvm remove 1.8.7
ruby-1.8.7-head - #already gone
/Users/travis/.rvm/bin/rvm: line 66: shell_session_update: command not found
/usr/local/bin/gpg
gpg: /Users/travis/.gnupg/trustdb.gpg: trustdb created
gpg: error reading key: No public key
gpg: keyserver receive failed: No route to host
The command "./build.sh" exited with 2.
```

- First error seems to be a well known issue : direnv/direnv#210
- Second error for gpg rvm/rvm#4215 (comment)
benoittgt added a commit to benoittgt/travis-rubies that referenced this issue Feb 28, 2018
Build that was failing:
https://travis-ci.org/travis-ci/travis-rubies/jobs/347426899

Error:
```
The command "unset JRUBY_OPTS" exited with 0.
3.61s$ ./build.sh
update rvm
2.29s$ rvm remove 1.8.7
ruby-1.8.7-head - #already gone
/Users/travis/.rvm/bin/rvm: line 66: shell_session_update: command not found
/usr/local/bin/gpg
gpg: /Users/travis/.gnupg/trustdb.gpg: trustdb created
gpg: error reading key: No public key
gpg: keyserver receive failed: No route to host
The command "./build.sh" exited with 2.
```

- First error seems to be a well known issue : direnv/direnv#210
- Second error for gpg rvm/rvm#4215 (comment)
@doviende
Copy link

doviende commented Nov 1, 2018

I ran into this problem on MacOS 10.13.6, and I currently suspect it's something weird with gpg deciding to use IPv6.

I currently don't have a valid global IPv6 address, so all IPv6 addrs should be "no route to host", but I noticed that if I manually look up keys.gnupg.net and substitute in one of the IPv4 addresses explicitly, then the command works and I can proceed, without doing the other workaround with curl.

$ gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
gpg: keyserver receive failed: No route to host

$ host keys.gnupg.net
keys.gnupg.net is an alias for hkps.pool.sks-keyservers.net.
hkps.pool.sks-keyservers.net has address 51.38.91.189 
hkps.pool.sks-keyservers.net has address 37.191.231.105
hkps.pool.sks-keyservers.net has address 192.146.137.99
hkps.pool.sks-keyservers.net has address 5.9.137.111
hkps.pool.sks-keyservers.net has address 192.146.137.98
hkps.pool.sks-keyservers.net has IPv6 address 2001:67c:26b4::99:0
hkps.pool.sks-keyservers.net has IPv6 address 2a01:4f8:190:1150::111
hkps.pool.sks-keyservers.net has IPv6 address 2001:41d0:800:d1e::82:0
hkps.pool.sks-keyservers.net has IPv6 address 2001:67c:26b4::98:0

$ gpg --keyserver hkp://51.38.91.189 --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
gpg: key 105BD0E739499BDB: 4 signatures not checked due to missing keys
gpg: key 105BD0E739499BDB: public key "Piotr Kuczynski <piotr.kuczynski@gmail.com>" imported
gpg: key 3804BB82D39DC0E3: 101 signatures not checked due to missing keys
gpg: key 3804BB82D39DC0E3: public key "Michal Papis (RVM signing) <mpapis@gmail.com>" imported
gpg: no ultimately trusted keys found
gpg: Total number processed: 2
gpg:               imported: 2

@doviende
Copy link

doviende commented Nov 2, 2018

Alternative workaround: You can forbid gpg's internal "dirmngr" from using IPv6 if that is your problem. Add the following line to ~/.gnupg/dirmngr.conf:

disable-ipv6

Make sure no existing dirmngr processes are still running (and kill them if they are), and then try your gpg --recv-keys command again as specified originally, and it should work (or at least does for me).

Note that the risk here is that if you really do need IPv6 later at some point, you may forget about this setting, but for most people this is unlikely.

@covard
Copy link

covard commented Dec 13, 2018

@doviende thank you so much for that, was driving me crazy

@pkuczynski
Copy link
Member

@doviende I added this info to rvm.io: rvm/rvm-site@e889114

With some other documentation fixes, I think we can close this issue.

@pkuczynski pkuczynski added this to the rvm-1.29.7 milestone Dec 24, 2018
@pkuczynski pkuczynski self-assigned this Dec 24, 2018
@sammcj
Copy link

sammcj commented Dec 27, 2018

Was just about to log a bug for this and I don't believe this bug should be closed as it is not IPv6 related.

This keys.gnupg.net DNS entry is handing out several DNS servers and one of them is malicious or at least dead.

The malicious or dead IP is: 37.191.231.105 which goes to a analytics / marketing login page https://analytics.sumptuouscapital.com.

~ dig keys.gnupg.net

; <<>> DiG 9.10.6 <<>> keys.gnupg.net
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 61921
;; flags: qr rd ra; QUERY: 1, ANSWER: 7, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;keys.gnupg.net.			IN	A

;; ANSWER SECTION:
keys.gnupg.net.		86161	IN	CNAME	hkps.pool.sks-keyservers.net.
hkps.pool.sks-keyservers.net. 3342 IN	A	37.191.231.105
hkps.pool.sks-keyservers.net. 3342 IN	A	51.38.91.189
hkps.pool.sks-keyservers.net. 3342 IN	A	37.17.173.9
hkps.pool.sks-keyservers.net. 3342 IN	A	192.146.137.99
hkps.pool.sks-keyservers.net. 3342 IN	A	46.4.246.179
hkps.pool.sks-keyservers.net. 3342 IN	A	192.146.137.98

According to sks-keyservers.net, you should be using hkp://pool.sks-keyservers.net which does not hand out said dodgy IP.

cc/ @pkuczynski

@noelruault
Copy link

noelruault commented Dec 27, 2018

The following code can be used in a script, as far as it will be compatible despite of future changes in the IPs (from keys.gnupg.net) or the recv-keys

gpg --keyserver
  hkp://$(host keys.gnupg.net | grep -oE "\b([0-9]{1,3}\.){3}[0-9]{1,3}\b" | head -1) 
  $(\curl -sSL https://get.rvm.io | grep -Eo '*--recv-keys.*')

___________ Example ___________

$ gpg --keyserver hkp://$(host keys.gnupg.net | grep -oE "\b([0-9]{1,3}\.){3}[0-9]{1,3}\b" | head -1) $(\curl -sSL https://get.rvm.io | grep -Eo '*--recv-keys.*')
gpg: key 105BD0E739499BDB: 4 signatures not checked due to missing keys
gpg: key 105BD0E739499BDB: "Piotr Kuczynski <piotr.kuczynski@gmail.com>" not changed
gpg: key 3804BB82D39DC0E3: 101 signatures not checked due to missing keys
gpg: key 3804BB82D39DC0E3: "Michal Papis (RVM signing) <mpapis@gmail.com>" not changed
gpg: Total number processed: 2
gpg:              unchanged: 2

@pkuczynski
Copy link
Member

@sammcj thanks for noting! Changes made in #4550 as well as in rvm.io site

@shivanraptor
Copy link

Alternative workaround: You can forbid gpg's internal "dirmngr" from using IPv6 if that is your problem. Add the following line to ~/.gnupg/dirmngr.conf:

disable-ipv6

Make sure no existing dirmngr processes are still running (and kill them if they are), and then try your gpg --recv-keys command again as specified originally, and it should work (or at least does for me).

Note that the risk here is that if you really do need IPv6 later at some point, you may forget about this setting, but for most people this is unlikely.

To restart dirmngr, the following command can be used:

gpgconf --kill all

@texpert
Copy link

texpert commented May 21, 2019

This is working without having to disable ipv6:

gpg --keyserver hkp://ipv4.pool.sks-keyservers.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB

@thomasrussellmurphy
Copy link

thomasrussellmurphy commented Jun 21, 2019

Since this is coming up in the Google search results for this GPG issue, I will add that using standard-resolver in place of disable-ipv6 in ~/.gnupg/dirmngr.conf also works. It is possible that an aged gpg.conf and absent dirmngr.conf may be a partial cause of this.

edit: forgot words

@anthonybrown
Copy link

I had the same problem, couldn't install rvm because gpg wasn't able to get the keys. I've tried all the solutions but nothing worked for me. After reading a little more, I found that docker is a problem.
I shut the docker server off and bingo, I was able to run the \curl -L https://get.rvm.io | bash -s stable and was able to install RVM!

@Schwad
Copy link

Schwad commented Aug 19, 2019

Hi - @texpert 's answer was the closest for me, but it turns out I was possibly fighting a firewall so had to force port 80 and use: gpg --keyserver hkp://ipv4.pool.sks-keyservers.net:80 --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB

@saper
Copy link

saper commented Oct 30, 2019

I will add that using standard-resolver in place of disable-ipv6 in ~/.gnupg/dirmngr.conf also works.

I also came here because of the search engine. disable-ipv6 didn't work for me, but standard-resolver did. Also make sure to kill any dirmngr process running.

@djdman2000
Copy link

I just ran into this and followed the suggestion on this Medium post and then \curl -L https://get.rvm.io | bash -s stable which worked.

BrandonMathis added a commit to BrandonMathis/ruby-orb that referenced this issue Jul 7, 2020
They GPG key import command also failed locally on my machine. This issue provided some insight into the problem.

rvm/rvm#4215

Moving to IPV4 keyserver fixes things
KyleTryon pushed a commit to CircleCI-Public/ruby-orb that referenced this issue Jul 8, 2020
They GPG key import command also failed locally on my machine. This issue provided some insight into the problem.

rvm/rvm#4215

Moving to IPV4 keyserver fixes things
@saquibkhan
Copy link

use hkp://ipv4.pool.sks-keyservers.net

@abinhho
Copy link

abinhho commented Apr 4, 2021

Confirmed change to

gpg --keyserver hkp://ipv4.pool.sks-keyservers.net --recv-keys BCE9D9A42D51784F

worked fine.

@mPanasiewicz
Copy link

gpg --keyserver hkp://ipv4.pool.sks-keyservers.net --recv-keys ............... worked for me

@atalis
Copy link

atalis commented Jul 9, 2021

I'm getting gpg: keyserver receive failed: No keyserver available when i run
gpg --keyserver hkp://ipv4.pool.sks-keyservers.net --recv-keys ...............

I followed the suggestion in Medium post and ran gpg-connect-agent. Don't know what the output means though:

> gpg-connect-agent --dirmngr 'keyserver --hosttable'
S # hosttable (idx, ipv6, ipv4, dead, name, time):
S #   0       pool.sks-keyservers.net
S #   1       ipv4.pool.sks-keyservers.net
OK

@y00rb
Copy link

y00rb commented Jul 9, 2021

@atalis
please try gpg2 --keyserver keyserver.ubuntu.com --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB

@vikramvi
Copy link

Anybody has got working solution as last few posts are not working on Mac 10.15.7

@vikramvi
Copy link

vikramvi commented Jul 10, 2021

I just ran into this and followed the suggestion on this Medium post and then \curl -L https://get.rvm.io | bash -s stable which worked.

I did above steps and got below

Vikrams-MacBook-Pro:~ abcd$ gpg --keyserver keyserver.ubuntu.com --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB gpg: /Users/abcd/.gnupg/trustdb.gpg: trustdb created gpg: key 105BD0E739499BDB: public key "Piotr Kuczynski <piotr.kuczynski@gmail.com>" imported gpg: key 3804BB82D39DC0E3: public key "Michal Papis (RVM signing) <mpapis@gmail.com>" imported gpg: Total number processed: 2 gpg: imported: 2

Is it safe to any random person's public key ?

Vikrams-MacBook-Pro:~ abcd$ gpg-connect-agent --dirmngr 'keyserver --hosttable'
S # hosttable (idx, ipv6, ipv4, dead, name, time):
S #   0       pool.sks-keyservers.net
S #   1       keyserver.ubuntu.com
S #   .       keyserver.ubuntu.com
S #   .   --> 3 2*
S #   2   4   162.213.33.9 (keyserver.ubuntu.com)
S #   3   4   162.213.33.8 (keyserver.ubuntu.com)
S #   4 6 4   keys.openpgp.org ([2a00:c6c0:0:154:1::1])
S #   5       hkps.pool.sks-keyservers.net
S #   6   4   51.38.91.189 (ip189.ip-51-38-91.eu)
S #   7       ipv4.pool.sks-keyservers.net
OK
> 

@atalis
Copy link

atalis commented Jul 10, 2021

@atalis
please try gpg2 --keyserver keyserver.ubuntu.com --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB

gpg2 isn't recognized, even after i attempted to install gnupg2. I ended up abandoning rvm (for which i needed to get the keys) and install rbenv instead.

@FelipeGalante
Copy link

@atalis
please try gpg2 --keyserver keyserver.ubuntu.com --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB

gpg2 isn't recognized, even after i attempted to install gnupg2. I ended up abandoning rvm (for which i needed to get the keys) and install rbenv instead.

Try only gpg instead of gpg2, that might going to work for you.

gpg --keyserver keyserver.ubuntu.com --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB

@SanaullaParvez
Copy link

Just use an other GPG key server like:

gpg --keyserver hkp://keyserver.ubuntu.com --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB

@tigermaffia
Copy link

good evening

I'm having trouble installing the script I keep getting these errors
I'm not that familiar with scripting so I'm asking you for help I'd love to hear from you

thanks in advance

Security and Settings Alerts
It is important for security and performance of your server that everything is configured correctly.
To help you with this, we do a few automatic checks.
See the related documentation for more information.

There are errors in your configuration.
Last performed background task 1 hour ago.
Something seems to have gone wrong.
PHP configuration option output_buffering must be disabled
The "Strict-Transport-Security" HTTP header is not set as a minimum of "15552000" seconds.
For enhanced security, we recommend enabling HSTS.
Your web server is not set up properly to find "/.well-known/caldav".
Your web server is not set up properly to find "/.well-known/carddav".
Your installation does not have a default phone region. This is necessary to validate phone numbers in the profile settings without a country code.
To allow numbers without a country code, add "default_phone_region" with the respective ISO 3166-1 code.
No memory cache is configured. To increase performance you can configure the memcache if it is available.
The PHP OPcache is not loaded. For better performance, we recommend loading it in your php.ini settings.
This server is missing a few recommended PHP modules. We recommend installing it for better performance and compatibility.
imagick
Read the installation manual ↗ carefully and check the logs for errors and warnings.

Check the security of your Nextcloud via our security scan ↗.

Version
Nextcloud Hub II (23.0.0)

Invalid private key for the crypto app. Update the private key password in your personal settings to regain access to your encrypted files.

@gabrielgaraujo
Copy link

As @y00rb told us, the information on RVM security page says:

If you encounter problem with the key server above, try a different one. Some alternatives are presented below:

hkp://ipv4.pool.sks-keyservers.net
hkp://pgp.mit.edu
hkp://keyserver.pgp.com

I've tried with hkp://pgp.mit.edu and it worked

@aflansburg
Copy link

Just use an other GPG key server like:

gpg --keyserver hkp://keyserver.ubuntu.com --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB

Out of all of the urls provided, this is the only one that worked ¯_(ツ)_/¯

@willc0de4food
Copy link

gpg --keyserver hkp://keyserver.ubuntu.com --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB

Why don't they update their website with this info..? 🤔

@chrisallenlane
Copy link

Only the Ubuntu keyserver worked for me as well. DNS doesn't even appear to resolve for the domains specified in the documentation:

chris@longarm:~$ host pool.sks-keyservers.net
Host pool.sks-keyservers.net not found: 2(SERVFAIL)
chris@longarm:~$ host ipv4.pool.sks-keyservers.net
Host ipv4.pool.sks-keyservers.net not found: 2(SERVFAIL)

DavidYang2149 added a commit to DavidYang2149/davidyang2149-jekyll-skeleton that referenced this issue Nov 29, 2022
루비 설치시 기존 keyserver 주소가 작동하지 않아 유효한 링크로
변경합니다.
See also: rvm/rvm#4215 (comment)
DavidYang2149 added a commit to DavidYang2149/davidyang2149-jekyll-skeleton that referenced this issue Nov 30, 2022
루비 설치시 기존 keyserver 주소가 작동하지 않아 유효한 링크로
변경합니다.
See also: rvm/rvm#4215 (comment)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests