Problem with socket : Connection refused

Hello!

When I want to encrypt and sign a message on the command line, I get an error message:

“can’t connect to ‘socket:///home/user/.gnupg/log-socket’: Connection refused” - How can I solve the problem without lowering security?

I’ve done a lot of research but there are no solutions, apart from old versions of Gnupg.

This is a real problem and I’ll give it to you straight.
I have the impression that nobody has a solution.

For information, I use ArchLinux.

Thanks!

Hi @alexandre0123
this problem seems to be ArchLinux specific.

Here is the page GnuPG - ArchWiki that has a number of hints how ArchLinux’s default configuration looks like.

That message

“can’t connect to ‘socket:///home/user/.gnupg/log-socket’: Connection refused”

relates to logging actions which is optional, so you can turn it off.

Set --log-file to a real file that gpg can write and only you can read in your call on the command line. And add an -v to see a little more details.

You may need to check if other components have this option in their configuration file, if changing the call to gpg is not enough. See the different log-file options in Option Index (Using the GNU Privacy Guard)

Best,
Bernhard

1 Like

I had the same problem, found a solution here:
https://bbs.archlinux.org/viewtopic.php?id=296399

So I edited gpg.conf and gpg-agent.conf and changed the logfile from a socket to a local file:

log-file /home/lpc123/.gnupg/gpg.log
1 Like

Hello, thanks you for answers @bernhard and @stokito

When I change the location of the socket to a folder that has read and write permission, I still get the same error message, except that the error message with the new socket path.

I tried to do what you told me but I still have the same problem, socket file is a hell for gnupg.

Finally, I deleted the .gnupg folders in /root and in the home file.
Then I run the following commands:

  • sudo pacman-key --init && sudo pacman-key --populate && sudo pacman-key --refresh

I added lines concerning the servers to receive the public keys in dirmngr.conf and I deactivated the line concerning the file linked to the socket.

There is no problem, but until when ?

To avoid losing public and private keys, I use kleopatra.

So I used kleopatra via AppImage, because kleopatra does not launch on ArchLinux and I want to avoid using Xorg at all costs, only Wayland.

I can save the public keys in a single block but also to save the private keys which are saved in an encrypted container via cryptsetup.

Indeed, I am sure that the socket problem will reappear and I do not understand the problem with the socket.
so if the problem reoccurs, I will use this method.

Thanks you !