<revremark>Initial release, reviewed by LDP.</revremark>
</revision>
<!-- don't bother the reader with too many revisions
<revision>
<revnumber>0.9</revnumber>
<date>2003-05-07</date>
<authorinitials>SS</authorinitials>
<revremark>Re add "About Backstreet Ruby", more Debian stuff, information on the new Input system.</revremark>
</revision>
<revision>
<revnumber>0.8</revnumber>
<date>2003-04-24</date>
<authorinitials>TP</authorinitials>
<revremark>Draft reviewed by LDP.</revremark>
</revision>
-->
</revhistory>
<abstract>
<para>
This HOWTO explains the shortest way to get a working,
multiple, local X user-capable PC system. It is not intended to be
a replacement of the existing documentation on the Backstreet Ruby
home page, which you'll probably need to consult for more detailed
information in case of problems.
</para>
</abstract>
</bookinfo>
<chapterid="intro">
<title>Introduction</title>
<sect1id="about_bruby">
<title>About Backstreet Ruby</title>
<para>Backstreet Ruby is a kernel patch for the Linux kernel. It is a back port to linux-2.4 of the Ruby kernel tree, which is developed by the Linux Console Project. The aim of the Linux Console developers is to enhance and reorganise the input, the console and the framebuffer subsystems in the Linux kernel, so they can work independent from each other and to allow multi-desktop operation. All this is done in the Ruby kernel tree which is based on the development linux-2.5 kernel. The new Input subsystem and the new Framebuffer layer are already integrated in linux-2.5 kernel, but as the main developer of the Linux Console Project, James Simmons, is too busy with completing the rewrite of the framebuffer layer in linux-2.5, the multi-desktop operation will not be integrated in the next stable Linux kernel (linux-2.6). </para>
<para>So Backstreet Ruby brings to the current stable Linux kernel (linux-2.4) the enhanced input subsystem and the ability to use multiple graphic cards and multiple keyboards independently, in order to make multiple local XFree users on a single PC system possible. </para>
<para>You can have multiple independent graphic cards and multiple independent mouses, but in order for multiple users to interact with the system, they do need independent keyboards as well. Multiple independent keyboards is the feature that linux-2.4 (and in the future linux-2.6) lacks, and this is what Backstreet Ruby adds to the stable Linux kernel linux-2.4. </para>
<para>The entire work on back porting Ruby to linux-2.4 is done by Aivils Stoss. <email>Aivils.Stoss (at) unibanka.lv</email></para>
<para>Visit his web site for more information on the patch itself, on the current status, how to build a kernel using his patch or how to build modified XFree86 server.</para>
<para>You can find it here:<ulinkurl="http://startx.times.lv/"> http://startx.times.lv</ulink></para>
<para>The address of the Linux Console Project is: <ulinkurl="http://linuxconsole.sf.net"> http://linuxconsole.sf.net</ulink></para>
<para><quote>Why not just use ruby instead?</quote> Well as I already mentioned, the main developer James Simmons is pretty busy with the framebuffer layer and drivers, so currently there is not much done in the ruby kernel tree(in the last 4 months there was no a single commit to cvs or bk, and the original ruby is currently against linux-2.5.59 -- acording to www.kernel.org current linus kernel is 2.5.73-bk1). But Aivils releases from time to time an updated ruby snapshot, so if you feel experimental you might want to check his site for a 2.5 patch.</para>
<para><quote> What are the advantages/disadvantages of the 2.4 against the 2.5 patch</quote></para>
<itemizedlist>
<listitem><para> Well the 2.4 linux kernel is really stable and most of the distributions are build on it, the 2.5 kernel is still in development and to my knowledge there is no distribution which supports 2.5 "out of the box".</para></listitem>
<listitem><para> The 2.4 patch is more tested/used so there should be less bugs(AFAIK there are no bugs added by the patch itself), but the 2.4 patch do not support framebuffers.</para></listitem>
<listitem><para> The 2.5 patch supports framebuffers(thougth framebuffer console is not yet implemented) so you could use a single dual-headed card which registers 2 framebuffers for 2 users/ X sessions, but the 2.5 patch is not really tested and may have a lot of bugs, the 2.5 kernel itself is not very stable.</para></listitem>
<listitem><para> And if you use the framebuffer driver of XFree with such a card (for example Matrox G550 DH) two get 2 X sessions on a single graphic card, you loose a lot of features as the XFree framebuffer driver do not support acceleration, DRI, XVideo extentions ....</para></listitem>
</itemizedlist>
</sect1>
<sect1id="about">
<title>About this document</title>
<para>This document explains how to configure your system for multiple local XFree users using the enchanted console/input subsystem in the Backstreet Ruby kernel .</para>
<note><para>Currently it is not possible to set up systems for multiple console users.</para>
</note>
<para>There are two ways of setting up multiple local XFree users:</para>
<para><orderedlist>
<listitem>
<para>Modify the kernel to ignore input from USB keyboards and add the handling of USB keyboards to a modified Xserver. This solution was developed by Miguel Freitas. Visit his page on the topic at <ulinkurl="http://cambuca.ldhs.cetuc.puc-rio.br/multiuser/">http://cambuca.ldhs.cetuc.puc-rio.br/multiuser/</ulink>, for instructions on how to set up such a system.
</para>
</listitem>
<listitem>
<para>Use the Backstreet Ruby kernel which supports independent keyboards.</para>
</listitem>
</orderedlist></para>
<para>I'll concentrate on configuring a system for multiple local XFree users using the Backstreet Ruby kernel, but there are parts which can be used also on a system using the solution from Miguel Freitas.</para>
<para><note>Every ocurance of Backstreet ruby should be replacable with the original Ruby in sense that everything explained here, should work the same way with Ruby (if not mentioned oderwise). When Ruby becomes more stable and finished I'll add some more information about it, but this probably won't happen before linux-2.6 becomes reality.</note></para>
<para>Note this document is not intended to be a replacement of the existing documentation on the Backstreet Ruby home page (<ulinkurl="http://startx.times.lv/">http://startx.times.lv</ulink>), but rather, this is a smaller HOWTO, explaining the way to a working X multi-user PC system. If you encounter any problems you'll probably need to consult the more detailed information there.</para>
<para>The document is based on the file system layout of the Mandrake-Linux distribution, but I tried to make it distribution-independent by including information about the differences to other mainstream distributions like Debian, Red Hat and SuSE Linux.</para>
<para>Well I would sugest first to read briefly chapters 3,4(may be 2 as well), then make your choices(which configuration will you use - DRI or non-DRI, do you want to install from source or binaries, ...). Then reread the parts which meet your needs more carefully. Start with a simple setup for 2 users only, get the basic setup running, then configure display manager. When everything seems to run OK, go for more advanced configurations in chapters 5,7.</para>
<para>Don't be afraid that its too complicated, </para>
<para>Don't be afraid to ask questions.</para>
</sect1>
-->
<sect1id="xf_confs">
<title>XFree configuration files</title>
<para>You should configure each of your video cards to work properly with a single X server, which is actually beyond the scope of this document. You should refer to the documentation that came with your distribution, but some general hints couldn't hurt.</para>
<para>The easiest way would be to use the same kind of monitors & video cards, you could then configure only the first card/monitor pair, make copies of this configuration file for the number of video cards you have, and then only adjust the BusID "PCI:x:xx:x" field in the configuration file. You can do this with the help of lspci, XFree86 -scanpci -verbose , or other similar distribution-specific tools.</para>
<para>You could use a similar approach if you have only monitors or video cards of the same type.</para>
<para>Most modern distributions also have advanced tools for easier configuration of Xinerama. You can use these tools to set up the system for Xinerama and then use this configuration file for generating the configuration files for the different X servers. You can use an example configuration file, replacing video card and monitor section, by the corresponding sections from the Xinerama <filename>XFConfig-4</filename> file.</para>
<para>Other useful resources:</para>
<itemizedlist>
<listitem>
<para><ulinkurl="http://www.tldp.org/HOWTO/XFree86-HOWTO/index.html">The Linux XFree86 HOWTO</ulink></para>
</listitem>
<listitem>
<para><ulinkurl="http://www.tldp.org/HOWTO/XFree86-Video-Timings-HOWTO/index.html">XFree86 Video Timings HOWTO</ulink></para>
</listitem>
<listitem>
<para><ulinkurl="http://www.tldp.org/HOWTO/XWindow-Overview-HOWTO/index.html">X Window System Architecture Overview HOWTO</ulink></para>
</listitem>
<listitem>
<para><ulinkurl="http://www.tldp.org/HOWTO/XWindow-User-HOWTO/index.html">The X Window User HOWTO</ulink></para>
</listitem>
</itemizedlist>
</sect1>
<sect1id="xf_confs_xinerama">
<title>Reusing Xinerama configured XFree</title>
<para>If you have a system configured for Xinerama, you can easily adjust the XFree configuration file so you can use it for multiple users.</para>
<para>This will allow you to easily switch between a multi-user environment and a Xinerama multi-monitor environment. </para>
<para>What is Xinerama and how does the system configured using this HOWTO differ from a system using the Xinerama extensions in XFree? </para>
<para> The Xinerama extensions were introduced to the XFree86 system in version 4.0. Xinerama is an extension to XFree86 Release 6 Version 4.0 (X4.0) which allows applications and window managers to use the two (or more) physical displays as one large virtual display. In case Xinerama is not used, applications can only reside on one of the displays and can not be moved between the two. Window managers had to be specially written to support the two displays. With Xinerama, window managers and applications don't have to be specially written to support the larger <quote>Virtual Desktop</quote> Xinerama creates.</para>
<para>Just the opposite, the primary goal of a system configured according to this HOWTO is to offer multiple independent displays for several users on a single PC system.</para>
<para>For more information on Xinerama read:</para>
<itemizedlist>
<listitem>
<para><ulinkurl="http://www.tldp.org/HOWTO/Xinerama-HOWTO/index.html">Xinerama-HOWTO</ulink>, Using Xinerama to MultiHead XFree86 v.4.0+</para>
</listitem>
</itemizedlist>
</sect1>
<sect1id="binaries">
<title>Binary packages</title>
<para>Binary rpms of modified XFree servers are currently available for Mandrake 8.2/ 9/ 9.1, Red Hat 8/ 9, SuSE 8.1 and Debian Sid. If you're running other rpm-based distributions please help me to prepare and rebuild packages, so other users can get pre-compiled binaries.
Currently the binary rpm packages are not mirrored and are only available from <ulinkurl="http://varna.demon.co.uk/~svetlio/ruby-contrib">http://varna.demon.co.uk/~svetlio/ruby-contrib</ulink>.
</para>
<para>Debian packages are also available thanks to Andreas Schuldei at <ulinkurl="http://www.schuldei.org/debian/bruby">http://www.schuldei.org/debian/bruby</ulink>, or as apt repository "deb http://www.schuldei.org/debian/bruby ./ ".</para>
</sect1>
</chapter>
<chapterid="kernel">
<title>Installing the kernel</title>
<para></para>
<sect1id="inst_kernel">
<title>Installing the Backstreet Ruby kernel</title>
<para>Now it's time to install the kernel.</para>
<para>The easiest way would be to pull an already prepared binary kernel; there are packages for some distributions (currently only Mandrake and Debian) or a source package, and rebuild it on your system.</para>
<para>If for some reason you cannot use them or have problems using them you can also build your own kernel with the bruby patch, for more information how to do this visit the Backstreet Ruby page on building and installing the kernel: <ulinkurl="http://startx.times.lv">http://startx.times.lv</ulink> (or some of the mirrors) -> Documentation -> Quick Kernel.</para>
<para>(If you are new to Linux, reading <quote>The Linux Kernel HOWTO</quote>, <ulinkurl="http://tldp.org/HOWTO/Kernel-HOWTO.html">http://tldp.org/HOWTO/Kernel-HOWTO.html</ulink>, could be very helpful.)</para>
<para>You can find binary kernel package for Mandrake-9.1 at <ulinkurl="http://varna.demon.co.uk/~svetlio/ruby-contrib/kernel.html">http://varna.demon.co.uk/~svetlio/ruby-contrib/kernel.html</ulink>.</para>
<para>Debian binary kernel packages are available at <ulinkurl="http://www.schuldei.org/debian/bruby">http://www.schuldei.org/debian/bruby</ulink>, or as apt repository "deb http://www.schuldei.org/debian/bruby ./ "</para>
</sect1>
<sect1id="build_kernel">
<title>Notes on building your own kernel</title>
<para>There are some things I would like to mention, although I won't go in details, as the Backstreet Ruby page on compiling the kernel discusses this topic.</para>
<para></para>
<para><orderedlist>
<listitem>
<para>You have to follow this order:</para>
<programlisting>
Input support
Virtual Terminal support
Console drivers
</programlisting>
<para>for all required options to be available/selectable.</para>
</listitem>
<listitem>
<para>You have to use built in input support:</para>
<programlisting>
Input device support --> Input core support
Input device support --> Mouse support
</programlisting>
</listitem>
<listitem>
<para>I would suggest you also include at least one keyboard (built in - not as a module). You can also use modules, but I find it safer to be able to use a keyboard instead of trying to find a PC with ssh (or something similar) to load the required modules.</para>
<para>For AT/PS2 keyboards, turn on (not modules):</para>
<programlisting>
Input device support --> Serial i/o support
Input device support --> i8042 PC Keyboard controller
Input device support --> Keyboards
Input device support --> AT keyboard support
</programlisting>
<para>For a USB keyboard turn on (not modules):</para>
<programlisting>
Input device support --> Keyboards
USB support --> support for USB
USB support --> USB driver (probably usb-uhci.o)
USB support --> USB Human Interface Device (full HID) support
USB support --> HID input layer support
</programlisting>
</listitem>
<listitem>
<para>If you are new to Linux, do not try to patch an already patched kernel (heavily patched kernels like the ones that ship with most distributions). Use a kernel from <ulinkurl="http://www.kernel.org">www.kernel.org</ulink>, and take a look at the <ulinkurl="http://www.tldp.org/HOWTO/Kernel-HOWTO/">Linux Kernel HOWTO</ulink>.</para>
</listitem>
</orderedlist></para>
<para></para>
<para>Support for frame buffer devices is not back-ported, and is disabled.</para>
<para><note> As Backstreet Ruby lacks framebuffer support, you will most certainly need separate graphic card for each display. You won't be able to use dual-headed card with single BusID for 2 independent displays, but it might be possible in case the card has different BusId's for the different heads.</note></para>
</sect1>
<sect1id="dev_files">
<title>Creating needed device files</title>
<para> If you are not using the devfs file system, you'll have to create several device files needed for the new input sub-system in the Backstreet Ruby kernel:</para>
<programlisting>
cd /dev
mkdir input.old
mv mouse js? input.old
mkdir input
cd input
mknod js0 c 13 0
mknod js1 c 13 1
mknod js2 c 13 2
mknod js3 c 13 3
mknod mouse0 c 13 32
mknod mouse1 c 13 33
mknod mouse2 c 13 34
mknod mouse3 c 13 35
mknod mice c 13 63
mknod event0 c 13 64
mknod event1 c 13 65
mknod event2 c 13 66
mknod event3 c 13 67
cd ..
ln -s input/js0 js0
ln -s input/js1 js1
ln -s input/mice mouse
</programlisting>
<para>If you use devfs, all required devices will be created automatically by devfs.</para>
<para>Mandrake is an example of one distribution that uses devfs. Debian does not use devfs by default, but the kernel supports devfs; in order to activate devfs you have to add <quote>devfs=mount</quote> to the <quote>append</quote> line of your boot loader and install devfsd (the devfs demon). Distributions that do not use devfs are Red Hat and SuSE.</para>
<para>You can check whether devfs is used by issuing the following commands:</para>
<itemizedlist>
<listitem>
<para>To check whether support for devfs is enabled in your kernel</para>
<para>As the frame buffer layer is not back-ported to linux-2.4, only the primary graphic card is initialised during the boot process. Secondary graphic cards can only be initialised by an X server, so you will have a single VGA text console on the primary graphic card. </para>
</sect1>
<sect1id="inst_kern_kbd">
<title>Keyboard numbering(order of detection)</title>
<para>In the following chapters you will read about 1st keyboard, 2nd keyboard and so on, so here I will explain what is meant by n-th keyboard. </para>
<para>When a keyboard device is found, it is bound to a free VT (given that there are free VT's). The first keyboard found will be bound to VT0 (tty0-tty7), the second to VT1 (tty8-tty15), the third to VT2 (tty16-tty23).</para>
<para>The order of detecting the keyboards depends on the configuration of your kernel :</para>
<itemizedlist>
<listitem><para>If you are using kernel with integrated USB input the USB keyboard devices will be registered first, then the AT/PS2 keyboards will follow when the modules are loaded</para></listitem>
<listitem><para>If you are using kernel with integrated PS2 input the AT/PS2 keyboard devices will be registered first, then the USB keyboards will follow when the modules are loaded</para></listitem>
<listitem><para>If you are using kernel with integrated PS2 & USB input the AT/PS2 keyboard devices will be registered first, then the USB keyboards will follow</para></listitem>
</itemizedlist>
<para>But there are some caveats:</para>
<para>Most USB keyboards represent themselves as more than one keyboard; it is common that the multimedia keys or the number-pad identify themselves as a different keyboard device. So if you are running a kernel with integrated USB input and have one USB keyboard with multimedia keys and one PS2 keyboard, the USB keyboard will be bound to VT0(real keyboard) and VT1(multimedia keys), the PS2 keyboard will be bound to VT2 (in case you have enough DUMB consoles).</para>
<para>There are several ways to work around these issues. Here I'll explain the easiest way to follow. It's definitely not the best one, but the shortest explanation, and I just want to make it clear to you that the problem is not that big. The Better solutions will follow later in their own section. </para>
<para>All you need to do is to start the Backstreet Ruby kernel with dumbcon=n , where n is the sum of your AT/PS2 keyboards plus the sum of your USB keyboards multiplied by 2 (I suppose this is the maximum number of interfaces a USB keyboard registers), so all keyboards will be bound to a VT. Now you should find out which VT's the real keyboards are bound to (the keyboards excluding the multimedia keys) and start X using the appropriate tty ranges. Thanks to the proc interface integrated in Backstreet Ruby, you can easily find the assignment of keyboards to VT's. Each VT creates a file <filename>/proc/bus/console/[n]/keyboard</filename> (n is the number of the VT, for VT0 n will be 00, for VT1 - 01, ... , for VT11 - 11); reading this file will give you the assigned keyboard.
<listitem><para>USB keyboard (real) is bound to VT0</para></listitem>
<listitem><para>USB keyboard (multimedia keys) is bound to VT1</para></listitem>
<listitem><para>PS2 keyboard is bound to VT2</para></listitem>
</itemizedlist>
<para>Now we can start X on the VT's with real keyboards, in this case VT0 and VT2.</para>
<para>Of course in this simple example with only 2 keyboards (one USB and one PS2) the problem could be easily avoided by using a kernel with primary PS2 input support. The PS2 keyboard would be found first and bound to VT0, the USB keyboard would follow and it's real keyboard interface would be bound to VT1, so there is no need for additional dumb consoles (for the multimedia interfaces of USB keyboards).</para>
</sect1>
</chapter>
<chapterid="x_servers">
<title>Setting up the X servers</title>
<para>Now its time to configure XFree.</para>
<sect1id="mod_x_server">
<title>Installing modified X server</title>
<note><para>For some video cards you can skip this part. Before installing the modified X server check the Video Compatibility list to determine whether you need one. Currently there are reports for working configurations without using a modified X server for Voodoo Graphics as primary and Voodoo3 or Nvidia TNT2 as secondary.</para></note>
<para><quote>Why should a modified X server be used?</quote> - The reason is that XFree is designed to serve a single user and this design requires a single X server to drive all available graphic cards. So when an unmodified X server starts, it disables access to graphic cards for other X servers. Hence we have to modify XFree to make it possible more then one X server to run at the same time.</para>
<para>You probably only need already-built binaries. If there are packages for your distribution you can install them. If not, you have 3 more possibilities:</para>
<orderedlist>
<listitem>
<para>Install an already built, but not packaged, modified X server and create the necessary symbolic links. You can get such binaries from the Backstreet Ruby home page, at <ulinkurl="http://startx.times.lv">http://startx.times.lv</ulink>.</para>
</listitem>
<listitem>
<para>Help us (as well other people using your distribution) in building an rpm for your distribution (we lack systems installed with all available distributions, so we are not able to build packages for every distribution).</para>
</listitem>
<listitem>
<para>To patch and rebuild XFree from source using the instructions at the Backstreet Ruby page go to the Documentation section, at <ulinkurl="http://startx.times.lv">http://startx.times.lv</ulink> (or some of the mirrors) -> Documentation -> Quick XFree.</para>
</listitem>
</orderedlist>
<para>Note that currently there are two different modifications of the X server:</para>
<orderedlist>
<listitem>
<para>XFree86-4.3 prefbusid (Preferred Bus ID), the new recommended patch/ binary.</para>
</listitem>
<listitem>
<para>Just the XFree-4.3/ XFree-4.3.patch, which is the older one (in the rpm section *server-concurrent.*rpm).</para>
</listitem>
</orderedlist>
<para>The new patch solves major problems for a number of graphic cards. Check the Video Compatibility list for details.</para>
<para>The older aproach(disabling the pci_disable functions in XFree) can also be done in kernel space, so the user doesn't need a modified X server, but rather can use the XFree packages that shipped with his distribution. The latest bruby patch includes the needed changes to the linux kernel.</para>
<para>To enable this feature you have to add this to your XFree configuration file:</para>
<programlisting>
Section "ServerFlags"
...
Option "PciOsConfig" "1"
...
EndSection
</programlisting>
<para> and to inform the kernel to filter unnecessary PCI commands:</para>
<para><note> This addition to Bruby is equal to the old XFree modification, so if your system freezes on restarting the first X server, it is recommended to install the Preferred Bus ID X server.</note></para>
</sect1>
<sect1id="sym_links">
<title>Creating symbolic links</title>
<para>The symbolic links are needed for properly starting several XFree instances, as well for properly exiting an X session. This applies for both starting X from console and the automatic starting of X by the display manager (kdm, gdm, xdm).</para>
<para>You need to create as many symbolic links to the modified X server binary (or the original X server in case you do not need a modified one), as the number of your video cards/X sessions.</para>
<para>I assume that you will have to use a modified X server, but in case you do not need it, use the following commands to create the links to your original X server:</para>
<screen>
cd /usr/X11R6/bin/
ln -s XFree[modified] X0
ln -s XFree[modified] X1
ln -s XFree[modified] X2
</screen>
<para>In case you use the provided rpm packages, you'll only need this if you want more than 4 parallel running X servers/X sessions, as the rpm creates 4 symbolic links to the X server binary.
</para>
</sect1>
<sect1id="ind_keyboards">
<title>Using independent keyboards with XFree</title>
<para>Once you install the Backstreet Ruby kernel and start it with <option>dumbcon=n</option>, you get n +1 independent consoles (1VGA + n DUMB). If you have enough keyboards connected to your PC, each of these consoles are associated with a given keyboard. This enables you to start multiple X servers on each of the consoles, using the keyboard associated with the corresponding console for input. Hence you get multiple independent X servers with independent keyboards, which in turn make it possible for one single PC to be used by several local X users simultaneously.</para>
<para>To start X on a given console (using a given independent keyboard) you pass it the argument <command>vt[N]</command>, where N is a number from a given tty range.</para>
<para>Under Backstreet Ruby, each console is represented by 8 tty's:</para>
<itemizedlist>
<listitem>
<para>VGA: tty0 to tty7</para>
</listitem>
<listitem>
<para>DUMB1: tty8 to tty15</para>
</listitem>
<listitem>
<para>DUMB2: tty16 to tty23</para>
</listitem>
</itemizedlist>
<note>
<itemizedlist>
<listitem>
<para>For the new Preferred Bus ID XFree Server you also have to specify the desired graphic card with parameter <quote><command>-prefbusid x:x:x</command></quote>, where x:x:x is the Bus ID of the desired graphic card.</para>
<itemizedlist>
<listitem><para>For AGP cards, something similar to <command>-prefbusid 1:0:0</command></para></listitem>
<listitem><para>For PCI cards, something similar to <command>-prefbusid 0:x:0</command> (x is normally the IRQ number)</para></listitem>
</itemizedlist>
</listitem>
<listitem>
<para>In the following explanation I will not use this option. If you use the Preferred Bus ID X server just append <command>-prefbusid x:x:x</command> with the correct Bus ID of the card you want to start right before the last argument <command>vt[x]</command> .</para>
</listitem>
</itemizedlist>
</note>
<para>If you have 3 video cards, 3 keyboards, and you have started the Backstreet Ruby kernel with dumbcon=2, you can start 3 independent X servers for 3 simultaneous users with the following commands:</para>
<para></para>
<para>For the 1st X server with the 1st keyboard:</para>
<para><command>$ startx -- /usr/X11R6/bin/X0 :0 -xf86config /etc/X11/XF86Config-4[for your 1st video card] vt7</command></para>
<para>For the 2nd X server with the 2nd keyboard:</para>
<para><command>$ startx -- /usr/X11R6/bin/X1 :1 -xf86config /etc/X11/XF86Config-4[for your 2nd video card] vt8</command></para>
<para>For the 3rd X server with the 3rd keyboard:</para>
<para><command>$ startx -- /usr/X11R6/bin/X2 :2 -xf86config /etc/X11/XF86Config-4[for your 3rd video card] vt16</command></para>
<para>For the 1st X server you can skip the <option>-xf86config /etc/X11/XF86Config-4[for your 1st video card]</option> argument. In this case, the default configuration file, <filename>/etc/X11/XF86Config-4</filename>, will be used.
</para>
<note>
<itemizedlist>
<listitem>
<para>For SuSE users:</para>
<para>the XFree configuration files are normally /etc/X11/XF86Config </para>
</listitem>
<listitem>
<para>The same applies for Red Hat users:</para>
<para>the XFree configuration files are normally /etc/X11/XF86Config </para>
</listitem>
</itemizedlist>
</note>
<para>You can also setup your display manager to start the independent X servers, once everything is properly configured. But don't rush to setup your display manager before the configuration is finished, because this could give you serious problems. When you are ready with the required configurations, you'll reach the section on configuring the display manager.
</para>
</sect1>
<sect1id="ind_mouses">
<title>Using independent mice with XFree</title>
<para>To use an independent mouse for each of your independent X servers/sessions, you just have to modify the input section of the XFree configuration files to adjust the proper device files.</para>
<para>Use <filename>/dev/input/mouse[n]</filename>, where n is the number of your mouse starting from 0:
<para>There could be several reasons for not using DRI:</para>
<para></para>
<itemizedlist>
<listitem>
<para>As far I know only one graphic card in a system can use DRI.</para>
</listitem>
<listitem>
<para>The Nvidia closed source driver does not support DRI. </para>
</listitem>
</itemizedlist>
<para>In case one of this reasons applies to your system, you do not need different XFree configuration files for the different displays.</para>
<para>You can configure your system for Xinerama using the tools provided with your distribution and reading <ulinkurl="http://www.tldp.org/HOWTO/Xinerama-HOWTO/index.html">The Xinerama-HOWTO</ulink>, so when the system is used by a single user, he/she could switch to Xinerama desktop and use all available displays for a bigger desktop. </para>
<para>Once configured for Xinerama, only small additions are needed to achieve multiple independent desktops. All you have to do is to add new layouts which use single screen definition and have independent input devices (well, this is actually needed only for the mouse devices, as the keyboard is managed through the <option>vt[n]</option> option).</para>
<para>If you have configured Xinerama in the following way:</para>
<programlisting>Section "ServerLayout"
Identifier "Simple Layout"
Screen "Screen 2"
Screen "Screen 1" RightOf "Screen 2"
InputDevice "Mouse1" "CorePointer"
InputDevice "Keyboard1" "CoreKeyboard"
EndSection</programlisting>
<para>To achieve multiple independent desktops you only have to add layout definitions for a single screen :</para>
<programlisting>Section "ServerLayout"
Identifier "first-Xserver"
Screen "Screen 1"
InputDevice "Mouse1" "CorePointer"
InputDevice "Keyboard1" "CoreKeyboard"
EndSection
Section "ServerLayout"
Identifier "second-Xserver"
Screen "Screen 2"
InputDevice "Mouse2" "CorePointer"
InputDevice "Keyboard1" "CoreKeyboard"
EndSection</programlisting>
<para>Which should result in these layout definitions:</para>
<programlisting>Section "ServerLayout"
Identifier "Xinerama"
Screen "Screen 2"
Screen "Screen 1" RightOf "Screen 2"
InputDevice "Mouse1" "CorePointer"
InputDevice "Keyboard1" "CoreKeyboard"
EndSection
Section "ServerLayout"
Identifier "first-Xserver"
Screen "Screen 1"
InputDevice "Mouse1" "CorePointer"
InputDevice "Keyboard1" "CoreKeyboard"
EndSection
Section "ServerLayout"
Identifier "second-Xserver"
Screen "Screen 2"
InputDevice "Mouse2" "CorePointer"
InputDevice "Keyboard1" "CoreKeyboard"
EndSection</programlisting>
<para>Now you can start a single X server with option <option>-layout Xinerama</option> and enjoy the Xinerama desktop, or</para>
<para>You can start 2 independent X servers using <option>-layout first-Xserver</option> for the first, and <option>-layout second-Xserver</option> for the second. </para>
<para><ulinkurl=""></ulink></para>
<para>Since you will use a single XFree configuration file for all X servers,
<orderedlist>
<listitem>
<para>in order to use independent keyboards you have to use following command:</para>
<para>For 1st X server with the 1st keyboard:</para>
<para>Here you will learn how to configure your system for parallel use of Nvidia's GLX and XFree's DRI. If you do not have Nvidia cards, or you have only Nvidia cards, you do not need to read this section. In the first case you do not need the Nvidia GLX at all, and in the second, you can use the standard procedure for installing GLX.</para>
<para>With the open source driver it's almost impossible to bring up a secondary card, so we should use the closed source driver.</para>
</listitem>
<listitem>
<para>Why the Nvidia card? Currently these are the only available, affordable PCI video cards with some acceleration.</para>
</listitem>
<listitem>
<para>
I tried to use DRI on 2 parallel X servers, but it didn't work. I posted emails to XFree, DRI and lkml list, but I only got a single answer with no valuable information on my problem. I tried to run DRI on a Matrox G550 DH AGP & SiS63xx PCI, but when enabled for both cards, I got AGP errors. When enabled only for one of the cards, I got DRI up and running. Please, someone confirm or prove me wrong!
</para>
</listitem>
</orderedlist></para>
<para>I'll explain several ways to get configuration working for both Nvidia GLX and XFree86 DRI. There are probably a lot of other possibilities, and maybe these are not the simplest, but they are the ones I know to work.</para>
<para> The reasons why this is needed: <orderedlist>
<listitem>
<para>Nvidia should use a different module path for xf86: the glx extension module from Nvidia is incompatible with the one from XFree86.</para>
</listitem>
<listitem>
<para>Nvidia should use a different XF86Config file: because DRI should be disabled for Nvidia and enabled for others.</para>
</listitem>
</orderedlist>
</para>
<para>If you find a simpler way, please email it me and I'll include it.</para>
<caution>
<para>This can not be used as-is on SuSE Linux. In order to make it easy for the user to switch between Mesa, XFree and Nvidia GL libraries, SuSE uses a very complicated setup for the GL libraries. To use this setup you have to switch your configuration to XFree86's GL libraries.</para>
</caution>
<sect2>
<title>Example 1</title>
<para>This is the configuration that I use on my system (ATI AIW Radeon 7500 AGP and Nvidia TNT2 M64 PCI) XFree configuration files:</para>
<orderedlist>
<listitem>
<para>Create a directory <filenameclass="directory">/usr/X11R6/libNV</filename>:</para>
<para>Install the Nvidia driver and libraries in <filenameclass="directory">/usr/X11R6/libNV</filename>.</para>
</listitem>
<listitem>
<para>Install Nvidia's <filename>libGLcore.so.1.0</filename> [driver version], or better, <filename>libGLcore.so.1</filename>, in <filenameclass="directory">/usr/lib</filename>. Make a symbolic link from <filename>/usr/X11R6/libNV/libGLcore.so.1</filename> to <filename>/usr/lib/libGLcore.so.1</filename> (this will allow you to easily update your Nvidia drivers):</para>
<para>Note: the Nvidia <filename>libGL.so</filename> is installed <filenameclass="directory">/usr/X11R6/libNV</filename>, so it's invisible to the system unless you tell the system about the existence of <filenameclass="directory">/usr/X11R6/libNV</filename>. For this setup, you must not do this, as it will break the standard X server start-up. But you can use the XFree GL libraries with the Nvidia graphic card and Nvidia closed source drivers, with a non-Nvidia graphic card, using XFree's DRI, which the GL library from Nvidia cannot do.</para>
</listitem>
<listitem>
<para>Add a line in the XFree configuration file for the Nvidia card to point the X server to the right location of the library and module path:
<programlisting>
Section "Files"
..........
ModulePath "/usr/X11R6/libNV/modules"
..........
EndSection
</programlisting>
</para>
</listitem>
<listitem>
<para>Install the Nvidia kernel driver.</para>
</listitem>
</orderedlist>
<para>Now everything should be fine and you should be able to use DRI and Nvidia GLX at the same time. You will have a bit smaller performance in comparison to a setup which uses Nvidia's libGL & libGLcore,
but the difference is not that big on my PC.</para>
</sect2>
<sect2>
<title>Example 2</title>
<para>This example will give you the full performance of both the Nvidia card(s), and the
non-Nvidia card, since XFree's libGL is used for the non Nvidia card, and
Nvidia's libGL is used for Nvidia cards. But this will require one more X server to be precise;
a simple wrapper to add the path to the Nvidia libraries, and symbolic links to it for
additional Nvidia cards.</para>
<para>It is almost the same as the previous scenario, with the difference that the X servers
for the Nvidia cards should start with an environment where Nvidia's libGL is known,
while the X servers for non Nvidia cards shouldn't know anything about the
Nvidia libGL. This requires a wrapper to be used for starting the X servers
driving Nvidia cards.
</para>
<para>Install the Nvidia libraries and kernel driver like in the previous example.
You may skip step 4. as <filename>libGLcore.so.1</filename> is installed in <filenameclass="directory">/usr/X11R6/libNV</filename>, and we'll inform the X servers driving Nvidia cards about the proper path
to the Nvidia libraries.</para>
<para>The missing part - the wrapper :
<programlisting>
#!/bin/bash
export LD_LIBRARY_PATH=/usr/X11R6/libNV
exec /usr/X11R6/bin/X0 $*
</programlisting>
</para>
<para>Copy these lines into your favourite editor and save the file as <filename>XNV</filename>. Make it executable:</para>
<para><command>chmod +x XNV </command></para>
<para>Copy the file to <filenameclass="directory">/usr/X11R6/bin</filename> and make symbolic links to it for additional Nvidia cards (for additional cards just add more links):</para>
<screen>
cp XNV /usr/X11R6/bin
cd /usr/X11R6/bin
ln -s XNV Xnv0
ln -s XNV Xnv1
ln -s XNV Xnv2
</screen>
<para>Remember to use <filename>/usr/X11R6/bin/Xnv0</filename>, <filename>/usr/X11R6/bin/Xnv1</filename> ..., instead of <filename>/usr/X11R6/bin/X0</filename>, <filenameclass="directory">/usr/X11R6/bin/X1</filename> ... for your Nvidia cards while configuring the display managers in the next chapter, or when starting X on Nvidia card(s) from console.</para>
</sect2>
<sect2>
<title>Installing the Nvidia libraries easily</title>
<para>Using the new Nvidia installer (note, this is a work in progress, do not use if you don't understand what happens here. To-do: write a script to perform steps 1-4. Please provide some feedback on the script in Appendix->Scripts):
</para>
<para>Manually:
<orderedlist>
<listitem>
<para>Make a backup of your XFree GL libraries:</para>
<para>Copy the installed files to <filenameclass="directory">/usr/X11R6/libNV</filename>:</para>
<screen>
cd /usr/X11R6NV/lib && tar cv * | tar xvC /usr/X11R6/libNV/
</screen>
</listitem>
<listitem>
<para>Restore the backed-up GL libraries:</para>
<screen>
cd [XFree prefix]
tar xvfp libGL-backup.tar && ldconfig
</screen>
</listitem>
</orderedlist>
</para>
</sect2>
</sect1>
</chapter>
<chapterid="tweak_input_devs">
<title>More on configuring input devices</title>
<para>Here you will find more details on configuring input devices and dealing with secondary keyboard interfaces found in USB multimedia keyboards.</para>
<note>
<para>If you are configuring a system with two displays( 2 keyboards, 2 mice) you probably can skip to <xreflinkend="dm_conf"/><quote>Configuring display managers</quote>, but if you want to use a single system for more users you will find really useful information in this chapter.</para>
</note>
<sect1id="tweak_input_devs-realDev">
<title>Finding the real devices</title>
<para>We will need this information later on, to be able to assign a given keyboard/mouse to a given X-server/Display.</para>
<para>To find the PHYS ID's (the addresses) or the name(quite oft it differs from the one labeled on the device) of your input devices you have to read the file <filename>/proc/bus/input/devices</filename>.</para>
N: Name="Cypress Sem. PS2/USB Browser Combo Mouse"
P: Phys=usb-00:10.1-1.2/input0
H: Handlers=mouse1 ts1
B: EV=7
B: KEY=1f0000 0 0 0 0 0 0 0 0
B: REL=103 </screen>
<note>
<itemizedlist>
<listitem>
<para><filename>/proc/bus/input/devices</filename> will provide the needed information for all devices except USB multimedia/office keyboards.</para>
</listitem>
<listitem>
<para>For such USB multimedia/office keyboards you will have to gather additional information, for example with the help of <command>lsusb</command>.</para>
</listitem>
</itemizedlist>
</note>
<itemizedlist>
<listitem>
<para>First we have to find the address of the USB keyboard:</para>
<screen>[root@svetljo How-To]# lsusb
Bus 004 Device 001: ID 0000:0000
Bus 003 Device 001: ID 0000:0000
Bus 003 Device 002: ID 0409:55ab NEC Corp. Hub [iMac kbd]
Bus 003 Device 003: ID 046d:c303 Logitech, Inc.
Bus 003 Device 004: ID 05fe:0011 Chic Technology Corp. Browser Mouse
Bus 002 Device 001: ID 0000:0000
Bus 001 Device 001: ID 0000:0000 </screen>
<para>Here, my USB Logitech keyboard is Device 003 on Bus 003.</para>
</listitem>
<listitem>
<para>Now we run <command> lsusb</command> with arguments <parameter> -v -s [your USB keyboard device id in form Bus:Device]</parameter>, in my case, <command>lsusb -v -s 003:003</command>.</para>
<screen>........
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 0
bAlternateSetting 0
bNumEndpoints 1
bInterfaceClass 3 Human Interface Devices
bInterfaceSubClass 1 Boot Interface Subclass
bInterfaceProtocol 1 Keyboard
iInterface 0
........
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 1
bAlternateSetting 0
bNumEndpoints 1
bInterfaceClass 3 Human Interface Devices
bInterfaceSubClass 0 No Subclass
bInterfaceProtocol 0 None
iInterface 0
........
</screen>
</listitem>
</itemizedlist>
<para>So my USB keyboard has two interfaces (see bInterfaceNumber); the first one is the real keyboard (bInterfaceProtocol 1 Keyboard), the second (bInterfaceProtocol 0 None) - the additional keys. Hence the real USB keyboard is:</para>
<programlisting>.....
N: Name="Logitech USB Keyboard"
P: Phys=usb-00:10.1-1.1/input0
H: Handlers=kbd
.....</programlisting>
<para>The <quote>P: Phys=</quote> field (the physical descriptor/address) consorts of:</para>
<para>and configure the applications which use them to use the symbolic links instead of the real devices</para>
</sect1>
<sect1id="tweak_input_devs-Xev1">
<title>Using XFree with event interface support</title>
<para>This will allow you:</para>
<itemizedlist>
<listitem>
<para>if you have input devices with different names, to use them with the same Xserver/screen wherever you plug or re-plug them. </para>
</listitem>
<listitem>
<para>if you have input devices with the same names, to use them with the same Xserver/screen according to the USB port where you plug or re-plug them. </para>
</listitem>
<listitem>
<para> the ability to use wild cards such as <quote>*</quote> and <quote>?</quote>.</para>
</listitem>
</itemizedlist>
<caution>
<para>Currently hot-plugging doesn't seems to work properly. I have reports that it works when using the <quote>Dev Name</quote> option, but my primary purpose was to get it working with <quote>Dev Phys</quote> and this does not currently seem to work. <quote>Why "Dev Phys"?</quote> - because if one wants to setup a single system for 4,5 or more users it would be easier to get 4,5 or more pieces of the same keyboard/ mouse then to find the same number keyboards or mice but from different manufacturer or with different names, and i find configuring XFree for such number users is simpler when <quote>Dev Phys</quote> is used.</para>
</caution>
<para>For this to work you will have to use XFree with the patches for event interface support, developed by Zephaniah Hull. You can find them at the following url: <ulinkurl="http://people.debian.org/~warp/evdev/">http://people.debian.org/~warp/evdev/</ulink>.</para>
<para>To build from source you will need the following patches :</para>
<itemizedlist>
<listitem>
<para><filename>029_lnx_evdev.diff</filename> : The evdev core patch.</para>
</listitem>
<listitem>
<para><filename>030_lnx_evdev_mouse.diff</filename> : The mouse side of the patch.</para>
</listitem>
<listitem>
<para><filename>031_lnx_evdev_keyboard.diff</filename> : The keyboard side of the patch.</para>
</listitem>
</itemizedlist>
<para>The binaries for Debian include these patches. Mandrake-9.1 rpms are also available.</para>
<para>For hot-plugging you will also need the <filename>/etc/hotplug/input.agent</filename> , which you can find under the above address and in Appendix Scripts </para>
<para>Then you have to configure XFree to use the event devices.</para>
<para>The configuration section for a mouse should look something like this:</para>
<programlisting>Section "InputDevice"
Identifier "Mouse1"
Driver "mouse"
Option "Protocol" "evdev"
Option "Dev Name" "A4Tech USB Optical Mouse"
Option "Dev Phys" "usb-*/input0"
Option "Buttons" "9"
Option "ZAxisMapping" "6 7 8 9"
EndSection</programlisting>
<para>The configuration section for a keyboard should look something like this:</para>
<programlisting>Section "InputDevice"
Identifier "Keyboard1"
Driver "kbd"
Option "Protocol" "evdev"
Option "Dev Name" "SILITEK USB Keyboard"
Option "Dev Phys" "usb-*/input0"
Option "AutoRepeat" "250 30"
Option "XkbRules" "xfree86"
Option "XkbModel" "pc101"
Option "XkbLayout" "dvorak"
EndSection</programlisting>
<para>For Dev Name and Dev Phys, the wildcats <quote>?</quote> and <quote>*</quote> work, you MUST have at least one of the two, if you have both then the device must match on both, a non-existent entry is the same as one consisting of <quote>*</quote>.</para>
</sect1>
<sect1id="tweak_input_devs-phys">
<title>Using the <quote>Phys</quote> descriptor and USB devices</title>
<para>Using the <quote>Phys</quote> descriptor of input devices simplifies a lot the configuration of input devices in XFree, especially when a bigger number of displays are used.</para>
<para>As USB devices are connecting in a tree form, you can really easy specify the way keyboard and mice devices are bound to a specified X display. You have to use one USB hub with number of ports equal(or bigger) to the number of the X displays, to this hub are connected smaller (2-4 port) hubs (or keyboards with integrated hub). To the first port of the smaller (integrated) hub are connected the keyboards, to the second the mice (in case there are free ports you can connect usb-audio devices to them :) ). This results in the following layout of the usb-id's in case the primary USB hub is the first USB device :</para>
<note>
<para>In the following explanations and examples I use for first device on the secondary(integrated) hub keyboard device because my keyboard is internally connected to the 1st port of the integrated hub. I assume this will apply for most of the keyboards with integrated hub, but in case the one you own uses different port you will have to make small adjustments.</para>
</note>
<itemizedlist>
<listitem>
<para>on the 1st port of the primary hub</para>
<itemizedlist>
<listitem><para>1.1 USB hub (integrated)</para></listitem>
<listitem><para>1.1.1 USB keyboard</para></listitem>
<listitem><para>1.1.2 USB mouse</para></listitem>
<listitem><para>(1.1.3 usb-audio/other usb device)</para></listitem>
</itemizedlist>
</listitem>
<listitem>
<para>on the 2nd port</para>
<itemizedlist>
<listitem><para>1.2 USB hub (integrated)</para></listitem>
<listitem><para>1.2.1 USB keyboard</para></listitem>
<listitem><para>1.2.2 USB mouse</para></listitem>
<listitem><para>(1.2.3 usb-audio/other usb device)</para></listitem>
</itemizedlist>
</listitem>
<listitem>
<para>on the 3rd port</para>
<itemizedlist>
<listitem><para>1.3 USB hub (integrated)</para></listitem>
<listitem><para>1.3.1 USB keyboard</para></listitem>
<listitem><para>1.3.2 USB mouse</para></listitem>
<listitem><para>(1.3.3 usb-audio/other usb device)</para></listitem>
</itemizedlist>
</listitem>
<listitem>
<para>on the 4th port</para>
<itemizedlist>
<listitem><para>1.4 USB hub (integrated)</para></listitem>
<listitem><para>1.4.1 USB keyboard</para></listitem>
<listitem><para>1.4.2 USB mouse</para></listitem>
<listitem><para>(1.4.3 usb-audio/other usb device)</para></listitem>
</itemizedlist>
</listitem>
</itemizedlist>
<para>Based on this we can bind all devices connected to a specified USB port to a given X server.</para>
<sect2id="tweak_input_devs-inputAgent2">
<title>... with Input Agent</title>
<para>An example for a 4-user system using the <quote>Phys</quote> descriptor with Input Agent and USB input devices.</para>
<para>We'll use the <quote><command>vt[n]</command></quote> parameter when starting X and the following configuration file for the keyboards:</para>
<programlisting>
#
# keyboard configuration
#
# vt_name device_physicaly_location
VT0 usb-*.*-1.1.1/input0
VT1 usb-*.*-1.2.1/input0
VT2 usb-*.*-1.3.1/input0
VT3 usb-*.*-1.4.1/input0
</programlisting>
<para>For mouse devices the configuration file will look like this:</para>
<programlisting>
#
# mouse device configuration
#
# sym_link device_physicaly_location
mouse0br usb-*.*-1.1.2/input0
mouse1br usb-*.*-1.2.2/input0
mouse2br usb-*.*-1.3.2/input0
mouse3br usb-*.*-1.4.2/input0
</programlisting>
<para>and we have to adjust the XFree configuration files, so XFree uses the symbolic links instead of the actual devices. If you already configured independent mice you have only to append <quote>br</quote> to each of the mouse devices.</para>
<para>Change each <quote>/dev/input/mouse[n]</quote> to <quote>/dev/input/mouse[n]br</quote>.</para>
# ChordMiddle is an option for some 3-button Logitech mice
Option "Emulate3Buttons"
# Option "ChordMiddle"
EndSection
Section "InputDevice"
Identifier "Mouse2"
Driver "mouse"
Option "Protocol" "IMPS/2"
Option "Device" "/dev/input/mouse1br"
Option "ZAxisMapping" "4 5"
# ChordMiddle is an option for some 3-button Logitech mice
Option "Emulate3Buttons"
# Option "ChordMiddle"
EndSection
......
</programlisting>
</sect2>
<sect2id="tweak_input_devs-Xev2">
<title>... with XFree with event interface support</title>
<para>Using the <quote>Dev Phys</quote> option of XFree with event device support and USB input devices enables us to use almost identical configuration of the input devices for all X servers. The only difference will be in the part of the usb-id, which reflects the port of the primary USB hub.</para>
<note><para>The examples below are for multiple XFree configuration files, if you use a single XFree configuration file you have to adjust the identifiers.</para></note>
<para>The configuration for the input devices for the 1st display would look something like this:</para>
<programlisting>
Section "InputDevice"
Identifier "Keyboard1"
Driver "kbd"
Option "Protocol" "evdev"
Option "Dev Phys" "usb-*-1.1.1/input0"
Option "AutoRepeat" "250 30"
Option "XkbRules" "xfree86"
Option "XkbModel" "pc101"
Option "XkbLayout" "dvorak"
EndSection
Section "InputDevice"
Identifier "Mouse1"
Driver "mouse"
Option "Protocol" "evdev"
Option "Dev Phys" "usb-*-1.1.2/input0"
Option "ZAxisMapping" "4 5"
EndSection</programlisting>
<para>For the 2nd display something like this:</para>
<programlisting>
Section "InputDevice"
Identifier "Keyboard1"
Driver "kbd"
Option "Protocol" "evdev"
Option "Dev Phys" "usb-*-1.2.1/input0"
Option "AutoRepeat" "250 30"
Option "XkbRules" "xfree86"
Option "XkbModel" "pc101"
Option "XkbLayout" "dvorak"
EndSection
Section "InputDevice"
Identifier "Mouse1"
Driver "mouse"
Option "Protocol" "evdev"
Option "Dev Phys" "usb-*-1.2.2/input0"
Option "ZAxisMapping" "4 5"
EndSection</programlisting>
<para>For the 3rd display something like this:</para>
<programlisting>
Section "InputDevice"
Identifier "Keyboard1"
Driver "kbd"
Option "Protocol" "evdev"
Option "Dev Phys" "usb-*-1.3.1/input0"
Option "AutoRepeat" "250 30"
Option "XkbRules" "xfree86"
Option "XkbModel" "pc101"
Option "XkbLayout" "dvorak"
EndSection
Section "InputDevice"
Identifier "Mouse1"
Driver "mouse"
Option "Protocol" "evdev"
Option "Dev Phys" "usb-*-1.3.2/input0"
Option "ZAxisMapping" "4 5"
EndSection</programlisting>
<para>and so on.</para>
<para>You could also use the <quote>?</quote>, so wherever you plug the primary hub, all displays will still have the desired configuration.</para>
<programlisting>
Section "InputDevice"
Identifier "Keyboard1"
Driver "kbd"
Option "Protocol" "evdev"
Option "Dev Phys" "usb-*-?.1.1/input0"
Option "AutoRepeat" "250 30"
Option "XkbRules" "xfree86"
Option "XkbModel" "pc101"
Option "XkbLayout" "dvorak"
EndSection
Section "InputDevice"
Identifier "Mouse1"
Driver "mouse"
Option "Protocol" "evdev"
Option "Dev Phys" "usb-*-?.1.2/input0"
Option "ZAxisMapping" "4 5"
EndSection
</programlisting>
</sect2>
</sect1>
</chapter>
<chapterid="dm_conf">
<title>Configuring display managers</title>
<para>If you have successfully finished the installation and configuration of the kernel and XFree, it's time to configure your display manager(s).</para>
<para>Beside the grafical differences, xdm/kdm and gdm handle differently the X servers. gdm will start the X servers in the order specified in it's configuration file (and stop them in the reverse order). xdm/kdm will start and stop all the X servers at the same time(in case there are no opened X sessions). Also restarting the gdm demon means end for all X sessions, but if you restart xdm/kdm when you are under X your session won't be closed.</para>
<itemizedlist>
<listitem><para>Using gdm could help you to retain the VGA console.</para></listitem>
<listitem><para>Using xdm/kdm allows you to switch it's configuration retaining your opened X session(of course the changes shouldn't affect the X server you are using).</para></listitem>
</itemizedlist>
<note>
<itemizedlist>
<listitem>
<para>For the new Preferred Bus ID XFree Server you have to also specify the desired graphic card with parameter <quote><command>-prefbusid x:x:x</command></quote>, where x:x:x is the Bus ID of the desired graphic card.</para>
<itemizedlist>
<listitem><para>For AGP cards, something similar to <command>-prefbusid 1:0:0</command></para></listitem>
<listitem><para>For PCI cards, something similar to <command>-prefbusid 0:x:0</command>, x is normally the IRQ number.</para>
</listitem>
</itemizedlist>
</listitem>
<listitem>
<para>In the following explanation I will not use this option. If you use the Preferred Bus ID X server just append <quote><command>-prefbusid x:x:x</command></quote> with the correct Bus ID of the card you want to start right before the last argument <command>vt[x]</command>.</para>
</listitem>
</itemizedlist>
</note>
<sect1id="dm_conf-xdm_kdm">
<title>Configuring xdm and kdm</title>
<para>If everything is working now, it's time to setup the automatic starting of X on all displays. For xdm and kdm you have to modify one single file. For a Red Hat-like system this would be <filename>/etc/X11/xdm/Xservers</filename>; for other distributions check whether this file exists. If not, find your XFree86 configuration directory, and in it you'll find <filename>xdm/Xservers</filename>. </para>
<para><filename>/etc/X11/xdm/Xservers</filename> for xdm</para>
</listitem>
<listitem>
<para><filename>/etc/opt/kde3/share/config/kdm/Xservers</filename> for kdm </para>
</listitem>
</itemizedlist>
<para>you can make a backup copy of <filename>/etc/opt/.../kdm/Xservers</filename> and make a symbolic link from <filename>/etc/X11/xdm/Xservers</filename> to <filename>/etc/opt/../kdm/Xservers</filename>, in order to use the same configuration file for xdm and kdm.</para>
</note>
<note>
<para>Debian uses:</para>
<itemizedlist>
<listitem>
<para><filename>/etc/kde3/kdm/Xservers</filename> for kdm </para>
</listitem>
</itemizedlist>
<para>you can make a backup copy of <filename>/etc/kde3/kdm/Xservers</filename> and make a symbolic link from <filename>/etc/X11/xdm/Xservers</filename> to <filename>/etc/kde3/kdm/Xservers</filename>, in order to use the same configuration file for xdm and kdm.</para>
<para>For every additional X server you should add a single line. You can copy the existing line, change the X server binary and display number, and append <option>-xf86config</option> [your configuration file]. My original xdm/Xservers:
<para>gdm, as a complete rewrite of xdm, uses its own configuration file, <filename>/etc/X11/gdm/gdm.conf</filename>. You should locate the definitions of the local X servers and add additional X servers for the number of cards you have.
<para>In case you do not use devfs, you may need to create additional device files. Take a look at <ulinkurl="http://www.tldp.org/HOWTO/Sound-HOWTO/index.html">The Linux Sound HOWTO</ulink>, for information on how to setup additional sound cards.</para>
</note>
<sect2>
<title>Using arts demon (artsd)</title>
<para>We have to specify different sound devices for the different Xsessions/Displays. This is done by using the following options of artsd:</para>
<itemizedlist>
<listitem>
<para>By OSS-free sound driver:</para>
<programlisting>-D /dev/dsp[n]</programlisting>
<para>where n is the number of the sound card.</para>
artsd -F 10 -S 4096 -a alsa -D hw:2,0 -s 5 -m artsmessage -l 3 -f &
;;
esac
/usr/X11R6/bin/enlightenment
artsshell -q terminate
</programlisting>
<para>This will start 3 arts demons for 3 X servers.</para>
<orderedlist>
<listitem>
<para>Demon will use the first OSS sound device for the 1st X server.</para>
</listitem>
<listitem>
<para>Demon will use the second OSS sound device for the 2nd X server.</para>
</listitem>
<listitem>
<para>Demon will use the Alsa sound device for the 3rd X server (requires feedback).</para>
</listitem>
</orderedlist>
</sect2>
</sect1>
<sect1id="automation_login_screen">
<title>Customising the login screen</title>
<sect2>
<title>Using xdm</title>
<para>Copy <filename>/etc/X11/xdm/Xsetup_0</filename> to <filename>/etc/X11/xdm/Xsetup_1</filename>. For additional X servers, create the file(s) <filename>/etc/X11/xdm/Xsetup_[n]</filename>, where n is the number of the X server starting from 0.</para>
<orderedlist>
<listitem>
<para>Modify the line containing the background image, to adjust the path to your image for the 2nd X server:</para>
<programlisting>
....
if [ -r /usr/share/mdk/backgrounds/default.png -a -x /usr/bin/qiv ]; then
<para>Repeat the procedure for each additional X server.</para>
</listitem>
<listitem>
<para>Check here for additional customising options: <ulinkurl="http://www.linuxjournal.com/article.php?sid=3325">Linux-Journal Issue 68: Linux Apprentice: Customising the XDM Login Screen</ulink>.</para>
</listitem>
</orderedlist>
</sect2>
<sect2>
<title>Using kdm</title>
<para></para>
<itemizedlist>
<listitem>
<para>I'm not really sure. This area requires feedback. </para>
<para>Check for additional customising options at the KDE Help Center.</para>
</listitem>
</itemizedlist>
</sect2>
<sect2>
<title>Using gdm</title>
<para>This requires <filename>gdmlogin</filename> to be used instead of <filename>gdmgreater</filename>, because using different themes for different displays is not yet implemented in gdm. In case you want to use gdm themes you'll have the same theme on all displays.</para>
<orderedlist>
<listitem>
<para>Switch to gdmlogin by making this changes in <filename>/etc/X11/gdm/gdm.conf</filename></para>
<para>From:</para>
<programlisting>.....
# Greeter for local (non-xdmcp) logins. Change gdmlogin to gdmgreeter to
# get the new graphical greeter.
Greeter=/usr/bin/gdmgreeter
.....
</programlisting>
<para>to </para>
<programlisting>.....
# Greeter for local (non-xdmcp) logins. Change gdmlogin to gdmgreeter to
# get the new graphical greeter.
Greeter=/usr/bin/gdmlogin
.....</programlisting>
</listitem>
<listitem>
<para>Copy the file <filename>/etc/X11/gdm/Init/Default</filename> to <filename>/etc/X11/gdm/Init/:0</filename>, and <filename>/etc/X11/gdm/Init/:1</filename></para>
</listitem>
<listitem>
<para>Add these lines to use the background that kdm uses (you can use another image file as well, just change the full path to it):</para>
<programlisting>
if [ -r /usr/share/mdk/backgrounds/default.png -a -x /usr/bin/qiv ]; then
<para>Repeat the procedure for each additional X server, using file(s) <filename>/etc/X11/gdm/Init/:[n]</filename>, where n is the number of the display.</para>
</listitem>
<listitem>
<para>Check here for additional customising options: <ulinkurl="http://www.ibiblio.org/oswg/oswg-nightly/oswg/en_US.ISO_8859-1/articles/gdm-reference/gdm-reference/">Gnome Display Manager Reference Manual</ulink>.</para>
<para>A small part of the Mandrake init scripts <filename>/etc/rc.d/rc.sysinit</filename> (you can append it to yours if you are missing something similar):</para>
<para>Move your <filename>XF86Config-4</filename> file (the one for standard kernel) to <filename>XF86Config-4.standard</filename>, create a symbolic link from it to <filename>XF86Config-4</filename>, and move the <filename>XF86Config-4</filename> file (the one for Backstreet Ruby) to <filename>XF86Config-4.bruby</filename>. For Ruby/Backstreet Ruby kernels, add to the append line in <filename>/etc/lilo.conf</filename>, or on boot prompt <quote>XFree=bruby</quote>, leave the standard kernel as is.</para>
<para>Results:</para>
<para>Booting with <quote>XFree=standard</quote> or without <quote>XFree=</quote> (boot prompt or <filename>lilo.conf</filename>) will result in linking <filename>XF86Config-4.standard</filename> to <filename>XF86Config-4</filename>; booting with <quote>XFree=bruby</quote> will link <filename>XF86Config-4.bruby</filename> to <filename>XF86Config-4</filename>, so in both scenarios XFree can be started with the proper configuration file for the first X server.</para>
<para>And what about the other X servers?</para>
<para>Under a standard kernel you cannot use several independent X servers, so you should use the other XFree configuration files only under Ruby/Backstreet Ruby - there is no need for different configuration files under standard & bruby kernels.</para>
</sect1>
<sect1id="auto_dm_confs">
<title>Number X servers started by Display managers</title>
<para>Here is a modified version of the previous approach. Add this to your init scripts (I bet it's missing!):</para>
<para>This will adjust the proper <filename>/etc/X11/xdm/Xservers</filename> and <filename>/etc/X11/gdm/gdm.config</filename> according to the boot line argument dumbcon=n (remember n+1= number of X users/sessions).</para>
<para>You have to create the configuration files following these assumptions:</para>
<para><quote>i</quote> only stands for <filename>/etc/X11/xdm/Xserver</filename> and <filename>/etc/X11/gdm/gdm.conf</filename>.</para>
<itemizedlist>
<listitem>
<para><quote>i.0</quote> is used for a single X server, when dumbcon=n is not specified, or dumbcon=0.</para>
</listitem>
<listitem>
<para><quote>i.1</quote> is used by the display manager when dumbcon=1 is specified.</para>
</listitem>
<listitem>
<para><quote>i.2</quote> is used by the display manager when dumbcon=2 is specified.</para>
</listitem>
<listitem>
<para><quote>i.3</quote> is used by the display manager when dumbcon=3 is specified.</para>
</listitem>
</itemizedlist>
<para>...and so on.</para>
<para>Therefore:</para>
<itemizedlist>
<listitem>
<para><quote>i.0</quote> should contain the definition only of your original standard X server.</para>
</listitem>
<listitem>
<para><quote>i.1</quote> should contain the definitions for 2 X servers.</para>
</listitem>
<listitem>
<para><quote>i.2</quote> should contain the definitions for 3 X servers.</para>
</listitem>
<listitem>
<para>...and so on.</para>
</listitem>
</itemizedlist>
<para>If you boot without dumbcon=n or with dumbcon=0 (for example a standard kernel),
your display manager will start a single X server with the corresponding XF86Config file.</para>
<para>If you start with dumbcon=1 the display manager will automatically start 2 X servers.</para>
<para>If you start with dumbcon=2, when booting is finished you'll get 3 login prompts on your
3 displays.</para>
<para>Keep in mind that each X server should have it's own configuration file, and it should be specified in the display manager configuration file properly. Take a look at the configuration files before restarting with an activated display manager and this addition to your init scripts.</para>
<para>This can also be used if you have a single XFree configuration file (see <xreflinkend="no_dri"/>, <quote>For graphic cards without DRI</quote>). In this case you will have to specify the correct layout instead of the correct XFree configuration file.</para>
</sect1>
<sect1id="dyn_switch_num_x_serv">
<title>Dynamically switching the number of X servers</title>
<para>There is a very experimental GUI/CLI for dynamically switching the number of running X servers. It uses the automatic configuration of the display managers (mentioned in <xreflinkend="automation_multy_snd-cards"/>), Python, dialog for the CLI, and Xdialog for the GUI.</para>
<para>Once it is more tested and bug-free, you could, for example, use it under Backstreet Ruby to switch between 2, 3 or more X servers and a single X server using Xinerama. So when your PC isn't used by more then one user, you could use the other monitors under Xinerama. Or one more funny example: you're simulating net gaming with a number of friends on your bruby Linux PC, you have invested a bit more in an additional graphic card which is already configured, but you don't have enough money right now to buy one more monitor and keyboard/mouse pair. One friend of yours comes and says, <quote>Hey guys, that's cool. Can I join?</quote> What would you answer? Using the GUI could result in the following answer from your side: <quote>No problem, just bring your monitor,keyboard and mouse.</quote></para>
<para>If you are feeling like a hacker and want to try out this BUGGY GUI/CLI, check the current status at <ulinkurl="http://varna.demon.co.uk/~svetlio/ruby-contrib/bruby-python/">http://varna.demon.co.uk/~svetlio/ruby-contrib/bruby-python/</ulink>. But remember, it's not very tested, and if not configured properly it can cause you serious troubles. Please wait until it is more stable if you are not that familiar with Linux. If you feel comfortable enough under Linux, and think of yourself as a hacker, please help in testing it and making it better, bug-free and easy to configure.
</para>
<para></para>
</sect1>
</chapter>
<chapterid="problems">
<title>Known problems</title>
<sect1id="hard_problems">
<titleid="software">Hardware problems</title>
<para>While not exactly problems, some graphic cards do not work well, or even at all in multi-user environments.</para>
<para>If you are building such a system from the beginning, check the Video Compatibility list before buying video hardware.</para>
</sect1>
<sect1id="soft_problems">
<title>Software problems</title>
<para>For details on solving software problems see <xreflinkend="distro_spec"/>, <quote>Special notes on some distributions.</quote></para>
<sect2id="inco_progs">
<title>Incompatible userspace program:s</title>
<orderedlist>
<listitem>
<para>gpm - freezy mouse under XFree86. With the current XFree86 you are losing VGA virtual consoles anyway.</para>
<para>You should change the lines including <quote><filename>/dev/tty[0-8]</filename></quote> to <quote><filename>/dev/tty[0-7]</filename></quote>.</para>
<para>Replacing <filename>sysfont</filename> with <filename>consolechars</filename>.</para>
<para>< needs to be written ></para>
<para>Rebuild <filename>console-tools-19990829-40.src.rpm</filename> using <command>rpmbuild --rebuild console-tools-19990829-40.src.rpm</command>. You can find the source rpm on <ulinkurl="http://www.rpmfind.net"></ulink>).</para>
# The variable NON_SUSE_KERNEL determines whether we need to chvt
# to a console before some console settings apply.
# We have no magic to find out about this (at boot time), so we
# leave it to the user to read this comment and put NON_SUSE_KERNEL="yes"
# into /etc/sysconfig/console
KBDBASE="/usr/share/kbd"
KBD_TTY="tty0 tty2 tty3 tty4 tty5 tty6 tty7"
KTABLE=${KEYTABLE%.map*}
KTABLE=${KTABLE##*/}
#
# first search the wanted keytable.
#
if [ $MACHINE = ppc -o $MACHINE = ppc64 ]; then
test -f /proc/cpuinfo || mount -n -t proc proc /proc 2>/dev/null
while read line; do
......
......
</programlisting>
</listitem>
<listitem>
<para>Hardware scans sometimes cause problems.</para>
<para>Recommended: disable. If you have to install new hardware and want to use this service, boot with standard kernel and start it manually.</para>
</listitem>
</orderedlist>
</sect1>
</chapter>
<chapterid="final_words">
<title>Final words</title>
<para>Have some comments? Send them to Svetoslav Slavtchev, <email>galia (at) st-peter.stw.uni-erlangen.de</email>.</para>
<para>Difficulty understanding the HOWTO? Some parts are not clear? Drop a line to the above address.</para>
<para>Difficulty configuring your system to run multiple independent X sessions using this HOWTO? Send your problems to the email address above.</para>
<para>You got it running? Congratulations! Drop a line, give some details on your configuration and attach your XFree configuration files.</para>
</chapter>
<appendixid="app_vid_comp">
<title>Video Compatibility list</title>
<para>This is an extract from the Video Compatibility list at the Backstreet Ruby home page.</para>
<sect1id="app_vid_comp_fine">
<title>Graphic card pairs/triples that work perfectly</title>
<sect2>
<titleid="app_vid_comp_x_orig">Modified X server not needed</title>
<para>This can be acomplished by manually starting X or using gdm as desktop manager. You'll have to abstain from using xdm or kdm, as they start the X servers at the same time.</para>
<para>The new X server patch (XFree-4.3-prefbusid) fixes most of the problems. In case the X servers are started in the right order there are no lock ups.</para>