Наши партнеры








Книги по Linux (с отзывами читателей)

Библиотека сайта rus-linux.net

Linux System Administrator's Survival Guide lsg05.htm

Previous Page TOC Next Page



Chapter 5


Installing and Configuring XFree86


X is a graphical user interface (GUI). The version of X supplied with most Linux software packages is XFree86, which is an implementation of the X Window system developed at MIT. XFree86 is available for several different PC UNIX versions, including Linux, and has been expanded over the more traditional X system to include the wide variety of hardware that is used in PC machines.



<NOTE>The official name of the GUI is X. It is often also called X Window System or X Windows, although these uses are greatly discouraged. (The latter version smacks of Microsoft's Windows product.) For the most part, you can use the terms X, X11 (from X version 11), XFree86, and X Window System interchangeably, but avoid X Windows! It's a sure method of annoying veteran UNIX users!<NOTE>

At least two major releases of XFree86 are available with Linux. Most distributions have version 2.X, although a few now offer the latest release (version 3.1.1 at the time of this writing). This chapter discusses installation and preliminary configuration of both XFree86 versions, although most of the examples use the more recent XFree86 3.x version.



<NOTE>It is important to understand the complete XFree86 installation process before you install your software. In some cases, you can cause damage to hardware and the already installed Linux software if you select inappropriate drivers.<NOTE>


Understanding XFree86


XFree86 is a public domain version of the X11 windowing system developed by MIT and now copyrighted to the MIT Consortium. In keeping with the Linux developers' desire to have no copyright code that requires licensing as part of the operating system, XFree86 was developed specifically for the PC architecture. XFree86 works with many PC-based UNIX systems including Linux.

Several versions of XFree86 are available, and they are all based on different releases of X. The most commonly used Linux version of XFree86 is release 2.X, which is based on X11 Release 5 (abbreviated as X11R5). The latest versions of XFree86 are releases 3.X, which are based on X11 Release 6 (X11R6), the most current version of the X Window system. Bug fixes and minor changes in utilities are often available as incremental version numbers. You can load these incremental versions over a release of the same number. For example, if you have loaded XFree86 version 2.1 and obtain the fix release 2.1.1, you must load it over 2.1 and not by itself. The bug fix releases do not contain the complete system, only the updates.



<NOTE>Do not use XFree86 version 2.0! It has several critical bugs. Instead, use at least version 2.1 or 2.1.1.<NOTE>

A few problems arose in the early days of the XFree86 development, primarily because of a lack of information from the official X Consortium (which controls the standards of X). To solve the problem, The XFree86 Project Inc. was founded and became a member of the X Consortium and was thereby granted access to information about new releases well before they were available to the general public. XFree86 is now a trademark of The XFree86 Project Inc.

Many Linux versions of XFree86 contain directories and references to a product called X386. X386 was an earlier version of X11R5 for the PC architecture, and XFree86 retained many of the X386 naming conventions for directories and files. However, X386 and XFree86 are different products and have no connection (other than naming conventions).

The latest versions of XFree86 require a practical minimum of at least 8M of RAM in your machine to run, and a virtual memory of at least 16M. In other words, you would need a swap space of at least 8M with an 8M RAM machine, although more is highly recommended. (XFree86 can run with 4MB, but it runs slowly enough to be annoying.) If you have 16M of RAM, you don't need the swap space although it should be used for safety's sake, especially if you plan on running memory-hogging applications. If you plan on using X a lot, set up your system to have 32M of virtual RAM for the best performance (preferably at least 16M RAM and the rest swap space).



<NOTE>Tweaking version 2.X of XFree86 to run in 4M of RAM is possible, although it is a slow process (both tweaking and running) and is therefore not recommended. XFree86 version 3.X will not run properly in 4M (although it can, with a lot of effort, be shoehorned in but then runs so slow as to be useless). XFree86 v 3.x will run in 8M RAM, although 16M is preferable. Again, a total of at least 16M virtual memory is recommended with 32M preferable.<NOTE>


Installing XFree86 Software


Most XFree86 distributions are provided as part of the software on a Linux CD-ROM or floppy disk set. This chapter uses a CD-ROM distribution (from the CD-ROM included with this book) as the example because it is the most common form of distribution. The instructions, however, apply equally for floppy disk distributions and software packages obtained from an FTP or BBS site.

Typically, the XFree86 software is located in a set of directories called x1, x2, x3, and so on. The Slackware distribution has directories running up to x14. Other distributions may differ in the number of directories. XFree86 applications are also stored in a set of directories called xap1, xap2, and so on. The software is usually supplied in gzipped format. The contents of each directory are usually summarized in a text file, which gives the filenames and their purposes.

Before you install the XFree86 software, verify that it will work with your existing Linux software. XFree86 releases depend on certain versions of the Linux kernel, the C library (libc), and the ld.so file version. A file in the distribution directories should explain the lowest version number of each of these three items that is necessary to run XFree86. If you obtained the XFree86 software packaged with a Linux release, it is likely to be compatible, and you can skip the verification stage.

If your X software wasn't installed by a setup program, you can install the XFree86 software manually by unzipping each file and then extracting the files in the archive. You must then properly load the files into the final directories. This process can be tedious and lengthy and should be avoided unless you want to know exactly what is going on. Instead, use the installation routines that the Linux vendor supplies, such as setup.

XFree86 version 2.X uses directories that mirror those used by the X386 software product. For most Linux systems, the primary directory is /usr/X386. To maintain consistency with software packages and utilities that expect a more common X11R5, X11R6, or X11 directory, Linux generally uses links between the X386 directory and the other directories as necessary. The Linux installation routine often creates these links.

XFree86 version 3.X abandons the /usr/X386 directory convention in favor of the more common X location /usr/X11R6. When upgrading an installation of XFree86 version 2.x to version 3.x, bear in mind the change of directory names and either change links or remove the old /usr/X386 versions completely. Make sure your search path variable is changed, too.



<NOTE>To simplify the directory structure for XFree86, links to a directory called /usr/X11 usually are created. This directory can then be linked to /usr/X386 and /usr/X11R6. Check your directory structure to determine which links are in place on your system. Also check your PATH environment variable to see which directory is in the search path (if one has been added at all).<NOTE>


Choosing an X Server


Before installing XFree86, you must decide which type of server you will use. The XFree86 servers are drivers for the video system. As a GUI, X uses the video card in your system extensively. Several drivers are available in most XFree86 distribution sets, and the names of the files tend to indicate the video card for which they are designed. For example, you may encounter the following server files in most XFree86 versions:

XF86_Mono Monochrome video card (generic)
XF86_VGA16 16-color VGA video card (generic)
XF86_SVGA Color SVGA video card (generic)
XF86_S3 Accelerated server for S3-based video cards
XF86_Mach8 Accelerated server for Mach8 video cards
XF86_Mach32 Accelerated server for Mach32 video cards
XF86_8514 Accelerated server for 8514/A video cards

The generic indications in the preceding list mean that the server has no card-specific instructions; the other servers have card-specific video card requirements. For example, you can use the XF86_S3 server only with video cards using the S3 chipset. Check with your video card documentation (or use a diagnostic utility program) to determine your video card's chipset. Your distribution version of XFree86 will probably have other specific server versions, so check the documentation for compatibility details.

The generic server drivers work with most cards that provide VGA and SVGA support. However, because the generic driver provides only the basic VGA and SVGA video instructions, any fancy features or extra power your video card may have will not be used. Card-specific servers, on the other hand, enable you to use the full capabilities of fancy video cards.



<NOTE>Installing an X server with the wrong specific video card driver can cause damage to your system. If you are not sure of the video card chipset, use a generic driver. Most video cards can handle VGA and SVGA generic drivers without a problem. If you're not sure, use generic.<NOTE>

Most distributions of XFree86 have a default of a standard VGA system prewritten into the configuration files. You can use this default setting without worrying about other configuration items in some cases, but it is better to check the configuration files manually before running XFree86 for the first time.

To change the server name that XFree86 uses, modify the symbolic link to the file called X under the XFree86 bin directory (such as /usr/X386/bin/X or /usr/X11R6/bin/X). You can change the server at any time by creating a new link to the required server file. For example, if you want to use the SVGA server when your system is currently configured for the VGA server, issue the following commands:


rm /usr/X11R6/bin/X

ln -s /usr/X11R6/bin/XF86_SVA /usr/X11R6/bin/X

The first line removes the current link and the second adds the link between XF86_SVGA and X. The directory names for the XFree86 base directory may change, depending on the version of XFree86 you are running (although if they are linked together, it won't matter which you change).

Installing XFree86 Manually


As mentioned earlier in this section, you can install XFree86 without using the installation scripts. You may want to install XFree86 this way if you have to perform installation across directories or place the files in directories other than their default values. Some users like to manually install XFree86 so that they know what is happening at each step. Manually installing XFree86 is a great way to learn the intricacies of the X operating system (although it can be a long operation).

To manually install the XFree86 distribution software, you must extract the files into the proper directories using the gzip command. The general process is quite simple:

  1. Log in as root. You must install XFree86 as the superuser.

  2. Create the directory /usr/X386. This directory may already exist on your system as some Linux installation scripts create it.

  3. Change to the /usr/X386 directory.

  4. For each file in the distribution set, use the gzip utility to extract and install the contents. The general format of the command is
    qzip -dc tarfile | tar xvof -
  5. Repeat the process for each file in the XFree86 product set. You must change to each distribution directory manually (on a CD-ROM or different floppy disk, for example) and use gzip on each archive file in that directory.

The tar utility flags shown in the preceding command line ensure that the original ownership of the files is preserved and that the output is displayed on-screen for you. Once all the XFree86 files have been installed into the correct directories, you can continue with the configuration process.

Installing XFree86 Using a Script


Most users want to automate the installation process. This installation method is faster, requires less interaction from the user, and is much less prone to errors. For this reason, most XFree86 distribution releases either include an installation script or use the Linux setup program.

When installing using the setup script (or similar utility) supplied with Linux distributions, you are usually prompted as to whether you want to install XFree86 during the initial Linux installation. If you answered affirmatively to this question, the binaries for XFree86 are already installed. If you didn't get prompted for XFree86 installation, it may have been installed automatically. Check the directories /usr/X386/bin or /usr/X11R6/bin for files. If a large number of files exist in either directory, XFree86 was installed for you.

Just because XFree86 was installed from the distribution media automatically doesn't usually mean you can use it immediately. You should still go through the configuration process using the ConfigFX86 or fx86config utilities, or manually editing the Xconfig or XF86Config file (depending on the version of XFree86). Most automated installations will include default VGA or SVGA preconfigured files, but it's still a good idea to check the contents of the Xconfig or XF86Config file before you try to run XFree86.

Using the PATH Environment Variable


Put the XFree86 binary directory in your path by using the environment variable PATH or path (depending on the shell). The location of the variable's definition depends on the type of shell you are using and the login you use to run XFree86. In general, you should add either /usr/X386/bin (XFree86 version 2.x) or /usr/X11R6/bin (XFree86 version 3.x) to the path definition statement.

For example, if you use bash (Bourne Again Shell) for most purposes, a .profile file is read when you log in to set environment variables. If you log in as a user other than root, the .profile file is kept in your home directory. If you use the root login, the .profile may be kept in the root directory or you may be using the default system .profile kept in the file /etc/profile (note the lack of a period when the file is in /etc. This convention is used to show that it is a globally available .profile).

If the XFree86 bin directory isn't already in the path, add it to the path or PATH variable definition. A .profile file for bash may have the following line after adding the XFree86 directory:


PATH="/sbin:/usr/bin:/bin:/usr/X11/bin:/usr/openwin/bin"

For C shell users (including tcsh) other than root, the syntax is a little different. The startup file .login or csh.login contains a line defining the path. Adding the XFree86 directory is a matter of tacking it to the definition:


set path = ( /sbin /usr/bin /bin /usr/X11/bin /usr/openwin/bin . )

Of course, your exact path definition lines will probably differ. As long as you add the XFree86 bin directory to the path and then log out and back in, the shell should find the proper binary files.

Configuring XFree86


Before you can run XFree86, you should specify some configuration information. This part tends to frustrate newcomers to XFree86 because getting your configuration files exactly right so that XFree86 runs properly can be a convoluted process. The step-by-step instructions in this section should streamline the process.

A utility called either ConfigFX86 or fx86config that is provided with many distributions of Linux and XFree86 simplifies the entire XFree86 installation process, but only if you have one of the supported graphics cards. A list of cards supported by ConfigFX86 and fx86config is usually included in the Hardware HOWTO file provided with the Linux distribution software. If you can't find the HOWTO file, you can obtain it from most FTP and BBS locations (see Chapter 2, "Linux Hardware and Software"). Make sure the version of the file corresponds to the Linux version you are running. The section "Using ConfigFX86 and fx86config" provides more details about ConfigFX86 and fx86config. (You can, in some cases, provide enough information for ConfigFX86 and fx86config to use your unlisted video card for the installation. This procedure is discussed in the "Using ConfigFX86 and fx86config" section.) If you don't have the Hardware HOWTO file or your video card is not listed and you don't want to use a generic driver, you must manually configure XFree86. Even if you use the ConfigXF86 or fx86config script to install XFree86, you may still have to make manual modifications to your installation.

Most of the configuration details for XFree86 version 2.x are contained in a file called Xconfig; XFree86 version 3.x uses a file called XF86Config or Xconfig, depending on the version. The bare-bones instructions for setting up an Xconfig or XF86Config file are spread out over several text files included with the XFree86 distribution set. Check the README, VideoModes.doc, README.Config, and README.Linux files. Also, read the man pages for Xconfig, XF86Config, XFree86, and Xfree86kbd. Finally, check the man pages for the server version you are running, if some are provided. It's a good idea to print out the man pages for easier reference.

You need a few items of information to properly complete the Xconfig or FX86Config file. Before you start configuring XFree86, take a moment to note the following details:

  • XFree86 server to be used

  • Type of mouse on your system and the port to which it is connected

  • Your video card's brand name and chipset. If you're not sure of the chipset, either consult your documentation or use a utility program like SuperProbe (Linux) or MSD (DOS).

  • Your video monitor brand name and model number, as well as the size of the monitor. It also helps to know the maximum horizontal and vertical scan frequencies; this information is usually available from the monitor's documentation.

  • Type of keyboard you will be using if not the U.S. generic type. Most users have the U.S. type, although some countries have customized keyboards that require different key mappings.

If you don't know some of the information and don't have an easy way (such as a utility program) to find out, check the documentation that comes with XFree86. Many distributions contain a directory such as /usr/X11/lib/X11/doc (usually linked to /usr/X386/lib/X11/doc or /usr/X11R6/lib/X11/doc) that contains a number of files describing many cards and monitors supported by XFree86 and the essential configuration information (such as monitor scan rates, which are always difficult to determine because you invariably don't remember where you placed the manual). Figure 5.1 shows an extract from the /usr/X11R6/lib/X11/doc/Monitors file. This entry shows the parameters that a Gateway 2000 system with a CrystalScan monitor requires. The Monitors file has entries for most popular monitor models. Another file included with most CD-ROM distributions is AccelCards, which lists popular video cards and their parameters. Figure 5.2 shows an extract from this file, which shows the S3 card series. Use these files, and any others in the doc directory, to identify the hardware you will be using.

Figure 5.1
The Monitors file in the X11/doc directory offers configuration information for many popular monitor models.

Figure 5.2.
The AccelCards file lists many popular video cards and the configuration information they require.

When you've noted all this configuration information, you are ready to start. Configuring XFree86 begins with the Xconfig or XF86Config file.

Deciding Where to Put Xconfig or XF86Config


You can put the Xconfig or XF86Config file in several places on the Linux filesystem. Usually, it resides in the /usr/X386/lib/X11 directory, which is also where a sample Xconfig or XF86Config file is often found. If you have easy access to the /usr/X386/lib/X11 directory, it's the best place for the Xconfig or XF86Config file. (Formally, the file is referenced in /usr/X11R6/lib/X11 or /etc, but because /usr/X386 is linked to /usr/X11R6, the two directories point to the same place. The documentation may reference the X11R6 directory, but you can use either /usr/X386 or /usr/X11R6 as long as the link to the X386 directory is in place.)



<NOTE>Unless you are manually installing configuration information, don't worry about whether you should use Xconfig or XF86Config. Automated installation scripts will use the proper file. If you are performing a manual configuration, use Xconfig for XFree86 version 2.X and XF86Config for XFree86 version 3.x.<NOTE>

If you can't use the /usr/X386/lib/X11 directory (maybe it's read-only or on a remote server) or don't want to because you need a customized version of the Xconfig file, you can also place the file in the /etc directory or in your home directory. If the Xconfig file is in your home directory, it applies to your sessions only; any configuration information will not be valid for other users. The /etc directory location for the XFree86 Xconfig file means the configuration information is applicable to all users.

You can also put the Xconfig file in the directory /usr/X386/lib/X11 specific to a particular host machine. To do this, append the name of the host machine to Xconfig filename. For example, the file Xconfig.merlin applies the configuration information only to users logging in from the machine called merlin.

The Linux convention for the Xconfig file is to place it in the /etc directory. Because this location is not the usual one for XFree86 installations, you must create a link to the /etc/Xconfig file to /usr/X386/lib/X11 or your home directory. This link enables XFree86 to find the Xconfig file. To create the link just mentioned, issue the following command:


ln -s /usr/X386/lib/X11 /etc/Xconfig

The -s option creates a symbolic link (compared to a hard link), which is explained in Chapter 18, "Filesystems and Disks."

Using SuperProbe


SuperProbe is a utility that attempts to determine the type of video card (and the amount of video RAM installed on that card) in a PC system. It works on ISA, EISA, and VLB (local bus) architectures, but not on MCA or PCI architectures (although SuperProbe versions for these systems may be available by the time you read this book). If you already know which video card you have, SuperProbe is of little use to you.

SuperProbe attempts to identify video cards by probing for certain known unique registers on each video card it knows about. This process has one drawback≈some instructions executed by SuperProbe can cause your machine to lock up. Although it is unlikely damage will occur because of SuperProbe, the filesystem will have to be cleaned if the machine must be reset. For this reason, make sure you are the only user on the machine. Making a backup of your system is also advisable.



<NOTE>Running SuperProbe by itself is almost guaranteed to lock up any machine. Use it with care and follow the instructions in this section for giving SuperProbe a basic idea of the testing it should do.<NOTE>

SuperProbe is usually included as part of the XFree86 distribution set on CD-ROMs; you also can get it from FTP and BBS sites that offer Linux software. SuperProbe is not exclusive to Linux; it can run under several other PC UNIX systems as well. A man page is available for SuperProbe.

SuperProbe uses a number of command-line options to specify its behavior. Although the exact options change with each new release of the software, the basic options of interest to you are limited to a few:

-bios Specifies the video card BIOS' address, normally set to C0000. If you had to set your BIOS address to some other value, it should be specified with this option.
-info Displays a list of all video cards SuperProbe knows about and the card's names as recognized by SuperProbe.
-no_16 Disables 16-bit testing. This option is used only for old, 8-bit video cards.
-no_bios Disables testing of the video card BIOS and assumes the card is an EGA, VGA, SVGA, or later type. If your video card is new, this option is useful for preventing many BIOS-caused system freezes.
-no_dac Disables testing for a RAMDAC type. You can use this option with VGA and SVGA cards to prevent potential freezes.
-no_mem Skips the testing for the amount of video RAM installed on the video card.
-order Specifies the order in which chipsets should be tested. This option is useful if you think you know the types of chipsets, but want confirmation. Alternatively, if you suspect the video card has one of a few chipsets, you can list just those.
-verbose Displays information on-screen as to SuperProbe's actions and results. You should use this option in all cases to show progress and potential problems.

One of the first steps to take is to display a list of all the video cards SuperProbe knows about. Issue the command


SuperProbe -info

and you will see a list that shows the cards, chipsets, and RAMDACs that SuperProbe can recognize. Note that the utility name SuperProbe is mixed case, with uppercase S and P. This format is unusual for a Linux system and may take experienced UNIX and Linux users a moment to get used to.

If you have an older 8-bit card, you can determine the chipset with the command


SuperProbe -no16 -verbose

If you have a 16-bit (or higher) card that you suspect to be an S3, Cirrus Logic, or Tseng chipset, for example, you can use the -order option to simplify testing (and prevent potential problems), as in


SuperProbe -order S3,Cirrus,Tseng -verbose

There are no spaces between chipsets specified after the -order option. The -verbose option lets you see what is going on. Narrowing the search for a chipset in this way prevents lockups. Even if you know exactly what video card is in your system, don't assume SuperProbe will function properly. SuperProbe has an annoying habit of hanging up a system because of conflicts with other cards or devices. Use it with care.

Using ConfigXF86 and XF86Config


ConfigXF86 and XF86Config use simple interfaces from which you select supported video cards and video monitors. (ConfigXF86 was written by Stephen Zwaska, by the way.) If the ConfigXF86 or XF86Config utility supports your video card (check the Hardware HOWTO and XFree86 README files), you can use the ConfigXF86 and XF86Config installation routine to simplify the configuration process enormously. If ConfigXF86 or XF86Config is provided with your XFree86 distribution, it is in the directory /usr/X386/bin.

Documentation for ConfigXF86 and XF86Config is usually placed in /usr/X386/bin with the executable file. Some versions of Linux and XFree86 don't supply the documents, though. The documentation is often supplied in multiple formats. An ASCII version is called ConfigXF86.txt, and a PostScript version (or the XF86Config version) is called ConfigXF86.ps

When you run either ConfigXF86 or XF86Config, some general information appears on-screen. Figure 5.3 shows the introductory screen of XF86Config, which is used as an example for the screen shots throughout this section. After this screen, you may receive a status message telling you about existing files and distributions of X. In most CD-ROM based installations, you are told that you already have an earlier version of X, as shown in Figure 5.4. This version was installed by setup, in most cases.You can ignore these messages and continue on with the configuration, although you should read the messages about paths.

Figure 5.3.
The introductory screen of XF86Config explains what the program is going to do and what information you need to provide.

Figure 5.4.
Most versions of XF86Config warn you that you have an earlier version of X already on your drive.

You are then prompted for the information you gathered earlier about your system. In most cases, you are shown a list of supported values and asked to choose one. Following through these choices in order provides the utility with the proper information to build your Xconfig file. The XF86Config utility, for example, asks you for your mouse type, as shown in Figure 5.5. Choose the mouse model you are using from this list. Don't assume that because you configured a mouse when you installed Linux that X will pick up the correct type.

Figure 5.5.
Because X is mouse-dependent, XF86Config asks you for the type of mouse you will be using.

Depending on the type of mouse you choose, you may be asked about special mouse button functionality. Figure 5.6, for example, shows the prompt after selecting a Logitech MouseMan mouse, which has three buttons (as do most UNIX workstation mouse models). This screen enables you to use the three buttons for their proper functions. After this screen, you are asked for the port of the mouse, as shown in Figure 5.7. If you installed a mouse when you installed Linux (such as with setup), you may have already supplied the port the mouse will use. This port was linked to the special device driver /dev/mouse. If you have installed a mouse already, press Enter. Otherwise, give the mouse port name.

Figure 5.6.
If the type of mouse you selected in the previous screen supports special options, you are asked whether you want them to be enabled.

Figure 5.7.
X must know the port your mouse is attached to. If you have already configured a mouse, press Return.

Some versions of the configuration routine ask whether you want to enable special character bindings on the keyboard, as shown in Figure 5.8. This option is used most often for non-English characters. For most users, the answer is no.

Figure 5.8.
X provides support for non-English characters through extended keyboard bindings.

Now comes the trickier parts. You must supply the information about your monitor and video card that you determined earlier. The screen shown in Figure 5.9 asks about the horizontal sync frequencies your monitor uses. If you are not sure, use a generic (VGA or SVGA) setting. Choosing the wrong setting may cause damage to your monitor!

Figure 5.9.
Select the proper horizontal sync frequency for your monitor from this screen.

Next, you must set the vertical sync rate. Again, err on the side of the more common rates. This screen is shown in Figure 5.10. If you are not sure, choose the lowest number. The horizontal and vertical sync frequencies for most popular monitors are given in the Monitors file in the doc directory, mentioned earlier. You are then asked to enter a name for the monitor, which is used to identify it in the configuration files. Figure 5.11 shows this screen. You can enter the actual model name or any string you want; it doesn't have to match your actual monitor name because the string is not used for anything except identification.

Figure 5.10.
You need to set the vertical sync frequencies, too.

Figure 5.11.
After setting the frequencies your monitor uses, you get to name it.

After configuring the monitor, you must configure your video card. The configuration program may ask you whether you want to look at the video card database (see Figure 5.12). If you do not have the parameters your card supports already at hand, take advantage of this option. You can page through a list of video cards, as shown in Figure 5.13, until you find a card that matches your card. Choose the number in the left-hand column to display the card's information, as shown in Figure 5.14. Sometimes the information is very brief. You may want to copy down some of this information for later reference.

Figure 5.12.
The configuration program may give you the option of looking up your video card in the video database.

Figure 5.13.
The video card database has several pages of cards listed.

Figure 5.14.
The video card database shows the X configuration information about your card when you select the proper number from the list.

After choosing the video card, you select a server as shown in Figure 5.15. The servers available under X were discussed earlier in this chapter. Enter the number that corresponds to the server you want to use. If you don't want to experiment with video card-specific servers, choose the VGA or SVGA server (the VGA entry is a safe bet for a first-time installation). You can change the server later, so don't worry about getting the best performance you can out of your video card at this time≈it's more important to get X running properly!

Figure 5.15.
Use this screen to specify the type of X server you want to run.

Depending on your installation configuration, you may be asked whether you want the configuration routine to set up some links for you, as shown in Figure 5.16. It doesn't hurt to have these links set unless they will cause a conflict with directory naming.

Figure 5.16.
On some systems, the configuration routine offers to set links to different X directories for you.

The next step is to tell X how much memory your video card has, as shown in Figure 5.17. The more RAM your video card has, the faster X can run. If you are not sure how much RAM your card has, choose a low number. Most video cards sold in the last year or two have at least 1M video RAM, but you should verify your card's RAM complement in your documentation.

Figure 5.17.
Choose the amount of video RAM on your card.

As a final step in the video card configuration, you are asked to name the card. As with the monitor names, these strings are used for identification only and can be set to anything you want.

Some video cards can handle special processing. A screen like the one shown in Figure 5.18 asks you which options you want to enable. Make sure you know what you are doing if you select some of these options; some of them can hang your system if used incorrectly. If you are not sure or you are configuring a generic system, don't enable any options. Just press Enter to ignore them.

Figure 5.18.
Some cards have special features that you can enable through this screen.

The screen shown in Figure 5.19 follows the special processing screen and asks about some clock features. Some video cards do not support this feature and will hang if it is tried. As you see at the bottom of the screen, the configuration utility has identified the video card in this configuration as not supporting this feature, so the SuperProbe system should not be run. If in doubt, don't use it!

Figure 5.19.
Many high-speed video cards can be optimized with the use of a Clocks option, although some cards (including the one in this example) do not support the option.

Finally, the configuration script asks whether you want it to write the information to the X configuration file, as shown in Figure 5.20. If you answer yes, the configuration file is updated automatically. If you answer no, all your entries are lost and you return to the shell.

Figure 5.20.
The final step in the configuration process is writing the configuration file. This prompt verifies that you want to generate the file.

After the XF86Config or Xconfig file has been created using the script, resist the temptation to start up X immediately. Instead, take the time to examine the file manually to prevent any chance of damage to your hardware from an incorrect setting. The following section on manually configuring the Xconfig or XF86Config file explains all the settings. Once you're sure all is fine, launch X with the command startx. If the X server fails to start, run the configuration utility again and check all your answers carefully. In case of problems, always choose generic settings just to get X working.

Examining the Xconfig and XF86Config Files in Detail


If you are manually entering your configuration information into the Xconfig or XF86Config files, you need to know how the files are laid out and how to enter your specific details. All versions of XFree86 have at least one sample configuration file, usually called Xconfig.eg or XF86Config.eg and located in the lib directory. Use this file as a template for creating your own configuration file. Copy the example file to a new file without the .eg extension, and make the changes described in the following paragraphs.

The Xconfig and XF86Config files are not short, but lots of comments are scattered throughout. The format of the configuration files is a set of sections for each aspect of the XFree86 configuration. The general order of sections is as follows:

      Pathnames to binaries and screen fonts

      Keyboard information

      Mouse information

      Server file

      Video information

If you have run the automated configuration file generator utilities like XF86config or XF86Config, check the entries in the generated file. If you are manually editing the file, proceed slowly and methodically to prevent errors.



<NOTE>The code excerpts shown in the rest of this section are from the XF86Config file created by XFree86 version 3.x, as it is the latest version and is usually included with new software distributions. The Xconfig file for XFree86 version 2.x is similar, and you should have no problem following the same procedures by examining the Xconfig file.<NOTE>

You will notice that each section in the Xconfig or XF86Config file starts with the keyword section followed by the name of the section. The section is terminated with the keyword EndSection. This keyword makes it easier to find the sections you want to work with. Comments in the file all start with a pound sign.

Pathnames


In most cases, the pathnames provided in the configuration files don't need changing unless you installed XFree86 in a directory other than the default value. The paths used by XFree86 for screen fonts and other files are given in a section of the configuration file that looks like the following:


Section "Files"

# The location of the RGB database. Note, this is the name of the

# file minus the extension (like ".txt" or ".db"). There is normally

# no need to change the default.

RgbPath "/usr/X11R6/lib/X11/rgb"

# Multiple FontPath entries are allowed (which are concatenated together),

# as well as specifying multiple comma-separated entries in one FontPath

# command (or a combination of both methods)

FontPath "/usr/X11R6/lib/X11/fonts/misc/"

FontPath "/usr/X11R6/lib/X11/fonts/Type1/"

FontPath "/usr/X11R6/lib/X11/fonts/Speedo/"

FontPath "/usr/X11R6/lib/X11/fonts/75dpi/"

FontPath "/usr/X11R6/lib/X11/fonts/100dpi/"

EndSection

The preceding code defines the search paths for the screen fonts and RGB database. If you installed XFree86 into the default directories or let the installation routines proceed with default values, you should not have to change anything here.

Note that the directories referenced in this XF86Config file follow the formal naming conventions for X, using /usr/X11R6. Because this directory is linked to /usr/X11, /usr/X386, and potentially other directories in most installations, the link can be followed to the target file. Verify that the directories point to the screen fonts by changing into each directory in turn and examining the files it contains. If the directory doesn't exist or is empty, XFree86 won't be able to load the fonts properly and will crash or generate error messages. If you add new fonts to your XFree86 installation, they should go in one of the font directories specified in the XF86Config file.

Keyboard Settings


In most installations, the keyboard setting defaults to a U.S. 101-key keyboard with standard key mappings. This setting is valid for most computer systems. Tweaking this file will help simplify your life, though, so don't completely ignore the keyboard section. The following code shows the keyboard section from the XF86Config file:


Section "Keyboard"

 Protocol "Standard"

# when using XQUEUE, comment out the above line, and uncomment the

# following line

# Protocol "Xqueue"

 AutoRepeat 500 5

# Let the server do the NumLock processing. This should only be required

# when using pre-R6 clients

# ServerNumLock

# Specifiy which keyboard LEDs can be user-controlled (eg, with xset(1))

# Xleds 1 2 3

# To set the LeftAlt to Meta, RightAlt key to ModeShift,

# RightCtl key to Compose, and ScrollLock key to ModeLock:

# LeftAlt Meta

# RightAlt ModeShift

# RightCtl Compose

# ScrollLock ModeLock

EndSection

Leave the Protocol set as standard. The Xqueue line is commented out, and should remain that way unless you implement an Xqueue for XFree86. The AutoRepeat setting tells XFree86 how long to wait for a key to be pressed before generating multiple keystrokes (for example, if you hold the x key down for more than a certain number of milliseconds, multiple x's start to appear).

ServerNumLock controls whether the NumLock key is on or off when XFree86 starts up. The ServerNumLock option is commented out by default in most sample configuration files. If you are running XFree86 version 2.x (or earlier), it is a good idea to uncomment the line. This helps tailor your keyboard for better operation under XFree86. With XFree86 version 3.x, you can leave it commented out as the server will handle the NumLock behavior.

In theory, you can use the Xleds setting to permit programming of the LED buttons on most keyboards (for Num Lock, Caps Lock, and Scroll Lock). Leave it commented as the LEDs are not used for much user feedback.

The rest of the section control show the Alt, Ctrl, and Shift key behave. Some UNIX applications expect special keystrokes called meta keys, composed of a special key held down and another key pressed (like Ctrl-C in DOS or UNIX). These entries let you control which keys are interpreted as Alt, Meta, Control, and ModeLock. Most installations will have no problem with all these lines commented out as the number of Linux applications that need special keystrokes is very small (and those are in limited distribution).

You can use XFree86 to translate keystrokes to international characters automatically. In most cases, the keyboard layout is read by XFree86 from the kernel, although you can override this setting. The X11 standards only allow four key tables to be modifies, much less than Linux.

Mouse Definition


XFree86 uses the mouse heavily, so you must specify the type of mouse on the system and how it is connected. XFree86 supports most popular mouse types, and any types not directly supported can usually be used in emulation of one of the more popular types like Microsoft or Logitech. The mouse section of the XF86Config file is labeled as Pointer (from pointing device) and looks like the following:


Section "Pointer"

 Protocol "Microsoft"

 Device "/dev/mouse"

# When using XQUEUE, comment out the above two lines, and uncomment

# the following line.

# Protocol "Xqueue"

# Baudrate and SampleRate are only for some Logitech mice

# BaudRate 9600

# SampleRate 150

# Emulate3Buttons is an option for 2-button Microsoft mice

# Emulate3Buttons

# ChordMiddle is an option for some 3-button Logitech mice

# ChordMiddle

EndSection

The Protocol section is the name of the mouse or the emulation to use. The names of supported mouse types are listed in the Xconfig or XF86Config man page, so if you use a mouse from a vendor other than Microsoft or Logitech, check the man page or other supplied documentation to find the name of the protocol to specify. Another method of identifying the type of mouse is to watch the startup messages when Linux boots≈it will often identify the type of mouse. Microsoft mice inevitably use the Microsoft protocol. Many Logitech mice are Microsoft compatible, but newer versions use the MouseMan protocol. Because Dexxa and many other mice vendors emulate the Microsoft mouse, you can use the Microsoft protocol with them as well.

The Device entry specifies the port the mouse is attached to, using Linux device terminology. In most cases, the entry /dev/mouse is sufficient, as the Linux installation procedure will have configured the mouse already. If you are using a mouse configured on the PS/2 port of IBM PS/2 models, use the PS/2 device driver and not a serial port device driver. Valid device drivers are listed in the man page or the documentation files accompanying XFree86, but most versions support the following devices:

/dev/mouse Linux default mouse driver
/dev/inportbm Microsoft bus mouse only
/dev/logibm Logitech bus mouse only
/dev/psaux PS/2 port mouse

A bus mouse requires a specific IRQ to be set in both XFree86 and the kernel. Make sure the IRQ is the same in both places.

As with the keyboard, there is an option for Xqueue users. Because most XFree86 installations don't use Xqueue, leave this line commented out. The baud rate and sampling rate lines, as the comment indicates, are for some older Logitech mice. Most mice will not need these lines, so keep them commented out. If your mouse does not work without these settings, try 9600 baud, followed by 1200 baud if that doesn't work. Some earlier versions of XFree86 liked to have a baud rate specified, but try it without an entry first.

The Emulate3Buttons option is useful if you have a two-button mouse. When active, Emulate3Buttons allows you to simulate the press of a middle button by pressing both the left and right mouse buttons simultaneously. Many Linux (and UNIX) applications make use of three buttons on the mouse, so this option is useful for Microsoft and compatible mice owners.

Finally, the ChordMiddle option is used with some Logitech mouse models. If you use the Logitech driver, try the mouse under XFree86 without this option turned on. If the mouse doesn't behave properly, try uncommenting this line. Most Logitech mice don't need ChordMiddle turned on. although some models won't recognize the middle button properly without it.

Monitor Model


Setting the monitor properly is an important step in configuring XFree86, and one that is easy to mess up. If some of the settings are incorrect, damage can occur to the monitor, so take care! Patience and common sense will help, although the monitor's operations manual is a much better source of information. If you are unsure about any settings, select the most basic level until you can get more information. For example, if you're not sure whether your monitor supports high resolutions, stick with VGA or SVGA until you can get confirmation.

The monitor section in the XF86Config file is broken into smaller subsections for convenience. The first section asks for information about the monitor type and model number, as shown in the following code:


Section "Monitor"

 Identifier "Generic Monitor"

 VendorName "Unknown"

 ModelName "Unknown"

The entries in this section are text strings only and have no real configuration value for XFree86. The only time they are used is when the text strings are echoed back to you when XFree86 starts up, or a utility displays configuration information. You can enter the proper values for these items to make XFree86 a little more friendly to work with.

The next subsection deals with the horizontal bandwidth of the monitor. This section is important, and you should try to find the actual values for your monitor. Some settings for specific brands are listed in the documentation accompanying XFree86, especially in the documents Monitors and VideoModes.doc. Check your distribution directories for any specification document files. If you can't find specific values for these settings, use the lowest setting as a default, unless you know your monitor is capable of higher values. The bandwidth section looks like the following:


# Bandwidth is in MHz unless units are specified

 Bandwidth 25.2

# HorizSync is in kHz unless units are specified.

# HorizSync may be a comma separated list of discrete values, or a

# comma separated list of ranges of values.

# NOTE: THE VALUES HERE ARE EXAMPLES ONLY. REFER TO YOUR MONITOR'S

# USER MANUAL FOR THE CORRECT NUMBERS.

 HorizSync 31.5 # typical for a single frequency fixed-sync monitor

# HorizSync 30-64 # multisync

# HorizSync 31.5, 35.2 # multiple fixed sync frequencies

# HorizSync 15-25, 30-50 # multiple ranges of sync frequencies

The bandwidth settings have good comments next to them. If you were installing a multisync monitor, for example, you could comment out the 31.5KHz line and uncomment the 30-64KHz line.

The vertical refresh rate is set in another subsection and is as critical to your monitor's good health as the bandwidth section. Again, check the documentation for more information. The vertical refresh subsection code looks like the following:


# VertRefresh is in Hz unless units are specified.

# VertRefresh may be a comma separated list of discrete values, or a

# comma separated list of ranges of values.

# NOTE: THE VALUES HERE ARE EXAMPLES ONLY. REFER TO YOUR MONITOR'S

# USER MANUAL FOR THE CORRECT NUMBERS.

 VertRefresh 60 # typical for a single frequency fixed-sync monitor

# VertRefresh 50-100 # multisync

# VertRefresh 60, 65 # multiple fixed sync frequencies

# VertRefresh 40-50, 80-100 # multiple ranges of sync frequencies

The comments in the file help out again, showing you the most common settings. You can use these settings as a guide, but check your documentation for specifics.

Setting the video modes correctly is very important, as too high a video resolution may cause snow, a blank screen, or a system crash. The SuperProbe utility discussed earlier can help determine supported video modes, although most monitors have a good list of supported modes in their documentation. The XFree86 Monitors file also lists many popular monitors and their modes. The subsection for setting the video modes is as follows:


# Modes can be specified in two formats. A compact one-line format, or

# a multi-line format.

# A generic VGA 640x480 mode (hsync = 31.5kHz, refresh = 60Hz)

# These two are equivalent

# ModeLine "640x480" 25.175 640 664 760 800 480 491 493 525

 Mode "640x480"

 DotClock 25.175

 Htimings 640 664 760 800

 Vtimings 480 491 493 525

 EndMode

# These two are equivalent

# ModeLine "1024x768i" 45 1024 1048 1208 1264 768 776 784 817 Interlace

 Mode "1024x768i"

 DotClock 45

 Htimings 1024 1048 1208 1264

 Vtimings 768 776 784 817

 Flags "Interlace"

 EndMode

The preceding examples show a standard VGA (640x480) resolution and a high 1024x768 resolution. You can modify these entries to match your specific resolution requirements. As you can see from the preceding code, you need to know the dot clock and horizontal and vertical timings for your monitor and video card. Note that you can specify all the details for the modes on a single line, but the more verbose listing is easier to read and work with.

Video Cards


The next subsection of the XF86Config file deals with the video card your system uses. You can have several cards defined with different resolutions, or you can enter just the one that you will use the most. For example, the following subsection has a VGA and SVGA generic driver defined:


Section "Device"

 Identifier "Generic VGA"

 VendorName "Unknown"

 BoardName "Unknown"

 Chipset "generic"

 VideoRam 256

 Clocks 25.2 28.3

EndSection

Section "Device"

 # SVGA server auto-detected chipset

 Identifier "Generic SVGA"

 VendorName "Unknown"

 BoardName "Unknown"

EndSection

The Identifier, VendorName, BoardName, and optional Chipset entries are strings and are used only for identification purposes. The VideoRam (the amount of RAM on the video board) and Clocks entries are used to specify any particular behavior for your card. Carefully check these entries to verify the information, as illegal entries can cause damage to some video boards.

If you have a particular video board that has special features, you can create a Device entry for that board. For example, the following entry is used for a Trident TVGA board:


Section "Device"

 Identifier "Any Trident TVGA 9000"

 VendorName "Trident"

 BoardName "TVGA 9000"

 Chipset "tvga9000"

 VideoRam 512

 Clocks 25 28 45 36 57 65 50 40 25 28 0 45 72 77 80 75

EndSection

The information in the VideoRam and Clocks lines was taken from the documentation file that accompanies XFree86, although it could have been entered manually from the video card's documentation.

Some video boards require more detail, provided by additional entries in the Devices subsection. For example, the following is the code for an Actix GE32+ video card with 2M of RAM on board:


Section "Device"

 Identifier "Actix GE32+ 2MB"

 VendorName "Actix"

 BoardName "GE32+"

 Ramdac "ATT20C490"

 Dacspeed 110

 Option "dac_8_bit"

 Clocks 25.0 28.0 40.0 0.0 50.0 77.0 36.0 45.0

 Clocks 130.0 120.0 80.0 31.0 110.0 65.0 75.0 94.0

 EndSection

The Ramdac and Dacspeed options, as well as an Options line, have been added to the entry. The entries that are allowed in this subsection change with each release of XFree86, so check the man pages or documentation files for more details if you want to get the most out of your video card.

The XFree86 Server


Earlier, this chapter showed how to choose an XFree86 server for your X server. The server section of the Xconfig or XF86Config file is where the server specification is located. The server subsection from an XF86Config file looks like the following:


Section "Screen"

 Driver "svga"

 Device "Generic SVGA"

 Monitor "Generic Monitor"

 Subsection "Display"

 Depth 8

 Modes "640x480"

 ViewPort 0 0

 Virtual 800 600

 EndSubsection

EndSection

The preceding section shows a generic SVGA driver. The card supports the VGA 640x480 and SVGA 800x600 resolutions. If you have a more powerful video card and monitor combination, you can use a specific server file, if it exists, such as the driver for the Actix GE32+ card with 2M RAM. The following code is set to use the special accelerated server file for the Actix card, supporting up to 1280x1024 resolutions:


Section "Screen"

 Driver "accel"

 Device "Actix GE32+ 2MB"

 Monitor "Generic Monitor"

 Subsection "Display"

 Depth 8

 Modes "640x480"

 ViewPort 0 0

 Virtual 1280 1024

 EndSubsection

 SubSection "Display"

 Depth 16

 Weight 565

 Modes "640x480"

 ViewPort 0 0

 Virtual 1024 768

 EndSubsection

 EndSection

The options in this subsection will not apply to all cards, but you can set their values if you know them. The most important (and most often used) options are:

  • The Depth option sets the number of color planes (the number of bits per pixel). Usually the depth is 8, although VGA16 servers have a depth of 4 and monochrome displays have a depth of 1. Accelerated video cards can have depths of 16, 24, 32, or even 64 bits per pixel, usually indicated as part of the model name (for example, the Diamond Stealth 24 card has a pixel depth of 24). You should, however, check before you assume the card's model name really is the depth.

  • The Modes option displays a list of the video mode names defined in the ModeLine option in the Monitor section. This option shows all the modes the card supports and you want to use. The first mode on the list is the default value when XFree86 starts. You can then switch between the other modes when XFree86 is running.

  • The Virtual option specifies the virtual desktop size. With extra RAM on the video card, you can have a virtual desktop larger than the screen display, and then you can scroll around the virtual desktop with the mouse. You could, for example, have a virtual desktop of 1024x768 but only display 800x600 (SVGA). The support for different virtual desktop sizes depends on the amount of RAM your video card has and the depth you use. For example, 1M of RAM on the video card can support 1024x768 with a depth of 8. Two megabytes of RAM will support the same size with a depth of 16, or it can support a 1280x1024 desktop at a depth of 8. To use a virtual desktop, use the fvwm window manager (usually used by default).

  • The ViewPort option is used with the virtual desktop to define the coordinates of the upper left hand corner of the virtual desktop when XFree86 starts.

Check the list of servers to see whether there is one specifically designed for your video card. If you are not sure what kind of video card you have, use a generic driver.

Testing XFree86 configurations


After you complete the Xconfig or XF86Config file, 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, and then show the basic X Window session. If XFree86 can't load, it usually displays error messages as part of the termination process. Check these messages to see whether there's any hint as to the problem. Usually, XFree86 runs into supported video mode problems. (For those used to using X on other UNIX systems, startx is a front-end utility to xinit, which is usually used to start X.)

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

Using the .xinitrc File


The .xinitrc file 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.

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, and the former is the path for X. (Linux places the file in the /etc/X11 directory structure instead of /usr/lib as some Linux installations prefer to mount the /usr directories as read-only, sometimes because they reside on a CD-ROM.)

If you want to customize the behavior of the XFree86 session, copy the the system's default .xinitrc file to your home directory and edit it with any editor. 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. There are man pages for startx and xinit that explain some of the details of the startup file.

The following code is an example of a .xinitrc 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 by the XFree86 software, but you should check them to make sure they are valid. Remember to follow links 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 don't 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 (to Steel Blue in this case). 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 xterm or other utility to start other tasks within XFree86), add the line:


xterm -e /bin/bash

In this case, the bash shell is invoked within the xterm session. 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 could, for example, use a .xinitrc file like the following:


#!/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 file starts two xterm sessions and the clock and places them on the desktop, sets the background color to Steel Blue, and finally starts the desktop manager. Note that 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 will start up and then immediately shut down.

Summary


If you followed the steps outlined in this chapter, your X system should now be functional and you can start working with the X system as your primary interface to Linux. 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. Once you've worked in X, it's hard to go back to character-based terminals!

Previous Page Page Top TOC Next Page