I am trying to install packages/modes from melpa on my emacs27.1, but I am unable to do so. If I run M-x package-refresh-contents
, I get the following error :
Importing package-keyring.gpg...done
Contacting host: elpa.gnu.org:443
gnutls.el: (err=[-50] The request is invalid.) boot: (:priority NORMAL:-VERS-TLS1.3 :hostname elpa.gnu.org :loglevel 0 :min-prime-bits nil :trustfiles (/etc/ssl/certs/ca-certificates.crt) :crlfiles nil :keylist nil :verify-flags nil :verify-error nil :callbacks nil)
Failed to download ‘gnu’ archive.
gnutls.el: (err=[-50] The request is invalid.) boot: (:priority NORMAL:-VERS-TLS1.3 :hostname stable.melpa.org :loglevel 0 :min-prime-bits nil :trustfiles (/etc/ssl/certs/ca-certificates.crt) :crlfiles nil :keylist nil :verify-flags nil :verify-error nil :callbacks nil)
Package refresh done
Failed to download ‘melpa-stable’ archive.
You can run the command ‘package-refresh-contents’ with M-x pa-r- RET
Failed to download ‘melpa-stable’ archive.
My emacs init file has the following commands corresponding to this function:
(setq gnutls-algorithm-priority "NORMAL:-VERS-TLS1.3")
(package-initialize)
(require 'package)
(add-to-list 'package-archives
'("melpa-stable" . "https://stable.melpa.org/packages/") t)
By tracing a little I thought the error might be due to GnuTLS and it could not connect to the internet. So I tried M-x eww RET https://www.wikipedia.org/ RET
, it stops at Contacting host: www.wikipedia.org:443
and does not load anything.
Prior to this, I was running on emacs25 (updated to 27.1 thinking this error would go away), and when I ran M-x eww RET https://www.wikipedia.org/ RET
on emacs25, I would get
Contacting host: www.wikipedia.org:443
gnutls.el: (err=[-50] The request is invalid.) boot: (:priority NORMAL:-VERS-TLS1.3 :hostname www.wikipedia.org :loglevel 0 :min-prime-bits 256 :trustfiles (/etc/ssl/certs/ca-certificates.crt) :crlfiles nil :keylist nil :verify-flags nil :verify-error nil :callbacks nil)
gnutls-negotiate: GnuTLS error: #<process www.wikipedia.org>, -50
Though I am running on Ubuntu 18.04LTS I tried the answer mentioned here hoping it would work, but unfortunately it did not. Please let me know if I need to add something more to my init file, or download some certificate or anything else.
error in process filter: eww-display-html: This function requires Emacs to be compiled with libxml2
. However,M-x package-refresh-contents
works and I was able to install jedi successfully and use it. Even though this is not a solution to make GnuTLS work, it madepackage-refresh-contents
work, so I believe you can write your comment as an answer so that it will help those who face same problem in the future. Thanks again!!