The X Window System, basic principles and Debian setup The XFree86 Project, an open-source X Window System implementation From
The XFree86 Project, Inc is the organization which produces XFree86, a freely redistributable open-source implementation of the X Window System which runs on Unix(R) and Unix-like operating systems such as Linux, all of the BSD variants, Sun Solaris x86, Mac OS X (via Darwin), as well as other platforms like OS/2 and Cygwin. XFree86, the product, provides a client/server interface between display hardware (the mouse, keyboard, and video displays) and the desktop environment while also providing both the windowing infrastructure and a standardized application interface (API). XFree86 is platform-independent, network-transparent and extensible. With XFree86 a user cannot only choose the desktop environment they prefer, but because we are an open-source project, users can also modify and update their systems as they see best. As XFree86 has always been an unabashed supporter of freedom of the user desktop, so we encourage users to customise and personalise their desktops with the application of their choice, whether it be KDE, GNOME, Enlightenment, Blackbox, AfterStep, fvwm or twm. Our goal at XFree86 is to have X run on every platform available, including those we do not currently support, as the best windowing system available on that platform.
The X Strike Force: XFree86/X Window System support for Debian Visit the X Strike Force homepage. XFree86 Installation Debian potato (2.2) is shipped with XFree86 version 3.6.6, while Debian woody (3.0) has XFree86 version 4. See current status at the X Strike Force homepage. X4 brings a lot of improvements and is now standard in Debian. There's not much difference from administration perspective, but notes will be put where appropriate. You can install basic X support, the icewm window manager and the wdm display manager with: # apt-get install xserver-xfree86 xbase-clients xfonts-base icewm icewm-themes wdm Please Note: If you're using X3, do apt-cache search xserver- and install the appropriate one instead of xserver-xfree86. wdm is a better-looking equivalent to xdm, the X Display Manager (it opens up graphical login prompts). It is nice to have it, especially if you want to install more window managers, and then select which one to use from the wdm's menu. If you are using Gnome or KDE consider using their native gdm or kdm programs. XFree86 Server Configuration When you install the packages, the configuration process will start automatically. If you don't get it right the first time, you can always re-run configuration with: # dpkg-reconfigure xserver-common # dpkg-reconfigure xserver-xfree86 The interface is very clean and should help you create working XFree configs in no time. In case of problems, inspect the config file (/etc/X11/XF86Config-4 or /etc/X11/XF86Config) manually to make sure you have the right Driver option, and that UseFBDev option is set to false (these are the most common errors). Tip If you see no UseFBDev option in the config file, you need to manually add it and set it to false. The proper location to do it is the Section "Device" part of the config file, and it needs to look more or look like this: Section "Device" Driver "ati" Option "UseFBDev" "false" BusID "PCI:1:0:0" EndSection Tuning the resolution in X When you start X, it picks the default color depth, loads in the list of available resolutions for the given depth, and displays the highest one. You can then cycle over other pre-defined resolutions with Ctrl+Alt+'+' and '-'. All this is set up in /etc/X11/XF86Config-4. Here's an excerpt from the configuration for 16bit colors with default resolution 1024x768: ... Section "Screen" ... DefaultDepth 16 SubSection "Display" Depth 1 Modes "1152x864" "1024x768" "800x600" "640x480" EndSubSection ... SubSection "Display" Depth 16 Modes "1024x768" "800x600" "640x480" EndSubSection ... EndSection ... To explicitly start X with 16bit colors (if there's no DefaultDepth option or it is different), use: startx -- -bpp 16 If you want to further experiment with refresh rates and resolutions, either manually tune VertRefresh, HorizSync and Modeline (in X3 only) definitions in X config file, or see OpenBSD's X tuning guidelines. Device autodetection To take advantage of some kind of device autodetection, see the following three programs: read-edid, hardware information-gathering tool for VESA PnP monitors mdetect, mouse device autodetection tool discover, hardware identification system The client-server model Since X is a client-server based model (as are most other things in Unix), it means you have a whole new domain of features at your disposal. We'll discuss them now. Typical local-user/local-machine session When you start X (with startx, xinit or X), it opens the first free virtual console (that is console 7 in most Linux distributions), and starts X server on it (X server uses the DISPLAY environment variable to detect the target display, and in this case it is “localhost:0”; just “:0” or undefined DISPLAY variable have the same effect). The X server then starts the window manager of your preference and the desktop screen shows up. All the files needed are found on your local disk. You can switch back to your console screens with Ctrl+Alt+F1, F2 etc... To get back to your X display, use Alt+F7. To close your X session, either find some form of a Logout button in your window manager, or simply use Ctrl+Alt+Backspace. Just as you can have more virtual text consoles, you can have more completely separate X displays on a single display device (of course, even under different usernames): To see it in practice, start X (with startx& command), then switch back to text console with Ctrl+Alt+F1, and run 'startx -- :1&'. Bravo! You have two X sessions running now! Switch between them with Ctrl+Alt+F7 and Ctrl+Alt+F8. Remote displays on your machine Let's say you have two machines, Monarch and Denali. You are sitting at Denali, and would like to start some X program on Monarch, but have the display locally on Denali's monitor (Note that this isn't a common file sharing: in our case, the program is really executed on Monarch, only the display is sent to Denali). We will use one very convenient approach (there are other ways, of course) - we will use slogin program (an alias for ssh actually) to log in to monarch. The slogin command will set up the .Xauthority magic cookie file and the DISPLAY variable automatically, so all we need to do is to start our application. Try xeyes. Here's an example for convenience: denali:~$ slogin monarch Enter password: xxxxx monarch:~$ echo $DISPLAY denali:0 monarch:~$ xeyes& Please Note: Note however that you must have the following options enabled for the example above to work: X11Forwarding in /etc/ssh/sshd_config and ForwardX11 in /etc/ssh/ssh_config. To restart the ssh daemon, use /etc/init.d/ssh restart The Direct Rendering Infrastructure (DRI) Here's a little introduction from the Documentation/ file (the kernel-doc-* packages):
AGP (the Accelerated Graphics Port) is a bus system mainly used to connect graphic cards to the rest of the system. If you have an AGP system, it will be possible to use the AGP features of your 3D rendering video card. Note that this is the only way to have XFree4/GLX use write-combining with MTRR support on the AGP bus. Without it, OpenGL direct rendering will be a lot slower but still faster than PIO. Kernel-level support for the Direct Rendering Infrastructure (DRI) was introduced in XFree86 4.0 (which you do have, if you use Debian Woody (3.0) or newer releases).
XFree86 Notes X3 has fewer drivers and you must install specific drivers for specific groups of graphic cards (for example, xserver-rage128, mach32, mach64, i128, 3dlabs, agx, 8514, s3v etc...). In X4, we solve this by only installing xserver-xfree86, which is modular and loads the appropriate modules at runtime. Also, the config file is /etc/X11/XF86Config-4 for X4, and just /etc/X11/XF86Config for old X3. Generally, only use X3 on old machines where you want to save some memory. Troubleshooting Check the /var/log/XFree86.log and ~/.xsession-errors files for hints. Edit /etc/X11/XF86Config-4 and search for the line Option "UseFBDev" "true" and turn 'true' to 'false'. If it still doesn't work, edit Driver= config parameter. After you make sure the driver option is ok, but it still doesn't work, try tweaking HorizSync and VertRefresh values. Try with this: HorizSync 30-80 VertRefresh 40-90 Make sure you do have some version of a window manager installed, apt-get install icewm should do. dpkg-reconfigure xserver-xfree86 should open up an interactive configurator, try with it. Window managers Now you have X window system running. Let's make this clear: You need the X server because it knows how to communicate with your hardware and actually display graphics. But that's all it does. How your interface really looks like depends purely on the 'window manager'. If you listened to me, you are probably running icewm now, but there are others (when you install them, they become the default or show up in wdm's login menu). Try wmaker, blackbox, afterstep, xfce or enlightenment. Also try twm and fvwm at least for historical reasons, to understand the Unix folklore ;) If you install GUI environments like Gnome or KDE, you won't have to worry about window managers as they will aready be taken care of. Don't be disappointed by the look of wdm or icewm (tastes difer), you have plenty of other variants to choose; Definitely check out the Window Managers for X website. To get a program which shows you graphical login (so you don't have to log in the console and type startx every time), install package wdm (or any of its relatives; xdm, kdm or gdm). Also, you will be able to select which window manager to use from the wdm's menu. You can also run X without the window manager (usually for testing purposes). Try starting xinit. Fonts for X Fonts you might want are found in xfonts-* packages. Type this command to search for them: # apt-cache search xfonts- If you are interested in using the Microsoft ttf fonts, there are font servers which can handle them, and I'd recommend you try xfstt. No fonts come with it since they all have non-free licenses. That means you have to get the ttf fonts yourself, copy them to /usr/share/fonts/truetype/, add FontPath “unix/:7101” to /etc/X11/XF86Config, execute /etc/init.d/xfstt restart and then restart X. To browse installed fonts, see the xfontsel and gfontview programs. Also, check out the file. Actually, X4 can deal with TrueType fonts directly, you don't need the ttf-enable font server; simply add the ttf FontPath in the X config file. TODO: find the fontpaths for all xfonts- packages and list them here Gpm (the console mouse driver) and the XFree86 You will most probably have problems with gpm and XFree86 running at the same time. The solution would be to set repeat type to 'raw' in gpm's config and mouse device to /dev/gpmdata in X config file, but that doesn't always give usable results. I prefer to shut down gpm.