Closed jborden closed 1 week ago
Hi @jborden, thanks for using this plugin.
I've been looking into your case, and it doesn't seem like these environment variable settings need to be set in the plugin, but rather they need to be set in your Mac's environment file (For example ~/.bashrc assuming bash)
Please see https://unix.stackexchange.com/a/257065
Please let me know if you managed to set it in your environment file and if this solved the problem for you
Hi thanks for looking into this. I did try adding the entries from the SO post. I tried adding entries with
GPG_TTY=$(tty)
export GPG_TTY
in ~/.profiles, ~/.bashrc, ~/.bash_profile, but it didn't solve the issue. I'm not sure how calls to command line tools works in Obsidian plugins and what environment they load. Perhaps looking at: https://stackoverflow.com/questions/72445825/gpg-error-inappropriate-ioctl-for-device/72788147#72788147, we could have an option for setting environment vars next to the path of the GPG Executable config option? The simplest would be if it could accept export GPG_TTY=$(tty) ; /opt/homebrew/bin/gpg
Just FYI, I can run gpg
commands at my terminal.
Thanks!
I will work on adding a section with custom commands to run before the gpg command, I will let you know when this change is ready, so you can try it out and see if it fixes your problem.
Please download last version 1.1.4 and enable the new feature called "Aditional commands", and add your command in the section "Additional Commands (Before)" (See the image as reference)
Please let me know if now it is working for you, so I could close this ticket.
Apologies for the late reply, I was out of town and wasn't at my computer, so I just missed the update from Github.
tl;dr - You need to encrypt text at the command line and enter your passphrase to GPG. It will cache it. After doing this, everything will work in Obsidian.
Here is how I debugged this:
Additional Commands (Before)
with
GPG_TTY=$(tty) ; export GPG_TTY
This got rid of the 'Inappropriate ioctl for device' message, but I then had a new one 'gpg: signing failed: No such file or directory'
I was trying to use the command line to debug this, so the console logging of the exact command is helpful. So I did a
"/opt/homebrew/bin/gpg" --batch --encrypt --armor --trust-model always --sign --local-user 64DD5A914D4419FF --recipient 64DD5A914D4419FF
I entered some text, hit Ctrl-D and was prompted for my key pass phrase. I provided it. It encrypted the text. I assume it cached the password because on subsequent terminal calls, it just encrypted the text without further prompting of the password.
I was then able to encrypt text in Obsidian, yay! Oddly, I also no longer need the Additional Commands (Before)
entry anymore. Everything just works. I assume the caching of the passphrase will have some time component to it. I waited until the passphrase was no longer cached and tried to encrypt in Obsidian again. I got the Inappropriate ioctl for device
again! I entered the passphrase and everything just worked again. In summary, the SO suggestion was a red herring.
Thanks for the additional work towards fixing this!
Thanks for the feedback, I'll close this ticket, if you need further assistance in something related this Obsidian plugin, please let me know
Thank you for writing this plugin, I really like the idea of offloading encryption to the tried and true GPG utils. However, I am having an issue when trying to actually encrypt a file.
I am running on: macOS 14.4.1 (23E224)
Here is my config:
Here is the actual message:
Here is the behavior:
What I've found so far: (may or may not be relevant) https://stackoverflow.com/questions/72445825/gpg-error-inappropriate-ioctl-for-device