How do I start XDM on boot?

There are two schools of thought on how to start xdm. One school starts xdm from /etc/ttys (see ttys(5)) using the supplied example, while the other simply runs xdm from rc.local (see rc(8)) or from a script in /usr/local/etc/rc.d. Both are equally valid, and one may work in situations where the other does not. In both cases the result is the same: X will pop up a graphical login: prompt.

The ttys method has the advantage of documenting which vty X will start on and passing the responsibility of restarting the X server on logout to init. The rc.local method makes it easy to kill xdm if there is a problem starting the X server.

If loaded from rc.local, xdm should be started without any arguments (i.e., as a daemon). xdm must start AFTER getty runs, or else getty and xdm will conflict, locking out the console. The best way around this is to have the script sleep 10 seconds or so then launch xdm.

If you are to start xdm from /etc/ttys, there still is a chance of conflict between xdm and getty(8). One way to avoid this is to add the vt number in the /usr/X11R6/lib/X11/xdm/Xservers file.

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

The above example will direct the X server to run in /dev/ttyv3. Note the number is offset by one. The X server counts the vty from one, whereas the FreeBSD kernel numbers the vty from zero.
Suggest a Site