Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
hostname and startx very slow
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
ajg112
n00b
n00b


Joined: 30 May 2012
Posts: 3

PostPosted: Wed May 30, 2012 9:23 pm    Post subject: hostname and startx very slow Reply with quote

Hi All,
I have a new and up-to-date installation of Gentoo. However, I am finding that startx is a lot slower to start with the PC's network cable disconnected. After some googling this seems to be related to domain/hostname lookup.
Sure enough, with the network cable plugged in hostname -f returns very quickly. When the cable is unplugged there is a delay, but it does eventually return with the same response.

Here is the contents of /etc/hosts:
Code:
127.0.0.1       onion.allotment onion localhost.localdomain localhost


/etc/conf.d/net:
Code:
config_eth0="192.168.1.35 netmask 255.255.255.0 brd 192.168.1.255"
routes_eth0="default via 192.168.1.5"
dns_servers_eth0="192.168.1.5"


/etc/resolv.conf
Code:
nameserver 192.168.1.5


/etc/hosts.conf
Code:
order hosts, bind
multi off


hostname -f returns
Code:
onion.allotment


Does anyone know how I can stop this delay when the network cable is disconnected? I've noticed that if I remove the nameserver line from /etc/resolv.conf then hostname -f returns successfully and quickly with and without the cable. However, this of course stops any other name lookups!

The PC's ip address is 192.168.1.35. My router is 192.168.1.5

The PC is running mythtv, so I want to reduce to time from switch on to the X frontend starting as much as possible.

Many thanks
Andy
Back to top
View user's profile Send private message
BillWho
Veteran
Veteran


Joined: 03 Mar 2012
Posts: 1600
Location: US

PostPosted: Wed May 30, 2012 11:45 pm    Post subject: Reply with quote

ajg112,

I'm not sure if this is what you're looking for, but what about a preup function in /etc/conf.d/net to check if eth0 has a link or not.

I use that method to connect wired if I have I have eth0 connected otherwise it connects with the usb wireless adapter.

Another avenue you can pursue is a runlevel for offline use.

Good luck :wink:
_________________
Good luck :wink:

Since installing gentoo, my life has become one long emerge :)
Back to top
View user's profile Send private message
krinn
Watchman
Watchman


Joined: 02 May 2003
Posts: 7471

PostPosted: Thu May 31, 2012 12:14 am    Post subject: Re: hostname and startx very slow Reply with quote

ajg112 wrote:

Here is the contents of /etc/hosts:
Code:
127.0.0.1       localhost.localdomain localhost
192.168.1.35 onion.allotment onion


Change it to this format, if a program see that onion.allotmen is going down, the 127.0.0.1 entry might be invalidate as it point to onion.allotmen, something unplugging a cable might do.
Back to top
View user's profile Send private message
ajg112
n00b
n00b


Joined: 30 May 2012
Posts: 3

PostPosted: Thu May 31, 2012 7:54 pm    Post subject: Reply with quote

BillWho, thanks for the suggestions, but I'd hoped there would be a simpler solution; I can't help but think I've just got something simple missing in a config file somewhere!

krinn, I tried your suggestion, but it made no difference. I've tried a number of different entries in /etc/hosts, but none have sorted the problem.

Surely this must be a common problem? My setup sounds very common; a single machine connected to an ADSL router. What is frustrating is that I'm sure I didn't see this problem with my old Gentoo installation (from about 2 years ago).

Any other suggestions anyone?

Thanks
Andy
Back to top
View user's profile Send private message
dansou90
n00b
n00b


Joined: 13 Apr 2012
Posts: 65

PostPosted: Fri Jun 01, 2012 8:29 pm    Post subject: Reply with quote

What differences are there between your old Gentoo installation and the new one?
Back to top
View user's profile Send private message
ajg112
n00b
n00b


Joined: 30 May 2012
Posts: 3

PostPosted: Sat Jun 02, 2012 8:11 pm    Post subject: Reply with quote

My old installation was from about 3 years ago!

I think the major difference to my updated system is the introduction of baselayout 2 and openRC.

Andy
Back to top
View user's profile Send private message
dansou90
n00b
n00b


Joined: 13 Apr 2012
Posts: 65

PostPosted: Sat Jun 02, 2012 8:46 pm    Post subject: Reply with quote

When I said difference to your old installation, I meant the network configuration differences.

But another question: Doesn't your router provide DHCP? Why do you use a static ip? It's much easier with DHCP, just set it in /etc/conf.d/net. Also, try this in your /etc/hosts:

Code:
127.0.0.1 localhost.localdomain localhost
127.0.0.1 onion.allotment onion


This is a bit like my own configuration, though I do not set the domain in my /etc/hosts. Hope this helps.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum