gpg: can't connect to the agent: IPC connect call failed

时间:2017-10-10 18:39:08

标签: gnupg

I am having a problem while trying to decrypt some keys using GPG. The following output is given to me:

gpg: can't connect to the agent: IPC connect call failed

I already edited some files, pointed in this tutorial: https://michaelheap.com/gpg-cant-connect-to-the-agent-ipc-connect-call-failed/ but with no success.

Possible reasons for that?

Thanks in advance

11 个答案:

答案 0 :(得分:186)

即使我在Ubuntu 20 WSL中遇到了上述问题,我还是尝试了以下所有方法|以上建议,但没有一个对我有用。

root@7400-9888K13:/mnt/c/Users/PKammari# wget -q -O - https://packages.cloudfoundry.org/debian/cli.cloudfoundry.org.key | sudo apt-key add -
gpg: can't connect to the agent: IPC connect call failed

我如何解决此问题?

  • 删除gpg
  • 安装其他版本的gpg。

我该怎么做?
apt remove gpg(按照说明进行操作)
apt install gnupg1(按照说明进行操作)

选项2。 sudo apt update --y

`sudo apt remove gpg`

`sudo apt-get update -y`

`sudo apt-get install -y gnupg1` 

证明。 (请参见屏幕截图):
enter image description here

答案 1 :(得分:15)

希望为上述新手增加preetam的出色回答。

要安装gnupg1-如果出现错误“软件包gnupg1不可用,但已被引用.....”

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

答案 2 :(得分:11)

系统上可能已经运行了gpg-agent,你的gpg命令无法连接到它。

如果您执行 pkill -9 gpg-agent 然后 source<(gpg-agent -daemon)重新启动代理,您应该能够连接到pinentry-curses以输入密码。

答案 3 :(得分:5)

对我来说,以前的响应有效,但部分原因是使the magic成为所有因素的组合,请参见下面的命令。

如果收到错误add-apt-repository: command not found,则为install package software properties common

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

# In case of Error when adding "ppa" with message: add-apt-repository: command not found
sudo apt-get install software-properties-common

# Now, the hack
sudo add-apt-repository ppa:rafaeldtinoco/lp1871129
sudo apt update
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.

答案 4 :(得分:2)

apt-get install -y gnupg gnupg1
cp -a /usr/bin/gpg /usr/bin/gpg2
ln -sf /usr/bin/gpg1 /usr/bin/gpg

apt-key在执行这些命令后为我工作。

我是带有Ubuntu 20.04(Windows 10 Build 2004)的WSL 2.0。

原因:

卸载gnupg(2.x)也会卸载gpg-agent,这是必需的。

安装gnupg1(1.x)仅安装gpg二进制文件,而不安装gpg-agent。

这两项都是必需的,但是我们希望gnupg1(1.x)作为默认的“ gpg”命令(尽管使用2.x支持工具)。

答案 5 :(得分:0)

我有同样的问题。就我而言,gpg配置文件已损坏。为了解决这个问题,我删除了~/.gnupg内部的所有配置(确保备份您仍然需要的所有密钥)。然后,我重新安装了gpg,一切正常。

答案 6 :(得分:0)

就我而言,该代理商甚至还没有开始。这是我要解决的问题:

C:\Program Files (x86)\gnupg\bin>gpg-connect-agent -v
gpg-connect-agent: no running gpg-agent - starting 'C:\Program Files (x86)\gnupg\bin\gpg-agent.exe'
gpg-connect-agent: waiting for the agent to come up ... (5s)
gpg-connect-agent: connection to agent established
> ^Z

此后,代理的命令开始工作。

答案 7 :(得分:0)

在WSL1 Ubuntu 20.04上,可以使用以下解决方法:https://github.com/microsoft/WSL/issues/5125#issuecomment-619097534

/tmp

答案 8 :(得分:0)

我必须使用:

sudo apt autoremove gpg gnupg1 gnupg2

答案 9 :(得分:0)

在Windows子系统中,Ubuntu 20执行以下步骤:

  1. sudo apt删除gpg
  2. sudo apt-get更新-y
  3. sudo apt-get install -y gnupg1

在此步骤之后,出现“确定”

enter image description here

答案 10 :(得分:0)

当我杀死代理时,我遇到了同样的问题。它无法再次连接到代理。所以我不得不删除所有与 gpg gpg 相关的包,然后重新安装。我也必须删除 gpg-agent 。 所以我做了什么

sudo apt remove gpg gpg-agent
sudo apt-get install -y gpg