Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Emacs hangs at contacting host #4453

Open
danprince opened this issue Jan 6, 2016 · 57 comments
Open

Emacs hangs at contacting host #4453

danprince opened this issue Jan 6, 2016 · 57 comments

Comments

@danprince
Copy link

Trying to install spacemacs on Ubuntu 15.04.

I've moved the spacemacs files to ~/.emacs.d/, but when I start emacs I get a flash of the initial emacs window, then a black screen with

Contacting host: melpa.org:443

Once it opened with orgmode.org:80 instead, but I haven't been able to recreate that.

  • Emacs works fine without the init file (emacs -q).
  • Using emacs 24.4.1
  • Using spacemacs 0.105.0
  • emacs --debug-init produces no output
  • I can curl https://melpa.org so not a network restriction

I've tried a fresh install of both emacs and spacemacs as well as using emacs, emacs24 and emacs24-x (but I'm not exactly sure what the differences are).

I've been writing Clojure for the last few months and I'm keen to beat some of the struggles I've been having with Lisp + Vim, but after five or six attempts, I've given in and resorted to putting in an issue. Any ideas?

@syl20bnr
Copy link
Owner

syl20bnr commented Jan 6, 2016

Can you try launching emacs with emacs --insecure to not use HTTPS to contact MELPA ?

@danprince
Copy link
Author

Aha, that's how created the orgmode.org:80 hang. It starts with melpa.org:80 then switches to Contacting host: orgmode.org:80 and hangs there instead.

@danprince
Copy link
Author

@syl20bnr Is it possible to install the packages manually from the repository? If so, will that prevent emacs from making that initial network request?

@greasynose
Copy link

@danprince I'm also meet this problem, do you solve it ?

@nickbdyer
Copy link

Did anyone find a solution to this?

@danprince
Copy link
Author

I haven't solved this problem yet. I just tried building emacs 24.4 from source and I still have a similar problem with Spacemacs.

Running emacs and emacs-24.4 causes it to hang at:

Opening TLS connection to melpa.org...done

Running emacs --insecure causes it to hang at:

Contacting host: melpa.org

@liangwang
Copy link

The same issue as OP reported, and the issue is only observed on Linux, no problems on Windows and MacOS.

Using latest spacemacs (v0.105.14), and emacs 24.5 for all three platforms.

@wende
Copy link

wende commented Apr 25, 2016

I've got the same problem on OSX with Emacs v0.105.19

Running from finder instead of terminal fixed the issue

@myme5261314
Copy link

Also meeting this issue, even though I've replaced melpa, org and gnu urls to the China mirror, It takes at least 5 minutes or more staying echo the contacting host: elpa.zilongshanren.com:80. @zilongshanren
The only way I found for now to work with it is just wait, maybe 10 minutes, maybe 30 minutes, it varies.
I'm on Ubuntu 14.04, using Emacs 24.5.1, spacemeacs 0.105.20

@zilongshanren
Copy link
Contributor

@myme5261314 Try to disable https?

@myme5261314
Copy link

