4

I've installed emacs on a new machine (macos) brew cask install emacs. My init.el file gets stuck installing cider (clojure ide) because it requires "spinner". When I do: M-x package-refresh-contents, I get the message "Failed to download 'gnu' archive" which leads me to believe elpa may be down, however, the elpa website itself does not appear to be down. If I try to manually install the package, the specific message is something to do with a "bad request".

I've tried to manually install the spinner.el file just to unblock myself, but that didn't seem to work. So the question is in two parts:

  1. How can I dig further into the issue, see if elpa is working, and debug the problem?
  2. How can I unblock myself? Does package installation of CIDER not check if "spinner" is already installed?
3
  • Does M-x eww https://elpa.gnu.org/ work? If not, maybe it's a HTTPS issue. If so, you can switch to HTTP by changing package-archives as a workaround, though you're suggested to figure out why HTTPS failed then fix it if you can. You can install spinner manually with M-x package-install-from-buffer, but you are going to need gnu elpa anyway in the future. Commented Jul 15, 2019 at 0:35
  • 3
    This may be Bug#36017, if it is, (setq gnutls-algorithm-priority "NORMAL:-VERS-TLS1.3") might work around it without disabling HTTPS completely. Commented Jul 15, 2019 at 3:29
  • @xuchuyang M-x package-install-from-buffer worked for me working around it. I will report back on the HTTPS when I have time to investigate. Commented Jul 19, 2019 at 21:20

1 Answer 1

3

A solution in several lines of code in elisp Emacs init file:

;; Some combination of GNU TLS and Emacs fail to retrieve archive ;; contents over https. ;; https://www.reddit.com/r/emacs/comments/cdei4p/failed_to_download_gnu_archive_bad_request/etw48ux ;; https://debbugs.gnu.org/cgi/bugreport.cgi?bug=34341 (if (and (version< emacs-version "26.3") (>= libgnutls-version 30604)) (setq gnutls-algorithm-priority "NORMAL:-VERS-TLS1.3")) 

Taken from here: https://www.reddit.com/r/emacs/comments/cdei4p/failed_to_download_gnu_archive_bad_request/ettqtlk/

How can I dig further into the issue, see if elpa is working, and debug the problem?

To find the above solution, some users tried unencrypted HTTP URLs, and it worked:

(setq package-archives '(("gnu" . "http://elpa.gnu.org/packages/") ("melpa" . "https://melpa.org/packages/") ("org" . "http://orgmode.org/elpa/"))) 
4
  • (>= libgnutls-version 30600) - that should be (>= libgnutls-version 30603) I believe. Commented Aug 24, 2019 at 2:51
  • @npostavs Probably. Though the fix worked for me as is. The bug(minor incompatibility) is meant to be fixed in Emacs 26.3; Commented Aug 24, 2019 at 12:52
  • gnutls only implemented TLS 1.3 in version 3.6.3, and it seems that setting the priority string for earlier versions will break things, e.g., github.com/magit/ghub/issues/89 Commented Aug 24, 2019 at 15:05
  • @npostavs Edited to check for 3.6.4 version, a final TLS 1.3 impl-tion. To be more robust on other distros. My Manjaro(Arch Linux) updated gnutls (3.5.19-2 -> 3.6.5-1) at 2018-12-31;(/var/log/pacman.log) Commented Aug 24, 2019 at 15:30

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.