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

Ubuntu 18.04 gpg dirmngr IPC connect call failed #3286

Closed
sirredbeard opened this Issue Jun 9, 2018 · 47 comments

Comments

Projects
None yet
@sirredbeard
Copy link
Contributor

sirredbeard commented Jun 9, 2018

  • Your Windows build number: 10.0.17134.81

  • What you're doing and what's happening:

Building MonoDevelop for Windows looks like a real hassle and there are no binaries available.

I decided to give MonoDevelop for Ubuntu binaries a try on WSL.

I installed a clean Ubuntu 18.04 from the Microsoft Store.

To get it all caught up I executed:

sudo apt-mark hold ebtables # for the current upgrade bug
sudo apt-get update
sudo apt-get upgrade -y

and then I picked up with the MonoDevelop IDE instructions:

sudo apt install apt-transport-https dirmngr
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF

Then I run into an issue.

I receive the following error message:

$ sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
[sudo] password for hayden:
Executing: /tmp/apt-key-gpghome.BG01sRSmD5/gpg.1.sh --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
gpg: connecting dirmngr at '/tmp/apt-key-gpghome.BG01sRSmD5/S.dirmngr' failed: IPC connect call failed
gpg: keyserver receive failed: No dirmngr
  • What's wrong / what should be happening instead:

gpg isn't able to call dirmngr

What I have attempted:

  1. Running dirmngr in another bash instance
  2. Making sure gpg-agent is running in the background
  3. This. https://stackoverflow.com/questions/49496667/gpg-key-generation-canceled and https://stackoverflow.com/questions/46673717/gpg-cant-connect-to-the-agent-ipc-connect-call-failed

Note: I have also tried building MonoDevelop from source on Ubuntu in WSL, but ran into this issue.

@sirredbeard sirredbeard changed the title Error installing GPG keys in Ubuntu on WSL Error importing key to apt keyserver in Ubuntu 18.04 on WSL Jun 9, 2018

@Alternate-Egoist

This comment has been minimized.

Copy link

Alternate-Egoist commented Jun 9, 2018

It's Bugging Since The First Bionics in wsl. But the temporary to pass this problems is using apt-key add instead adv options through wget or curl :
curl -sL "http://keyserver.ubuntu.com/pks/lookup?op=get&search=0xA6A19B38D3D831EF" | sudo apt-key add

@sirredbeard

This comment has been minimized.

Copy link
Contributor

sirredbeard commented Jun 9, 2018

Thanks. I did get it installed via your workaround. Sadly MonoDevelop will not run though.

@sirredbeard sirredbeard closed this Jun 9, 2018

@therealkenc

This comment has been minimized.

Copy link
Collaborator

therealkenc commented Jun 12, 2018

I hate to look a 'closed' gift horse in the mouth, but this one merits some further attention because it will keep coming up until we have a work-around on the books for the dirmngr fail proper. The problem is unrelated to Mono or MonoDevelop, natch. MariaDB (key 0xF1656F24C74CD1D8) fails the same, as will every apt-key howto anyone has ever posted on the Interwebs.

The problem is that dirmngr (sudo apt install dirnmgr) isn't running (or isn't autolaunched?) and thus there is nothing on the other end for apt-key via gpg to talk to. After around half an hour of investigation, like @sirredbeard, I wasn't able to make dirmngr at home on WSL manually. Maybe someone else will have better luck or suggestions.

@therealkenc therealkenc changed the title Error importing key to apt keyserver in Ubuntu 18.04 on WSL Ubuntu 18.04 gpg dirmngr IPC connect call failed Jun 12, 2018

@therealkenc therealkenc reopened this Jun 12, 2018

@sirredbeard

This comment has been minimized.

Copy link
Contributor

sirredbeard commented Jun 12, 2018

I support re-opening for the wider issue with dirmgr.

I think I was able to import the key by curling it in and piping it to apt-key.

Is this only on Ubuntu and only 18.04? If so, should we file a bug report upstream with Canonical?

@therealkenc

This comment has been minimized.

Copy link
Collaborator

therealkenc commented Jun 12, 2018

I think I was able to import the key by curling it in and piping it to apt-key.

Yes that's effectively the work-around until the base cause and a solution to the root problem is articulated.

Is this only on Ubuntu and only 18.04?

That is part of what merits investigation. It wasn't a problem on 16.04 (but you already knew that). Whether it wasn't a problem in 16.04 because (a) an operable dirmngr wasn't previously a requirement or (b) dirmng was working fine and nobody thought anything of it or (c) something changed with gpg or apt-key or dirmngr or something in between that now causes the sequence to fail, I can't tell you. Or at least, not with any authority after looking at it for a short bit.

