pinentry
, which is used to safely enter a password on Linux, has several frontends. There’s a GTK one, a Qt one, even an ncurses one, and so on.GnuPG also uses
pinentry
. And you can configure your frontend of choice here in gpg-agent.conf
.But what happens when you *don’t* configure it? What’s the default?
Turns out,
pinentry
is a shellscript wrapper and it’s not even that long. Here it is in full:#!/bin/bash
# Run user-defined and site-defined pre-exec hooks.
[[ -r "${XDG_CONFIG_HOME:-$HOME/.config}"/pinentry/preexec ]] && \
. "${XDG_CONFIG_HOME:-$HOME/.config}"/pinentry/preexec
[[ -r /etc/pinentry/preexec ]] && . /etc/pinentry/preexec
# Guess preferred backend based on environment.
backends=(curses tty)
if [[ -n "$DISPLAY" || -n "$WAYLAND_DISPLAY" ]]; then
case "$XDG_CURRENT_DESKTOP" in
KDE|LXQT|LXQt)
backends=(qt qt5 gnome3 gtk curses tty)
;;
*)
backends=(gnome3 gtk qt qt5 curses tty)
;;
esac
fi
for backend in "${backends[@]}"
do
lddout=$(ldd "/usr/bin/pinentry-$backend" 2>/dev/null) || continue
[[ "$lddout" == *'not found'* ]] && continue
exec "/usr/bin/pinentry-$backend" "$@"
done
exit 1
Preexec, okay, then some auto-detection to use a toolkit matching your desktop environment …
… and *then* it invokes
ldd
? To find out if all the required libraries are installed for the auto-detected frontend?Oof. I was sitting here wondering why it would use
pinentry-gtk
on one machine and pinentry-gnome3
on another, when both machines had the exact same configs. Yeah, but different libraries were installed. One machine was missing gcr
, which is needed for pinentry-gnome3
, so that machine (and that one alone) spawned pinentry-gtk
…