2

On Emacs 26.3, Ubuntu 20.04, when I run

emacs -Q

followed by

(package-refresh-contents)

I get

Contacting host: elpa.gnu.org:443

So the package refresh just hangs. I tried to switch from https to http, but no luck.

user31313
  • 121
  • 5
  • FWIW there was a [bug](https://gnu.emacs.bug.narkive.com/d7AZ6sQP/bug-17879-24-3-92-package-refresh-contents-hangs-at-contacting-host-melpa-milbox-net-80) about this (closed as unfixed). I still have the issue (Emacs hangs, not only stuck at "Contacting host: ...") with GNU Emacs 26.1 – Httqm Nov 04 '20 at 11:13

2 Answers2

4

Try:

(custom-set-variables
 '(gnutls-algorithm-priority "normal:-vers-tls1.3"))

Found by @sds (https://emacs.stackexchange.com/a/56067/21569) and the emacs-devel mailing list (Cf. https://emacs.stackexchange.com/a/56067/795 ).

Supposedly the underlying issue was fixed in emacs 26.3, but I still see it in emacs 27.1[^1].

[^1]: exact versions

( cat /etc/fedora-release ; uname -a ; rpm -q emacs) | sed -e "s/$(hostname)/XXX/"
Fedora release 33 (Thirty Three)
Linux XXX 5.10.12-200.fc33.x86_64 #1 SMP Mon Feb 1 02:40:52 UTC 2021 x86_64 
x86_64 x86_64 GNU/Linux
emacs-27.1-2.fc33.x86_64
mtd
  • 161
  • 4
0

Having a similar issue with the MELPA stable repository (GNU Emacs 26.1 on Debian 10.6), I've been able to workaround this with :

(package-initialize)
(setq package-check-signature nil)
(require 'package)
(setq package-archives '(
    ("melpa-stable" . "http://www.mirrorservice.org/sites/stable.melpa.org/packages/")
    )
)

with some limitations / remarks :

Httqm
  • 141
  • 5
  • I suggest you to look into fixing HTTPS. It will affect far more than just fetching packages. The package signature part isn't required if you only use MELPA. – wasamasa Nov 05 '20 at 07:34