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

Unable to import gpg keys for node on macOS #192

Closed
eng618 opened this issue Jan 20, 2021 · 20 comments · Fixed by #272
Closed

Unable to import gpg keys for node on macOS #192

eng618 opened this issue Jan 20, 2021 · 20 comments · Fixed by #272

Comments

@eng618
Copy link

eng618 commented Jan 20, 2021

Just set up a new dev Mac and trying to install node, when trying to add the gpg keys I'm getting the following errors.

bash -c '${ASDF_DATA_DIR:=$HOME/.asdf}/plugins/nodejs/bin/import-release-team-keyring'

gpg: keybox '/Users/engarcia/.gnupg/asdf-nodejs.gpg' created
gpg: keyserver receive failed: Network is unreachable
gpg: keyserver receive failed: No keyserver available
...
gpg: keyserver receive failed: Network is unreachable
gpg: keyserver receive failed: No keyserver available
@ruprict
Copy link

ruprict commented Feb 26, 2021

I had this issue today and created the file ~/.gnupg/dirmngr.conf and added the following line:

standard-resolver

And it fixed it for me. Not sure if this needs to be in the docs for asdf-nodejs (or other asdf tools)

@eng618
Copy link
Author

eng618 commented Feb 28, 2021

@ruprict i ended up doing the same thing and it worked for me as well. Forgot to come back here and post an update.

@augustobmoura
Copy link
Member

What's the reasoning behind standard-resolver? It's something general from GnuPG or something related to asdf-nodejs?

@augustobmoura
Copy link
Member

augustobmoura commented Mar 11, 2021

Also: can you guys send the OSes that have shown the problem? Because other similar problems showed up almost at the same time I suspect is a update of some distribution that introduced a incompatible default config, we might want to add this fix to the README

@ammarnajjar
Copy link

for what it's worth, the solution suggested here (#192 (comment)) did not work for me on its own:

$ echo "standard-resolver" >  ~/.gnupg/dirmngr.conf

I had to additionally do:

sudo pkill dirmngr

now keys are found and imported.

I am on:

  • macOS Big Sur v11.2.3
  • gpg (GnuPG) 2.2.27
  • asdf v0.8.0-c6145d0

ammarnajjar added a commit to ammarnajjar/dotfiles that referenced this issue Mar 12, 2021
@ruprict
Copy link

ruprict commented Mar 12, 2021

Also: can you guys send the OSes that have shown the problem? Because other similar problems showed up almost at the same time I suspect is a update of some distribution that introduced a incompatible default config, we might want to add this fix to the README

I would've been on Mac OS X Catalina 10.15 when I was having the issue.

@eng618
Copy link
Author

eng618 commented Mar 12, 2021

I'm on MacOS Big Sur 11.2.3

@otherguy
Copy link

Had to do the same on Big Sur 11.2.1 (20D74)

@philihp
Copy link

philihp commented Mar 23, 2021

Some of the SKS keyservers in the pool are at times not very reliable. I ran one, once, and the software tends to need to be restarted every few hours, which may have happened here, and hitting the pool again should give people a different server.

gpg: keyserver receive failed: Network is unreachable
gpg: keyserver receive failed: No keyserver available

Would the project be open to a PR which updates repo to include the keys with it, and the import keyring script import them directly? I'm happy to contribute this if it would be considered; it would remove the reliance on a keyserver.

@augustobmoura
Copy link
Member

augustobmoura commented Apr 9, 2021

@philihp I don't know if this is related to the keyservers reliability because only now this error is showing up, and only to a narrow number of users (only macOS users as of now). I don't know if we are comfortable with keeping the keys in the project for now, but we will keep this idea in mind

@Jikodis
Copy link

Jikodis commented Jun 1, 2021

Can confirm this issue is happening on MacOS Big Sur 11.3.1 (20E241). The standard-resolver in dirmngr.conf fixed the issue as well. Interesting to note is that two of my fellow devs were running MacOS Catalina and did not get this error. One of them tried the same same installation process between Big Sur and Catalina, and that provided extra verification that it was indeed a Big Sur specific issue.

I would not have found this Github suggested solution were it not for a fellow dev sending it my way. Searching the error message online brings up a myriad of suggested resolutions that send the dev down a rabbit hole of trying many different potential resolutions that end up not working. Adding this to the readme, docs somewhere, part of the installation, or fixing it in the code base for MacOS Big Sur would save others a lot of trouble.

@ssunday
Copy link

ssunday commented Jun 8, 2021

I was also having this issue on MacOS Big Sur 11.4 (Intel) and the standard-resolver did fix it after a few attempts.

Agree with @Jikodis 💯 that this should be added to the docs or fixed.

@joshuataylor
Copy link
Contributor

I believe that this is caused by the keyservers being dead, and removing the dead ones should fix it. #240

@joschi
Copy link

joschi commented Aug 19, 2021

#192 (comment) solved my issue (using 95a2091 of asdf-nodejs).

# asdf info
OS:
Darwin my.machine.example.com 20.6.0 Darwin Kernel Version 20.6.0: Wed Jun 23 00:26:31 PDT 2021; root:xnu-7195.141.2~5/RELEASE_X86_64 x86_64

