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

WSL Ubuntu 20.04 - gpg: can't connect to the agent: IPC connect call failed #5125

Closed
dawsonc623 opened this issue Apr 24, 2020 · 72 comments
Closed

Comments

@dawsonc623
Copy link

I have a fresh installation of Windows 10, and I am trying to get a development environment with WSL set up. I enabled WSL and installed Ubuntu from the Microsoft Store. Everything went smoothly in that process. Then, I tried to go through the steps to install Yarn here.

When I try to run the first line (curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -), I get the error in the title:

$ curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
gpg: can't connect to the agent: IPC connect call failed

I have looked up this error, and there were a few suggestions related to gpg-agent that I tried, such as manually starting the agent and creating/deleting certain configuration files related to gpg. Everything I tried resulted in the same error above. I am at a loss for what to try next. Has anyone else seen and fixed this issue?

@onomatopellan
Copy link

Which Windows build? Ubuntu 20.04 right now is incompatible with WSL1.
I just tested in WSL2 and that line runs without problem.

@dawsonc623
Copy link
Author

OS Build 18363.815

I do not think WSL 2 is available to me right now. I am no longer getting preview updates, so I have to wait until the official release.

@sirredbeard
Copy link
Contributor

Can you please run:

$ sudo apt install strace -y

$ strace -o strace.log curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -

Then post it to a gist?

@maximilia
Copy link

@sirredbeard
Copy link
Contributor

Are you on WSL 1 @maximilia?

@maximilia
Copy link

@sirredbeard yes, I am

@dawsonc623
Copy link
Author

My trace, if it provides any insight @maximilia's does not:

https://gist.github.com/dawsonc623/06c9300dca0d5504602d6ea3ffe21004

@mbjunior79
Copy link

I got the same error when a tried to run curl -sL https://deb.nodesource.com/setup_14.x | sudo -E bash -

@onomatopellan
Copy link

onomatopellan commented Apr 24, 2020

It fails in WSL1 build 19041 and It works in WSL1 build 19613 so I'd say same as #4898.

@onomatopellan
Copy link

onomatopellan commented Apr 24, 2020

How to fix this issue until Microsoft releases the fix via Windows Update. Solution by @rafaeldtinoco:

sudo add-apt-repository ppa:rafaeldtinoco/lp1871129
sudo apt update
sudo apt install libc6=2.31-0ubuntu8+lp1871129~1 -y
sudo apt-mark hold libc6

@Kagami
Copy link

Kagami commented Apr 25, 2020

@onomatopellan in case if build-essential is installed it should be:

sudo add-apt-repository ppa:rafaeldtinoco/lp1871129
sudo apt update
sudo apt install libc6=2.31-0ubuntu8+lp1871129~1 libc6-dev=2.31-0ubuntu8+lp1871129~1 libc-dev-bin=2.31-0ubuntu8+lp1871129~1 -y --allow-downgrades
sudo apt-mark hold libc6

to avoid g++ removal.

But otherwise it works fine, thanks to you and @rafaeldtinoco.

@harryqt
Copy link

harryqt commented Apr 25, 2020

That worked, thank you very much.

@nardocesar
Copy link

Hey everyone, enabling WSL 2 works for me.

What I did:

@jvoss
Copy link

jvoss commented Apr 30, 2020

sudo apt install libc6=2.31-0ubuntu8+lp18711291 libc6-dev=2.31-0ubuntu8+lp18711291 libc-dev-bin=2.31-0ubuntu8+lp1871129~1 -y

Will result in:

E: Packages were downgraded and -y was used without --allow-downgrades.

Make sure you add the --allow-downgrades on this step:

sudo apt install libc6=2.31-0ubuntu8+lp1871129~1 libc6-dev=2.31-0ubuntu8+lp1871129~1 libc-dev-bin=2.31-0ubuntu8+lp1871129~1 -y --allow-downgrades

@bkraul
Copy link

bkraul commented May 2, 2020

I tried this workaround and it did work but I gotta say it seems like a pretty ugly hack. What are the repercussions of holding back libc6? Is there any hope of "cleanup" to where, after installing the needed key and the packages, everything can be put back the way it was?

@alexandrerocco
Copy link

thanks to @rafaeldtinoco and @Kagami for the workaround!

@mdragoss
Copy link

mdragoss commented May 5, 2020

I have the same issue with WSL 1 and Ubuntu-20.04, converted it into wsl2
wsl

