WSL: WSL Ubuntu 20.04 - gpg: can't connect to the agent: IPC connect call failed
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?
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 73
- Comments: 72
@onomatopellan in case if build-essential is installed it should be:
to avoid g++ removal.
But otherwise it works fine, thanks to you and @rafaeldtinoco.
How to fix this issue until Microsoft releases the fix via Windows Update. Solution by @rafaeldtinoco:
Temporary Solution: Downgrade libc6
wget https://launchpad.net/~rafaeldtinoco/+archive/ubuntu/lp1871129/+files/libc6_2.31-0ubuntu8+lp1871129~1_amd64.debsudo dpkg --install libc6_2.31-0ubuntu8+lp1871129~1_amd64.debsudo apt-mark hold libc6 #to avoid further updateEdit: /var/lib/dpkg/info/libc6:amd64.postinst and remove the sleep 1 that is in nearly the last line. then try.
Try installing gnupg1, it works for me đ
Source: https://github.com/MicrosoftDocs/WSL/issues/662#issuecomment-626680713
I got the same error when a tried to run curl -sL https://deb.nodesource.com/setup_14.x | sudo -E bash -
This works for me
I resolved it removing the gpg and installing the gnupg1: sudo apt remove gpg sudo apt install gnupg1
Will result in:
Make sure you add the
--allow-downgradeson this step:From this command
Whatâs happen when Windows release update for this issue and How to rollback when Windows solved this ?
Which Windows build? Ubuntu 20.04 right now is incompatible with WSL1. I just tested in WSL2 and that line runs without problem.
Ubuntu 20.04 sudo apt remove gpg sudo apt install gnupg1
@janba12: https://github.com/microsoft/WSL/issues/5125#issuecomment-631804986 worked for me. You might try this:
Hey everyone, enabling WSL 2 works for me.
What I did:
Would love to know which one is the other issue.
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
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 #4898Edit: 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.
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?Best sollution. Simple. Works for me in Windows build 2004 WSL2 and Ubuntu 20.04
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.
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.
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.
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:
(last command is for checking that Ubuntu is using WSL2)
Worked nice! Thinks.
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):
See
man gpg-agentin 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.
The original issue and official response from the WSL team is https://github.com/microsoft/WSL/issues/4898#issuecomment-592196721
Yep, what is it duplicate of?
This screws up libc6 big time. It cannot revert back to pre-rafaeldtinoco changes:
To fix this you must do:
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)
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âŚ
I have the same issue with WSL 1 and Ubuntu-20.04, converted it into wsl2
It fails in WSL1 build 19041 and It works in WSL1 build 19613 so Iâd say same as #4898.
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?