When trying to create a key with gpg –gen-key, I was getting the error:
gpg: problem with the agent: No pinentry
To solve this, first check if pinentry is installed. On Debian systems, use:
apt-get install pinentry
or on Redhat/Centos, use:
yum install pinentry
If you still get the error and you’re running gpg from the command line, the problem is that pinentry is set up to run in a GUI by default. You need to tell GPG to use the “curses” version of pinentry that can be run in a terminal. To do this, edit the GPG config file:
vi /etc/gnupg/gpg-agent.conf
Add or change the line with pinentry-program so that it looks like this:
pinentry-program /usr/bin/pinentry-curses
That’s it! Let me know in the comments if this works for you.
Thanks dude woks! in openSUSE 13.1 just reload the terminal and its all.
Worked, thank you (had to adapt it a bit for ubuntu)
Worked with centos 7.6, thx! Should also issue the reload command gpg-connect-agent reloadagent /bye
Didn’t work for me.
# gpg –cipher-algo AES256 -c password
gpg: problem with the agent: No pinentry
gpg: error creating passphrase: Operation cancelled
gpg: symmetric encryption of `password’ failed: Operation cancelled
try
gpgconf –kill gpg-agent
echo ‘pinentry-program /usr/bin/pinentry-curses’ > ~/.gnupg/gpg-agent.conf
gpg-agent –daemon
echo test | gpg –clear-sign
This solved a very confounding problem I was having – thanks for posting!
For reference, maybe this will help others:
If running macOS and using MacPorts version of Pass,
you can find the gpg-agent.conf at ~/.gnupg/gpg-agent.conf
and the referenced pinentry-curses location should be in /opt/local/bin/
so enter the line below into gpg-agent.conf:
pinentry-program /opt/local/bin/pinentry-curses