LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (http://www.linuxquestions.org/questions/slackware-14/)
-   -   Played with hosts, now certain console commands are very slow... (http://www.linuxquestions.org/questions/slackware-14/played-with-hosts-now-certain-console-commands-are-very-slow-4175437592/)

Ook 11-17-2012 12:04 PM

Played with hosts, now certain console commands are very slow...
 
So I played with /etc/hosts, adding a few entries to see if it made a difference in browser performance and to disable certain ad banners, etc. When I did this, I found that if I were to open a console and try to start the midnight commander, it would just sit there for about 15 seconds before responding. During this 15 seconds, as far as I can tell nothing is happening - no cpu consumption, no network bandwith consumption, nothing. It is just sitting there. Fifteen seconds later, mc appears.

I restored my hosts file, reboot, problem still remains. Now I'm lost - I'm not sure why dinkering with the hosts file would cause this, and I'm even less sure why restoring it did not fix it. The only other time I saw this was when I had mounted a network share, and that share became unavailable while it was still mounted. In this case, there are no network shares mounted.

How do you troubleshoot something like this?

PS: This happens for all users including root.
Slackware 14 64 bit.

jefro 11-17-2012 12:08 PM

Nothing to do with hosts would be my guess. I have used hosts files on all sorts of OS's and never an issue like that. I get the standard one at a windows site.

Could it be that you didn't use or need to use ipv6? Some ipv6 issue.

Some other issue is at fault. It may be hard to find too. Try top command and maybe if you have or can install some system load monitor or other tools to graph the resources.

I am not too sure but there is an outside chance that some secure linux feature could be involved but I don't know how.

Ook 11-17-2012 12:11 PM

Quote:

Originally Posted by jefro (Post 4831454)
Nothing to do with hosts would be my guess. I have used hosts files on all sorts of OS's and never an issue like that. I get the standard one at a windows site.

Could it be that you didn't use or need to use ipv6? Some ipv6 issue.

Some other issue is at fault. It may be hard to find too. Try top command and maybe if you have or can install some system load monitor or other tools to graph the resources.

I am not too sure but there is an outside chance that some secure linux feature could be involved but I don't know how.

Ran top and watched. Nothing changes, nothing is using any cpu when it is pausing. It may be coincidence, but it happened exactly when I dinkered with my hosts file.

mrclisdue 11-17-2012 12:36 PM

I'm going to begin by stating that I'm taking a long shot stab at this, based neither on knowledge nor experience. There was a similar thread recently, unresolved:

https://www.linuxquestions.org/quest...in-4175436131/

and I'm curious as to whether your machine is having difficulty resolving your machine's hostname; iow, does your hosts file properly reflect your hostname, or domain...?

cheers,

Ook 11-17-2012 03:40 PM

SOLVED!

When I restored my hosts file, I left out:

127.0.0.1 ook.ook.org ook

I restored that line, and now everything works fine.

The question then becomes, why would not having this in the hosts file cause the problem? Midnight Commander must be trying to resolve the machine namae, and without this line it fails and times out. <shrug>....

Edit: I might mention that with this line in hosts, mc starts up in a fraction of a second. Poof, and it is there.

metageek 11-19-2012 04:27 AM

Quote:

Originally Posted by Ook (Post 4831571)
SOLVED!

When I restored my hosts file, I left out:

127.0.0.1 ook.ook.org ook

I restored that line, and now everything works fine.

Strange, I thought that one should never have that line, and use instead

127.0.0.1 localhost

have you tried this line too?

tronayne 11-19-2012 07:02 AM

Here's a thing. Slackware almost always includes notes and cautions in configuration files (if they're not already there from the developers); sort of lessons learned during a wasted youth kinds of things. /etc/hosts, straight from the "factory," has this:
Code:

# By the way, Arnt Gulbrandsen <agulbra@nvg.unit.no> says that 127.0.0.1
# should NEVER be named with the name of the machine.  It causes problems
# for some (stupid) programs, irc and reputedly talk. :^)
#

# For loopbacking.
127.0.0.1              localhost

So that one has to be there and you should not monkey with it.

Your machine should have a name and an address. The name can be anything you like (the default on Slackware is "darkstar"); just something short and sweet (I name my servers fubar, snafu, pita and other pungent things). The address for a non-public server (not an Internet address) should be something like 192.168.x.y. The x is the subnet address from your router or switch and is, usually but not always, 1. The y is an address you pick, greater than 1 and less than 100, just so it's unique on your network (consisting of one or more Ethernet devices -- computers, printers, etc.)

Why 1? Because 1 is usually the gateway address of your router (a lot of them default to 192.168.1.1. Why < 100? Because DHCP starts at 100 by default and you can use a fixed IP address for your machine less that 100 and it won't interfere with DHCP.

Remember, we're talking about Slackware here; some other distribution might do things differently (and who cares what some other distribution fiddles around with).

Do you have a router? Probably you do -- many of the "modems" you get from your service provider nowadays are a combination modem/router (so you can't conveniently run a web site).

So, what does an /etc/hosts file look like? Like this:
Code:

#
# hosts        This file describes a number of hostname-to-address
#              mappings for the TCP/IP subsystem.  It is mostly
#              used at boot time, when no name servers are running.
#              On small systems, this file can be used instead of a
#              "named" name server.  Just add the names, addresses
#              and any aliases to this file...
#
# By the way, Arnt Gulbrandsen <agulbra@nvg.unit.no> says that 127.0.0.1
# should NEVER be named with the name of the machine.  It causes problems
# for some (stupid) programs, irc and reputedly talk. :^)
#

# For loopbacking.
127.0.0.1              localhost
# Local servers
192.168.1.10            fubar.com fubar
192.168.1.15            InkJet
192.168.1.20            snafu.com snafu
192.168.1.30            pita.com pita
# Public servers
75.126.162.205          www.linuxquestions.org  linuxquestions.org

# End of hosts.

In the above there are three local servers, fubar.com, snafu.com and pita.com. There is one Ethernet printer, InkJet. This is one external server, linuxquestions.org.

Defining an external server as above means that you avoid hitting a DNS server; /etc/hosts is the first place "looked at" to find an address and, if an address is not found in /etc/hosts, the next places looked at is a DNS server, either BIND (if you're running it) or DNS server addresses in /etc/resolv.conf; e.g.,
Code:

cat /etc/resolv.conf
search com
nameserver 8.8.8.8
nameserver 8.8.4.4

Those two -- you only need two -- are Google's public DNS servers addresses. You're free to use those or ISP-provided addresses (these are just an example). If the first one is not available, the second will be looked at and it will take some time for the look up to fail before that switch happens (by then you'll be frustrated) so make sure you've got good DNS server addresses in /etc/resolv.conf.

Now, the trick is that all your local servers are listed in /etc/hosts (and the file is identical on all the servers). The IP address is first, followed by the name and domain of the server; e.g., fubar.com, followed by an alias (fubar). The alias means that your can, say, connect from fubar to snafu with SSH like this:
Code:

ssh snaf
You don't have to type the domain name. Not really a big deal, just a convenience.

Your host name is found in /etc/HOSTNAME; e.g.,
Code:

cat /etc/HOSTNAME
fubar.com

That's pretty much it. Simple and elegant.

Hope this helps some.


All times are GMT -5. The time now is 09:01 PM.