Only figured this out yesterday:
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
…
#lnzctjq
(#lnzctjq) @movq@www.uninformativ.de Huuuhhh?! Did I get this correctly? There are programs installed that miss (some of) their dependencies?! What the heck! O_o
#3aku22a
(#lnzctjq) @lyse@lyse.isobeef.org They are optional dependencies and listed as such:
$ pacman -Qi pinentry
Name : pinentry
Version : 1.3.1-5
Description : Collection of simple PIN or passphrase entry dialogs which
utilize the Assuan protocol
Optional Deps : gcr: GNOME backend [installed]
gtk3: GTK backend [installed]
qt5-x11extras: Qt5 backend [installed]
kwayland5: Qt5 backend
kguiaddons: Qt6 backend
kwindowsystem: Qt6 backend
And it’s probably a good thing that they’re optional. I wouldn’t want to have all that installed all the time.
#iaa2bza
(#lnzctjq) @movq@www.uninformativ.de Wow, up until now, it never occurred to me that dependencies can be optional. :-O I gotta put that on my research list.
#3xjdr3q
(#lnzctjq) (Now why is that GNOME gcr
thing running with debug logs enabled that print stuff like “sending secret exchange: …”? Is this healthy?)
#k7fyycq