Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Startx and network
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Desktop Environments
View previous topic :: View next topic  
Author Message
fangwen
Tux's lil' helper
Tux's lil' helper


Joined: 23 Oct 2011
Posts: 128
Location: Shanghai, China

PostPosted: Fri Nov 18, 2011 10:55 am    Post subject: Startx and network Reply with quote

I noticed this strange problem. When the network cable is unplugged, startx will take a very long time, about 20 seconds, with the following output:
Code:
hostname: Host name lookup failure
xauth:  file /home/yufw/.serverauth.1960 does not exist


X.Org X Server 1.10.4
Release Date: 2011-08-19
X Protocol Version 11, Revision 0
Build Operating System: Linux 3.0.6-gentoo i686 Gentoo
Current Operating System: Linux gentoo 3.0.6-gentoo #40 SMP Fri Nov 18 16:53:16 CST 2011 i686
Kernel command line: root=/dev/sda8
Build Date: 10 November 2011  01:15:41PM
 
Current version of pixman: 0.22.2
   Before reporting problems, check http://wiki.x.org
   to make sure that you have the latest version.
Markers: (--) probed, (**) from config file, (==) default setting,
   (++) from command line, (!!) notice, (II) informational,
   (WW) warning, (EE) error, (NI) not implemented, (??) unknown.
(==) Log file: "/var/log/Xorg.0.log", Time: Fri Nov 18 16:59:56 2011
(==) Using system config directory "/usr/share/X11/xorg.conf.d"
(EE) Failed to load module "vesa" (module does not exist, 0)
(EE) Failed to load module "fbdev" (module does not exist, 0)
/etc/X11/xinit/xinitrc: line 60: xclock: command not found


But when my computer is connected to the local area network, startx is at its normal speed, while still give these output except this line:
Code:
hostname: Host name lookup failure

Does network have anything to do with X?
_________________
All operating systems suck. This one just sucks less.
Back to top
View user's profile Send private message
Gusar
Advocate
Advocate


Joined: 09 Apr 2005
Posts: 2665
Location: Slovenia

PostPosted: Fri Nov 18, 2011 1:16 pm    Post subject: Reply with quote

The startx script uses "hostname" to set up Xauth (permissions and stuff). It's very possible that "hostname" behaves differently if a cable is plugged in or not.

Try this: When your machine starts without a cable attached, run "hostname -f", see how long it takes for something to happen. Now attach a cable and run "hostname -f" again.
Back to top
View user's profile Send private message
fangwen
Tux's lil' helper
Tux's lil' helper


Joined: 23 Oct 2011
Posts: 128
Location: Shanghai, China

PostPosted: Fri Nov 18, 2011 2:09 pm    Post subject: Reply with quote

Gusar wrote:

Try this: When your machine starts without a cable attached, run "hostname -f", see how long it takes for something to happen. Now attach a cable and run "hostname -f" again.

Without a cable attached, it takes much longer to run this command and finally returns
Code:
hostname: Host name lookup failure

Does this mean I need to always attach the network cable when I run X?
_________________
All operating systems suck. This one just sucks less.
Back to top
View user's profile Send private message
Gusar
Advocate
Advocate


Joined: 09 Apr 2005
Posts: 2665
Location: Slovenia

PostPosted: Fri Nov 18, 2011 2:27 pm    Post subject: Reply with quote

There's another option: open /usr/bin/startx, find the section that deals with hostname, remove it and replace it with a simple
Code:
hostname=`hostname`
Back to top
View user's profile Send private message
fangwen
Tux's lil' helper
Tux's lil' helper


Joined: 23 Oct 2011
Posts: 128
Location: Shanghai, China

PostPosted: Fri Nov 18, 2011 4:45 pm    Post subject: Reply with quote

Gusar wrote:
There's another option: open /usr/bin/startx, find the section that deals with hostname, remove it and replace it with a simple
Code:
hostname=`hostname`

Gusar,
Thank you. I followed your suggestions and now there is no host name lookup failure. Now I am interested in this line:
Code:
xauth:  file /home/yufw/.serverauth.1960 does not exist

It seems to be a warning message. What does it mean?
_________________
All operating systems suck. This one just sucks less.
Back to top
View user's profile Send private message
Knute
Guru
Guru


Joined: 28 Jun 2004
Posts: 362
Location: Fargo, ND

PostPosted: Mon Nov 21, 2011 2:50 am    Post subject: Reply with quote

Alternatively, you could set up your hostname in /etc/conf.d/hostname. And then also put that hostname in your /etc/hosts file as an alias for localhost.

This way, when /usr/bin/startx is upgraded, the issue won't return. :)

HTH,
_________________
Knute
----------
The human race has one really effective weapon, and that is laughter.
-- Mark Twain

If you want proof of that, take a look at windows sometime. :)
Back to top
View user's profile Send private message
fangwen
Tux's lil' helper
Tux's lil' helper


Joined: 23 Oct 2011
Posts: 128
Location: Shanghai, China

PostPosted: Mon Nov 21, 2011 5:19 am    Post subject: Reply with quote

Knute wrote:
Alternatively, you could set up your hostname in /etc/conf.d/hostname. And then also put that hostname in your /etc/hosts file as an alias for localhost.

This way, when /usr/bin/startx is upgraded, the issue won't return. :)

HTH,

Thank you, Knute
I set my hostname to be gentoo and edited my /etc/hosts file to be like this:
Code:
127.0.0.1 gentoo localhost.localdomain localhost
::1       gentoo localhost.localdomain localhost

