To reproduce the problem:
$ echo $DISPLAY :0.0 $ (unset DISPLAY; pinentry-qt --display :0.0) Unable to init server: Could not connect: Connection refused (pinentry-qt:8246): Gtk-WARNING **: 12:00:11.688: cannot open display:
Because gpg-agent may invoke pinentry with no DISPLAY env var but --display option, this is problematic.