I'm getting this error while trying download a package from ELPA:

 Failed to verify signature archive-contents.sig:
 No public key for 474F05837FBDEF9B created at 2018-11-28T14:10:03-0800 using DSA
 Command output:
 gpg: keyblock resource '/c/apps/emacs-25.3_1/bin/c:/users/myuserid/.emacs.d/elpa/gnupg/pubring.kbx': No such file or directory
 gpg: Signature made Wed Nov 28 14:10:03 2018 PST
 gpg:                using DSA key CA442C00F91774F17F59D9B0474F05837FBDEF9B
 gpg: Can't check signature: No public key

I've been doing some clean up in my init file but I don't see how it could have impacted this. In a way it's a good thing because it's a good opportunity to setup gpg but it's not working for me. I used customize-apropos to set these values:

  '(epg-gpg-home-directory "C:/Program Files/Git")
  '(epg-gpg-program "gpg.exe --homedir /c/users/myuserid/.emacs.d/elpa/gnupg")

I'm using the gpg that comes with my git client. However, no matter what I set it doesn't seem to care, it still has the invalid path the keys.

What could be causing these gpg variables to not be respected??


5 Answers 5


I encountered this issue. I solved it using the following steps in order:

  1. Installing Gpg4win
  2. Make sure that the folder c:/Progra~2/GnuPG/bin is on your path before any other installed versions of the GnuPG executables (in my case, I had it installed via msys2).

Note that Progra~2 expands to "Program Files (x86)" on my system (I am using the 64 bit version of Windows, you might need to substitute Progra~1 in the string if you are using a 32 bit version of Windows).

  • Seems to have worked, thanks!
    – AndyJ
    Commented Oct 7, 2019 at 21:09
  • 1
    See also: The gnu elpa gpg key has expired in september, this seems to be the solution: gpg --homedir ~/.emacs.d/elpa/gnupg --receive-keys 066DAFCB81E42C40 source: reddit.com/r/emacs/comments/bn6k1y/updating_gnu_elpa_keys
    – AndyJ
    Commented Oct 18, 2019 at 0:03

I solved this issue using above solutions in tandem.

I changed the package-gnupghome-dir as suggested. This got me partway there. I then got a different error, Can't check signature: No public key. So, I ran

$ gpg --homedir /c/Users/micha/AppData/Roaming/.emacs.d/elpa/gnupg --receive-keys 066DAFCB81E42C40

gpg: key 066DAFCB81E42C40: public key "GNU ELPA Signing Agent (2019) <[email protected]>" imported

and the issue was resolved. Thanks, @preetpalS and @jürgen-a-erhard!

  • 1
    This worked for me on Windows using emacs build 27.2
    – Tian
    Commented Nov 13, 2021 at 18:15

Emacs' package infrastructure uses its own variable for GPG, package-gnupghome-dir. For me (and, obviously, you here) it failed because Emacs' filename functions don't see the path as an absolute path (see the "/c:/users/" in the "keyblock" line). Thus, it does what it does with relative paths, it finds them (or tries to) in the current directory.

Change the beginning of package-gnupghome-dir from "C:/" to "/c/"… that should fix it, but I only tested it on my (msys2) system. YMMV ;-)


I could only mitigate this issue by running emacs via a Windows command shell (or powershell). To clarify, I installed emacs via MSYS2, but I always encounter the pubring.kbx': No such file or directory error if I run emacs via an MSYS22 shell.

This may introduce other issues, but I can refresh my package contents, and install new packages. My .emacs.d/ seems to be in <windows home directory>/Appdata/Roaming/.

(Emacs 27.2 build 1 on Windows 10)


I faced this issue on GNU Emacs 27.2 for Windows, when I performed a M-x list-packages. In my case, I've both GNU Emacs 27.2 for Windows and MSYS2. I only have this issue under the Windows version.

The gnupg path for Windows version is under c:/users/userid/AppData/Roaming/.emacs.d/elpa/gnupg/. The gnupg path for MSYS2 version is under /home/userid/.emacs.d/elpa/gnupg. A pubring.kbx file (and other files) is found under MSYS2 version, but no files under Windows version.

I solved this issue in 2 steps: -

  1. adding (setq package-gnupghome-dir "~/.emacs.d/elpa/gnupg") to my .emacs in Windows version. .emacs should be found under c:/users/userid/AppData/Roaming/. If not found, you can create one and append the (setq...) above.
  2. copy the pubring.kbx file from MSYS2 version to c:/users/userid/AppData/Roaming/.emacs.d/elpa/gnupg/.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.