Pinentry confusion

Posted by fitheach on Fri 15 September 2017

Signing email messages is a requirement that I have several times a day. Claws Mail handles this requirement very nicely with the GPG Plugin. The plugin provides a configuration option to set a time period for the pinentry passphrase to be stored. For example, I have set the passphrase to be stored for 600 minutes. This means that when I enter the passphrase in the morning it is being cached for the rest of the working day, i.e. for 10 hours. If I need to sign an email after this period, the pinentry dialog will appear again and I re-enter the passphrase. Once entered the passphrase is stored for a further ten hours.

Claws Mail About screenshot

Claws Mail About screenshot

At least, this is how it worked until my recent upgrade. Now, regardless of the config setting of 600 minutes I was being prompted to enter my passphrase every time. This was a bit annoying.

It took me some time to realise that I actually had two pinentry tools installed: one for GTK2 and another for GNOME. I was being prompted by the GNOME version, which isn't used by the Claws Mail GPG Plugin. Although the two pinentry dialogs look different I hadn't twigged as I assumed it was a style change brought about by my system upgrade.

I couldn't deinstall the GNOME pinentry package as it was a dependency of another package which I required (Evolution). Instead I needed to prioritise the use of the GTK2 version which I could do using the command line tool update-alternatives (as root):

update-alternatives --config pinentry

There are 2 choices for the alternative pinentry
(providing /usr/bin/pinentry).

  Selection    Path                      Priority   Status
  0            /usr/bin/pinentry-gnome3   90        auto mode
  1            /usr/bin/pinentry-gnome3   90        manual mode
* 2            /usr/bin/pinentry-gtk-2    85        manual mode

Press enter to keep the current choice[*], or type selection number:

Once this was done the previous, and desired behaviour, was restored.

Related posts: