On Sunday 04 Jan 2015 16:06:50 Urs Schütz wrote:
> Hi list
> 
> While hunting down slow startx times (12-16s instead the usual 2-5s) I
> found that "hostname -f" tries to resolve the hostname. This is a slow
> process (timeout?):
> 
> urs@cadd ~ $ time hostname -v
> gethostname()=`cadd'
> cadd
> 
> real    0m0.001s
> user    0m0.000s
> sys     0m0.001s
> 
> urs@cadd ~ $ time hostname -v -f
> gethostname()=`cadd'
> Resolving `cadd' ...
> Result: h_name=`cadd'
> Result: h_addr_list=`127.0.0.1'
> cadd
> 
> real    0m10.011s
> user    0m0.000s
> sys     0m0.001s
> 
> urs@cadd ~ $ man hostname
> ...snip...
>   -f, --fqdn, --long
>                Display the FQDN (Fully Qualified Domain Name). A FQDN
> consists
>                of  a  short  host  name and the DNS domain name. Unless
> you are
>                using bind or NIS for host lookups you can change the
> FQDN  and
>                the  DNS  domain  name  (which  is  part  of  the  FQDN)
>   in the
>                /etc/hosts file.
> ...snip...
> 
> My /etc/hosts.conf orders hosts before bind:
> urs@cadd ~ $ grep order  /etc/host.conf
> # recognized are order, trim, mdns, multi, nospoof, spoof, and reorder.
> order hosts, bind
> 
> I do not run any NIS or bind services.
> 
> I solved the slow startx by replacing "hostname -f" by "hostname" in the
> /usr/bin/startx script, but still feel that I'm missing the real cause
> for the slow hostname lookup.
> 
> I do not have a DNS domain name definition in /etc/hosts.
> I do run networkmanager.
> Any hints where to search?
> 
> What is the recommended way for /etc/hosts? I'm at a simple home
> network, behind a NAT cable modem, and do not have a dns domain name.
> 
> Thanks for any hints.
> Urs

In my /etc/hosts I have something like this:

# IPv4 and IPv6 localhost aliases
127.0.0.1       cad.homeLAN localhost cad
::1             cad.homeLAN localhost cad

See if this solves your problem.

PS. I remember a thread in this M/L about the correct way to configure a 
domain name and why how the Gentoo Handbook was wrong.  I think there was a 
bug opened about it, too. 

-- 
Regards,
Mick

Attachment: signature.asc
Description: This is a digitally signed message part.

Reply via email to