While interacting with
gnupg on Debian/Ubuntu it is often necessary to input a passphrase. I found the most reliable way to do this from the command line is to use
gpg-agent and configure the pinentry tool to be command line based. This may break GUI apps though that need a pinentry tool.
$ update-alternatives --config pinentry $ # Alternatively $ update-alternatives --set $(which pinentry-tty)