reddit / emacs

Fix for 'Failed to verify signature archive-contents.sig, No public key'

RememberToBackupData ยท 2022-10-19 03:44
Just thought I'd document this fix here. I have Emacs running portably on Dropbox through a batch script that sets the HOME environment variable: REM Set the environment variable HOME, which Emacs uses as the base directory. set HOME=%~dp0 REM Run Emacs, passing any parameters to it as well. "D:\Dropbox\Apps\emacs\emacs-28.1\bin\runemacs.exe" %* I began getting this error whenever I tried to list ELPA packages: Failed to verify signature archive-contents.sig: No public key for _____________ created at 2022-10-18T08:05:04+1100 using RSA Command output: gpg: keyblock resource '/d/Dropbox/Apps/emacs/.emacs.d/d:/Dropbox/Apps/emacs/.emacs.d/elpa/gnupg/pubring.kbx': No such file or directory gpg: Signature made Tue Oct 18 08:05:04 2022 AUSEST gpg: using RSA key _________________ gpg: Can't check signature: No public key My googling led me to [this Stack Exchange thread](https://emacs.stackexchange.com/questions/60278/gpg-no-public-key) which noted that this was caused by the homedir expansion producing an invalid directory path. The fix in my `init.el` is therefore: (setq package-gnupghome-dir "elpa/gnupg") This creates the keys in the directory that Emacs expects (`.emacs.d/elpa/gnupg/`) and allows the whole thing to work.