@bkraul
Copy link

bkraul commented May 5, 2020

For me, WSL2 is a no can do. My dev environment heavily relies on both virtual box and VMware workstation. I know vbox 6 is compatible, but VMware has yet to release their patch...

@onomatopellan
Copy link

onomatopellan commented May 5, 2020

@bkraul VMWare released a tech preview that works with WSL2. If there are no important bugs this will be next stable release.
https://blogs.vmware.com/workstation/2020/01/vmware-workstation-tech-preview-20h1.html

@ultramaks
Copy link

ultramaks commented May 5, 2020

Guys, so what do I do if I have 18363 (WSL 1)build only and I need to use gpg? If I use Ubuntu 18.04 instead of 20.04 will it help?
Or the only thing is a hack that is described above (by @rafaeldtinoco)

@bkraul
Copy link

bkraul commented May 5, 2020

Pretty much seems to be the only solution for you if going with 20.04. The hack does work, tho. Not sure how intricate your particular WSL instance is, but I would figure if it is not that intricate and you need to use gpg, the hack is worth implementing.

Or yeah, you could try 18.04. I believe 18.04 does not have that issue. At least I do not experience on my 18.04 instance.

@bkraul
Copy link

bkraul commented May 5, 2020

@onomatopellan Thanks, I did check that out. But can't move to it until GA because of critical development environments running on VMware at the moment. I will keep an eye out for both Windows May 20 update and VMWare GA release.

@danikhil
Copy link

danikhil commented May 8, 2020

Temporary Solution: Downgrade libc6
wget https://launchpad.net/~rafaeldtinoco/+archive/ubuntu/lp1871129/+files/libc6_2.31-0ubuntu8+lp1871129~1_amd64.deb
sudo dpkg --install libc6_2.31-0ubuntu8+lp1871129~1_amd64.deb
sudo apt-mark hold libc6 #to avoid further update

Edit: /var/lib/dpkg/info/libc6:amd64.postinst and remove the sleep 1 that is in nearly the last line.
then try.

@PePoDev
Copy link

PePoDev commented May 9, 2020

From this command

sudo add-apt-repository ppa:rafaeldtinoco/lp1871129
sudo apt update
sudo apt install libc6=2.31-0ubuntu8+lp1871129~1 libc6-dev=2.31-0ubuntu8+lp1871129~1 libc-dev-bin=2.31-0ubuntu8+lp1871129~1 -y --allow-downgrades
sudo apt-mark hold libc6

What's happen when Windows release update for this issue and How to rollback when Windows solved this ?

@krodelabestiole
Copy link

What's happen when Windows release update for this issue and How to rollback when Windows solved this ?

sudo apt-mark unhold libc6
sudo apt install ppa-purge
sudo ppa-purge ppa:rafaeldtinoco/lp1871129
sudo apt update
sudo apt upgrade

@PePoDev
Copy link

PePoDev commented May 10, 2020

Windows Build 1909 with fresh Ubuntu 20.04 install on WSL2 also had the same issue.
Doing as @rafaeldtinoco proposed, fixed it for now.

1909 build has WSL 2 ?
How you get it ?

@onomatopellan
Copy link

onomatopellan commented May 27, 2020

It's a broken libc6 and it's used everywhere.
Try looking for the shared libraries used by a binary:
ldd $(which gpg)
If you can see libc.so.6 then you probably will hit #4898

Edit: Ok now there is no doubt both issues are related:
https://github.com/gpg/gnupg/blob/master/common/sysutils.c#L350

gpg uses nanosleep from glibc which right now is broken in Ubuntu 20.04 WSL1.

@Andrei-Paul
Copy link

Andrei-Paul commented May 29, 2020

Had the same issue with the kubernetes repo key; I chucked the key in /etc/apt/trusted.gpg.d, it worked and I moved on.

@bkraul
Copy link

bkraul commented May 29, 2020

Windows 10 2004 came out 2 days ago. With this, WSL2 is now widely available. I upgraded my ubuntu WSL instance to WSL2, and everything works as expected.

@ghost
Copy link

ghost commented Jun 1, 2020

Just for the record, since that's the first google finds when searching for the issue: You don't need to fiddle with your clib or even downgrade to gpg1, the only thing needed to make it work is an environment-Variable, which is best to set by appending these Lines to your shell-Initialisation (~/.bashrc on a default-wsl-ubuntu install):

GPG_TTY=$(tty)
export GPG_TTY

