wireless connection and X session

Rick Stevens rstevens at vitalstream.com
Tue May 2 20:50:46 UTC 2006


On Tue, 2006-05-02 at 15:17 -0500, Aaron Konstam wrote:
> On Tue, 2006-05-02 at 17:32 +0200, François Patte wrote:
> > Mikkel L. Ellertson a écrit :
> > > François Patte wrote:
> > > 
> > >>Bonjour,
> > >>
> > >>I am facing a problem that I don't understand. I installed FC4 on my
> > >>laptop and wireless is working fine but if I launch the wireless
> > >>connection after the boot (using for instance ifup eth1) I loose the
> > >>ownership of the X session, ie I am unable to open any graphical
> > >>application.
> > >>
> > >>If I kill my session and log again, I recover this ownership (and the
> > >>wireless connection is not lost...).
> > >>
> > >>Who can help me?
> > >>
> > >>Thank you.
> > > 
> > > Dumb question - is your hostname changing when you bring up the
> > > network connection? If so, this will cause problems in X.
> > 
> > This seems to be exactly the problem and it seems to be present only
> > with gnome..... (not appears with kde...)

I don't buy that.  KDE may restart X when the hostname changes, but X
depends on the hostname being set.  Read on.

> > What can i do? How to guess the hostname you will get when you want to
> > use a wifi in an airport for instance? Shall I put all possible names in
> > /etc/hosts?
> > 
> > I'm interrested to the solution of this problem....
> > 
> > Thanks.
> Well here is my question. If you are using  wireless communication
> using DHCP to multiple access points why are you defining a hostname?
> Take the hostname the dhcp server gives you.

That will only work if X comes up AFTER the machine receives its IP and
hostname from the DHCP server.  Remember that the local X session is
tied to the X server with its display at "hostname:0".  If the hostname
changes to "newhostname" and you DON'T restart X, there'll be no
"newhostname:0" display and you won't be able to open any new X clients.
End of story.

If you're not sure if you'll get DHCPd before or after X comes up, the
best bet is to define a fixed hostname and tie it to 127.0.0.1 in
your /etc/hosts file (you already have one..."localhost") and ignore any
hostname the DHCP server gives you.  Edit your dhclient.conf file and
add 'supersede host-name "localhost"' to the stanza that defines your
connection.  For example (stripped down to minimums),

       timeout 60;
       retry 60;
       reboot 10;
       select-timeout 5;
       initial-interval 2;

       interface "wlan0" {
           supersede host-name "localhost";  <<<---NOTE! Ignore DHCP
           request subnet-mask, broadcast-address, time-offset, routers,
                domain-name-servers;
           require subnet-mask, domain-name-servers;
       }

Alternately, you can accept the hostname the DHCP server gives you and
then add some commands to /usr/sbin/dhclient-script (e.g.
"/usr/sbin/gdm-restart") so X restarts with the new hostname.  I leave
that as an exercise for the reader.

BTW, this is one of the reasons why your system defaults to "localhost"
if you don't have a hostname configured--so X can start.

----------------------------------------------------------------------
- Rick Stevens, Senior Systems Engineer     rstevens at vitalstream.com -
- VitalStream, Inc.                       http://www.vitalstream.com -
-                                                                    -
-               500: Internal Fortune Cookie Error                   -
----------------------------------------------------------------------





More information about the fedora-list mailing list