Emacs, Melpa and the “Failed to download GNU” archive error

The problem

If a few days ago you tried to install Evil for Emacs under Linux Debian 10 or Fedora 30 you might have found a bad surprise: a Failed to download GNU archive error.

Even in Linux Manjaro I found the same problem.

The same error occurs if you try to run the Emacs command: M-x package-refresh-contents to refresh the Melpa archive.

The problem, however, does not affect all distributions. In Linux Mint 19.x I didn’t find the problem.

The version of Emacs in my Linux Mint distribution is 25.2.2. In Debian 10 I found Emacs 26.1. In Fedora 30 and Manjaro Emacs 26.2.

I suspect from these observations that the problem is related to version 26.x of Emacs.

I have done a lot of researches to find a solution to the problem.

I also tried installation via el-get with the command M-x el-get-install RET evil RET but in this archive the package was not found.

The solution

Finally I found a working solution that solved the problem in every distributions.

It seems that the key is to insert at the beginning of Emacs configuration file (i.e the .emacs file) the following string

(setq gnutls-algorithm-priority "NORMAL:-VERS-TLS1.3")

as suggested in this page and this other page followed by M-x package-initialize and M-x package-refresh-contents.

After the modifiy I was be able to install Evil without any problem.

Thank you for your attention.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store