Gentoo Archives: gentoo-user

From: "Urs Schütz" <u.schutz@×××××××.ch>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] SOLVED: Slow startx - Why does hostname -f hang?
Date: Sun, 04 Jan 2015 18:55:43
Message-Id: 54A98CA4.7050003@bluewin.ch
In Reply to: Re: [gentoo-user] Slow startx - Why does hostname -f hang? by wabenbau@gmail.com
1 On 01/04/15 15:27, wabenbau@×××××.com wrote:
2 > Am Sonntag, 04.01.2015 um 14:06
3 > schrieb Urs Schütz <u.schutz@×××××××.ch>:
4 >
5 >> Hi list
6 >>
7 >> While hunting down slow startx times (12-16s instead the usual 2-5s)
8 >> I found that "hostname -f" tries to resolve the hostname. This is a
9 >> slow process (timeout?):
10 >
11 > Normally this is a fast process. See my results below.
12 >
13 >> urs@cadd ~ $ time hostname -v
14 >> gethostname()=`cadd'
15 >> cadd
16 >>
17 >> real 0m0.001s
18 >> user 0m0.000s
19 >> sys 0m0.001s
20 >
21 > user@puter ~ $ time hostname -v
22 > gethostname()=`puter'
23 > puter
24 >
25 > real 0m0.003s
26 > user 0m0.000s
27 > sys 0m0.000s
28 >
29 >> urs@cadd ~ $ time hostname -v -f
30 >> gethostname()=`cadd'
31 >> Resolving `cadd' ...
32 >> Result: h_name=`cadd'
33 >> Result: h_addr_list=`127.0.0.1'
34 > ^^^^^^^^^
35 > Does your computer only have an IP address for your localhost?
36 >
37 >> cadd
38 >>
39 >> real 0m10.011s
40 >> user 0m0.000s
41 >> sys 0m0.001s
42 >
43 > user@puter ~ $ time hostname -v -f
44 > gethostname()=`puter'
45 > Resolving `puter' ...
46 > Result: h_name=`puter.local'
47 > Result: h_aliases=`puter'
48 > Result: h_addr_list=`192.168.44.32'
49 > puter.local
50 >
51 > real 0m0.005s
52 > user 0m0.003s
53 > sys 0m0.003s
54 >
55 >> What is the recommended way for /etc/hosts? I'm at a simple home
56 >> network, behind a NAT cable modem, and do not have a dns domain name.
57 >
58 > What is the content of your /etc/hosts file?
59 > This is my hostfile:
60 >
61 > 127.0.0.1 localhost
62 > ::1 localhost
63 > 192.168.44.32 puter.local puter
64 >
65 > Regards
66 > wabe
67 >
68 >
69
70 Hi Wabe
71
72 IP changes dynamically, is assigned by Networkmanager with dhclient use
73 flag.
74 I changed /etc/hosts as Mick/Michael pointed out in an other reply, and
75 this solved the slow response. Here the relevant part of the corrected,
76 working /etc/hosts:
77
78 # IPv4 and IPv6 localhost aliases
79 127.0.0.1 cadd.homeLAN localhost
80 ::1 cadd.homeLAN localhost cadd
81
82 Thanks for your time looking into it and the hints.
83 Urs

Replies

Subject Author
Re: [gentoo-user] SOLVED: Slow startx - Why does hostname -f hang? Tom H <tomh0665@×××××.com>