The XFree86 configuration files

Once we have been introduced to the general philosophy of the X Window System, it is time to take a closer look at the XFree86 implementation, which is the one that Linux has been using since the very beginning.

XFree86 is actually a collection of different servers, each one of them specifically developed for a certain type of chipset or video card. When you install a Linux distribution, it usually performs some sort of hardware probing, and it automatically installs the server that corresponds to your video card. In my case, it is the SVGA server. If you are interested to see which server are you running, simply run ls -l/etc/X11/X which will show you that the X executable is nothing but a link to your specific X server.

If you did not configure your X Window System during installation, you still can use several scripts to perform the configuration now. Most Linux systems offer two choices: the XF86Setup script, which allows for a more graphical and perhaps more user-friendly aproach, and the xf86config script, which is text-based. Additionally, Red Hat also provides xconfigurator to assist you in the configuration of the X Window System. Which one should you run actually depends on your personal preferences. At the beginning, I found xconfigurator to be perhaps the easiest to use, although sometimes I needed to rely on XF86Setup when the former failed. However, as I became more and more familiar with Linux and the X Window System, I started to like the powerful but otherwise admittedly ugly xf86config script.

Starting from the beginning, the command any user usually runs to start the X Window System in a Linux system is startx. But if you ever bother to take a closer look, you will immediately notice that startx is not a binary, but rather a simple shell script. Its function is to search for several configuration files and pass the user command arguments to the xinit binary. First of all, startx looks for a client script called .xinitrc in the user\’s home directory, and if it is not found there it then proceeds to use the contents of /usr/lib/X11/xinit/xinitrc, which is nothng but a symbolic link to /etc/X11/xinit/xinitrc. In any event, this file provides some basic mechanism for starting up programs and performing some customization that will be executed when the X session begins (something similar to the placing program or shortcuts in the Startup folder in Windows, although quite more powerful in its customization capabilities). The second configuraton file used by startx is the server client configuration set in the .xserverrc file. As in the case of the .xinitrc file, startx first looks for the .xserverrc file in the user\’s own home directory, and if it is not found there it then uses the /etc/X11/xinit/xserverrc file (please , notice that in the case of Red Hat 6.1, there is no .xinitrc or .xserverrc files in the home directories by default, and there is only a xinitrc file in the /etc/X11/xinit directory, but no xserverrc).

Thus, as we said above, once startx does all the frontend processing, it calls the xinit binary application and it passes the parameters from the xinitrc file to it. On its turn, xinit will look for the name of a server script and if it does not have one (I explained above that Red Hat, for instance, does not create any .xserverrc file by default) it then proceeds to run the X :0 command, which is nothing but /etc/X11/X (i.e., a symbolic link to the specific X server that corresponds to the user\’s video card). If xinit is not passed a client script as a parameter and it cannot find one in the user\’s home directory, it will then open a bare X session and an X terminal. The session then will not display any window manager at all.

It is worthy to notice here that Red Hat 6.1 also makes use of the /etc/X11/xinit/Xclients file to specify the desktop environment that will run by default. Specifically, Red Hat\’s /etc/X11/xinit/xinitrc script refers to the abovementioned Xclients script, which clearly states which one will run by default (of course, you can change this parameter yourself).