Homebrew / homebrew-core

🍻 Default formulae for the missing package manager for macOS (or Linux)

Home Page:https://brew.sh

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

gnupg2: gpg: public key decryption failed: Inappropriate ioctl for device

olalonde opened this issue · comments

commented

Please always follow these steps:

  • Confirmed this is a problem with brew installing one, specific formula (not cask) and not every time you run brew? If it's a general brew problem please file this issue at https://github.com/Homebrew/brew/issues/new. If it's a brew cask problem please file this issue at https://github.com/Homebrew/caskroom/homebrew-cask/new
  • Ran brew update and retried your prior step?
  • Ran brew doctor, fixed all issues and retried your prior step?
  • Ran brew gist-logs <formula> (where <formula> is the name of the formula that failed) and included the output link?
  • If brew gist-logs didn't work: ran brew config and brew doctor and included their output with your issue?

Please note we will close your issue without comment if you delete or do not fill out the issue checklist and provide ALL the requested information.

To help us debug your issue please explain:

  • What you were trying to do (and why)

Decrypt text with gpg2 -d.

  • What happened (include command output)
cat password.txt | base64 --decode | gpg2 -d
gpg: encrypted with 2048-bit RSA key, ID CBD2E04C36A72E45, created 2017-05-13
      "Oli Lalonde <me@my-email.com>"
gpg: public key decryption failed: Inappropriate ioctl for device
gpg: decryption failed: No secret key
  • What you expected to happen
Get the decrypted text
  • Step-by-step reproduction instructions (by running brew install commands)
brew install gnupg2
cat encrypted-text.txt | base64 --decode | gpg2 -d
commented

This workaround fixed the problem: IJHack/QtPass#156 (comment)

brew install pinentry-mac
echo "pinentry-program /usr/local/bin/pinentry-mac" >> ~/.gnupg/gpg-agent.conf
killall gpg-agent

The pinentry-mac formula already tells you to do that (in the caveats, emitted when the formula is installed).

But I find it weird that the gnupg2 formula, which depends on pinentry and compiles it in as the default pinentry, results in a gpg binary that doesn't just call that (console) pinentry out of the box.

commented

Yeah, I just found out about the pinentry-mac workaround by googling for this issue, it's not a pinentry-mac bug report but a gnupg2 one.

I wonder if this has any bearing on the reason why it isn't using the configured pinentry:

You should always add the following lines to your .bashrc
or whatever initialization file is used for all shell invocations:
      GPG_TTY=$(tty)
      export GPG_TTY
It is important that this environment variable always reflects the
output of the tty command. For W32 systems this option is not required.

from here.

commented

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

commented

Beep boop, might be stale but still an issue ;)

commented

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

This is not a Homebrew issue, but rather one of user configuration. The information I posted before should solve your issue.

The relevant configuration instructions, (the solution), are present both on gnupg.org and towards the beginning of the gpg-agent manpage.

Given these two things, and the fact that the user configuration is predominantly outside of Homebrew's scope in cases like this, this issue is inherently "resolved".

Apologies for opening a frivolous ticket @JCount

It was not clear to me from this thicket that your comment represented the community opinion on the matter of bundled pinentry tool.

Thank you for all the hard work you do as a maintainer, and for speedily reviewing community PRs.

My comment represents the opinion and position of the maintainers of this project.