@Alternate-Egoist

This comment has been minimized.

Copy link

Alternate-Egoist commented Jun 12, 2018

but sometimes in metapackages with ubuntu-desktop when i was want to install Crystal Language by importing their gpg and it's works through the adv options

@DarthSpock

This comment has been minimized.

Copy link

DarthSpock commented Jun 13, 2018

I'd like to report that any debian based distro (possibly any distro) utilizing an updated dirmngr before 18.04 was officially released as LTS was recieving this error. The issue was resolved just in time for 18.04 release. So this may be a regression or something Ubuntu did to screw with it.

When I had experienced this error utilizing Debian Buster, I simply reinstalled Debian from the Store after 18.04 was released and the updated package containing the fix was imported when upgrading from Stretch to Buster. As of yesterday evening, I have yet to see this issue re-occur.

The work-around mentioned above failed at the time and did prevent any package (including stock) from successfully upgrading. Even apt update failed.

I would recommend others test a different distro other than Ubuntu 18.04 that uses the same version of dirmngr (or upgrade to it if not part of the base) and see if it still has an issue.

For completeness, I'm running build 17134 with the latest patch.

@sirredbeard

This comment has been minimized.

Copy link
Contributor

sirredbeard commented Jun 15, 2018

@Alternate-Egoist

I wanted to do the same but could not duplicate your success.

capture32432

@filjoseph1989

This comment has been minimized.

Copy link

filjoseph1989 commented Jun 16, 2018

I tried following the guide here https://downloads.mariadb.org/mariadb/repositories/#mirror=utm&distro=Ubuntu&distro_release=bionic--ubuntu_bionic&version=10.3

while running this, sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xF1656F24C74CD1D8, i got
gpg: connecting dirmngr at '/tmp/apt-key-gpghome.cROhJELJ0N/S.dirmngr' failed: IPC connect call failed message too

@therealkenc

This comment has been minimized.

Copy link
Collaborator

therealkenc commented Jun 16, 2018

I tried following the guide here ... apt-key etc etc etc ..../mariadb/.... etc etc etc ... 0xF1656F24C74CD1D8 .... I got .... etc etc .... IPC connect call failed

Well, yes. Because Quoth:

The problem is unrelated to Mono or MonoDevelop, natch. MariaDB (key 0xF1656F24C74CD1D8) fails the same, as will every apt-key howto anyone has ever posted on the Interwebs.

@jibin2706

This comment has been minimized.

Copy link

jibin2706 commented Jun 28, 2018

same error while installing mongodb

@sav-valerio

This comment has been minimized.

Copy link

sav-valerio commented Jul 1, 2018

Same problem here with MariaDB, if you really need the repository you could "avoid" authenticating the repository key using sudo apt-get --allow-insecure-repositories update, after add-apt-repository.

Still it is not a proper solution, not to mention the potential security issues that could arise.

@foxliu

This comment has been minimized.

Copy link

foxliu commented Jul 5, 2018

Can try this:

  1. use sudo apt update then will get something like The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 5523BAEEB01FA116
  2. Got the pubkey 5523BAEEB01FA116
  3. Use curl -sL "http://keyserver.ubuntu.com/pks/lookup?op=get&search=0x5523BAEEB01FA116" | sudo apt-key add Replace 0x5523BAEEB01FA116 with 0x<your pubkey in 2step>
  4. complete, you can run sudo apt udpate no error
@sav-valerio

This comment has been minimized.

Copy link

sav-valerio commented Jul 5, 2018

@foxliu solution seems to work just fine.
But still I wasn't able to download the public key using curl, so I copied manually the key from the Ubuntu Keyserver link,to a new file in WSL, then loaded it with sudo apt-key add.

For future reference, this is the MariaDB Package Signing Key:
http://keyserver.ubuntu.com/pks/lookup?op=get&search=0xF1656F24C74CD1D8

@amehrshad

This comment has been minimized.

Copy link

amehrshad commented Jul 9, 2018

i have the same error while installing mongodb

@luisarriojas

This comment has been minimized.

Copy link

luisarriojas commented Jul 9, 2018

Hi. I am trying to install mongodb on Ubuntu 18.04 for Windows and got the same error:
$ sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 9DA31620334BD75D9DCB49F368818C72E52529D4

Executing: /tmp/apt-key-gpghome.oRreNqzIoe/gpg.1.sh --keyserver hkp://keyserver.ubuntu.com:80 --recv 9DA31620334BD75D9DCB49F368818C72E52529D4

gpg: connecting dirmngr at '/tmp/apt-key-gpghome.oRreNqzIoe/S.dirmngr' failed: IPC connect call failed

