Subject: Re: misc/5115: xdm doesn't run correctly when called from /etc/rc
To: Wolfgang Rupprecht <>
From: Todd Vierling <tv@NetBSD.ORG>
List: netbsd-bugs
Date: 03/04/1998 15:43:46
On 4 Mar 1998, Wolfgang Rupprecht wrote:

: writes:
: > 	Boot NetBSD with a recent /etc/rc, xdm enabled, and a couple things
: >     in /etc/rc.local (optional).  Since xdm manages to get running
: >     before init spawns any gettys it doesn't always pick an empty one.
: > 	This leads to tons of fun when xdm and getty stomp on each other.

port-i386 under "pcvt", right?

The simplest fix for this is not to use hackery after rc is finished; it is
to specify explicitly which tty you want the X server to show up on.  Using
the "standard" NetBSD X distribution based on XFree86, this is simple.

Edit /usr/X11R6/lib/X11/xdm/Xservers.  You'll see the line:

:0 local /usr/X11R6/bin/X

Change it to:

:0 local /usr/X11R6/bin/X vt02

where "2" is replaced with the number if the tty you really want there (the
last digit of /dev/ttyv2).  I believe this also works as "vt2" for one-digit
numbers.  This is listed as the second to last option if you do a
"/usr/X11R6/bin/X -help" -- right before "-keeptty". 

With this workaround in mind, I'm going to change the PR to "feedback" state
(it's still open but assumed fixed pending further possible discussion).

: When I run sshd from /etc/rc, xdm which is started a bit later can't
: bind to /dev/ttyv0 and instead grabs /dev/ttyv1 with the obvious
: results.  X and the getty fight for keboard events and eventually X
: loses control of the keyboard.  When I turned off ssh, then X gets
: ttyv0 and all is happy.

Your best solution is to have getty on ttyv0, not ttyv1, and run X on ttyv1. 
You should then have no problems with either sshd or X-vs-getty.   Use the
fix I describe above for this PR to do that.

-- Todd Vierling (Personal; Bus.