40. Starting X
Introduction to FreeBSD

By default, FreeBSD boots to the text based login screen.

FreeBSD/i386 (vnode.vmunix.com) (ttyp8)


From here each user can log into the console and type startx and X will start. Typing startx will use default values in /usr/X11R6/lib/X11/xinit/system.xinitrc. These can be over-ridden by placing .xinitrc in your home directory. The .xinitrc file is a script that gets run every time startx is executed. The # character is used to comment out lines.

setenv KDEDIR /usr/local
#color_xterm -geometry 80x24+0+0 &
#color_xterm -geometry 80x23+-1+341 &
#color_xterm -geometry 85x24+492+1 -ls &

It is possible to configure X to start autmatically and provide graphical login services. This configuration allows remote X terminals. Typing xdm as root, will start graphical logins immediately. Adding xdm to your /etc/ttys file will start xdm at boot up.

ttyv0   "/usr/libexec/getty Pc"         cons25  on  secure
# Virtual terminals
ttyv1   "/usr/libexec/getty Pc"         cons25  on  secure
ttyv2   "/usr/libexec/getty Pc"         cons25  on  secure
ttyv3   "/usr/X11R6/bin/xdm -nodaemon"  xterm   on  secure 

When users log in using xdm.xinitrc is ignored. Instead a different file, .xsession, is executed. None of the users normal startup scripts are initialized during startup, therefore, .xsession must contain all file location and shell information that is needed to start X.

The .xsession file must be executable. You can do this by typing chmod u+x .xsession. Here is an example .xsession that starts kde:

set path = (/bin /sbin /usr/bin /usr/sbin 
            /usr/local/bin /usr/local/sbin /usr/X11R6/bin )
setenv KDEDIR /usr/local/

If a user attemps to log in and the .xsession file does not exist, or has problems, the user will be denied access and errors will be logged to .xsession-errors in that users home directory.

Return to Table of Contents

Visit the Gifcom