Closed mattock closed 7 years ago
could you run export GPG_TTY=$(tty)
and test again in that shell env?
Indeed, that does the trick:
$ export GPG_TTY=$(tty)
$ freight-cache -c /etc/freight.conf
...and the pinentry screen pops up.
@mmoll : I guess this is something we should document, then. Shall I provide a documentation PR?
Yes, please. At least if there's no possibility to handle this automatically (I didn't dig deeper on that).
Running freight-cache fails on Debian 9 which comes with GnuPG 2.1.18 installed:
When I run the same with "set -x" in /usr/bin/freight-cache the offending command-line is conveniently shown:
The problem seems to be that GnuPG 2.x by default requires gpg-agent and expects the user to enter the password via some pinentry mechanims (e.g. pinentry-curses, pinentry-gnome3). A fix / workaround is to append
--pinentry-mode loopback
to the gpg command-line in lib/freight/apt.sh. However, the --pinentry-mode parameter is unknown to GnuPG 1.x, so it would have to be added conditionally.Another way to fix this would be to ensure that freight can actually use a running gpg-agent. In my case it does, except that it does not pop up any pinentry GUI. If I run an essentially identical command manually outside freight the pinentry GUI does show up:
Once gpg-agent has cached the password entered via pinentry, freight-cache is able to use the cached credentials. So the only problem is that something in freight-cache / apt.sh prevents it from showing the pinentry prompt.
EDIT: fix a small typo.