4

Root task: trying to install R mode for emacs (ESS following - https://stackoverflow.com/questions/1422987/emacs-mode-for-r)

OS: Ubuntu 18.04

Problem: When I run M-x package-refresh-contents RET

I get the following error:

Failed to verify signature archive-contents.sig:
No public key for 066DAFCB81E42C40 created at 2020-09-08T10:05:02+0100 using RSA
Command output:
gpg: WARNING: unsafe permissions on homedir '/home/xxx/.emacs.d/elpa/gnupg'
gpg: Signature made Tue 08 Sep 2020 10:05:02 BST
gpg:                using RSA key C433554766D3DDC64221BFAA066DAFCB81E42C40
gpg: Can't check signature: No public key

I tried following the accepted answer at: How to proceed on package.el signature check failure

Updating the public keys using M-x package-install RET gnu-elpa-keyring-update RET gives [No match].

If I try to update the keys manually using gpg:

gpg --homedir ~/.emacs.d/elpa/gnupg --receive-keys 066DAFCB81E42C40

gives

gpg: WARNING: unsafe permissions on homedir '/home/xxx/.emacs.d/elpa/gnupg'
gpg: keyserver receive failed: General error

Sure enough if I go to keyserver.ubuntu.com and search for the fingerprint I find nothing. Furthermore, if I try to extend the expiration date of the old key (another workaround suggested):

gpg  --quick-set-expire 474F05837FBDEF9B 1y

gives

gpg: "474F05837FBDEF9B" is not a fingerprint

Can anyone explain why this is failing? I'm not massively familiar with gpg.

Update

Following advice in the comments I managed to fix the permissions on ~/.emacs.d/elpa/gnupg so the warning is gone, however the error persists. Running M-x package-refresh-contents RET now results in:

Failed to verify signature archive-contents.sig:
No public key for 066DAFCB81E42C40 created at 2020-09-09T10:05:02+0100 using RSA
Command output:
gpg: Signature made Wed 09 Sep 2020 10:05:02 BST
gpg:                using RSA key C433554766D3DDC64221BFAA066DAFCB81E42C40
gpg: Can't check signature: No public key

Similarly, running: gpg --homedir ~/.emacs.d/elpa/gnupg --receive-keys 066DAFCB81E42C40

just gives:

gpg: keyserver receive failed: General error

  • What are the permissions of `~/.emacs.d/elpa/gnupg`? They probably need to be `drwx------`. – loris Sep 08 '20 at 11:37
  • ```drwxr-xr-x 8 xxx xxx 4096 Sep 8 11:15 .emacs.d``` I couldn't figure out why this warning appeared either, I don't think I've ever touched the permissions. – R. Mitchell Sep 08 '20 at 12:54
  • They are 700 for me: change the permissions and try again. It might eliminate the problem or at least eliminate the permissions as the source of the problem – NickD Sep 08 '20 at 14:51
  • 1
    Just realised how stupid my last comment was. The permissions on ```~/.emacs.d/elpa/gnupg``` were wrong. I've fixed them and the issue persists. Update above. – R. Mitchell Sep 09 '20 at 12:38

3 Answers3

4

I had the same problem. It seems like gpg is not able to locate a key server.

To fix it, in the ~/.emacs.d/elpa/gnupg directory, create a file named gpg.conf with the following line:

keyserver hkp://keyserver.ubuntu.com

Then run this on the command line:

gpg --homedir ~/.emacs.d/elpa/gnupg --receive-keys 066DAFCB81E42C40

And then in emacs:

M-x package-refresh-contents RET
Justin N
  • 141
  • 4
0

Try the following:

gpg --homedir ~/.emacs.d/elpa/gnupg --keyserver hkps://keys.openpgp.org --recv-keys 066DAFCB81E42C40

You might also like to add keyserver hkp://keys.gnupg.net to your ~/.emacs.d/elpa/gnupg/gpg.conf file

And finally don't forget to run M-x package-refresh-contents RET

toomaj
  • 1
  • 1
0

Run this on the command line:

gpg --homedir ~/.emacs.d/elpa/gnupg --keyserver hkp://keyserver.ubuntu.com --receive-keys 066DAFCB81E42C40

Then, inside Emacs, download descriptions of all configured ELPA packages:

M-x package-refresh-contents RET
tessiof
  • 1
  • 1