Package undo-tree is unavailable and Failed to download 'gnu' archive. Bad request. (Solution included)
Closed this issue · 32 comments
Reproduction guide 🪲
- With a new install of spacemacs, start Emacs 26.2
Observed behaviour: 👀 💔
- See a number of package unable to load errors (17 at the time of reporting)
Expected behaviour: ❤️ 😄
- bootstrapping works
System Info 💻
- OS: darwin
- Emacs: 26.2
- Spacemacs: 0.200.13
- Spacemacs branch: master (rev. 8c0b8c3)
- Graphic display: nil
- Distribution: spacemacs
- Editing style: vim
- Completion: helm
- Layers:
(ruby helm emacs-lisp)
- System configuration features: JPEG NOTIFY ACL GNUTLS LIBXML2 ZLIB MODULES THREADS LCMS2
Solution
This is not a bug in Spacemacs per se but I figured people would want the solution.
In ~/.emacs.d/init.el
, at the top, I added
(setq gnutls-algorithm-priority "NORMAL:-VERS-TLS1.3")
and it solved my problems. Thanks to https://www.reddit.com/r/emacs/comments/cdei4p/failed_to_download_gnu_archive_bad_request/ for the pointer.
Here's the upstream issue: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=34341
Cheers mate!
This helped me! Thanks!
I would have never found this issue without the gitter channel. The title of the issue didn't match the actual issue, at least according to a newcomer to emacs via spacemacs. The proposed fix here seems to have fixed my issue.
Solution by @yanowitz also worked for me.
Updated issue title in order for users to find it more easily.
Thank you for the issue.
Backported the fix, should be fixed in develop.
I think this solution caused a regression on my machine. It also seems to break a lot of circle CI builds. Now every time I try to install a package (by adding it to dotspacemacs-additional-packages
) I get the following error on the messages buffer:
(Spacemacs) --> refreshing package archive: melpa... [1/3]
Contacting host: melpa.org:443
gnutls.el: (err=[-50] The request is invalid.) boot: (:priority NORMAL:-VERS-TLS1.3 :hostname melpa.org :loglevel 0 :min-prime-bits 256 :trustfiles (/etc/ssl/cert.pem) :crlfiles nil :keylist nil :verify-flags nil :verify-error nil :callbacks nil)
(Spacemacs) --> refreshing package archive: org... [2/3]
Contacting host: orgmode.org:443
gnutls.el: (err=[-50] The request is invalid.) boot: (:priority NORMAL:-VERS-TLS1.3 :hostname orgmode.org :loglevel 0 :min-prime-bits 256 :trustfiles (/etc/ssl/cert.pem) :crlfiles nil :keylist nil :verify-flags nil :verify-error nil :callbacks nil)
(Spacemacs) --> refreshing package archive: gnu... [3/3]
gnutls.el: (err=[-50] The request is invalid.) boot: (:priority NORMAL:-VERS-TLS1.3 :hostname elpa.gnu.org :loglevel 0 :min-prime-bits 256 :trustfiles (/etc/ssl/cert.pem) :crlfiles nil :keylist nil :verify-flags nil :verify-error nil :callbacks nil)
(Spacemacs) --> installing package: chocolate-theme@dotfile... [1/1]
gnutls.el: (err=[-50] The request is invalid.) boot: (:priority NORMAL:-VERS-TLS1.3 :hostname melpa.org :loglevel 0 :min-prime-bits 256 :trustfiles (/etc/ssl/cert.pem) :crlfiles nil :keylist nil :verify-flags nil :verify-error nil :callbacks nil)
(Spacemacs) Error:
An error occurred while installing chocolate-theme (error: (gnutls-error melpa.org -50))
I reverted commit d19d91f and the error went away.
System Info 💻
- OS: darwin
- Emacs: 26.1
- Spacemacs: 0.300.0
- Spacemacs branch: develop (rev. 3521d7a)
- Graphic display: t
- Distribution: spacemacs
- Editing style: vim
- Completion: ivy
- Layers:
(ivy auto-completion better-defaults emacs-lisp git html markdown
(ibuffer :variables ibuffer-group-buffers-by 'projects)
themes-megapack yaml python multiple-cursors
(lsp :variables lsp-ui-doc-enable nil lsp-enable-on-type-formatting nil lsp-ui-sideline-show-hover nil lsp-ui-sideline-show-symbol nil lsp-ui-sideline-show-code-actions nil)
(java :variables java-backend 'lsp)
(c-c++ :variables c-c++-default-mode-for-headers 'c++-mode)
(version-control :variables version-control-diff-tool 'diff-hl version-control-global-margin t version-control-diff-side 'left))
- System configuration features: JPEG RSVG IMAGEMAGICK NOTIFY ACL GNUTLS LIBXML2 ZLIB TOOLKIT_SCROLL_BARS NS MODULES THREADS LCMS2
Also gnutls-cli version is gnutls-cli 3.5.19
.
I was testing with '(chocolate-theme)
but I think any package that it tries to download will trigger the same problem (see recent circleci build https://circleci.com/gh/syl20bnr/spacemacs/40315).
I think it has something to do with the gnutls version. IIRC the bug is only present from a specific version of gnutls.
I cannot reproduce the bug, chocolate-theme
is installed as expected on my system which is:
- MacOS Mojave
- Emacs 26.1
- gnutls-cli version 3.6.5
I'm also seeing the error message:
gnutls.el: (err=[-50] The request is invalid.) boot: (:priority NORMAL:-VERS-TLS1.3 :hostname melpa.org :loglevel 0 :min-prime-bits 256 :trustfiles (/etc/ssl/cert.pem) :crlfiles nil :keylist nil :verify-flags nil :verify-error nil :callbacks nil)
It's happening when I try to update packages. A warnings buffer opened:
Warning (spacemacs):
Error while contacting melpa repository!
Warning (spacemacs):
Error while contacting org repository!
Warning (spacemacs):
Error while contacting gnu repository!
I was prompted to update the packages.
Do you want to update 4 package(s)? (y or n)
Switching back to the Spacemacs buffer showed that 4 packages had updates:
doom-modeline
helm
helm-org
org-plus-contrib
I answered y
and restarted. But on startup the err=[-50] message appeared and the packages were unable to be installed. And since Helm
was one of the packages, then a lot of things didn't work.
Like searching SPC /
, I think the error message said something about helm-do...
And opening files didn't work either SPC f f
it might depend on helm-find-files
, same thing with C-x C-f
(they probably use the same command).
Commenting out the fix in core-emacs-backports.el
(when (and (version< "25" emacs-version)
(version< emacs-version "26.3"))
;; backport fix for https://debbugs.gnu.org/cgi/bugreport.cgi?bug=34341
(setq gnutls-algorithm-priority "NORMAL:-VERS-TLS1.3"))
installed the packages without any issues.
I also tried uncommenting the fix and adding chocolate-theme
to the additional packages, and the issue also occur there. It's probably obvious, since they probably use the same installation procedure, It was just another test.
I wonder if people with installation issues before applying the TLS1.3 fix are behind a proxy/firewall?
System Info 💻
- OS: windows-nt
- Emacs: 26.2
- Spacemacs: 0.300.0
- Spacemacs branch: develop (rev. 31353d7)
- Graphic display: t
- Distribution: spacemacs
- Editing style: vim
- Completion: helm
- Layers:
(autohotkey auto-completion emacs-lisp git helm html javascript markdown multiple-cursors
(org :variables org-want-todo-bindings t)
python shell spell-checking syntax-checking themes-megapack treemacs version-control)
- System configuration features: XPM JPEG TIFF GIF PNG RSVG SOUND NOTIFY ACL GNUTLS LIBXML2 ZLIB TOOLKIT_SCROLL_BARS THREADS LCMS2
I ran into this issue (gnutls error) with emacs 26.2 on ubuntu 18.04 installed on a AWS vm. This means the networking in NAT for ipv4 normal for ipv6 and there is a default firewall that allows everything out but almost nothing in.
Windows 1903, gnutls-cli 3.6.0
In a Ubuntu 18.04 virtualbox vm, Command 'gnutls-cli' not found
. But I'm seeing the -50 error on startup (the packages haven't been installed with Emacs 26.2 yet, Spacemacs was installed with 27.0.50).
The latest commit seems to have fixed it.
Packages are installed without any errors with Emacs 26.2 in both Windows 1903, and Ubuntu 18.04.
Commit 25f639e indeed solved the problem of download of packages.
However, at least on macOS, I can no longer start spacemacs without internet. If I turn off wifi, spacemacs stops initializing with this error:
Warning (initialization): An error occurred while loading ‘/Users/henrique/.emacs.d/init.el’:
error: api.github.com/443 nodename nor servname provided, or not known
To ensure normal operation, you should investigate and remove the
cause of the error in your initialization file. Start Emacs with
the ‘--debug-init’ option to view a complete error backtrace.
At this point only default emacs is loaded.
No worries. Thanks for all your effort!
I pushed the fix for offline support. It simply ignore errors :-)
Thanks @yanowitz! And thanks to @gcentauri for pointing me here!
I have two linux systems. One is arch, and the other is fedora. Both systems have emacs 26.2 and the latest develop version of spacemacs. I was hitting this bug on the fedora system (despite having the patch), but not on the arch system. After reading this entire thread, I was able to determine that the issue was that gnutls-cli
was installed on my arch box, but not on fedora. dnf install gnutls-utils
fixed it. This seems like a pretty specific edge case, but if you're hitting this bug on an RPM-based system, be aware that apparently gnutls
and gnutls-cli
are packaged separately, so you may have the former but not the latter.
Thanks!!!
Another solution to this problem:
My issue was that I had emacs 25.x on my system and there were some issues with that verision of emacs. Here are the commands below that fixed my issue.
sudo apt autoremove emacs emacs23 emacs24 emacs25
sudo add-apt-repository ppa:kelleyk/emacs
sudo apt-get update
sudo apt install emacs26
I had this issue on Ubuntu 18.04 with Emacs 26.3 installed from ppa:kelleyk/emacs and got it fixed by installing gnutls-bin (sudo apt install gnutls-bin
).
If you are using snap
to install on ubuntu 18.04, I couldn't get it to work and had to fall back to using apt
. I had to use emacs26 to get this to work.
Any updates on this? I have emacs 26.1 installed (Ubuntu 19.04) and every time I start it with spacemacs configured it just tries to download packages it failed to install (undo-tree
being one of them) and keeps failing. I've tried the solution in the original post but that doesn't resolve anything.
EDIT: apparently emacs 26.1 just doesn't work anymore. After upgrading my distribution and getting 26.3 everything works just fine.
I had same issue on Ubuntu 18.04
For me solution was to remove emacs packages which were installed from PPA repository and install emacs from snap store.
I am have issues with this on OS X Catalina. Tried with emacs 26, 27, and 28 all have the same issue.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Please let us know if this issue is still valid!
for future references, please use latest stable Emacs and Spacemacs develop branch.
Closing this now but if it re-appears, one can open a new issue.