-->
Previous Table of Contents Next


Testing XFree86 Configurations

Now that the Xconfig or XF86Config file is completed, it’s time to take the plunge and start XFree86. Use the command startx and the X startup script should load all the requisite drivers and daemons, clear the screen, then show the basic X Window session. If XFree86 can’t load, it will usually display error messages as part of the termination process. Check these messages to determine whether there’s any hint as to the problem. Usually, XFree86 runs into supported video mode problems. (For those used to using UNIX on other systems, startx is a front-end utility to xinit, usually used to start X.)

If you can’t get XFree86 running quickly, the easiest debugging method is to step all the configuration information to the lowest denominator, such as a simple VGA system. If that works, then you can step up to more complex resolutions and configurations. This usually helps isolate the cause of the problems. If the generic VGA drivers don’t work, then a configuration problem is usually the cause. Check the configuration files carefully.

The .xinitrc File

The .xinitrc is a startup file (similar to the .profile or .cshrc startup files for the shells) for X. It usually includes any local modifications to the configuration defined in the Xconfig or XF86Config files, as well as instructions for starting specific applications or window managers when XFree86 starts. If you use either the startx or runx commands to start XFree86, the .xinitrc is renamed without the period (so it would be called xinitrc).

The system’s xinitrc file is usually kept as /usr/lib/X11/xinit/xinitrc or in /etc/X11/xinit/xinitrc. The latter path is more common with XFree86 and Linux, while the former is the path for X. (Linux places the file in the /etc/X11 directory structure instead of /usr/lib because some Linux installations prefer to mount the /usr directories as read-only and because sometimes they reside on a CD-ROM.)

The system’s default .xinitrc file can be overridden by placing a copy in your home directory. When XFree86 starts, it first checks your home directory for the .xinitrc file, and then reads the default startup file if one isn’t found. If you want to customize the behavior of the XFree86 session, copy the system file to your home directory and edit it with any editor. There are man pages for startx and xinit that explain some of the details of the startup file.

An example of a .xinitrc file is shown as follows. This is the default startup file from a straightforward XFree86 installation. The file has been cut into smaller sections so each subsection can be examined in a little more detail. The first subsection deals with setting paths:


userresources=$HOME/.Xresources

usermodmap=$HOME/.Xmodmap

sysresources=/usr/X11R6/lib/X11/xinit/.Xresources

sysmodmap=/usr/X11R6/lib/X11/xinit/.Xmodmap

These paths are usually set up in the XFree86 software, but you should check them to make sure they are valid. Remember to follow links if they exist to other directories. These variables are all that is required for XFree86.

The next subsection checks for the existence of some system resources and performs actions based on the check. Most, if not all, of these checks will not need to be modified unless you have very special requirements for your X session.


# merge in defaults and keymaps



if [ -f $sysresources ]; then

  xrdb -merge $sysresources

fi



if [ -f $sysmodmap ]; then

  xmodmap $sysmodmap

fi



if [ -f $userresources ]; then

  xrdb -merge $userresources

fi



if [ -f $usermodmap ]; then

  xmodmap $usermodmap

fi

The final subsection in the .xinitrc file runs the setroot program, if present, to set the background color (in this case, to steel blue). Finally, the fvwm window manager is executed and starts your session:


# start some nice programs

xsetroot -solid SteelBlue

fvwm

If you want to use another window manager, such as Motif’s mwm manager, change the last line in this subsection. Make sure that the window manager file is in the search path, so the startup routines can find it.

If you want to create an xterm session from within the .xinitrc file (you will need an xterm or other utility to start other tasks within XFree86), add the following line:


xterm -e /bin/bash

In this case, the bash shell is invoked within the xterm. You can, of course, use any shell you want.

If you create .xinitrc files for your own use, place them in your home directory. You can, for example, use a .xinitrc file like this:


#!/bin/sh



xterm -fn 7x13bold -geometry 80x32+10+10 &

xterm -fn 7x13bold -geometry 80x32+30+50 &

oclock -geometry 70x70-7+7 &

xsetroot -solid SteelBlue &

exec fvwm

This starts two xterms and the clock and places them on the desktop, then sets the background color to steel blue and finally starts the desktop manager. Two important notes: The last command in the script is preceded by the exec command and the last command is not sent to background. If you send the last command to background or forget the exec command, X starts up, and then immediately shuts down!

Summary

All of the previous steps will help you set up XFree86 properly, and after following them your XFree86 session should start up without a problem. The specifics of working with X are beyond the scope of this book. If you are not sure how to use X, check the documentation files that came with the release or consult a user-oriented book.

However, if you followed the steps outlined previously, your X system should now be functional and you can start working with the X system as your primary interface to Linux. After you’ve worked in X, it’s hard to go back to character-based terminals!

From here, there are a number of chapters that you can go to that are related to this topic:

Wabi, a way to run Windows applications under Linux, is discussed in Chapter 23, “Wabi.”
Ghostscript, which lets you see PostScript files onscreen and send them to the printer, is discussed in Chapter 24, “Ghostscript and Ghostview.”
Programming under Linux is discussed in Part V, starting with Chapter 25, “gawk.”
System administration is discussed in Part VI, starting with Chapter 32, “System Administration Basics.”


Previous Table of Contents Next