See man gpg-agent in your Linux for an explanation.

EDIT: forgot to say why I still write this, since wsl 2 also fixes the Issue: You can't use wsl 2 on arm64 devices at the moment, ther seems to be a showstopper for the new release for this architecture.
__
s.

@wscatao
Copy link

wscatao commented Jun 23, 2020

How to fix this issue until Microsoft releases the fix via Windows Update. Solution by @rafaeldtinoco:

sudo add-apt-repository ppa:rafaeldtinoco/lp1871129
sudo apt update
sudo apt install libc6=2.31-0ubuntu8+lp1871129~1 -y
sudo apt-mark hold libc6

Worked nice! Thinks.

@APradyut
Copy link

APradyut commented Jul 3, 2020

Guys, so what do I do if I have 18363 (WSL 1)build only and I need to use gpg? If I use Ubuntu 18.04 instead of 20.04 will it help?
Or the only thing is a hack that is described above (by @rafaeldtinoco)

Try installing gnupg1, it works for me :)

sudo apt-get remove gpg
sudo apt-get install gnupg1

Source: MicrosoftDocs/WSL#662 (comment)

This works for me

@sithmal
Copy link

sithmal commented Jul 15, 2020

@onomatopellan in case if build-essential is installed it should be:

sudo add-apt-repository ppa:rafaeldtinoco/lp1871129
sudo apt update
sudo apt install libc6=2.31-0ubuntu8+lp1871129~1 libc6-dev=2.31-0ubuntu8+lp1871129~1 libc-dev-bin=2.31-0ubuntu8+lp1871129~1 -y --allow-downgrades
sudo apt-mark hold libc6

to avoid g++ removal.

But otherwise it works fine, thanks to you and @rafaeldtinoco.

Thanks this works for me.

@pmdpaula
Copy link

pmdpaula commented Jul 18, 2020

Guys, so what do I do if I have 18363 (WSL 1)build only and I need to use gpg? If I use Ubuntu 18.04 instead of 20.04 will it help?
Or the only thing is a hack that is described above (by @rafaeldtinoco)

Try installing gnupg1, it works for me :)

sudo apt-get remove gpg
sudo apt-get install gnupg1

Source: MicrosoftDocs/WSL#662 (comment)

Best sollution. Simple.
Works for me in Windows build 2004 WSL2 and Ubuntu 20.04

@janba12
Copy link

janba12 commented Jul 19, 2020

Still having the same issue after try every "solution here"
any other suggest?
WSL2 ubuntu v20.04

@uberhacker
Copy link

@janba12: #5125 (comment) worked for me. You might try this:

sudo apt remove gpg
sudo apt autoremove --purge -y
sudo apt install gnupg1

@onomatopellan
Copy link

@janba12 What's the output of wsl.exe -l -v ?

@KevinBurton
Copy link

I run into the same issue in trying to install v14 of Nodejs following the steps outlined in this article. It seems that the nodesource_setup.sh script that is downoaded reverses the workaround steps

sudo apt-get remove gpg
sudo apt-get install gnupg1

and fails with the same error. Here is version info for me

PS C:\Users\RKevi> wsl -l -v
  NAME                   STATE           VERSION
* Ubuntu                 Stopped         1
  docker-desktop-data    Running         2

@onomatopellan
Copy link

@KevinBurton Your Ubuntu distro is still WSL1. You need to convert it to WSL2 with
wsl.exe --set-version Ubuntu 2
After that issues like the one in this thread should not happen anymore.

@expatjedi
Copy link

Don't mess up your system by installing / disabling extra programs, just follow the inctructions carefully on micosoft's website. It takes only 5 minutes to apply.

https://docs.microsoft.com/en-us/windows/wsl/install-win10

@janba12
Copy link

janba12 commented Jul 29, 2020

The issue i had happened because i was instaling "ubuntu" from Microsoft Store. i just uninstall that one and get Ubuntu 20.04 LTS , that fixed all the issues. thanks for your answers

@sgarcia-dev
Copy link

@janba12: #5125 (comment) worked for me. You might try this:

sudo apt remove gpg
sudo apt autoremove --purge -y
sudo apt install gnupg1

Thank you! That was much simpler than some of the solutions above, and it worked for me when installing Yarn

@NBSOD
Copy link

NBSOD commented Aug 5, 2020

How to fix this issue until Microsoft releases the fix via Windows Update. Solution by @rafaeldtinoco:

