1 |
On 01/04/15 15:20, Mick wrote: |
2 |
> On Sunday 04 Jan 2015 16:06:50 Urs Schütz wrote: |
3 |
>> Hi list |
4 |
>> |
5 |
>> While hunting down slow startx times (12-16s instead the usual 2-5s) I |
6 |
>> found that "hostname -f" tries to resolve the hostname. This is a slow |
7 |
>> process (timeout?): |
8 |
>> |
9 |
>> urs@cadd ~ $ time hostname -v |
10 |
>> gethostname()=`cadd' |
11 |
>> cadd |
12 |
>> |
13 |
>> real 0m0.001s |
14 |
>> user 0m0.000s |
15 |
>> sys 0m0.001s |
16 |
>> |
17 |
>> urs@cadd ~ $ time hostname -v -f |
18 |
>> gethostname()=`cadd' |
19 |
>> Resolving `cadd' ... |
20 |
>> Result: h_name=`cadd' |
21 |
>> Result: h_addr_list=`127.0.0.1' |
22 |
>> cadd |
23 |
>> |
24 |
>> real 0m10.011s |
25 |
>> user 0m0.000s |
26 |
>> sys 0m0.001s |
27 |
>> |
28 |
>> urs@cadd ~ $ man hostname |
29 |
>> ...snip... |
30 |
>> -f, --fqdn, --long |
31 |
>> Display the FQDN (Fully Qualified Domain Name). A FQDN |
32 |
>> consists |
33 |
>> of a short host name and the DNS domain name. Unless |
34 |
>> you are |
35 |
>> using bind or NIS for host lookups you can change the |
36 |
>> FQDN and |
37 |
>> the DNS domain name (which is part of the FQDN) |
38 |
>> in the |
39 |
>> /etc/hosts file. |
40 |
>> ...snip... |
41 |
>> |
42 |
>> My /etc/hosts.conf orders hosts before bind: |
43 |
>> urs@cadd ~ $ grep order /etc/host.conf |
44 |
>> # recognized are order, trim, mdns, multi, nospoof, spoof, and reorder. |
45 |
>> order hosts, bind |
46 |
>> |
47 |
>> I do not run any NIS or bind services. |
48 |
>> |
49 |
>> I solved the slow startx by replacing "hostname -f" by "hostname" in the |
50 |
>> /usr/bin/startx script, but still feel that I'm missing the real cause |
51 |
>> for the slow hostname lookup. |
52 |
>> |
53 |
>> I do not have a DNS domain name definition in /etc/hosts. |
54 |
>> I do run networkmanager. |
55 |
>> Any hints where to search? |
56 |
>> |
57 |
>> What is the recommended way for /etc/hosts? I'm at a simple home |
58 |
>> network, behind a NAT cable modem, and do not have a dns domain name. |
59 |
>> |
60 |
>> Thanks for any hints. |
61 |
>> Urs |
62 |
> |
63 |
> In my /etc/hosts I have something like this: |
64 |
> |
65 |
> # IPv4 and IPv6 localhost aliases |
66 |
> 127.0.0.1 cad.homeLAN localhost cad |
67 |
> ::1 cad.homeLAN localhost cad |
68 |
> |
69 |
> See if this solves your problem. |
70 |
> |
71 |
> PS. I remember a thread in this M/L about the correct way to configure a |
72 |
> domain name and why how the Gentoo Handbook was wrong. I think there was a |
73 |
> bug opened about it, too. |
74 |
> |
75 |
|
76 |
Setting up /etc/hosts exactly as above did resolve the slow hostname -f |
77 |
lookup. |
78 |
|
79 |
urs@cadd ~ $ time hostname -v -f |
80 |
gethostname()=`cadd' |
81 |
Resolving `cadd' ... |
82 |
Result: h_name=`cadd.homeLAN' |
83 |
Result: h_aliases=`localhost' |
84 |
Result: h_aliases=`cadd' |
85 |
Result: h_addr_list=`::1' |
86 |
cadd.homeLAN |
87 |
|
88 |
real 0m0.001s |
89 |
user 0m0.000s |
90 |
sys 0m0.000s |
91 |
|
92 |
:-) Thanks for your help. |
93 |
Urs |