Yes

  (setq-default
   ;; If non nil ELPA repositories are contacted via HTTPS whenever it's
   ;; possible. Set it to nil if you have no way to use HTTPS in your
   ;; environment, otherwise it is strongly recommended to let it set to t.
   ;; This variable has no effect if Emacs is launched with the parameter
   ;; `--insecure' which forces the value of this variable to nil.
   ;; (default t)
   dotspacemacs-elpa-https nil
   ;; Maximum allowed time in seconds to contact an ELPA repository.
   dotspacemacs-elpa-timeout 5

But the funny thing is that the dotspacemacs-elpa-timeout 5 seems have no effects, it just hang on for more than 5 seconds.

@zilongshanren don't make it wrong, it's not caused by the mirror, the problem exists while using melpa outside China, refer to the issue author.

@necto
Copy link

necto commented Jul 12, 2016

Similar issue here. I wanted to bootstrap spacemacs on a new ubuntu 14.04 machine.
Tried multiple emacs versions.

  • 24.3 kinda works - it manages to download packages, but then some packages do not work with emacs version lower than 24.4.
  • 24.4, 24.5, 25.1, no matter if I add --insecure option or not, hangs on

contacting host: melpa.org:443

And becomes unresponsive (5 sec timeout in .spacemacs clearly does not work). --debug-init does not help, as it hangs right after start. I can interrupt the init process by C-G C-G, but then I can not exit emacs, as C-x C-c nor SPC q q do not work.

@myme5261314
Copy link

Actually, don't know why, after a long holiday, my issue described above was gone and it exists before the holiday. Using the china mirrors won't hang up. Just for reference.

@snaphuman
Copy link

Hi. I have an emacs config that remained almost the same through several emacs updates and I did not change how emacs contact melpa repositories. So checking melpa documentation I noticed that my config was pointing to http://melpa.milkbox.net/packages as shown in the following code snippet

'(package-archives
(quote
(("melpa" . "http://melpa.milkbox.net/packages/")
("gnu" . "http://elpa.gnu.org/packages/"))))

Changing this config to as recommended in melpa.org solved the issue to me:

(require 'package)
(add-to-list 'package-archives
'("melpa" . "https://melpa.org/packages/"))
(when (< emacs-major-version 24)
(add-to-list 'package-archives '("gnu" . "http://elpa.gnu.org/packages/")))

Hope this helps

@ghost
Copy link

ghost commented Aug 16, 2016

I had the same issue just now. It happened after I added html to the existing dotspacemacs-configuration-layers list in my ~/.spacemacs per the HTML layer instructions, and closed Spacemacs.

When I next started Spacemacs, it hung. Above the mode line, it said:

Found 9 new package(s) to install...
--> refreshing package archive: melpa... [1/3]

Below the mode line, it said: Contacting host: melpa.org:443

After several minutes, Spacemacs gave the following messages above the mode line:

9 errors at startup! Spacemacs may not be able to operate properly.
Warning (spacemacs): 
Error connection time out for melpa repository!

and the following below the mode line:

Leaving directory `/home/sampablokuper/.emacs.d/elpa/haml-mode-20150508.2011'

Compiling file /home/sampablokuper/.emacs.d/elpa/haml-mode-20150508.2011/haml-mode-pkg.el at Tue Aug 16 20:53:16 2016
Entering directory `/home/sampablokuper/.emacs.d/elpa/haml-mode-20150508.2011/'

Compiling file /home/sampablokuper/.emacs.d/elpa/haml-mode-20150508.2011/haml-mode.el at Tue Aug 16 20:53:16 2016

In haml-fontify-region:
haml-mode.el:134:14:Warning: `font-lock-syntactic-keywords' is an obsolete
    variable (as of 24.1); use `syntax-propertize-function' instead.

In haml-fontify-region-as-javascript:
haml-mode.el:174:43:Warning: reference to free variable
    `js--font-lock-keywords-3'
haml-mode.el:175:56:Warning: reference to free variable
    `js-font-lock-keywords-3'
haml-mode.el:176:47:Warning: reference to free variable `js-mode-syntax-table'
haml-mode.el:177:60:Warning: reference to free variable
    `javascript-mode-syntax-table'
haml-mode.el:180:61:Warning: reference to free variable
    `js--quick-match-re-func'

In haml-fontify-region-as-markdown:
haml-mode.el:202:28:Warning: reference to free variable
    `markdown-mode-syntax-table'

In haml-maybe-extend-region:
haml-mode.el:386:18:Warning: reference to free variable `font-lock-beg'
haml-mode.el:390:17:Warning: reference to free variable `font-lock-end'
haml-mode.el:390:55:Warning: assignment to free variable `font-lock-beg'
haml-mode.el:392:21:Warning: assignment to free variable `font-lock-end'

Compiling no file at Tue Aug 16 20:53:18 2016

I tried restarting Spacemacs a couple of times, with similar results.

Update: A day later, and restarting Spacemacs worked fine, without any of the warnings above.

@wudixiaotie
Copy link

The reason is mepla.org is not stable. I use an agent based in US, still can't open page Multiple-Cursors from melpa. Got an Error:
503 Service Unavailable

@ghost
Copy link

ghost commented Aug 18, 2016

The reason is mepla.org [sic] is not stable.

It's true that melpa.org is sometimes down. Additionally, it might sometimes be unreachable for other reasons outside the melpa maintainers' control, e.g. client misconfiguration, or unreliable internet connectivity. But even if Spacemacs can't reach melpa.org, or if melpa.org returns an error when Spacemacs does reach it, Spacemacs ideally ought not to hang :)

@d12frosted
Copy link
Collaborator

@sampablokuper Indeed it should hang. I've sent PR that advocates this issue.

@ghost
Copy link

ghost commented Aug 18, 2016

@d12frosted

Indeed it should hang. I've sent PR that advocates this issue.

I'm not yet sufficiently literate in Emacs Lisp to grok your PR, but I think it means that if Spacemacs can't reach a repository (e.g. Melpa), then it will hang with the following error:

Archive '%s' is not available. Please verify that you have internet connection and you are able to connect to +%s.

That's definitely more helpful than the current feedback, but it would be nice if the feedback would additionally give the user a clearly stated means to bypass the hang, deferring whatever it was that Spacemacs was trying to do with the currently-unreachable repository until the next time Spacemacs is started. E.g.

Archive '%s' is not available. Please verify that you have internet connection and you are able to connect to +%s. Alternatively, press foo bar to skip this operation until the next time Spacemacs is run.

I'm not sure what the most user-friendly key binding would be, which is why I just wrote foo bar. Maybe something like SPC e s for "Spacemacs error skip"?

Anyhow, it's great that you're working to improve the issue. Thanks!

@d12frosted
Copy link
Collaborator

@sampablokuper :

but I think the implication is that if Spacemacs can't reach a repository (e.g. Melpa), then it will hang with the following error

Yes, you understood it correctly.

That's definitely more helpful than the current feedback, but it would be nice if the feedback would additionally give the user a clearly stated means to bypass the hang

I don't see any way to help with connectivity problem without looking into specific case. Bad internet connection, walls and other stuff can't be and should not be fixed from Spacemacs side. That's why it states Please verify that you have internet connection and you are able to connect to %s.. And sometimes archive is just down. And again, you have to verify that you can connect manually to the server using printed link. This message is not ideal. But my point is that it should not provide recipes for solving internet connection troubles. Documentation is better place for this.

Alternatively, press foo bar to skip this operation until the next time Spacemacs is run.

In some cases it makes no sense. I mean, if it's fresh install and MELPA is not available - Spacemacs can't function anyway. Because core itself uses a lot of third-party packages. If you let people pass though this error - they'll get messages like 'package-*** is not available' and it will be even more misleading. When Spacemacs tries to install package - package is required somehow. Not having this package installed is undefined behaviour. Trying to be as friendly as possible also means mitigating undefined behaviour 😸 At least in my opinion.

Anyhow, it's great that you're working to improve the issue. Thanks!

There is room for improvement 😸 Ideally I would like to have fallback package archive to be used when one of third-party package archives is down. So ideally user should never see that error (except for missing internet connection).

@ghost
Copy link

ghost commented Aug 18, 2016

@d12frosted thanks for the clarifications.

Bad internet connection, walls and other stuff can't be and should not be fixed from Spacemacs side.

Agreed. But even if the user's internet connection (or Melpa, etc) is down, that should never prevent the user from running Spacemacs, if Spacemacs and its core dependencies are already installed on the user's computer. Right?

A key reason to use locally installed software like Spacemacs rather than a "cloud" service is to be able to get work done without being dependent upon having a good connection to some remote server.

@TheBB
Copy link
Collaborator

TheBB commented Aug 18, 2016

But even if the user's internet connection (or Melpa, etc) is down, that should never prevent the user from running Spacemacs, if Spacemacs and its core dependencies are already installed on the user's computer. Right?

Nor will it, unless you have changed the configuration somehow so that additional packages are needed.

I don't mean to suggest that the current state of affairs is fine, but do please understand that Spacemacs hangs because it's trying to install stuff that you told it to install.

@d12frosted
Copy link
Collaborator

d12frosted commented Aug 18, 2016

if Spacemacs and its core dependencies are already installed on the user's computer. Right?

In my opinion - not. If Spacemacs tries to install something - then this something is missing, so Spacemacs can't operate correctly. But I wonder what @TheBB and @syl20bnr think about it 💃

A key reason to use locally installed software like Spacemacs rather than a "cloud" service is to be able to get work done without being dependent upon having a good connection to some remote server.

If everything is installed you don't have to be online anymore. If you wish additional functionality that has dependencies that are not yet installed - you need internet connection again :(


Oh, @TheBB is fast 😸

I don't mean to suggest that the current state of affairs is fine, but do please understand that Spacemacs hangs because it's trying to install stuff that you told it to install.

Yeah, exactly. 😸 💯

@necto
Copy link

necto commented Aug 18, 2016

I agree that Spacemacs must be operational with or without Internet connection. If it is not the first launch, then it should keep the latest working setup, and if the repo is unavailable - backup to the latest working setup.
Otherwise people can never rely on it as a primary editor.

@TheBB
Copy link
Collaborator

TheBB commented Aug 18, 2016

Since user configuration can be arbitrarily complex, there's no truly reliable way for us to keep track of the last working setup. I'm interested to hear suggestions as to what that could look like.

@d12frosted
Copy link
Collaborator

@sampablokuper

(re: hanging and skipping connectivity errors)

But it turned out that at the moment Spacemacs restarted, either Melpa was down or returning errors (or perhaps my internet connection became flaky?), so Spacemacs hung. It hung with no immediately discoverable cause and no immediately discoverable remedy that would let me at least get on and edit my file in Spacemacs. It was not, at that point, clear to me that Spacemacs had hung because I had html to the existing dotspacemacs-configuration-layers list in my ~/.spacemacs and Spacemacs couldn't reach Melpa to download the HTML layer. (It was not until I found this bug report that I was confident that this had been the cause.)

Just to clarify. I don't think that this is desired behaviour. That's why I am working on improving it. And thanks for bringing that up 😸

When Spacemacs prevents the user from using Spacemacs, that is a showstopper bug in Spacemacs.

While that sounds right, users should be responsible for the changes they do in their configurations (which can be scattered across many different files). Using your example, if I want to edit html file, but I am offline and html layer is not yet enabled - Spacemacs physically can't help me with editing html files, because it misses required packages. If we allow user to skip that 'error', behaviour of Spacemacs is undefined. Whenever I hit similar situation - I just don't enable required layer and edit file in other mode (even fundamental-mode is helpful enough in most cases).

We probably should add suggestions when it's impossible to download required packages. E. g. ask user to disable specific layer or remove package from list of additional packages. So Spacemacs can start properly. Also, probably lazy installation flow should not propose user to enable layer if package archives are not reachable.


(re: rollback to last working config)

@TheBB nice examples you bring up here. Also in some cases some packages depend on .dir-locals.el. For example, with completion backend in haskell layer.

And as another example - Spacemacs actually can be loaded manually. I store Spacemacs in ~/.spacemacs.d and load it manually from ~/.emacs.d/init.el. So again, breaking changes might come outside of Spacemacs :/

As far as I'm concerned this is far too complicated to get right, and getting it half-right isn't worth the trouble.

Exactly.

@ghost
Copy link

ghost commented Aug 21, 2016

@d12frosted wrote:

Just to clarify. I don't think that this is desired behaviour. That's why I am working on improving it. And thanks for bringing that up.

You're welcome, and thanks to you, too!

Using your example, if I want to edit html file, but I am offline and html layer is not yet enabled - Spacemacs physically can't help me with editing html files, because it misses required packages.

That's different to my example.

In my example, before I added html to the existing dotspacemacs-configuration-layers list in my ~/.spacemacs, Spacemacs was able to help me edit HTML files. That is because HTML files are text files and Spacemacs is a text editor, and Spacemacs at that point was letting me edit text files and was not hanging.

If we allow user to skip that 'error', behaviour of Spacemacs is undefined.

Maybe at the moment, but not necessarily. The solution is to define the behaviour of Spacemacs in such a case. That would be much better than having Spacemacs just hang, which doesn't help the user at all.

The first bit of behaviour to implement would be better feedback: inform the user of the trouble Spacemacs has encountered. It's great that you're working on this!

The next bit of behaviour to implement would be to give the user a good way to get out of that trouble.

A common user interface pattern for this is "safe mode". Windows used to have this; maybe it still does. Some web browsers, likewise. The idea of a "safe mode" is that it won't give you all the functionality you would ideally have, but it will dependably give you enough functionality to get basic things done (e.g. edit text files) until you have finished troubleshooting whatever it is that was preventing the full desired functionality from being achieved. That is the essence of what I advocated in my earlier comment, but I hope that giving a name to it (i.e. "safe mode") will make my suggestion clearer. By "an option to bypass the hang", I essentially mean "an option to enter Spacemacs Safe Mode".

The more functional that safe mode is, the better, as long as Safe Mode is dependable. Invoking Safe Mode should never cause Spacemacs to hang: it should always provide at least the functionality offered by an unmodified Spacemacs install.

One way to achieve this might be to ship Spacemacs with a read-only "safe mode" configuration in addition to the user-editable configuration. The former would contain comments explaining its purpose and advising the user not to modify or delete it.

Upon invocation of Safe Mode, Spacemacs would then load that "safe mode" configuration instead of the user's configuration.

There, that's it; that would provide an adequate fix for this issue :)

A more sophisticated refinement of that idea, if anyone got really keen, would be for Spacemacs to tentatively load each part of the user's configuration after having loaded the "safe mode" configuration. By "tentatively", I mean something like, "For each function in the user's configuration, attempt to run that function, but if it returns an error or takes more than a few seconds to return, then skip it and move on to the next function." If that worked robustly, then even if the whole of the user's config couldn't be loaded, at least the end result would work and it would also be configured as closely to the user's desired behaviour as possible without hanging.

Whenever I hit similar situation - I just don't enable required layer and edit file in other mode (even fundamental-mode is helpful enough in most cases).

Sure, but if the user is unaware of what is causing Spacemacs to hang or how to stop it hanging, then (a) this resolution might not be obvious to them, and (b) they had better have another text editor handy, because while Spacemacs is hanging, they can't use Spacemacs to revert the addition they made to their ~/.spacemacs file that is resulting in the hang. Which is why I am proposing a fix that would solve (a) and (b) :)

We probably should add suggestions when it's impossible to download required packages. E. g. ask user to disable specific layer or remove package from list of additional packages. So Spacemacs can start properly.

If this were implemented entirely within Spacemacs, that would be great: much better than hanging! Ideally, the user should not have to invoke another text editor in order to fix the problem.

Also, probably lazy installation flow should not propose user to enable layer if package archives are not reachable.

I see where you're coming from here, but I disagree with this specific implementation suggestion. There is a temporal consideration here. When a user adds a layer's name to their config, they are not saying to Spacemacs, "Download and install this layer right now!" What they are instead saying to Spacemacs is, "Next time you load this config, please try to download and install this layer; and if at that point you can't download or install it, then don't hang or otherwise interrupt my productivity, just inform me what it was that you couldn't do and why, and give me the option to ask you to try again next time you load this config."

Thanks again :)

@aykgb
Copy link

aykgb commented Aug 24, 2016

Possible solution:

  1. After spacemacs bootstrap failed, use list-packages command and install the evil package manually.
  2. Close spacemacs and boot it again.

My environment:
CentOS7-1511, Emacs-25.0.95 building from source, Spacemacs-0.105.21.

The bootstrap failed message of spacemacs.
Warning (spacemacs):
Error connection time out for melpa repository!
Warning (spacemacs):
Error connection time out for org repository!
Warning (spacemacs):
Error connection time out for gnu repository!
Warning (spacemacs): An error occurred while retrieving the theme, using default theme. (error: (error Package ‘spacemacs-theme-’ is unavailable))
Warning (initialization): An error occurred while loading ‘/home/wangsr/.emacs.d/init.el’:

error: Package ‘evil-’ is unavailable

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.

I reproduce the procedure 3 times.
Hope it helpful.

@mwillsey
Copy link
Contributor

mwillsey commented Nov 3, 2016

Weird, I fixed my very similar problem (on OS X) by just installing gpg: brew install gpg. The last-ranked answer on this Stack Overflow post mentions something about package-check-signature wanting to use it, and sure enough installing it just fixed it for me.

@tarvos21
Copy link

tarvos21 commented Jan 6, 2017

I encounter such problem, and I service start polipo to enable http_proxy and https_proxy in my terminal, so emacs can retrieve anything from shadowsocks server.
Also, I have update to emacs25, it's better than emacs24.5.

@cyian-1756
Copy link

cyian-1756 commented May 10, 2017

Did anyone ever find a work around for this? Because watching my network connections it doesn't even look like emacs is trying to reach any host

Edit: Adding the line (setq package-check-signature nil) to init.el fixed the issue for me

@ghost
Copy link

ghost commented May 11, 2017

@mwillsey wrote:

I fixed my very similar problem (on OS X) by just installing gpg: brew install gpg. The last-ranked
answer on this Stack Overflow post mentions something about package-check-signature wanting
to use it, and sure enough installing it just fixed it for me.

Interesting, but the machine it occurred on for me was one that did have gpg installed. This was under GNU/Linux, though, not OS X.

@kirkins
Copy link

kirkins commented Jul 20, 2017

Also having this issue on Ubuntu 16.04 with Emacs 24.5

@mihaelS
Copy link

mihaelS commented Feb 1, 2018

Same issue, but under Windows 10.

This issue touches not only packages install, but also other https connections, emacs simple hang up when "Contacting host".

btw. Emacs under Cygwin works pretty fine with https with the same .spacemacs file and the same .emacs.d folder.

@ygol
Copy link

ygol commented Feb 21, 2018

I have also the same issue under windows 10. spacemacs hangs at "refreshing package archive:org... [2/3]"
I tried with various working emacs version and various spacemacs' branches (develop, master, release-0.200). With and without insecure flag.

@luposlip
Copy link

Same issue here, Windows 10, normal emacs-25.3_1-x86_64. Just hangs when failing to connect.
Tried running runemacs.exe as administrator too, same issue.

@williamdemeo
Copy link

[SOLVED] (for me)

Try pinging the site that emacs is trying to reach. For example, my .emacs config file contained the following lines:

(require 'package)
(setq package-archives
      '( ("melpa-stable" . "http://stable.melpa.org/packages/")
	("melpa"     . "http://melpa.milkbox.net/packages/")
	("marmalade" . "http://marmalade-repo.org/packages/")
        ("gnu"       . "http://elpa.gnu.org/packages/")))
(package-initialize)

I tried ping stable.melpa.org and the response looked fine, but when I tried ping melpa.milkbox.net I got no response. I figured that is what was causing emacs to hang, so I tried ping www.melpa.milkbox.net and the response was good. So I changed the "melpa" line above to:

("melpa"     . "http://www.melpa.milkbox.net/packages/")

and now emacs starts up quickly, without hanging on Contacting host: melpa.org:443

I hope this helps others. This was a very frustrating, longstanding problem for me, but apparently has a very simple solution, which I haven't seen suggested anywhere else... weird.

@thautwarm
Copy link

The solution is, evalutate (package-initialize) and (setq package-check-signature nil) in order before (required 'package).

@berkay-repos
Copy link

Same issue, but under Windows 10.

This issue touches not only packages install, but also other https connections, emacs simple hang up when "Contacting host".

btw. Emacs under Cygwin works pretty fine with https with the same .spacemacs file and the same .emacs.d folder.

Cygwin worked like a charm. Thank you so much.

@ivnsch
Copy link

ivnsch commented Feb 15, 2020

I just started using Emacs and got it as well. Installed evil mode as described in its repo or here and there's a blocking delay contacting the host every single time I open emacs...

GNU Emacs 26.3

@duianto
Copy link
Collaborator

duianto commented Feb 19, 2020

@i-schuetz It occurs because of this line:

(package-refresh-contents)

If you comment it out or remove it:

;; (package-refresh-contents)

Then it won't contact the host on startup.

@ivnsch
Copy link

ivnsch commented Feb 20, 2020

@duianto meanwhile I was able to figure that out 🙂, I just wonder, are those lines missing a conditional? Or are they not supposed to go in the init file? It seems weird to have to put it in the init to download it only the first time.

@duianto
Copy link
Collaborator

duianto commented Feb 20, 2020

The docstring for package-refresh-contents says:

Download descriptions of all configured ELPA packages.
For each archive configured in the variable ‘package-archives’,
inform Emacs about the latest versions of all packages it offers,
and make them available for download.
Optional argument ASYNC specifies whether to perform the
downloads in the background.

It might just make sure that the latest version is installed.

You will probably get the best answer why it's suggested, if you ask the source: https://github.com/emacs-evil/evil

@woochica
Copy link

woochica commented Apr 13, 2020

I updated my Emacs to 26.3 from 25.3 and since then every time I want to install a package, Emacs hangs. I've tried starting it with --debug-init --insecure but I see no debug output because the process doesn't answer any more.

My workaround was to replace the line (configuration-layer/sync) to (configuration-layer/sync 'no-install) in .emacs.d/init.el so that I can use the editor again. This way at least I can work but I cannot add/remove packages.

@nicobao
Copy link

nicobao commented May 5, 2020

Any news on that? I am facing the same issue.

@f8ttyc8t
Copy link

f8ttyc8t commented Jul 3, 2020

Same to me. Version 25.x works (using HTTP, I think), where 26.2/26.3 don't. Emacs simply hangs when trying to play with package manager, e.g. trying to install packages.
Btw. tried on Windows 10 and Linux Mint 19.3 .
Even updated gnutls to 3.6.13 (on Windows install)

@f8ttyc8t
Copy link

f8ttyc8t commented Jul 3, 2020

As a note: running emacs 16.3 on MacOS (installed via brew) works as expected. So it's probably not related to server side.

@phrxmd
Copy link

phrxmd commented Aug 19, 2020

I still see this behaviour on Emacs 27.1 and 28.0.50 on Linux with the develop branch, regardless of whether using HTTP or HTTPS.

In my case it's due to MELPA currently being down or inaccessible. In those cases you can still open http://melpa.org in a web browser, so the test with curl or in the browser is misleading.

You can work around this by telling Spacemacs to use a different set of mirrors, e.g. by putting something like this in your user-init in .spacemacs:

;; Hack for using a different set of repositories when ELPA is down
(setq package-archives
      '(("melpa" . "https://raw.githubusercontent.com/d12frosted/elpa-mirror/master/melpa/")
        ("org"   . "https://raw.githubusercontent.com/d12frosted/elpa-mirror/master/org/")
        ("gnu"   . "https://raw.githubusercontent.com/d12frosted/elpa-mirror/master/gnu/")))
;; (setq package-check-signature nil) ;; probably not necessary
(package-initialize)

The (package-initialize) line is important, otherwise Spacemacs will override the package archives with its own.
As soon as MELPA is back up again, comment out the section again.

@avallark
Copy link

avallark commented Dec 6, 2020

The issue is most certainly with verifying the certificates.
Adding the below line as the first to init.el or custom.el does solve the issue.

(setq package-check-signature nil)

@anyanf
Copy link

anyanf commented Dec 8, 2020

Can you try launching emacs with emacs --insecure to not use HTTPS to contact MELPA ?

tks

@posita
Copy link

posita commented Jun 9, 2021

I was seeing a hang on Contacting host: melpa.org:80, which turned out to be somewhat misleading in my case. I was apparently hung on http://marmalade-repo.org/packages/, despite the status message. Removing ("marmalade" . "http://marmalade-repo.org/packages/") from package-archives got rid of the hanging.

@pyctamh
Copy link

pyctamh commented Dec 20, 2021

Trying to install spacemacs on Ubuntu 15.04.

I've moved the spacemacs files to ~/.emacs.d/, but when I start emacs I get a flash of the initial emacs window, then a black screen with

Contacting host: melpa.org:443

Once it opened with orgmode.org:80 instead, but I haven't been able to recreate that.

  • Emacs works fine without the init file (emacs -q).
  • Using emacs 24.4.1
  • Using spacemacs 0.105.0
  • emacs --debug-init produces no output
  • I can curl https://melpa.org so not a network restriction

I've tried a fresh install of both emacs and spacemacs as well as using emacs, emacs24 and emacs24-x (but I'm not exactly sure what the differences are).

I've been writing Clojure for the last few months and I'm keen to beat some of the struggles I've been having with Lisp + Vim, but after five or six attempts, I've given in and resorted to putting in an issue. Any ideas?

(when (not package-archive-contents)
(package-refresh-contents))

@VanillaBase1lb
Copy link

I still see this behaviour on Emacs 27.1 and 28.0.50 on Linux with the develop branch, regardless of whether using HTTP or HTTPS.

In my case it's due to MELPA currently being down or inaccessible. In those cases you can still open http://melpa.org in a web browser, so the test with curl or in the browser is misleading.

You can work around this by telling Spacemacs to use a different set of mirrors, e.g. by putting something like this in your user-init in .spacemacs:

;; Hack for using a different set of repositories when ELPA is down
(setq package-archives
      '(("melpa" . "https://raw.githubusercontent.com/d12frosted/elpa-mirror/master/melpa/")
        ("org"   . "https://raw.githubusercontent.com/d12frosted/elpa-mirror/master/org/")
        ("gnu"   . "https://raw.githubusercontent.com/d12frosted/elpa-mirror/master/gnu/")))
;; (setq package-check-signature nil) ;; probably not necessary
(package-initialize)

The (package-initialize) line is important, otherwise Spacemacs will override the package archives with its own. As soon as MELPA is back up again, comment out the section again.

2022 this problem still exists. This worked for me.

@webloginwu
Copy link

webloginwu commented Jul 23, 2022

Let me list the whole procedure of using signature along with certificate check:

  1. a)Using my company macbook: server daemon will print the following err and hange there
    and (setq package-check-signature nil) was commented out
[yas] Prepared just-in-time loading of snippets successfully.
Contacting host: elpa.gnu.org:443
Contacting host: melpa.org:443
Contacting host: orgmode.org:443
Continue connecting? (always, session only, no, details, backward page, forward page, ?):

I started emacs client, emacs will ask if I trust certificate issued by my company for orgmode.org.
the sceenshot is:
977A49DE-4FA9-4289-A65E-BFEE521F227A
The only way to reply "always" is using emacs client again and again.

  1. b) then I installed gpg by "brew install gpg" on my company macbook
    and (setq package-check-signature nil) was commented out
    In the end the server daemon log is:
Loading server...
Loading server...done
Loading /Users/abc/.emacs.d/lisp/robot-mode.el (source)...
Loading /Users/abc/.emacs.d/lisp/robot-mode.el (source)...done
Iedit default key binding is C-;
Loading /Users/abc/.emacs.d/lisp/origami.el (source)...
Loading /Users/abc/.emacs.d/lisp/origami.el (source)...done
Loading /Users/abc/.emacs.d/lisp/highlight-indentation.el (source)...
Loading /Users/abc/.emacs.d/lisp/highlight-indentation.el (source)...done
Loading /Users/abc/.emacs.d/recentf...
Loading /Users/abc/.emacs.d/recentf...done
Cleaning up the recentf list...
Cleaning up the recentf list...done (0 removed)
[yas] Prepared just-in-time loading of snippets successfully.
Importing package-keyring.gpg...
Importing package-keyring.gpg...done
Contacting host: elpa.gnu.org:443
Contacting host: elpa.gnu.org:443
Contacting host: melpa.org:443
Contacting host: melpa.org:443
Contacting host: orgmode.org:443
Package refresh done
Loading /Users/abc/.emacs.d/wu.el (source)...
Loading /Users/abc/.emacs.d/wu.el (source)...done
Clearing removed files...
Clearing removed files...done
Processing modified files...
Processing modified files...done
Turning on magit-auto-revert-mode...
Turning on magit-auto-revert-mode...done
Starting Emacs daemon.
Restarting server

usually Contacting host: melpa.org:443 etc take a long time.

  1. Using my private macbook: I don't see "Continue connecting?" above, gpg is not installed.
    and (setq package-check-signature nil) was commented out

log below show emacs doesn't check signature by default

Cleaning up the recentf list...done (0 removed)
[yas] Prepared just-in-time loading of snippets successfully.
Contacting host: elpa.gnu.org:443
Contacting host: melpa.org:443
Contacting host: orgmode.org:443
Package refresh done
Loading /Users/frankwu/.emacs.d/wu.el (source)...
Loading /Users/frankwu/.emacs.d/wu.el (source)...done

I use the same init.el for both laptop
3 If I set (setq package-check-signature t)
emacs seems to verify signature for all package

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests