[Home] [Resume] [Work Responsibilities] [Search Page] [IT Menu]
![]()
Configuring the X Window System
THIS SECTION COVERS:
•
•
THE X WINDOW SYSTEM, OR JUST X, provides graphics on UNIX. (It’s never called X Windows; to call it X Windows is a sign of ignorance.) Although X is by far the de facto graphics system on UNIX, it also runs on other operating systems such as Windows NT, Windows, and DOS. Because it is not as popular on these other systems, X tends to be confusing for anyone with experience in the personal computer world.
This section tackles the toughest part of X: installing and configuring it for your hardware. We’ve all been lulled by ubiquitous PC hardware and assume that because Microsoft Windows runs with just about every graphics card, so should Linux. Linux does to an extent, but you pay a price in added complexity.
X is very hardware-dependent. In the UNIX workstation world, you don’t see many problems with this, because UNIX vendors maintain tight control over the hardware and do the hard work of supporting X for that hardware.
The PC realm, though, is different. You have zillions of vendors and a huge number of combinations of graphics cards, monitors, buses, and mice. So, as we’ll repeat again and again, you need to know the intimate details of your hardware in order to get the X Window System up and running. If you’re used to the UNIX workstation world, this will come as a rude surprise.
X on Linux is actually in the form of XFree86, a public project devoted to bringing X Window to PC-based Unixes. While there are some changes between a straight X Window System installation on a workstation and XFree86, you probably won’t notice these differences.
Remember that X is both the X server (also named X) and a number of X application programs (also called clients). To get X going, you must first start the X server and then start a number of X applications. Almost always, one of these X applications is a window manager.
To start X, you must first login to your Linux system, such as in the following:
Welcome to Linux darkstar login: Password:
Once you login and get the Linux shell prompt, you can start X with the startx script:
darkstar~$: startx
This assumes that XFree86 has been configured correctly for your Linux installation, a process we discuss shortly.
The startx script runs a program called xinit, which starts the X server, /var/X11R6/bin/X (you may be more familiar with /usr/bin/X11/X on most other UNIX systems), and looks for a file named .xinitrc (note the leading dot) in your home directory. The .xinitrc file is a shell script that launches all the X applications you want started at the beginning of your X session.
Before launching any of these programs, however, the X server must be started, a task also handled by xinit.
The X server looks for the XFree86 configuration file — the most critical file for X on your system. This file, usually named XF86Config and stored in /usr/X11R6/lib/X11 (symbolically linked to /var/X11R6/lib), is a specially formatted file that tells XFree about your system’s hardware.
The hardest part about installing XFree86 on your system is fleshing out this file. There are tools that help, but the process is still dangerous and fraught with error.
X Window Contents
To install and properly set up XFree86, a scary task under the best of conditions, follow these steps:
1. Determine your system configuration.
2. Set up the proper X server for your graphics card.
3. Fill out the XF86Config file.
4. Test that you can run X.
5. Tune your XF86Config file.
We discuss these steps in the rest of this section.
Virtually all of XFree86 installs in the /usr/X11R6 directory. Many other directories, such as /usr/bin/X11 and /usr/lib/X11, will be symbolic links to locations in /usr/X11R6.
Because there’s so much variety in PC graphics hardware and because doing something wrong can actually destroy your hardware (in theory, anyway; we find incredulous tales of exploding monitors and such), XFree86 ships in a mode that prevents you from running X. This fact strikes us as bizarre, but setting up X is probably the hardest thing you have to do to get Linux up and running.
Before you start setting up XFree86, track down every piece of documentation that came with your monitor and graphics card. You’ll need to know some obscure values about your monitor, such as the horizontal and vertical frequency ranges.
If you can’t find any of this information, you may want to pop open the machine and check the text written on your graphics card — often a lot of useful information is found there. Even if this fails and you can’t find out anything about your graphics card, you still have a chance to run X. If your graphics card can support standard Super VGA, you should be able to use the example XF86Config file that comes with XFree86.
Once you’ve determined your system configuration, the next step is to set up the proper X server for your graphics card. XFree86 ships with a number of X servers, each of which is compiled with drivers for a certain type of graphics card or chipset. Each of these X server executables usually starts with XF86_ and ends with the type of cards supported. For example, the XF86_SVGA X server is built with support for standard Super VGA chipsets. XF86_S3 is the X server for S3-based graphics cards.
You’ll need to know which chipset your graphics card has and then figure out which X server to use.
We list the XFree86 X servers in the Table below.
Fillename For Chipsets
XF86_8514 8514/A and true clones
XF86_AGX IIT AGX-014, AGX-015, AGX-016
XF86_I128 Number Nine Imagine 128 graphic cards
XF86_Mach8 ATI Mach8
XF86_Mach32 ATI Mach32
XF86_Mach64 ATI Mach64
XF86_Mono Monochrome VGA, also Hercules, Hyundai HGC1280, Sigma LaserView, Visa, and Apollo monochrome cards
XF86_P9000 Weitek P9000
XF86_S3 S3-based cards
XF86_S3V S3 VIRGE-based cards
XF86_SVGA Super VGA
XF86_TGA (Alpha-only) for Digital 21030 TGA chipsets
XF86_VGA16 16-color VGA server
XF86_W32 Tseng ET4000/W32, ET4000/W32i, ET4000/W32p
You have to know which X server to use because the wrong server at best won’t work and at worst may damage your system.
XFree86 is set up to run only one X server, the program named X and stored in /usr/X11R6/bin. Because of this, you need to link the X server you chose earlier to the file named X. The following commands, when run as root user, link the S3 X server we use to the standard file named X:
Now that you have the proper X server set up to run when you start X, the next step is to tell XFree86 about your hardware in even more detail by filling out the infamous XF86Config file.
X Window Contents
The XF86Config file, located in /usr/lib/X11, is read when the X server starts up; it describes your graphics hardware and other configuration options for XFree86.
When you’ve gotten to this step, there are two routes you can take. You can set up a generic XF86Config file for Super VGA graphics, or you can tune the XF86Config file for your particular card. We discuss both routes in this section. We strongly advise you to configure the XF86Config file for your graphics card. Unfortunately, in our experience, this is the most difficult Linux task. Nothing else has been this difficult. So be warned — dangerous waters lie ahead.
The main reason this is a difficult task is that virtually all graphics card vendors write device drivers for Microsoft Windows, but virtually none write drivers for Linux. Because of this, you have to set up your system to run with the graphics card
We keep repeating the mantra that you need to know your system’s hardware inside and out. If you know your hardware, you can get the most out of X. If you don’t, you run the danger of destroying your system.
Yes, we’ll repeat that: Making a mistake in your X configuration can result in damaged hardware.
Unless you’re independently wealthy, this should cause you to pause for a moment. Take advantage of the time and go dig up all the documentation on your mouse, monitor, and graphics card. This can be hard. On a system that’s a few years old, you may not be able to find everything. On a new system, your computer case may be full of no-name, off-brand hardware, and the documentation may tell you nothing of value.
We’ve found that some newer systems just tell you the amount of video RAM and how to run DOS terminate-and-stay-resident (TSR) programs to configure the card, which is not very useful for a non-BIOS operating system such as Linux. Let’s face it — the vast majority of PC users run DOS and Microsoft Windows, not Linux. As a Linux pioneer, your task is harder. Try examining the original boxes the system came in. On at least one of our prepackaged systems, we found more technical information about the graphics card (especially the chipset) on the box than in all the printed manuals that came with the system.
Some of the key bits of information you need to discover about your system are listed in Table below.
Information You Need to Know About Your System
Aspect | What You Need to Know |
Graphics card | Vendor and model Chipset, such as S3 Amount of video RAM, such as 1 or 2MB RAMDAC, if one is used, such as ATT20C490 |
Monitor | Bandwidth in megahertz (MHz), such as 25.2 Horizontal sync range, such as 31.5-64.3 kilohertz (kHz) Vertical refresh range, such as 55-120 Hertz (Hz) |
Mouse |
Serial, PS/2, or parallel? If serial, which serial port it’s connected to Vendor and model, such as Logitech Firstmouse |
Note that some of the more obscure details, such as the RAMDAC, may be described for you in the XFree86 documentation. XFree86 comes with a description of a number of graphics cards and monitors. If you’re lucky, you can pull some of these values directly from the XFree86 documentation into your XF86Config file, the master file that describes your hardware to X.
NOTE: Look in the /var/X11R6/lib/doc directory for lots of information on XFree86 and various cards and monitors to help you get going. If you have no idea what kind of hardware is in your computer, you can get a lot of information by running the SuperProbe command.
The XF86Config file contains a number of sections, each of which describes some part of your system to the X server. These sections are listed below.
Section | Usage |
Files | Tells where font and RGB files are located |
Module | Controls loading of dynamic modules |
ServerFlags | Special X server flags |
Keyboard | Describes the type of keyboard you have |
Pointer | Details information concerning your mouse |
Monitor | Gives in excruciating detail information about your monitor |
Device | Tells about the graphics card |
Screen |
Describes the combined card and monitor |
XFree86 comes with two utilities to help configure X. XF86Setup provides a very simple graphical interface and xf86config provides a text-only interface. Both can help create the XF86Config file. Before trying either of these programs, though, read through the following sections to ensure that you are familiar with all of the data you will need to place into the XF86Config file, regardless of whether or not you use a graphical interface to fill out the file. If you do want to use a friendly front-end to fill out the file, try XF86Setup first.
When the xf86config program starts, it will ask a lot of questions. The xf86config program prompts you for a lot of the values necessary for the XF86Config file, such as type of mouse, your desires for the keyboard, and monitor frequencies. When you’re done, xf86config will write the data to a file named XF86Config in the current directory.
X Window Contents
The XF86Config file controls how the X server runs and specifies a lot of information about your hardware. Linux needs a special file like this to help it deal with the myriad hardware combinations available on PCs.
Each section in the XF86Config file is discussed in the following material. You should read through the entire discussion of the XF86Config file before running either XF86Setup or xf86config.
The Files section is by far the easiest to set up in your XF86Config file. That’s because just about everybody has the same paths. In the Files section, you need to tell X where the RGB (Red-Green-Blue) color database file is kept and where the fonts are located.
After the Files section comes the ServerFlags section. Again, you rarely have to do much with this. We normally comment out everything in this section because most of these flags work backwards — if you uncomment the entry, it turns the feature off.
The standard 101 keyboard should be fine. We need not get too involved here.
Linux supports virtual terminals. A virtual terminal is a pseudo-TTY UNIX terminal connected to your screen. X uses one virtual terminal, but you may have many more.
Each virtual terminal takes over your entire display and presents a traditional UNIX textual terminal, much like what you see when you log in. A special key sequence allows you to change between virtual terminals. When you do this, the screen gets cleared and you see the next virtual terminal.
The UNIX magic key sequence to change to a virtual terminal is Alt-Fn, where Fn is one of your keyboard’s function keys, such as F1. In X, however, the magic key sequence to change to a virtual terminal is Ctrl-Alt-Fn, not Alt-Fn. The discrepancy occurs because most window managers capture all Alt-Fn keys.
The mouse - called pointer in X terminology - is meant to be rather easy to set up, but you must watch out for some tricks. I have been quite detailed in this section as mouse have cause me no end of problems in the past. The main reason for this is that many vendors’ mice (e.g., Logitech) emulate other vendors’ mice, most notably Microsoft mice. Because of this, you may have to lie about your mouse.
For example, one of our test systems uses a serial Logitech Firstmouse. This mouse was designed by Logitech to emulate the Microsoft serial mouse. What’s odd is that the Logitech mouse has three buttons (a very good thing for X, as most X programs expect three-button mice), while the Microsoft serial mouse sports only two buttons.
When we configure the XF86Config file, we claim our Logitech mouse is really a Microsoft mouse (the other common choice for Logitech mice is to claim that they are Mouseman mice).
The two key things you must specify for your Pointer section is what kind of mouse, e.g., Microsoft, and, if it’s a serial mouse, which port.
As you can see, our Pointer section is rather short:
Section "Pointer" Protocol "Microsoft" Device "/dev/ttyS0" EndSection
Be sure to put in the type of mouse you have and the device it is connected to. Don’t copy our configuration.
The protocol must be one of these options:
• Auto | • IntelliMouse | • Mouseman | • OSMouse | • Xqueue |
• BusMouse | • Logitech | • MouseManPlus PS/2 | • PS/2 | |
• GlidePoint | • Microsoft | • MouseSystems | • SysMouse | |
• GlidePoint PS/2 | • MMHitTab | • NetMouse PS/2 | • ThinkingMouse | |
• IM PS/2 | • MMSeries | • NetScroll PS/2 | • ThinkingMouse PS/2 |
Relatively new serial mice may work with the Auto protocol, which tries to determine dynamically what kind of mouse you have.
For Logitech mice, you’ll most likely use BusMouse (if a bus mouse); for serial mice, you’ll probably use the Microsoft or Mouseman protocols, rather than the more obvious Logitech protocol.
If your mouse is connected to a PS/2 port, use the PS/2 protocol. (If you’re using a newer system from a mass merchandiser such as Dell or Compaq, check the mouse port. Many newer systems feature PS/2 mouse ports, but they’re not always called PS/2 ports; Dell, for example, calls it a mouse port.)
As explained previously, don’t use the Xqueue protocol. The OSMouse is only for SCO UNIX, not for Linux.
Our mouse is connected to serial port number one, often called com 1 in the DOS lexicon. In true UNIX tradition, however, Linux starts counting serial ports with 0. To specify that our mouse is connected to com1, we use a device name of /dev/ttyS0, which is the Linux device file for this port.
Your system may also have the /dev/mouse device file set up for the mouse port. No matter what device file you choose, the device must exist beforehand. (On our system, /dev/mouse is a link to /dev/ttyS0.) This would have been setup in the installation section.
Device Usage
/dev/atibm
ATI bus mouse/dev/logibm Logitech bus mouse
/dev/inportbm Microsoft bus mouse
/dev/psaux PS/2 or Quickport mice
The Monitor section describes your monitor to X. You can define a number of monitors in the XF86Config file, as each Monitor section has its own name. The Screen section then connects a monitor to a video card for a complete graphics system. This section will ask about the horizontal and vertical sync rates. Your will need to have this documentation at hand.
The Device section describes your graphics card to X.
Locate your card from the list
Note that the Screen section uses the monitor and device identifiers we entered earlier. This is essential to connect the screen to the proper monitor and card.
The Driver tells what kind of X server you’re using; the choices are Accel, SVGA, VGA 16, VGA2, or Mono. In almost all cases, you’ll use SVGA for Super VGA cards (and the XF86-SVGA X server) or Accel for any accelerated chipset and X server, such as the XF86-53 server.
Each Display subsection covers the modes available at a particular depth. (A depth of 8 specifies 8 planes for color, or 256 maximum colors.) The Modes used refer back to the Modelines for the monitor that we defined earlier. This controls what resolution X should start in. Generally, you want the best resolution first.
X Window Contents
Now you’re ready to start X to determine whether X works properly. Type the following command to start X:
startx
X Window Contents