GPG (gpg-agent or gnome-keyring-daemon) not asking for passphrases after reinstall

A few days ago I reinstalled my box, keeping my previous /home partition intact.

Afterwards, I’ve been unable to use gpg “normally”: I use Emacs and have configured git to sign every commit. Trying to commit from emacs (with magit) results in:

error: gpg failed to sign the data
fatal: failed to write commit object

In the console I get the error:

$ git commit -m 'Add AsyncButton' 
error: gpg failed to sign the data
fatal: failed to write commit object

but that can be worked around by setting GPG_TTY to the result of tty; but that only solves the console issue, not the Emacs issue.

Journal of gpg-agent and gnome-keyring-daemon is:

$ journalctl --since=today /usr/bin/gnome-keyring-daemon                                                                                                                                                                                             
-- Journal begins at Sat 2021-07-31 17:30:33 CEST, ends at Wed 2021-08-04 10:10:57 CEST. --
-- No entries --


$ journalctl --since=today /usr/bin/gpg-agent                                                                                                                                                                                                       
.... 
Aug 04 10:09:18 pavla gpg-agent[487692]: failed to unprotect the secret key: Inappropriate ioctl for device
Aug 04 10:09:18 pavla gpg-agent[487692]: failed to read the secret key
Aug 04 10:09:18 pavla gpg-agent[487692]: command 'PKSIGN' failed: Inappropriate ioctl for device <Pinentry>

Do you have any ideas?

The solution described in https://stackoverflow.com/a/59170001/211280 works. Not exactly as before, but it works for me. Emacs now ask for the passphrase in the minibuffer. I like this.

Summary:

Add this to ~/.gnupg/gpg.conf:

use-agent 
pinentry-mode loopback

and this to ~/.gnupg/gpg-agent.conf

allow-loopback-pinentry

Then restart the agent with echo RELOADAGENT | gpg-connect-agent.

Source of that answer: Fixing GPG "Inappropriate ioctl for device" errors — Daniel15

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.