Closed danprince closed 4 days ago
Can you try launching emacs with emacs --insecure
to not use HTTPS to contact MELPA ?
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.
@syl20bnr Is it possible to install the packages manually from the repository? If so, will that prevent emacs from making that initial network request?
@danprince I'm also meet this problem, do you solve it ?
Did anyone find a solution to this?
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
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.
I've got the same problem on OSX with Emacs v0.105.19
Running from finder instead of terminal fixed the issue
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
@myme5261314 Try to disable https?
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.
Similar issue here. I wanted to bootstrap spacemacs on a new ubuntu 14.04 machine. Tried multiple emacs versions.
--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.
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.
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
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.
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
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 :)
@sampablokuper Indeed it should hang. I've sent PR that advocates this issue.
@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!
@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).
@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.
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.
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. 😸 💯
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.
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.
Well, I see it as keeping the latest working .spacemacs
config file (shadow copy) somewhere hidden in .emacs.d
and packets all working. When Spacemacs loads up, and sees the configuration changed, it first checks the connection, then (if the repo is available) it updates and downloads necessary packets, then it copies the new .spacemacs
replacing the shadow copy.
If there is no connection, it reports it to the user, and loads up the shadow copy, that was working last time.
@d12frosted wrote:
@TheBB wrote: 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.
Yes, I understood all that before making my comments above, and my points still stand.
Here was my use case:
html
to the existing dotspacemacs-configuration-layers
list in my ~/.spacemacs
per the instructions, and restarted Spacemacs.Every one of these points is reasonable, right?
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.)
That meant that at that point I couldn't readily edit that HTML file in Spacemacs. I had to choose between troubleshooting Spacemacs, or just using another text editor.
When Spacemacs prevents the user from using Spacemacs, that is a showstopper bug in Spacemacs.
This is why I made my suggestion above, which if implemented would fix this bug.
Thanks for your time :)
Well, I see it as keeping the latest working .spacemacs config file (shadow copy) somewhere hidden in .emacs.d and packets all working. When Spacemacs loads up, and sees the configuration changed, it first checks the connection, then (if the repo is available) it updates and downloads necessary packets, then it copies the new .spacemacs replacing the shadow copy. If there is no connection, it reports it to the user, and loads up the shadow copy, that was working last time.
Unfortunately there's no guarantee that the user configuration is entirely contained in the dotfile, or even that all the layers used can be inferred from the dotfile alone, nor is it guaranteed that if the list of layers are the same, then the list of packages are also the same.
Examples:
As far as I'm concerned this is far too complicated to get right, and getting it half-right isn't worth the trouble. It is much more achievable to
@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.
@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 :)
Possible solution:
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.
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.
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.
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
@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.
Also having this issue on Ubuntu 16.04 with Emacs 24.5
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.
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.
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.
[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.
The solution is, evalutate (package-initialize)
and (setq package-check-signature nil)
in order before (required 'package)
.
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.
@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.
@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.
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
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.
Any news on that? I am facing the same issue.
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)
As a note: running emacs 16.3 on MacOS (installed via brew) works as expected. So it's probably not related to server side.
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 withOnce it opened with
orgmode.org:80
instead, but I haven't been able to recreate that.emacs -q
).emacs --debug-init
produces no outputcurl https://melpa.org
so not a network restrictionI've tried a fresh install of both emacs and spacemacs as well as using
emacs
,emacs24
andemacs24-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?