sudo add-apt-repository ppa:rafaeldtinoco/lp1871129
sudo apt update
sudo apt install libc6=2.31-0ubuntu8+lp1871129~1 -y
sudo apt-mark hold libc6

this is really good for me! ths!!!! windows 10 2004 , wsl1 Ubuntu 20.04

@ghost
Copy link

ghost commented Aug 6, 2020

Ubuntu 20.04
sudo apt remove gpg
sudo apt install gnupg1

@pkiserver
Copy link

Ubuntu 20.04
sudo apt remove gpg
sudo apt install gnupg1

I was trying to run as follows:
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key
add -

And was getting error:
gpg: can't connect to the agent: IPC connect call failed

Ran the commands provided > sudo apt remove gpg

sudo apt install gnupg1 .. and after that the command worked, Thank you

@maximelafarie
Copy link

Don't mess up your system by installing / disabling extra programs, just follow the inctructions carefully on micosoft's website. It takes only 5 minutes to apply.

https://docs.microsoft.com/en-us/windows/wsl/install-win10

Works perfectly (and so true btw, just read the docs 😅) while neither other solution worked for me. Thank you so much! 🤘

So here are the commands that saved my day:

wsl --set-default-version 2
wsl --set-version Ubuntu 2
wsl --list --verbose

(last command is for checking that Ubuntu is using WSL2)

@fkomaralp
Copy link

fkomaralp commented Aug 16, 2020

On Windows 10 before the Windows preview.
You are installed/enabled the WSL feature
Install your Linux distribution of choice (Ubuntu 20.04 on my system) from Microsoft Store
Register for Windows Insider program > https://insider.windows.com/en-us/ follow the getting-started document and do all things.
Choose Preview channel.
Update your system to the last Windows preview.
After that update your system to latest Windows 10 preview. My latest update is 19041.423
Download a msi installer from https://docs.microsoft.com/en-us/windows/wsl/wsl2-kernel and install this "Linux kernel update package".
Restart your Windows system.
Open your Powershell as Administrator.
Type wsl --set-version <Distro> 2
is your installed Linux distribution. If you dont know what you installed on your system. You can get installed distributions typing by this command wsl --list
And you can get like these lines
https://i.paste.pics/b5934bbe5881543abfa44b4cd5d5df44.png
You can type you command like this wsl --set-version Ubuntu-20.04 2
All after that you have WSL2 Linux distribution.

Shortly if you want to use wsl command with --set-default-version --set-version options you need to have WSL2. WSL2 only supports Windows previews at this moments.

@dimpu204
Copy link

I have a fresh installation of Windows 10, and I am trying to get a development environment with WSL set up. I enabled WSL and installed Ubuntu from the Microsoft Store. Everything went smoothly in that process. Then, I tried to go through the steps to install Yarn here.

When I try to run the first line (curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -), I get the error in the title:

$ curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
gpg: can't connect to the agent: IPC connect call failed

I have looked up this error, and there were a few suggestions related to gpg-agent that I tried, such as manually starting the agent and creating/deleting certain configuration files related to gpg. Everything I tried resulted in the same error above. I am at a loss for what to try next. Has anyone else seen and fixed this issue?

do sudo apt remove gpg then sudo apt install gnupg1 it worked.

@Kyle-Williamson-Dev
Copy link

@onomatopellan in case if build-essential is installed it should be:

sudo add-apt-repository ppa:rafaeldtinoco/lp1871129
sudo apt update
sudo apt install libc6=2.31-0ubuntu8+lp1871129~1 libc6-dev=2.31-0ubuntu8+lp1871129~1 libc-dev-bin=2.31-0ubuntu8+lp1871129~1 -y --allow-downgrades
sudo apt-mark hold libc6

to avoid g++ removal.

But otherwise it works fine, thanks to you and @rafaeldtinoco.

This helped me immensely. I hadn't struggled for long. Once I saw the issue, I googled and luckily found this. It worked for me as now I've been able to install rails.

@onomatopellan
Copy link

Time to get rid of any workarounds. The fix for WSL1 in Windows 10 v2004 is finally here.

KB4571756 (OS Build 19041.508)

Now sleep in Ubuntu 20.04 WSL1 is working just fine.

@therealkenc
Copy link
Collaborator

Workaround discussions (to the extent anyone wants to continue them) can happen over in discussions.

@microsoft microsoft locked and limited conversation to collaborators Sep 8, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests