LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   Slackware 14.2: Emacs doesn't start when Internet is off (https://www.linuxquestions.org/questions/slackware-14/slackware-14-2-emacs-doesnt-start-when-internet-is-off-4175592080/)

usr345 10-23-2016 09:24 PM

Slackware 14.2: Emacs doesn't start when Internet is off
 
Emacs: 24.5.1 (i586-slackware-linux-gnu, GTK+ Version 2.24.28).

When I try to launch Emacs without Internet connection --- it doesn't run. Neither in GUI or console mode. I renamed my .emacs file to 1.emacs, and it still doesn't work. So it has nothing to do with my settings.

After I plug in the Internet cable, it starts to work. What's up? How can I fix it?

drgibbon 10-23-2016 11:14 PM

Does it start with
Code:

emacs -nw -Q
?

Also, what is in /etc/hosts ?

dederon 10-24-2016 06:27 AM

hahaha, this bug report gave me a good laugh, thank you for this. sorry i can't help in any way.

usr345 10-24-2016 09:48 AM

Quote:

Originally Posted by drgibbon (Post 5622133)
Does it start with
Code:

emacs -nw -Q
?


no, doesn't start without the Internet connection.

Quote:

Originally Posted by drgibbon (Post 5622133)
what is in /etc/hosts ?

Code:

# For loopbacking.
127.0.0.1              localhost
127.0.0.1              phpmyadmin
127.0.0.1              dubai
127.0.0.1              lwt
192.168.1.4            asus.asus asus
93.184.220.75          static1.dmcdn.net
208.64.123.130          bitcoin.org

# End of hosts.


atelszewski 10-24-2016 12:48 PM

Hi,

Try adding IPv6 for localhost to /etc/hosts:
Code:

::1                        localhost
::1                        [your full domain] [your hostname]

--
Best regards,
Andrzej Telszewski

Richard Cranium 10-24-2016 06:45 PM

Quote:

Originally Posted by usr345 (Post 5622096)
Emacs: 24.5.1 (i586-slackware-linux-gnu, GTK+ Version 2.24.28).

When I try to launch Emacs without Internet connection --- it doesn't run. Neither in GUI or console mode. I renamed my .emacs file to 1.emacs, and it still doesn't work. So it has nothing to do with my settings.

After I plug in the Internet cable, it starts to work. What's up? How can I fix it?

What do you mean "without internet connection"?

Do you have anything in your .emacs file (or newer equivalent)?