gpg: keyserver receive failed: No dirmngr

I have installed mongodb many times in different Linux distros and this is the first time I see this error.

@luisarriojas

This comment has been minimized.

Copy link

luisarriojas commented Jul 9, 2018

For future reference, manual solution is this:
$ curl -sL "https://www.mongodb.org/static/pgp/server-4.0.asc?_ga=2.264892495.1953852568.1531143056-750073170.1531143056" | sudo apt-key add

@benhillis

This comment has been minimized.

Copy link
Member

benhillis commented Jul 9, 2018

I took a look at this today and have determined that this is a timing-related issue that is exposed because of a difference in how Windows and Linux handles connection attempts to localhost sockets. On Linux an attempt to connect to a localhost tcp socket on a port that is not active will return a failure immediately. On Windows there appears to be a 1 second timeout. This causes the following sequence to occur.

  1. gpg spawns dirmngr
  2. dirmngr attempt to connect to localhost port 9050 (this is attempted twice).
  3. gpg attempts to connect to a unix socket that dirmngr creates after the localhost socket connection fails.

This one second timeout in step 2 is enough to cause gpg to think that dirmngr is not responding. There appears to be a retry loop in gpg, but it is not waiting long enough to account for the 1 second connect timeout (the connect is actually attempted twice).

I've reached out to some Windows networking experts to determine if there is a way that this timeout can be avoided.

@benhillis benhillis self-assigned this Jul 9, 2018

@therealkenc

This comment has been minimized.

Copy link
Collaborator

therealkenc commented Jul 9, 2018

That's awesome Ben. Thank-you for digging; by total chance I was going to dive this one myself this evening. Motivation being, this is blocking LXC, which uses gpg to fetch keys for the images in the same manner as apt-key 😉.

Being ahead of me, if you've got a suggestion for a temporary work-around in the gpg or dirmngr source to make them collectively happy (avoid the timeout) that would be helpful. Even if not, at least I know where to look now, which is very appreciated. If this is going to be a long lead time thing (won't make fall release) maybe I can push a PPA to launchpad.

@benhillis

This comment has been minimized.

Copy link
Member

benhillis commented Jul 10, 2018

I haven't looked through the gpg source but it seems to be after it has launched dirmngr and is trying to connect to a unix socket it expects dirmngr to create. There is a retry loop that goes for about 20 iterations.

@benhillis

This comment has been minimized.

Copy link
Member

benhillis commented Jul 10, 2018

I took another look this morning and found the bug in gpg. Their retry loop waiting for dirmngr to come up is passing an invalid argument to the nanosleep system call. From the nanosleep man page:

The value of the nanoseconds field must be in the range 0 to 999999999.

The retry loop starts with a relatively small sleep and doubles the duration, eventually capping out at one second. However they pass 1 second as 1000000000 nanoseconds, which returns EINVAL immediately.

This was actually already fixed by this commit (but it appears 18.04 is using an older version): gpg/gnupg@0cfdd3b#diff-01af2aa0c9e9ef29097d81dfcf608938

@benhillis benhillis added the external label Jul 10, 2018

@hermanomark

This comment has been minimized.

Copy link

hermanomark commented Aug 13, 2018

I think I'm having the same issue. I'm trying to install MongoDB and nothing happens when running sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 9DA31620334BD75D9DCB49F368818C72E52529D4

@hermanomark

This comment has been minimized.

Copy link

hermanomark commented Aug 13, 2018

@foxliu hey I tried your steps

sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 9DA31620334BD75D9DCB49F368818C72E52529D4

converted to:

curl -sL "http://keyserver.ubuntu.com/pks/lookup?op=get&search=0x9DA31620334BD75D9DCB49F368818C72E52529D4" | sudo apt-key add

did I did this right?? it returned
Ok. then I just proceeded to install MongoDB works just fine.

@foxliu

This comment has been minimized.

Copy link

foxliu commented Aug 13, 2018

@hermanomark OK means the key has been added, you can install the one you need

@hermanomark

This comment has been minimized.

Copy link

hermanomark commented Aug 13, 2018

@foxliu thank you very much!

@buddha314

This comment has been minimized.

Copy link

buddha314 commented Oct 30, 2018

This same error occurs trying to install ROS via these instructions and I have not been able to figure out how to use curl in this instance.

@gavanderhoorn

This comment has been minimized.

Copy link

gavanderhoorn commented Oct 30, 2018

@buddha314: there is a Q&A on ROS Answers about this (this one).

@IanKemp

This comment has been minimized.

Copy link

IanKemp commented Nov 8, 2018

