GpgFrontend icon indicating copy to clipboard operation
GpgFrontend copied to clipboard

Pinentry- problem with generating a pair of keys

Open bohorok opened this issue 4 months ago • 4 comments

I can't generate a pair of keys.

Platform : archlinux gpg version: 2.4.8 pinentry version: pinentry-gtk2 (pinentry) 1.3.2 gpgfrontend version: v2.1.9

When i probe generate a new pair of keys i give announcement in window:

Error code: 85 source: no source description: no pinentry

command: ps -aux | grep pinentry

show that gpg-agent trying to use pinentry-gnome3

When i generate pair of keys in the command line, but after closing aplication window (gpgfrontend), everything works correctly. After showing the window to enter the password I am doing the command again: ps -aux | grep pinentry

show that gpg-agent trying to use pinentry-gtk

I think there is here problem that gpgfrontend trying use incorrect pinentry. How i can setting another pinenty to use by gpgfrontend. I trying setting variable environment:

export PINENTRY=/usr/share/pinentry-gtk

but it dosn't work. I don't know if this is a configuration error or a program error. Could you advise something, tell you how to fix it ?.

bohorok avatar Sep 20 '25 12:09 bohorok

Thanks for reporting this. The issue comes from a missing comma in the DecidePinentry() function, which makes pinentry-gtk or pinentry-qt not detected.

https://github.com/saturneric/GpgFrontend/blob/60f04a8bed8830c67058644d1ff96cc9e2cafd0c/src/core/utils/GpgUtils.cpp#L468-L506

GpgFrontend launches its own gpg-agent and enforces its own pinentry path, so external environment variables will not help here. There isn’t really a perfect temporary workaround in this case. I will fix this in the code within the next few days.

saturneric avatar Sep 26 '25 21:09 saturneric

Fixed. You may try the latest nightly build.

Refer: 97e8aa99839fcccd603d66f975356c61500c5276

saturneric avatar Oct 15 '25 19:10 saturneric

I learned from some article that the pinentry program must be compatible with the gpg agent. I created symbolic link in the directory where "gpgfrontend" looks for the pinentry program. The symbolic link points to the pinentry program, not pinentry-gtk but only pinentry.

ln -T /usr/bin/pinentry /usr/local/bin/pinentry-gnome3

And it work. why I'm writing about this ?. I think that the pinentry program will select the pinentry that will be compatible with the installed gpg agent. I don't know if this will work in every distribution.

I tested also version 2.1.9 of appimage from the develop branch, and this error still occurs.

[20251016 23:55:23.872] [core] [W] [264297] - haven't connect to:  "gpg-agent" , trying to make a connection
[20251017 0:00:15.785] [core] [W] [264297] - haven't connect to:  "gpg-agent" , trying to make a connection
[20251017 0:00:15.805] [core] [W] [276563] - gpg operation failed [error code:  85 ], source:  GPG Agent  description:  "No pinentry"
[20251017 0:00:15.808] [core] [W] [276563] - gpg operation failed [error code:  85 ], source:  GPG Agent  description:  "No pinentry"
[20251017 0:00:15.820] [core] [W] [264297] - gpg operation failed [error code:  85 ], source:  Unspecified source  description:  "No pinentry"
[20251017 0:00:15.820] [core] [W] [264297] - [Error  85 ] Source:  Unspecified source  description:  "No pinentry"  predict:  "Success"
[20251017 0:00:15.820] [core] [W] [264297] - [Error  85 ] Source:  Unspecified source  description:  "No pinentry"  predict:  "Success"

After creation symbolink link, as I wrote in the introduction, pinentry window is invoked correctly.

bohorok avatar Oct 16 '25 21:10 bohorok

I installed and tested the latest Arch Linux. I compiled and ran GpgFrontend (develop branch) the same way as the AUR package does, and everything seems to work fine. When generating a new key, the pinentry-gnome3 dialog pops up correctly.

I ran GpgFrontend with the command gpgfrontend -l debug, and here’s the relevant log output:

[20251018 19:25:44.646] [core] [D] [9357] /home/eric/GpgFrontend/src/core/function/gpg/GpgContext.cpp:63 - get gpg-agent path:  "/usr/bin/gpg-agent"
[20251018 19:25:44.646] [core] [D] [9357] /home/eric/GpgFrontend/src/core/utils/GpgUtils.cpp:489 - find pinentry path:  "/usr/bin/pinentry-gnome3"
[20251018 19:25:44.647] [core] [D] [9357] /home/eric/GpgFrontend/src/core/function/gpg/GpgContext.cpp:87 - gpg-agent start args:  QList("--homedir", "/home/eric/.gnupg", "--daemon", "--enable-ssh-support", "--pinentry-program", "/usr/bin/pinentry-gnome3") channel: 0

As you can see, GpgFrontend correctly detects the pinentry path and starts the gpg-agent with it.

By the way, setting export PINENTRY=/usr/share/pinentry-gtk won’t work, since GpgFrontend doesn’t use this environment variable. It launches its own gpg-agent daemon with the appropriate arguments. You can show me your debug log related to this, so I can take a look at what’s happening on your side.

saturneric avatar Oct 18 '25 17:10 saturneric