If you wait ~12 minutes (that's default TCP timeout, BTW), does it come up?

usr345 10-25-2016 06:56 AM

Quote:

Originally Posted by atelszewski (Post 5622371)
Hi,

Try adding IPv6 for localhost to /etc/hosts:
Code:

::1                        localhost
::1                        [your full domain] [your hostname]


Tried. Didn't help

usr345 10-25-2016 06:59 AM

Quote:

Originally Posted by Richard Cranium (Post 5622507)
What do you mean "without internet connection"?

When the Internet cable is unplugged, it doesn't start. When I plug in the cable, it starts.

Quote:

Originally Posted by Richard Cranium (Post 5622507)
Do you have anything in your .emacs file (or newer equivalent)?

Yes, I have. I renamed the file to 1.emacs to exclude any corruptions, and it still didn't work.

Quote:

Originally Posted by Richard Cranium (Post 5622507)
If you wait ~12 minutes (that's default TCP timeout, BTW), does it come up?

Will try.

usr345 10-25-2016 03:20 PM

Quote:

Originally Posted by Richard Cranium (Post 5622507)
If you wait ~12 minutes (that's default TCP timeout, BTW), does it come up?

Yes, it starts in around 10 minutes. Why is it trying to access the Internet?

asdrubale 10-25-2016 05:05 PM

Quote:

Originally Posted by usr345 (Post 5622096)
Emacs: 24.5.1 (i586-slackware-linux-gnu, GTK+ Version 2.24.28).

When I try to launch Emacs without Internet connection --- it doesn't run. Neither in GUI or console mode. I renamed my .emacs file to 1.emacs, and it still doesn't work. So it has nothing to do with my settings.

After I plug in the Internet cable, it starts to work. What's up? How can I fix it?

maybe you have to add
Code:

127.0.0.1  host.does.not.exist
to /etc/hosts, as explained here?

jmccue 10-25-2016 05:22 PM

I saw you renamed ~/.emacs with no luck. Also try renaming Directory ~/.emacs.d

Another thing to check, did you copy any files to /usr/share/emacs/site-lisp ?

John

kikinovak 10-25-2016 05:34 PM

Quote:

Originally Posted by usr345 (Post 5622096)
Emacs: 24.5.1 (i586-slackware-linux-gnu, GTK+ Version 2.24.28).

When I try to launch Emacs without Internet connection --- it doesn't run. Neither in GUI or console mode. I renamed my .emacs file to 1.emacs, and it still doesn't work. So it has nothing to do with my settings.

After I plug in the Internet cable, it starts to work. What's up? How can I fix it?

That's because it tries to report back to gnu.org and fails.

Try Vim instead.

:D

rkelsen 10-25-2016 05:44 PM

Quote:

Originally Posted by kikinovak (Post 5622947)
That's because it tries to report back to gnu.org and fails.

Is that true? Why?

Personally, I've never used Emacs. Never had the need. It has been installed on my computer for a very long time though.

Richard Cranium 10-25-2016 06:00 PM

Quote:

Originally Posted by rkelsen (Post 5622949)
Is that true? Why?

Personally, I've never used Emacs. Never had the need. It has been installed on my computer for a very long time though.

He's trying to see if your leg comes off if he pulls hard enough.

Richard Cranium 10-25-2016 06:05 PM

Quote:

Originally Posted by usr345 (Post 5622665)
When the Internet cable is unplugged, it doesn't start. When I plug in the cable, it starts.

Does eth0 think that it is still connected after you unplug the cable? As in, it still has an IP address?

drgibbon 10-25-2016 07:25 PM

Quote:

Originally Posted by usr345 (Post 5622304)
no, doesn't start without the Internet connection.
Code:

# For loopbacking.
127.0.0.1              localhost
127.0.0.1              phpmyadmin
127.0.0.1              dubai
127.0.0.1              lwt
192.168.1.4            asus.asus asus
93.184.220.75          static1.dmcdn.net
208.64.123.130          bitcoin.org

# End of hosts.


What's in /etc/HOSTNAME ? Also I found some info at StackExchange that might be relevant;
Quote:


One slow startup problem is usually that you don't have your machines fully qualified hostname declared in /etc/hosts which causes emacs to hang at some syscall during startup. However, that would not explain why emacs is faster than emacs -Q.
[...]
I had the same problem and solved it by adding machine name (not fully qualified) to /etc/hosts as a synonym for localhost. strace revealed that it used before 5 seconds opening an IP connection and another 4+4 seconds in two ioctls and still some seconds in other handling of these connections. Now it starts immediately

usr345 10-26-2016 12:09 AM

Quote:

Originally Posted by asdrubale (Post 5622939)
maybe you have to add
Code:

127.0.0.1  host.does.not.exist
to /etc/hosts

Tried, didn't help. But it seems, that this is the right way of investigation at least. Today when I launched GUI Emacs after some time I got a popup with the following message:

Quote:

The authenticity of host 'host.does.not.exist (127.0.0.1)' can't be established. ECDSA key fingerprint is SHA256:<hex code>. Are you sure want to continue connecting?
So, it's tramp trying to connect to my local machine for some reason.

a4z 10-26-2016 12:24 AM

have you tried to remove (rename) your .emacs.d , or what you use for emacs,
maybe there is some auto install update melpa other package manager configured that tries to get info from the net
did you tried to use emacs clean?

usr345 10-26-2016 01:20 AM

Quote:

Originally Posted by a4z (Post 5623034)
have you tried to remove (rename) your .emacs.d , or what you use for emacs,
maybe there is some auto install update melpa other package manager configured that tries to get info from the net
did you tried to use emacs clean?

Yes, I renamed both .emacs and .emacs.d --- didn't help.

asdrubale 10-26-2016 03:46 PM

Quote:

Originally Posted by usr345 (Post 5623032)
Tried, didn't help. But it seems, that this is the right way of investigation at least. Today when I launched GUI Emacs after some time I got a popup with the following message:



So, it's tramp trying to connect to my local machine for some reason.

you could try with an IP address which belongs to the same subnet of your PC but is not used by any other PC, e.g. 192.168.1.253. I had the same problem a year ago and now in my /etc/host there is the following line:
Code:

192.168.1.253  host.does.not.exist
but I can't remember why I chose that address...

usr345 10-26-2016 11:14 PM

Quote:

Originally Posted by asdrubale (Post 5623350)
you could try with an IP address which belongs to the same subnet of your PC but is not used by any other PC, e.g. 192.168.1.253. I had the same problem a year ago and now in my /etc/host there is the following line:
Code:

192.168.1.253  host.does.not.exist

Tried, didn't help.

Richard Cranium 10-26-2016 11:38 PM

Quote:

Originally Posted by usr345 (Post 5623032)
So, it's tramp trying to connect to my local machine for some reason.

Unplug cable. Start emacs with the "--debug-init" command line option. Hit ctrl-G after 5 minutes. Give stacktrace.

usr345 10-27-2016 10:24 AM

Quote:

Originally Posted by Richard Cranium (Post 5623524)
Unplug cable. Start emacs with the "--debug-init" command line option. Hit ctrl-G after 5 minutes. Give stacktrace.

Tried it. It gave just the info about successfully loading my packages:

Quote:

Loading /home/usr345/.emacs.d/bootstrap-init.el (source)...
Loading ~/.emacs.d/functions...done
Loading /home/usr345/.emacs.d/accounting.el (source)...done
Loading /home/usr345/.emacs.d/bookmarks.el (source)...done
Loading /home/usr345/.emacs.d/dired.el (source)...
Loading /home/usr345/.emacs.d/filesets-cache.el (source)...done
Accessing directories in Dired will REUSE the buffer
Loading /home/usr345/.emacs.d/dired.el (source)...done
Loading /home/usr345/.emacs.d/cperl.el (source)...done
Loading /home/usr345/.emacs.d/css.el (source)...done
Loading /home/usr345/.emacs.d/eshell.el (source)...done
Loading /home/usr345/.emacs.d/html-mode.el (source)...done
Loading /home/usr345/.emacs.d/kb_shortcuts.el (source)...done
Loading /home/usr345/.emacs.d/latex.el (source)...done
Loading /home/usr345/.emacs.d/php.el (source)...
Loading /home/usr345/.emacs.d/php-functions.el (source)...done
Loading /home/usr345/.emacs.d/php.el (source)...done
Loading /home/usr345/.emacs.d/javascript.el (source)...done
Loading /home/usr345/.emacs.d/elisp.el (source)...done
Loading /home/usr345/.emacs.d/org-mode.el (source)...done
Loading /home/usr345/.emacs.d/sql-mode.el (source)...
Loading sql...done
Loading /home/usr345/.emacs.d/local_databases.el (source)...done
Loading /home/usr345/.emacs.d/sql-mode.el (source)...done
Loading tagging...done
Loading /home/usr345/.emacs.d/plugins/yasnippet/yasnippet.el (source)...done
[yas] Prepared just-in-time loading for ~/.emacs.d/yasnippets
[yas] Reloaded everything (snippets will load just-in-time)....
Loading cua-base...done
Loading /home/usr345/.emacs.d/bootstrap-init.el (source)...done
[yas] Loading for `emacs-lisp-mode', just-in-time: (lambda nil (yas--load-directory-1 (quote /home/usr345/.emacs.d/yasnippets/emacs-lisp-mode) (quote emacs-lisp-mode)))!
[yas] Loading compiled snippets from /home/usr345/.emacs.d/yasnippets/emacs-lisp-mode
Loading /home/usr345/.emacs.d/yasnippets/emacs-lisp-mode/.yas-compiled-snippets.el (source)...done
[yas] Loading snippet files from /home/usr345/.emacs.d/yasnippets/emacs-lisp-mode
For information about GNU Emacs and the GNU system, type C-h C-a.
Package iswitchb is obsolete!
Quit

number22 10-27-2016 10:43 AM

Do you use yp for user and any firewall rule on local client? local host's 127.0.0.1 has to connect to yp server.

drgibbon 10-27-2016 10:49 AM

So does the machine hostname (in /etc/HOSTNAME) have an entry in /etc/hosts ?

Also, you could perhaps try the idea from StackExchange (running it under strace)
Code:

strace -o /tmp/foo emacs -Q -nw
and see what's in /tmp/foo while it's hanging.

drgibbon 10-27-2016 11:42 AM

Also, there's no strange zombie processes are there? If you
Code:

killall emacs
first do you get anywhere?

number22 10-27-2016 11:45 AM

Do you use any rpc services? rpc binding port can be connected to 127.0.0.1 as well.

usr345 10-27-2016 12:40 PM

Quote:

Originally Posted by drgibbon (Post 5623690)
So does the machine hostname (in /etc/HOSTNAME) have an entry in /etc/hosts ?

Also, you could perhaps try the idea from StackExchange (running it under strace)
Code:

strace -o /tmp/foo emacs -Q -nw
and see what's in /tmp/foo while it's hanging.

No, it doesn't. /etc/HOSTNAME has:

Quote:

laptop.local
Which is not present in /etc/ hosts

Here is the trace (seems that it tries to connect to laptop):

Quote:

socket(PF_INET, SOCK_DGRAM|SOCK_NONBLOCK, IPPROTO_IP) = 4
connect(4, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("192.168.1.1")}, 16) = 0
poll([{fd=4, events=POLLOUT}], 1, 0) = 1 ([{fd=4, revents=POLLOUT}])
send(4, "\346k\1\0\0\1\0\0\0\0\0\0\6laptop\5local\0\0\34\0\1", 30, MSG_NOSIGNAL) = 30
poll([{fd=4, events=POLLIN}], 1, 5000) = 0 (Timeout)
poll([{fd=4, events=POLLOUT}], 1, 0) = 1 ([{fd=4, revents=POLLOUT}])
send(4, "\346k\1\0\0\1\0\0\0\0\0\0\6laptop\5local\0\0\34\0\1", 30, MSG_NOSIGNAL) = 30
poll([{fd=4, events=POLLIN}], 1, 5000) = 0 (Timeout)
close(4) = 0
It repeats again and again.

usr345 10-27-2016 12:42 PM

Hurray! After adding:

Quote:

127.0.0.1 laptop
to /etc/hosts it started to work. Thank you, drgibbon, sir.

atelszewski 10-27-2016 12:51 PM

Hi,

Quote:

Originally Posted by usr345 (Post 5623737)
Hurray! After adding:
Quote:

laptop 127.0.0.1
to /etc/hosts it started to work. Thank you, drgibbon, sir.

This does not look like a correct entry for /etc/hosts (i.e. IP address should be first).

--
Best regards,
Andrzej Telszewski

usr345 10-27-2016 01:02 PM

Quote:

Originally Posted by atelszewski (Post 5623742)
Hi,


This does not look like a correct entry for /etc/hosts (i.e. IP address should be first).

Fixed the post.

Richard Cranium 10-27-2016 09:27 PM

Quote:

Originally Posted by usr345 (Post 5623684)
Tried it. It gave just the info about successfully loading my packages:

Hmm. I see a lot of stuff from your ~/.emacs.d directory loading.

drgibbon 10-27-2016 09:47 PM

Quote:

Originally Posted by usr345 (Post 5623737)
Hurray! After adding:

Code:

127.0.0.1 laptop
to /etc/hosts it started to work. Thank you, drgibbon, sir.

Nice! Emacs on :hattip: By the way, if you have "laptop.local" as the hostname, I think it should be at least;
Code:

# For loopbacking.
127.0.0.1                localhost
127.0.0.1                laptop.local laptop
# End of hosts.

In /etc/hosts (plus whatever else you want in there).

usr345 10-28-2016 03:26 PM

Quote:

Originally Posted by drgibbon (Post 5623937)
By the way, if you have "laptop.local" as the hostname, I think it should be at least;
Code:

# For loopbacking.
127.0.0.1                localhost
127.0.0.1                laptop.local laptop
# End of hosts.


Done.

rkelsen 10-28-2016 05:13 PM

Quote:

Originally Posted by drgibbon (Post 5623937)
Nice! Emacs on :hattip: By the way, if you have "laptop.local" as the hostname, I think it should be at least;
Code:

# For loopbacking.
127.0.0.1                localhost
127.0.0.1                laptop.local laptop
# End of hosts.

In /etc/hosts (plus whatever else you want in there).

Doesn't Slackware usually put the correct information in /etc/hosts as part of the installation?

What happened here? Was the file edited by the OP?

usr345 10-29-2016 02:33 AM

Quote:

Originally Posted by rkelsen (Post 5624284)
Doesn't Slackware usually put the correct information in /etc/hosts as part of the installation?

In my case it didn't. I installed fresh Slackware 14.2 and chose "laptop" as my host name.

Quote:

Originally Posted by rkelsen (Post 5624284)
Was the file edited by the OP?

It was edited by me (needed to add names of locally developed websites), but I didn't delete anything from it.

NoStressHQ 10-29-2016 08:46 AM

BTW: never used that feature myself, but I know that you can start an "emacs daemon" and then when you launch emacs, it is spawned as a "client", usefull (at the time) to share memory between several "instances" of emacs in tmux or screen.

Anyway, I guess that on start of emacs, he tries to connect to a potential "daemon" first to know in which mode it must starts. And the daemon communication might goes through a "localhost" port and something in happens when the socket is created/bound, name resolution or something of this kind.

This would lead me to think that this problem could happen on some other application which use the a local socket too, and might have similar code than emacs to do it.

It was just to say... :)

drgibbon 10-29-2016 08:54 AM

Actually to connect to the server you need to run 'emacsclient'. The regular 'emacs' command doesn't do that :)

NoStressHQ 11-03-2016 09:17 AM

Quote:

Originally Posted by drgibbon (Post 5624462)
Actually to connect to the server you need to run 'emacsclient'. The regular 'emacs' command doesn't do that :)

Alright I did it again... Should have tried it before guessing ;).

Bests.


All times are GMT -5. The time now is 02:36 PM.