@benhillis For those of us not on an insider build and have no possibility to go to one (corporate network), is there any way to get this fix?

@jefraroce

This comment has been minimized.

Copy link

jefraroce commented Nov 8, 2018

Hello, I arrived to this thread for a similar problem installing MongoDB, but maybe this steps are useful for you too:

(Were ran in Ubuntu 18.04 installed like a subsystem of windows 10)

First download the key manually (This key is for mongodb-org repository)

wget https://www.mongodb.org/static/pgp/server-4.0.asc

Add key manually

sudo apt-key add server-4.0.asc

Remove it

rm server-4.0.asc

Update package list

sudo apt-get update

Install MongoDB-org

sudo apt-get install -y mongodb-org

That's it, I hope to have helped to anyone.

Cheers!

@ppumkin

This comment has been minimized.

Copy link

ppumkin commented Nov 28, 2018

If you need to install something from Microsoft, say like Azure CLI

wget https://packages.microsoft.com/keys/microsoft.asc

Following the guide by @jefraroce helped me

@MaurGi

This comment has been minimized.

Copy link

MaurGi commented Dec 1, 2018

If you need to install something from Microsoft, say like Azure CLI

wget https://packages.microsoft.com/keys/microsoft.asc

Following the guide by @jefraroce helped me

Where is the guide @ppumkin ?
I am stuck on this now - thx!

@firezdog

This comment has been minimized.

Copy link

firezdog commented Dec 2, 2018

So it seems like the solution to this issue is to upgrade gpg?

@MaurGi

This comment has been minimized.

Copy link

MaurGi commented Dec 3, 2018

@firezdog I resolved installing the az command line using instructions in Azure/azure-docs-cli-python#1164

@ppumkin

This comment has been minimized.

Copy link

ppumkin commented Dec 4, 2018

If you need to install something from Microsoft, say like Azure CLI

wget https://packages.microsoft.com/keys/microsoft.asc

Following the guide by @jefraroce helped me

Where is the guide @ppumkin ?
I am stuck on this now - thx!

Use what @jefraroce has written up just aboive my previous comment. In particular

wget https://www.mongodb.org/static/pgp/server-4.0.asc

would be

wget https://packages.microsoft.com/keys/microsoft.asc

and follow the rest of the steps to install the key substituting the file name for the one downloaded above.

@JohnFlowerful

This comment has been minimized.

Copy link

JohnFlowerful commented Dec 9, 2018

Add no-use-tor to dirmngr.conf.

@MajidJafari

This comment has been minimized.

Copy link

MajidJafari commented Dec 20, 2018

Hi guys. I had problem installing mongodb on wsl like you. Then I just downloaded "TGZ" package from https://www.mongodb.com/download-center/community?jmp=docs and followed the installation steps from https://docs.mongodb.com/v3.2/tutorial/install-mongodb-on-linux/ and everything works for me.

Hope this could help you.

@Choco0914

This comment has been minimized.

Copy link

Choco0914 commented Dec 24, 2018

안녕 얘들 아. 나는 당신처럼 wsl에 mongodb를 설치하는 데 문제가있었습니다. 그럼 난 그냥에서 "TGZ"패키지를 다운로드 https://www.mongodb.com/download-center/community?jmp=docs 에서 설치 단계 및 다음 https://docs.mongodb.com/v3.2/tutorial/ install-mongodb-on-linux / 모든 것이 저에게 효과적입니다.

희망이 당신을 도울 수 있습니다.

Hi guys. I had problem installing mongodb on wsl like you. Then I just downloaded "TGZ" package from https://www.mongodb.com/download-center/community?jmp=docs and followed the installation steps from https://docs.mongodb.com/v3.2/tutorial/install-mongodb-on-linux/ and everything works for me.

Hope this could help you.

I can not see the results for that link

@MajidJafari

This comment has been minimized.

Copy link

MajidJafari commented Dec 26, 2018

@Choco0914 copy and paste the link in the new tab. Seems Gitlab doesn't allow for direct linking

@ScottRBK

This comment has been minimized.

Copy link

ScottRBK commented Jan 10, 2019

Anyone having any the same issue when trying to install Mono for Ubuntu 18.04 (https://www.mono-project.com/download/stable/#download-lin) in WSL?

I've tried the suggested work around but I'm not able to find the key (3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF) that is required for Mono on the Ubunutu key server site (http://keyserver.ubuntu.com/) and not surprisingly it's not worked when using curl.

Edit: Sorry saw that there was a link to this issue here for mono which has a work around of applying this command:

curl https://download.mono-project.com/repo/xamarin.gpg | sudo apt-key add -

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment