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?
Even I had the above issue in Ubuntu 20 WSL, I tried all the below | above suggestions, but none worked for me.
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
What did I do to resolve the issue?
remove gpg
install other version of gpg.
How do I do it?
apt remove gpg ( follow the instructions)
apt install gnupg1 (follow the instructions)
Option 2.
sudo apt update --y
`sudo apt remove gpg`
`sudo apt-get update -y`
`sudo apt-get install -y gnupg1`
Proof. (refer to the screenshot):
There is probably already a gpg-agent running on the system, which your gpg command is unable to connect to.
If you do a pkill -9 gpg-agent and then source <(gpg-agent --daemon) to restart the agent, you should be able to connect to the pinentry-curses for inputting your password.
In my case the agent wasn't even started. This is what I did to resolve:
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
Afterwards the commands to the agent started working.
To hopefully add to preetam's excellent answer above for those very new to this.
To install gnupg1 - if you get the error "Package gnupg1 is not available, but referenced....."
sudo apt remove gpg
sudo apt-get update -y
sudo apt-get install -y gnupg1
For me, previous responses worked, but partially, what made the magic in my case was a combination of all, see the commands below.
If you get error add-apt-repository: command not found, then, 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.
apt-get install -y gnupg gnupg1
cp -a /usr/bin/gpg /usr/bin/gpg2
ln -sf /usr/bin/gpg1 /usr/bin/gpg
apt-key worked for me after executing those commands.
I'm WSL 2.0 with Ubuntu 20.04 (Windows 10 Build 2004).
Reason:
uninstalling gnupg (2.x) also uninstalls gpg-agent, which is required.
installing gnupg1 (1.x) will install only gpg binary, not gpg-agent.
Both are required to work, but we want gnupg1 (1.x) to be the default "gpg" command (despite working with 2.x support-tools).
Based upon other behaviors in my Windows 10 system and through experimentation, I believe sometimes Windows Defender blocks gpg-agent from running because of a Windows Defender bug that slows the system trying to access low-level CPU counters.
Read Windows Defender can Significantly Impact Intel CPU Performance, We have the Fix. Work around the issue by downloading Counter Control from TECHPOWERUP and clicking "Reset Counters" when this problem arises. (See below.)
In my case I would frequently get the following error while trying to sign JAR files for deployment to Maven Central.
gpg: can't connect to the gpg-agent: IPC connect call failed
gpg: keydb_search failed: No agent running
gpg: skipped "…": No agent running
gpg: signing failed: No agent running
Sometimes if I kept trying over and over and over, eventually it would succeed.
Based on other answers, when this happened I trying manually connecting to the gpg-agent, but even that would time out:
> gpg-connect-agent --verbose
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: waiting for the agent to come up ... (4s)
gpg-connect-agent: waiting for the agent to come up ... (3s)
gpg-connect-agent: waiting for the agent to come up ... (2s)
gpg-connect-agent: waiting for the agent to come up ... (1s)
gpg-connect-agent: can't connect to the gpg-agent: IPC connect call failed
gpg-connect-agent: error sending standard options: No agent running
Because I've been experiencing similar slowdown issues on my machine seemingly related to Windows Defender, I ran "Counter Control" and sure enough, it showed that Windows Defender was maxing out the counter access as described in the article above. (Image embedded from the article.)
I tried to manually connect to gpg-agent again, but this time I hit "Reset Counters" in the utility just as gpg-connect-agent was retrying. When I did this, it immediately connected!
> gpg-connect-agent --verbose
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 the agent established
This seems unlikely to be a coincidence that it would connect at just the moment I reset the counters. Moreover Windows Defender has been causing other slowdown problems on my machine.
I believe that buggy behavior of Windows Defender is causing this problem on my machine. Please investigate and report if you can reproduce this workaround. (Note that, as per the article, this problem only affects certain generations of Intel CPUs.)
Update: Upon further testing, I'm still getting can't connect to the gpg-agent even if I've already reset counters to prevent Windows Defender from hogging the CPU as explained above. For some reason I normally still have to manually run gpg-connect-agent. Now it may be that resetting the counters while gpg-agent was trying to connect allowed it to connect. And it could still be be that Windows Defender is stopping gpg-agent from connecting when my system starts up. But at this moment all I know is that 1) gpg-agent isn't starting up automatically, 2) I have to run gpg-connect-agent manually, and 3) even running gpg-connect-agent will time out unless I reset the CPU counters to stop Windows Defender from hogging the CPU.
Mine is a windows machine, and when I do git commit I get the following message. I have already configured gpg keys on my machine.
gpg: can't connect to the gpg-agent: IPC connect call failed
gpg: keydb_search failed: No agent running
gpg: skipped "BBB42EB62E25E8EB33AE2E65F40A504840B1C66B": No agent running
gpg: signing failed: No agent running
error: gpg failed to sign the data
fatal: failed to write commit object
Will Buffington answer worked for me.
I had to apply the command
gpg-connect-agent -v
repeatedly as shown below. And it worked in the third attempt.
Once the I get the message connection to agent established, I now ran the commit command again. Now its successful. Note the -S flag to sign my commits.
Update
This morning, it did not start even after 3 attempts. I had to double click the exe from its installed location.
I had the same problem. In my case, the gpg config files were somehow corrupted. To solve it, I have removed all the configurations inside ~/.gnupg (make sure to backup any keys that you still need). Then I have reinstalled gpg and everything worked well.
On WSL1 Ubuntu 20.04 following workaround available: https://github.com/microsoft/WSL/issues/5125#issuecomment-619097534
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
I had to use:
sudo apt autoremove gpg gnupg1 gnupg2
In windows subsystem Ubuntu 20 works these steps:
sudo apt remove gpg
sudo apt-get update -y
sudo apt-get install -y gnupg1
After that steps appear "Ok"
I had the same problem when I killed the agent. It was not able to connect to agent again. So I had to remove all gpg gpg-related packages, and reinstall. I had to remove gpg-agent as well.
so what I did
sudo apt remove gpg gpg-agent
sudo apt-get install -y gpg
I was able to connect without installing new software. In my case the issue was that the IPC file wasn't in the expected position.
Check if gpg-agent with ps -eaf | grep gpg is running and kill it if it is running with killall gpg-agent
Start gpg-agent with verbose
$ gpg-agent --daemon -v
...
GPG_AGENT_INFO=/tmp/.../S.gpg-agent; export GPG_AGENT_INFO
copy-paste the GPG_AGENT_INFO line, including the export, in the shell where you need the agent.
Related
I'm trying to setup the dev environment for an existing project on another computer under WSL2 and Windows 10. Having installed the project from its own repo with composer install and making sure a basic .env file is in place, I ran /vendor/bin/sail up to do the initial build.
Docker starts normally, but then during stage 4 of 11 RUN apt-get update && apt-get install...., it just halts when it gets to the line gpg: keybox '/root/.gnupg/pubring.kbx' created the build halts, the clock is still ticking but the operation never finishes.
I'm able to hit Ctrl + C and it Cancels cleanly.
Editing Laravel's dockerfile, I added a -v to the gpg --recv-key ... line in the script and got additional output with the operation halting after gpg: connection to dirmngr established instead.
I'm running Ubuntu under WSL2, fully updated, docker freshly installed and configured to talk to it as on my other machine where I'm not having any issues.
Removing the portnumber (:80) for the keyserver from the PHP 8.x docker file seems to be a workaround for this problem.
echo "keyserver hkp://keyserver.ubuntu.com" >> ~/.gnupg/dirmngr.conf \
Tested with PHP 8.1.
Source: https://github.com/laravel/sail/issues/503#issuecomment-1336273951
I'm using Ubuntu (VERSION="20.04 LTS (Focal Fossa) on Windows 10. Itried to install Docker.
I'm following the Docs from docs.docker.com:
I run the two commands:
$ curl -fsSL https://get.docker.com -o get-docker.sh
$ sudo sh get-docker.sh
When I run the second command it return an error:
Warning: apt-key output should not be parsed (stdout is not a terminal)
gpg: can't connect to the agent: IPC connect call failed
I looked in internet I found that some links trying to resolve the issue but in vein.
gpg: can't connect to the agent: IPC connect call failed
https://michaelheap.com/gpg-cant-connect-to-the-agent-ipc-connect-call-failed/
Someone have a suggestion please ?
Thanks
The temporary workaround mentioned on the issue thread at https://github.com/microsoft/WSL/issues/5125#issuecomment-625985191 worked for me. Run the commands
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 like so:
Change this:
To this:
I tried to install a package after dowloading a .deb file. The command was:
dpkg -i minergate-cli-release.deb
The package obviously needed to access links that were no longer online, so I got an endless number of timeouts:
Setting up minergate-cli (4.05) ...
--2017-12-18 16:04:21-- https://minergate.com/repo/deb/repo-pub.key
Resolving minergate.com (minergate.com)... 136.243.102.167, 88.99.142.163, 94.130.143.162, ...
Connecting to minergate.com (minergate.com)|136.243.102.167|:443... failed: Connection timed out.
So I killed it with Ctrl+C. But now whenever I try to install or remove a package with apt-get, it goes back to this state of trying to connect to a minergate mirror.
I tried more desperate stuff, but it always ends in E: dpkg was interrupted, you must manually run 'sudo dpkg --configure -a' to correct the problem..
And this dpkg --configure -a resumes the Connecting to minergate.com thing.
How do I interrupt the initial dpkg -i ... command Any help would be immensly appreciated !
1.you coud download .deb file from https://minergate.com/download/deb-cli ,then uncompress it, upload the 'minergate' folder to the linux, execute the ./minergate-cli script to start, no need to install.
check your http connection to Internet, it means the http connection between your linux and Minergate is not ok.
I'm using Ubuntu 16.04.
When I update, I got the following message
$ sudo apt-get update
....
E: dpkg was interrupted, you must manually run 'sudo dpkg --configure -a' to correct the problem.
Following the error message, I try
$ sudo dpkg --configure -a
setting up snapd (2.14.2~16.04) ...
then it hangs forever.
Does anybody know how can I fix this problem?
Thanks.
This is a confirmed bug.
https://bugs.launchpad.net/ubuntu/+source/snapd/+bug/1621336
A workaround is listed:
https://bugs.launchpad.net/ubuntu/+source/snapd/+bug/1621336/comments/4
Adding the workaround from Axel Kämpfe since the links seems to be broken:
Start a rootshell with "sudo -i"
Run echo "bash -c 'service snapd.boot-ok start'" | at now + 4 min
Then run apt install snapd (if it argues about canceled dpkg processes use the dpkg --configure -a. Then wait for at least 4 minutes. The hanging should gone then.
Good luck! :)
/Patrik
I had a similar problem twice and I have noticed that it happens everytime my system wants to upgrade to a new Kernel. The steps below seem to work for me all the time;
Boot into the recovery mode of your newest kernel versions.
Log-in to the system as root from the drop-down menu.
Edit the /etc/resolv.conf file using a text editor, I normally use vi, i.e.
vi /etc/resolv.conf
and put in the contents below and save file;
nameserver 208.67.222.220
nameserver 208.67.222.222
After the above step, Ctrl+D (exit) back into the recovery mode menu and click on networking to enable network/internet connection.
Next, click on the dpkg item to fix broken packages.
That's it, after the reboot your system should have the right kernel install and broken packages fixed/removed.
Identify the application that is causing the dpkg --configure -a hanging error.
Example: snapd
Execute the following command:
sudo apt-get remove snapd
In my case, I entered the following command:
sudo apt-get remove mysql-server-8.0
Re-install the application if necessary.
I hope this helps you too. Health!
I have tried to install clamav in linux centos, but not able to succeed, so anybody provide me the procedure to install clamav antivirus and test the same.
Thanks in advance
First thing to do is install the program sudo apt-get install clamav
It´s necessary install the deamon program as well sudo apt-get install clamav-daemon
Once that we have the program properly installed, will be necessary configure to make it works with our app. /etc/clamav/clamd.conf
TCPAddr 127.0.0.1
TCPSocket 3310
To configure by console the antivirus just type sudo dpkg-reconfigure clamav-freshclam
Restart the service sudo /etc/init.d/clamv-* restart
For CentOS 6
Install ClamAV via yum epel repo:
yum install clamd
Edit config file:
vim /etc/clamd.conf
ExtendedDetectionInfo yes
ExcludePath /usr/local/maldetect/
DetectPUA yes
Set to start on boot:
chkconfig clamd on
Update ClamAV prior to a scan:
freshclam
Start ClamAV:
service clamd start
Add the cron for daily automatic scans:
vim /etc/cron.daily/daily-clamscan
#!/bin/bash
SCAN_DIR="/"
LOG_FILE="/var/log/clamav/daily-clamscan.log"
/usr/bin/clamscan -i -r $SCAN_DIR >> $LOG_FILE
Set proper cron permissions:
sudo chmod +x /etc/cron.daily/daily-clamscan
Update the logrotate file to look for all logs via wildcard
vim /etc/logrotate.d/daily-clamscan
/var/log/clamav/daily-clamscan.log {
missingok
notifempty
create 644 clam clam
}
Thats how I installed it on my machine. Here are a few good quick commands or you can use the cron to manually run it. I also installed Linux Malware Detect (LMD) with it so I can do more for my scans.
Full System Scan that only displays infected files and runs in the background with bell
Use jobs command to view status
clamscan -r --bell -i / &