From rabbit!shanee@inga.augusta.de  Tue May 13 13:31:47 1997
Received: from inga.augusta.de (root@inga.augusta.de [193.175.23.65])
          by hub.freebsd.org (8.8.5/8.8.5) with SMTP id NAA11636
          for <FreeBSD-gnats-submit@freebsd.org>; Tue, 13 May 1997 13:31:38 -0700 (PDT)
Received: from rabbit by inga.augusta.de with uucp
	(Smail3.1.29.1 #1) id m0wROD6-004cphC; Tue, 13 May 97 22:30 MET DST
Received: by rabbit.augusta.de (Smail3.1.29.1 #1)
	id m0wRLC9-00021IC; Tue, 13 May 97 19:17 MET DST
Message-Id: <m0wRLC9-00021IC@rabbit.augusta.de>
Date: Tue, 13 May 97 19:17 MET DST
From: shanee@rabbit.augusta.de
Reply-To: shanee@rabbit.augusta.de
To: FreeBSD-gnats-submit@freebsd.org
Subject: Little mistake in ttys
X-Send-Pr-Version: 3.2

>Number:         3590
>Category:       docs
>Synopsis:       FAQ gives bad reccomendation re: xdm
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    dwhite
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Tue May 13 13:40:00 PDT 1997
>Closed-Date:    Fri Apr 9 17:04:16 PDT 1999
>Last-Modified:  Fri Apr  9 17:04:47 PDT 1999
>Originator:     Andreas Kohout
>Release:        FreeBSD 3.0-CURRENT i386
>Organization:
Private Site running FreeBSD-current
>Environment:

	n/a

>Description:

	in the FAQ:
	Starting xdm via /etc/ttys is a Bad Thing.

	in /usr/src/etc/ttys:
	ttyv3   "/usr/X11R6/bin/xdm -nodaemon"  xterm   off secure

	nothing about xdm in /usr/src/etc/rc.local

>How-To-Repeat:

	take a lock in the src-tree

>Fix:
	
	Change line 14 in /usr/src/etc/ttys
	from: ttyv3   "/usr/X11R6/bin/xdm -nodaemon"  xterm   off secure
	to:   ttyv3   "/usr/libexec/getty Pc"         cons25  off secure

	Add this to rc.conf:
	# path for xdm
	XDMP=/usr/X11R6/bin

	# set to YES to start xdm
	xdm_start=NO

	Add this to rc.local:
	# xdm
	if [ X${xdm_start} = X"YES" -a -x $XDMP/xdm ]; than
       		echo -n " xdm"
       		$XDMP/xdm
       		sleep 1
	fi

>Release-Note:
>Audit-Trail:

From: "Jordan K. Hubbard" <jkh@time.cdrom.com>
To: shanee@rabbit.augusta.de
Cc: FreeBSD-gnats-submit@FreeBSD.ORG
Subject: Re: conf/3590: Little mistake in ttys 
Date: Wed, 14 May 1997 03:07:21 -0700

 > 	in the FAQ:
 > 	Starting xdm via /etc/ttys is a Bad Thing.
 
 Actually, I think the FAQ is wrong - I start xdm from my /etc/ttys
 and it works just fine, nor is it a big problem should X start falling
 over since I can always switch to a different VTY and kill xdm.
 
 				Jordan
Responsible-Changed-From-To: freebsd-bugs->freebsd-doc 
Responsible-Changed-By: hoek 
Responsible-Changed-When: Mon Apr 13 08:31:45 PDT 1998 
Responsible-Changed-Why:  
-doc related PR.  Rephrased Synopsis (I thought we got to enter 
explanations of synopsis-changes, too?) 

From: Tim Vanderhoek <ac199@hwcn.org>
To: freebsd-gnats-submit@FreeBSD.ORG
Cc:  Subject: Re: conf/3590
Date: Thu, 23 Apr 1998 18:34:55 -0400 (EDT)

 Yet Another Opinion on This Contentious Bug
 
 --
  tIM...HOEk
 OPTIMIZATION: the process of using many one-letter variables names
               hoping that the resultant code will run faster.
 
 ---------- Forwarded message ----------
 Date: 22 Apr 1998 13:29:44 +0200
 From: Dag-Erling Coidan Smrgrav <dag-erli@ifi.uio.no>
 To: Kazutaka YOKOTA <yokota@zodiac.mech.utsunomiya-u.ac.jp>
 Cc: "Alok K. Dhir" <adhir@worldbank.org>, current@FreeBSD.ORG
 Subject: Re: Disappearing keyboard
 
 Kazutaka YOKOTA <yokota@zodiac.mech.utsunomiya-u.ac.jp> writes:
 > AFAIK, there are four ways to start xdm and avoid conflicts with getty.
 > 
 > 1. Specify xdm in /etc/ttys.  If you want to run xdm in ttyv3, you write:
 > 
 > 	ttyv3	"/usr/X11R6/bin/xdm -nodaemon" xterm on secure
 
 This is evil and should never have been suggested in the docs.
 
 > 2. Run xdm from /etc/rc.local (or other rc* files).
 > [...]
 > 3. Another way to run xdm from /etc/rc.local (or other rc* files).
 > [...]
 
 There is a better way, see below.
 
 > 4. Specify the X server in /etc/ttys.
 > 
 > 	ttyv3	"/usr/X11R6/bin/X vt4 -query localhost" xterm on secure
 
 Again, this is evil.
 
 The Right Way (tm) to start X or xdm is to put a shell script in
 /usr/local/etc/rc.d which Does the Deed. It will work, no questions
 asked. I have something similar to this:
 
 #!/bin/sh
 if [ -r /noxdm ] ; then
     echo -n " (xdm disabled)"
 else
     [ -x /usr/X11R6/bin/xdm ] && /usr/X11R6/bin/xdm && echo -n " xdm"
 fi
 
 in /usr/local/etc/rc.d/xdm.sh.
 
 If you're picky about the execution order of /usr/local/etc/rc.d/*,
 use a numeric prefix for each script, as in /etc/periodic/*.
 
 -- 
 Noone else has a .sig like this one.
 
 To Unsubscribe: send mail to majordomo@FreeBSD.org
 with "unsubscribe freebsd-current" in the body of the message
 

From: Tim Vanderhoek <ac199@hwcn.org>
To: freebsd-gnats-submit@FreeBSD.ORG
Cc:  Subject: Re: conf/3590
Date: Thu, 23 Apr 1998 18:36:04 -0400 (EDT)

 and the sequel for real, this time...
 
 
 --
  tIM...HOEk
 OPTIMIZATION: the process of using many one-letter variables names
               hoping that the resultant code will run faster.
 
 ---------- Forwarded message ----------
 Date: 22 Apr 1998 15:12:39 +0200
 From: Dag-Erling Coidan Smrgrav <dag-erli@ifi.uio.no>
 To: "Jordan K. Hubbard" <jkh@time.cdrom.com>
 Cc: Kazutaka YOKOTA <yokota@zodiac.mech.utsunomiya-u.ac.jp>,
     "Alok K. Dhir" <adhir@worldbank.org>, current@FreeBSD.ORG
 Subject: Re: Disappearing keyboard
 
 "Jordan K. Hubbard" <jkh@time.cdrom.com> writes:
 > > This is evil and should never have been suggested in the docs.
 > Why?  It's always worked just great for me and I've had it like
 > this for over 3 years.
 
 Amongst other things, it makes it difficult to restart xdm properly,
 and it has been known to hang some machines under some circumstances.
 
 -- 
 Noone else has a .sig like this one.
 
 To Unsubscribe: send mail to majordomo@FreeBSD.org
 with "unsubscribe freebsd-current" in the body of the message
 

From: Tim Vanderhoek <ac199@hwcn.org>
To: freebsd-gnats-submit@FreeBSD.ORG
Cc:  Subject: Re: conf/3590
Date: Thu, 23 Apr 1998 18:47:00 -0400 (EDT)

 Okay, perhaps I should have read through the whole thread first,
 but the following seems to be the concensus reached...
 
 
 --
  tIM...HOEk
 OPTIMIZATION: the process of using many one-letter variables names
               hoping that the resultant code will run faster.
 
 ---------- Forwarded message ----------
 Date: Wed, 22 Apr 1998 11:29:38 -0500 (EST)
 From: John Fieber <jfieber@indiana.edu>
 To: Mike Smith <mike@smith.net.au>
 Cc: "Jordan K. Hubbard" <jkh@time.cdrom.com>,
     Dag-Erling Coidan Smrgrav <dag-erli@ifi.uio.no>,
     Kazutaka YOKOTA <yokota@zodiac.mech.utsunomiya-u.ac.jp>,
     "Alok K. Dhir" <adhir@worldbank.org>, current@FreeBSD.ORG
 Subject: Re: Disappearing keyboard 
 
 On Wed, 22 Apr 1998, Mike Smith wrote:
 
 > > > This is evil and should never have been suggested in the docs.
 > > 
 > > Why?  It's always worked just great for me and I've had it like
 > > this for over 3 years.
 > 
 > "Because if your X server crashes it just loops forever"
 > 
 > At least that's the pathetic excuse that I've heard most often.
 
 And not even correct.  If *xdm* immediately crashes, it will loop
 a couple times but then init notices something is amiss and stops
 trying to start it.
 
 If your *X server* crashes, xdm restarts it. Whether you started
 xdm int /etc/ttys or by some other mechanism has nothing to do
 with it with this behavior. 
 
 
 
 -john
 
 
 To Unsubscribe: send mail to majordomo@FreeBSD.org
 with "unsubscribe freebsd-current" in the body of the message
 

From: Tim Vanderhoek <ac199@hwcn.org>
To: freebsd-gnats-submit@FreeBSD.ORG
Cc:  Subject: Re: conf/3590
Date: Thu, 23 Apr 1998 18:49:32 -0400 (EDT)

 And, of course, for reference purposes, Kazu always seems to know
 what he's talking about...  :)  This is probably a good summary
 and should be FAQ-ified.
 
 
 --
  tIM...HOEk
 OPTIMIZATION: the process of using many one-letter variables names
               hoping that the resultant code will run faster.
 
 ---------- Forwarded message ----------
 Date: Wed, 22 Apr 1998 14:16:40 +0900
 From: Kazutaka YOKOTA <yokota@zodiac.mech.utsunomiya-u.ac.jp>
 To: "Alok K. Dhir" <adhir@worldbank.org>
 Cc: current@FreeBSD.ORG, yokota@zodiac.mech.utsunomiya-u.ac.jp
 Subject: Re: Disappearing keyboard 
 
 
 >I've been having a strange problem with -current since late March.  The
 >machine is a Dell Workstation 400, dual Pentium 300 (running SMP).
 >
 >Problem is that occasionally, the keyboard stops responding completely.
 >The mouse in X continues to work, and telnet sessions are fine.  It just
 >stops taking keyboard input.
 >
 >I can make this happen repeatably simply by having "xdm" in rc.local.
 >Then, every time it comes up, the keyboard is dead.  Taking xdm out of
 >rc.local, and starting it manually as root after the system is up keeps
 >the keyboard working OK.  It still dies every now and then though.
 >
 >Any ideas? 
 
 There may be conflict between getty and xdm.  On which vty are you
 running xdm?
 
 AFAIK, there are four ways to start xdm and avoid conflicts with getty.
 
 1. Specify xdm in /etc/ttys.  If you want to run xdm in ttyv3, you write:
 
 	ttyv3	"/usr/X11R6/bin/xdm -nodaemon" xterm on secure
 
 2. Run xdm from /etc/rc.local (or other rc* files).
 
 	if [ -x /usr/X11R6/bin/xdm ]; then
 		(sleep 10; /usr/X11R6/bin/xdm) &
 	fi
 
    It is essential to add "sleep N" for proper operation.  You may need
    to experient in order to find an appropriate value for N in your 
    configuration.
 
 3. Another way to run xdm from /etc/rc.local (or other rc* files).
 
 	if [ -x /usr/X11R6/bin/xdm ]; then
 		/usr/X11R6/bin/xdm
 	fi
 
    You need to explicitly specify a vty in which to run the X server
    by modifying /usr/X11R6/lib/X11/xdm/Xserver.
 
 	:0 local /usr/X11R6/bin/X vt4
 
    The above example will run the X server in ttyv3.  Note that the X 
    server counts vtys as vt1, vt2, vt3..., whereas FreeBSD uses the
    notation ttyv0, ttyv1, ttyv2,...
 
 4. Specify the X server in /etc/ttys.
 
 	ttyv3	"/usr/X11R6/bin/X vt4 -query localhost" xterm on secure
 
    _Remove_ the X server from /usr/X11R6/lib/X11/xdm/Xserver.
    _Add_ localhost to /usr/X11R6/lib/X11/xdm/Xaccess.
    Start xdm from /etc/rc* as:
 
 	if [ -x /usr/X11R6/bin/xdm ]; then
 		/usr/X11R6/bin/xdm
 	fi
 
 Hope this will give you some ideas.
 
 Kazu
 
 
 
 
 
 
 
 
 To Unsubscribe: send mail to majordomo@FreeBSD.org
 with "unsubscribe freebsd-current" in the body of the message
 

From: Tim Vanderhoek <ac199@hwcn.org>
To: freebsd-gnats-submit@FreeBSD.ORG
Cc:  Subject: Re: conf/3590
Date: Thu, 23 Apr 1998 18:50:05 -0400 (EDT)

 Perhaps along with the explanatory literature...
 
 --
  tIM...HOEk
 OPTIMIZATION: the process of using many one-letter variables names
               hoping that the resultant code will run faster.
 
 ---------- Forwarded message ----------
 Date: Wed, 22 Apr 1998 22:43:15 +0900
 From: Kazutaka YOKOTA <yokota@zodiac.mech.utsunomiya-u.ac.jp>
 To: dag-erli@ifi.uio.no
 Cc: current@FreeBSD.ORG, yokota@zodiac.mech.utsunomiya-u.ac.jp
 Subject: Re: Disappearing keyboard 
 
 
 >Kazutaka YOKOTA <yokota@zodiac.mech.utsunomiya-u.ac.jp> writes:
 >> AFAIK, there are four ways to start xdm and avoid conflicts with getty.
 >> 
 >> 1. Specify xdm in /etc/ttys.  If you want to run xdm in ttyv3, you write:
 >> 
 >> 	ttyv3	"/usr/X11R6/bin/xdm -nodaemon" xterm on secure
 >
 >This is evil and should never have been suggested in the docs.
 
 I knew some people don't like this :-) To me it is a matter of 
 preference.
 
 >> 2. Run xdm from /etc/rc.local (or other rc* files).
 >> [...]
 >> 3. Another way to run xdm from /etc/rc.local (or other rc* files).
 >> [...]
 >
 >There is a better way, see below.
 >
 >> 4. Specify the X server in /etc/ttys.
 >> 
 >> 	ttyv3	"/usr/X11R6/bin/X vt4 -query localhost" xterm on secure
 >
 >Again, this is evil.
 >
 >The Right Way (tm) to start X or xdm is to put a shell script in
 >/usr/local/etc/rc.d which Does the Deed. It will work, no questions
 >asked. I have something similar to this:
 
 I picked up /etc/rc.local simply because it was what the original
 poster was using.  I don't care which rc script you would prefer to
 use for this purpose.
 
 >#!/bin/sh
 >if [ -r /noxdm ] ; then
 >    echo -n " (xdm disabled)"
 >else
 >    [ -x /usr/X11R6/bin/xdm ] && /usr/X11R6/bin/xdm && echo -n " xdm"
 >fi
 >
 >in /usr/local/etc/rc.d/xdm.sh.
 >
 >If you're picky about the execution order of /usr/local/etc/rc.d/*,
 >use a numeric prefix for each script, as in /etc/periodic/*.
 
 Umm, I am puzzled. I don't see why this particular version should
 solve the original poster's problem.
 
 We are talking about possible conflict between getty and xdm.
 
 We usually turn on getty on some vtys, say ttyv0 through ttyv2.  When
 xdm is started from /etc/rc.local (or /usr/local/etc/rc.d/something),
 getty has not yet been started. Therefore, ttyv1 through ttyv2 are not
 in use and is available.
 
 If getty is not yet running when xdm tries to start the X server, the
 X server will pick up the first available vty, in this case ttyv1.
 Then, init starts getty on ttyv1 and you get two programs, the X
 server and getty, trying to read the keyboard in ttyv1...
 
 This is a timing problem.  If getty has been started in ttyv1 through
 ttyv2 BEFORE xdm starts the X server, the X server will see ttyv3 is
 available and will use it, then you have no conflict.
 
 That's why I suggested to put `sleep N' before starting xdm from
 rc.local (or whichever rc script) so that getty will run before the X
 server, or explicitly specify a vty in which to run the X server.
 
 Kazu
 
 To Unsubscribe: send mail to majordomo@FreeBSD.org
 with "unsubscribe freebsd-current" in the body of the message
 
Responsible-Changed-From-To: freebsd-doc->dwite 
Responsible-Changed-By: nik 
Responsible-Changed-When: Fri Apr 9 14:20:10 PDT 1999 
Responsible-Changed-Why:  
FAQ text appears to have changed, but it doesn't contain the full 
explanation from the PR.  Either close the PR, or re-assign back to doc,  
with a note that the text needs improving. 
Responsible-Changed-From-To: dwite->dwhite 
Responsible-Changed-By: nik 
Responsible-Changed-When: Fri Apr 9 14:21:03 PDT 1999 
Responsible-Changed-Why:  
dwite -> dwhite 
State-Changed-From-To: open->closed 
State-Changed-By: dwhite 
State-Changed-When: Fri Apr 9 17:04:16 PDT 1999 
State-Changed-Why:  
Suggestions considered and committed. 
>Unformatted:
