View previous topic :: View next topic |
Author |
Message |
ajg112 n00b

Joined: 30 May 2012 Posts: 3
|
Posted: Wed May 30, 2012 9:23 pm Post subject: hostname and startx very slow |
|
|
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
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 |
|
 |
BillWho Veteran


Joined: 03 Mar 2012 Posts: 1600 Location: US
|
Posted: Wed May 30, 2012 11:45 pm Post subject: |
|
|
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  _________________ Good luck
Since installing gentoo, my life has become one long emerge  |
|
Back to top |
|
 |
krinn Watchman


Joined: 02 May 2003 Posts: 7471
|
Posted: Thu May 31, 2012 12:14 am Post subject: Re: hostname and startx very slow |
|
|
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 |
|
 |
ajg112 n00b

Joined: 30 May 2012 Posts: 3
|
Posted: Thu May 31, 2012 7:54 pm Post subject: |
|
|
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 |
|
 |
dansou90 n00b

Joined: 13 Apr 2012 Posts: 65
|
Posted: Fri Jun 01, 2012 8:29 pm Post subject: |
|
|
What differences are there between your old Gentoo installation and the new one? |
|
Back to top |
|
 |
ajg112 n00b

Joined: 30 May 2012 Posts: 3
|
Posted: Sat Jun 02, 2012 8:11 pm Post subject: |
|
|
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 |
|
 |
dansou90 n00b

Joined: 13 Apr 2012 Posts: 65
|
Posted: Sat Jun 02, 2012 8:46 pm Post subject: |
|
|
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 |
|
 |
|