SHELL:
zsh 5.8 (x86_64-apple-darwin20.0)

ASDF VERSION:
v0.8.1

ASDF ENVIRONMENT VARIABLES:
ASDF_DIR=/usr/local/Cellar/asdf/0.8.1_1/libexec

ASDF INSTALLED PLUGINS:
nodejs                       git@github.com:asdf-vm/asdf-nodejs.git

@courier-new
Copy link

In case it may help someone, I ran into a similar issue, which is not at all the fault of asdf-nodejs:

# bash -c '${ASDF_DATA_DIR:=$HOME/.asdf}/plugins/nodejs/bin/import-previous-release-team-keyring'

gpg: removing stale lockfile (created by 51144)
gpg: connecting dirmngr at '/Users/krockwell/.gnupg/S.dirmngr' failed: IPC connect call failed
gpg: keyserver receive failed: No dirmngr
gpg: connecting dirmngr at '/Users/krockwell/.gnupg/S.dirmngr' failed: IPC connect call failed
gpg: keyserver receive failed: No dirmngr
gpg: connecting dirmngr at '/Users/krockwell/.gnupg/S.dirmngr' failed: IPC connect call failed
gpg: keyserver receive failed: No dirmngr
gpg: connecting dirmngr at '/Users/krockwell/.gnupg/S.dirmngr' failed: IPC connect call failed
(...and so on)

I'm running macOS 11.5.2 (Intel), and made sure asdf and all its plug-ins were up-to-date.

After some investigation as to what dirmngr is, I found out my dirmngr was managed by Homebrew:

# which dirmngr
/usr/local/bin/dirmngr

It looks like it's expected to start on its own when gpg connects to it, but for whatever reason some library was missing that was required to start it, which I was able to observe by trying to start it on its own in a separate terminal window:

# dirmngr
dyld: Library not loaded: /usr/local/opt/libffi/lib/libffi.6.dylib
  Referenced from: /usr/local/opt/p11-kit/lib/libp11-kit.0.dylib
  Reason: image not found
[1]    44205 abort      dirmngr

I reinstalled gnupg as dirmngr comes with that set of tools:

# brew install gnupg

After that, I could verify dirmngr was able to start again:

# dirmngr
dirmngr[56931.0]: permanently loaded certificates: 133
dirmngr[56931.0]:     runtime cached certificates: 0
dirmngr[56931.0]:            trusted certificates: 133 (132,0,0,1)
# Home: /Users/krockwell/.gnupg
# Config: /Users/krockwell/.gnupg/dirmngr.conf
OK Dirmngr 2.3.1 at your service

And, in turn, I could once again import the gpg keys successfully. 🎉

@maco
Copy link

maco commented Oct 5, 2021

Fetching the keys from Ubuntu's keyserver instead is what worked for me: nodejs/node#39114 (comment)

@augustobmoura augustobmoura changed the title Unable to import gpg keys for node Unable to import gpg keys for node on macOS Oct 12, 2021
@MPV
Copy link
Contributor

MPV commented Feb 9, 2022

Upgrading to the latest asdf-nodejs solved this for me today:

$ asdf install nodejs lts
Installing alias lts as 16.14.0
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  4035    0  4035    0     0  28255      0 --:--:-- --:--:-- --:--:-- 30111
gpg: keyserver receive failed: Try again later
^C
gpg: signal Interrupt caught ... exiting

received sigint, cleaning upCould not install version 16.14.0

received sigint, cleaning up%
$ asdf plugin update nodejs
Updating nodejs to master
From https://github.com/asdf-vm/asdf-nodejs
   cb61e3d..ed34355  master     -> master
   cb61e3d..ed34355  master     -> origin/master
Already on 'master'
Your branch is up to date with 'origin/master'.
$ asdf install nodejs lts
Installing alias lts as 16.14.0
Cloning node-build...
node-build: definition not found: 16.14.0
Could not install version 16.14.0
$ asdf install nodejs 16.13.2
Trying to update node-build... ok
Downloading node-v16.13.2-darwin-x64.tar.gz...
-> https://nodejs.org/dist/v16.13.2/node-v16.13.2-darwin-x64.tar.gz
Installing node-v16.13.2-darwin-x64...
Installed node-v16.13.2-darwin-x64 to /Users/vs/.asdf/installs/nodejs/16.13.2

@augustobmoura
Copy link
Member

Yes, asdf-nodejs doesn't rely on keyservers anymore

ganczarek added a commit to ganczarek/dotfiles that referenced this issue Oct 7, 2022
@obianaghag
Copy link

This worked for my linux Ubuntu also. Thanks!

@AndreVirtimo
Copy link

I faced this issue today on my MacBook (M2) with macOS 14.4.1. I have installed gnupg (2.4.5) via homebrew.

This fixed it for me:

for what it's worth, the solution suggested here (#192 (comment)) did not work for me on its own:

$ echo "standard-resolver" >  ~/.gnupg/dirmngr.conf

I had to additionally do:

sudo pkill dirmngr

now keys are found and imported.

I am on:

  • macOS Big Sur v11.2.3
  • gpg (GnuPG) 2.2.27
  • asdf v0.8.0-c6145d0

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

Successfully merging a pull request may close this issue.