And it solved my problem, there is no delay of "startx", but "hostname -i" returned ::1, shouldn't it return my ip address?

I tried removing the second line, but experienced a long delay to run startx, just like before.

What's wrong with my /etc/hosts?

Also, do I need always to reboot when I changed /etc/hosts to see if the change works for me?
_________________
All operating systems suck. This one just sucks less.
Back to top
View user's profile Send private message
Gusar
Advocate
Advocate


Joined: 09 Apr 2005
Posts: 2665
Location: Slovenia

PostPosted: Mon Nov 21, 2011 10:23 am    Post subject: Reply with quote

Knute wrote:
Alternatively, you could set up your hostname in /etc/conf.d/hostname. And then also put that hostname in your /etc/hosts file as an alias for localhost.

Ah, /etc/hosts is the magic incantation :). I knew there was something, didn't quite know what. Until now I've only set /etc/conf.d/hostname

@fangwen: ::1 *is* your ip address. IPv6 that is. It's for IPv6 what 127.0.0.1 is for IPv4. I don't have IPv6 support in my kernel, so hostname -i returns 127.0.0.1

Oh, and no need to reboot here. The changes to /etc/hosts take effect immediately.
Back to top
View user's profile Send private message
fangwen
Tux's lil' helper
Tux's lil' helper


Joined: 23 Oct 2011
Posts: 128
Location: Shanghai, China

PostPosted: Mon Nov 21, 2011 2:49 pm    Post subject: Reply with quote

Gusar wrote:

@fangwen: ::1 *is* your ip address. IPv6 that is. It's for IPv6 what 127.0.0.1 is for IPv4. I don't have IPv6 support in my kernel, so hostname -i returns 127.0.0.1

Strange enough! I don't have IPv6 support in my kernel, either, I just disabled it the day before yesterday. With these two lines in my /etc/hosts:
Code:
127.0.0.1 gentoo localhost
::1       gentoo localhost

I can ping 127.0.0.1, but I can't ping ::1 (unknown host). "hostname -i" returns ::1, not 127.0.0.1.

Could anyone explain that to me in detail?
_________________
All operating systems suck. This one just sucks less.
Back to top
View user's profile Send private message
Knute
Guru
Guru


Joined: 28 Jun 2004
Posts: 362
Location: Fargo, ND

PostPosted: Mon Nov 21, 2011 8:15 pm    Post subject: Reply with quote

Without ipv6 support in your kernel, that address is not in a language that the system understands. Verstehen sie? (german for Do you understand? ;) )

The easiest thing to do would simply be to comment out that line (or remove it if you definately have no plans in the future to add ipv6 support to your system), and that should take care of the issue.

Or, now that I think about it, take out the alias from the ipv6, and then when you look at the hostname your hostname will show up with the IPv4 rather than the IPv6.

I just took a peek at my /etc/hosts file, and I only put the hostname alias in the IPv4, not the IPv6 address and mine returns the IPv4 address.

HTH,
_________________
Knute
----------
The human race has one really effective weapon, and that is laughter.
-- Mark Twain

If you want proof of that, take a look at windows sometime. :)
Back to top
View user's profile Send private message
fangwen
Tux's lil' helper
Tux's lil' helper


Joined: 23 Oct 2011
Posts: 128
Location: Shanghai, China

PostPosted: Tue Nov 22, 2011 9:46 am    Post subject: Reply with quote

Knute wrote:
Without ipv6 support in your kernel, that address is not in a language that the system understands. Verstehen sie? (german for Do you understand? ;) )

but how do you explain I can't ping ::1 while being able to ping 127.0.0.1 with those two aliases in /etc/hosts?
Knute wrote:
The easiest thing to do would simply be to comment out that line (or remove it if you definately have no plans in the future to add ipv6 support to your system), and that should take care of the issue.

I have tried what you suggested, but with no luck.

I think the IPv6 alias is optional, but it seems to be necessary on my computer and the IPv4 is optional. :?:

I still wonder why the IPv4 alias takes no effect.
_________________
All operating systems suck. This one just sucks less.
Back to top
View user's profile Send private message
fangwen
Tux's lil' helper
Tux's lil' helper


Joined: 23 Oct 2011
Posts: 128
Location: Shanghai, China

PostPosted: Thu Nov 24, 2011 4:33 am    Post subject: Reply with quote

I finally figured out where was wrong. If I don't bring up the network interface during startup, "hostname -i" will return 127.0.0.1.

But I don't understand the details.
_________________
All operating systems suck. This one just sucks less.
Back to top
View user's profile Send private message
cach0rr0
Bodhisattva
Bodhisattva


Joined: 13 Nov 2008
Posts: 4123
Location: Houston, Republic of Texas

PostPosted: Thu Nov 24, 2011 6:24 am    Post subject: Reply with quote

fangwen wrote:

Strange enough! I don't have IPv6 support in my kernel, either, I just disabled it the day before yesterday. With these two lines in my /etc/hosts:


glibc (which is whose functions are going to be used to do that sort of lookup) and other packages on your system may well still be built with ipv6 support. If you don't want to use ipv6 at all, you should also make sure you have -ipv6 in your USE flags.


fangwen wrote:

I think the IPv6 alias is optional, but it seems to be necessary on my computer and the IPv4 is optional

This is why:
http://sourceware.org/bugzilla/show_bug.cgi?id=4980

WARNING: unfriendly developer replies in the above link. Consider yourself warned :lol:
_________________
Lost configuring your system?
dump lspci -n here | see Pappy's guide | Link Stash
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Desktop Environments 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