Personal tools
You are here: Home Projects 3 Headed Monster
Document Actions

3 Headed Monster

The three-headed monster is a project to use one Pentium-III with three users at the same time.

THREE HEADED MONSTER HOWTO

Running a multi-user XFree86 on one machine

Introduction

The "three headed monster" is a linux PC running three simultanious, independent X sessions for three users at the same time. Each user has it's own monitor, keyboard and mouse. Other hardware is shared between the users.

Keywords: XFree86 multi-user dual-head triple-head multiple keyboard, multiple mouse, multiple video card, dual keyboard, multiple local XFree users, multiple local X servers.

About this document

This document was written as a resume of my own experience in building such a machine in ASCII (non profit internet workspace), Amsterdam, in february 2003. During the proces of building i used information from different sources, but these ones were crucial:

http://linuxdocs.org/HOWTOs/Xinerama-HOWTO.html

This is the Xinerama Howto. Read it, because it tells you how X would handle more than one monitor when they work together as one console. Get this to work first!!! If you dont do this, you might well find yourself trying to fix a very low level hardware problem while working with a homebrew patched X-version you cannot trust either.

http://www.linuxplanet.com/linuxplanet/tutorials/3100/1/

This is an article about multi-head X on a normal linux system. All it requires is a patched version of XFree86. I did not get it to work, because apparently my (Riva TNT2) videocards were a bit dodgy (they locked up each other). It might work with these cards if you use the commercial nvidia driver for it, i did not have a change to test that yet.

A newer version of the same document (with newer patched binaries) can be found here:

http://cambuca.ldhs.cetuc.puc-rio.br/multiuser/

http://startx.times.lv/

The Backstreet Ruby project page. This page has all you need, allthough the documentation might look a bit unclear. I used the kernel-patch and patched X-version from this page.

http://www.nvidia.com/view.asp?IO=linux_display_ia32_1.0-4191

If you happen to use the same video hardware i did: the Backstreet Ruby patch does NOT work with the default nv XFree86 driver. You have to download the nvidia binary driver from their website to get it to work.

This document was written by Jaap (jaap at squat dot net) . If you have any comments or corrections, let me know.

What you need

To create your own version of the "three-headed monster", you need:

  • hardware:
  • A machine that houses three video cards. Use "decent" cards i.e. cards that work fine under XFree86 version 4 independently.
  • Enough connectors on your machine. My machine has two serial ports, two times PS/2 (keyboard and mouse) and two times USB. So i could connect:
    • two ps/2 keyboards (yes, one on the mouse port)
    • two serial mice
    • one usb keyboard
    • one usb mouse

Make sure you have all this hardware and make sure it works. Test all mice under X, make sure the usb keyboard works (you should be able to type both on the ps/2 and the usb keyboard). The keyboard connected to the ps/2 mouse port will not work yet, but we'll fix that later.

Any other combination of hardware should also work, but make sure to resolve all possible hardware problems before you go on. Test!

Step one: getting as much as possible to work under normal X

XFree86 version 4 uses the "layout" section to store different setups in one XF86Config-4 configuration file. We will use this to test all the hardware on the system.

First, we make a section for every device:

  Section "InputDevice"
Identifier "Keyboard0"
Driver "keyboard"
Option "XkbRules" "xfree86"
Option "XkbModel" "pc101"
Option "XkbLayout" "us_intl"
EndSection

For keyboards, there's no need for a section per keyboard. For now, there's only one keyboard recognized. The USB keyboard shouls also work, as the support for it is built into the kernel, not into XFree86.

  Section "InputDevice"
Identifier "Mouse0"
Driver "mouse"
Option "CorePointer"
Option "Device" "/dev/ttyS0"
Option "Protocol" "MicroSoft"
Option "Emulate3Buttons" "true"
EndSection

Section "InputDevice"
Identifier "Mouse1"
Driver "mouse"
Option "CorePointer"
Option "Device" "/dev/ttyS1"
Option "Protocol" "PS/2"
Option "Emulate3Buttons" "true"
EndSection


Section "InputDevice"
Identifier "Mouse2"
Driver "mouse"
Option "SendCoreEvents" "true"
Option "Device" "/dev/input/mice"
Option "Protocol" "ImPS/2"
Option "ZAxisMapping" "4 5"
Option "Buttons" "5"
EndSection

For each mouse, you make a section. Later you will have to test them one by one and make sure they work as they should.

  Section "Monitor"
Identifier "Monitor0"
HorizSync 30-57
VertRefresh 43-72
EndSection

Section "Monitor"
Identifier "Monitor1
HorizSync 30-57
VertRefresh 43-72
EndSection


Section "Monitor"
Identifier "Monitor2"
HorizSync 30-57
VertRefresh 43-72
EndSection

For each monitor, make sure you have a working configuration here. If a monitor needs a special ModeLine, make sure the right monitor has it.

  Section "Device"
Identifier "video0"
Driver "nvidia"
BusID "agp:01:00:0"
EndSection

Section "Device"
Identifier "video1"
Driver "nvidia"
BusID "pci:00:09:0"
EndSection


Section "Device"
Identifier "video2"
Driver "nvidia"
BusID "pci:00:10:0"
EndSection

The BusID is the tricky part here. Each videocard (even if it's AGP!) has a PCI bus id, that you can see if you type lspci. Note that lspci gives the values in hexadecimal and XF86Config-4 needs them to be decimal, so 0a becomes 10.

With the BusID you tell XFree86 which video card you mean, so if you do something wrong here you get the wrong video card to react (or not react at all).

  Section "Screen"
Identifier "screen0"
Device "video0"
Monitor "Monitor0"
DefaultDepth 24
SubSection "Display"
Depth 24
Modes "1024x768" "800x600" "640x480"
EndSubSection
EndSection

Section "Screen"
Identifier "screen1"
Device "video1"
Monitor "Monitor1"
DefaultDepth 24
SubSection "Display"
Depth 24
Modes "1024x768" "800x600" "640x480"
EndSubSection
EndSection


Section "Screen"
Identifier "screen2"
Device "video2"
Monitor "Monitor2"
DefaultDepth 24
SubSection "Display"
Depth 24
Modes "1024x768" "800x600" "640x480"
EndSubSection
EndSection

The Screen section brings your monitor and video card together. Follow the wire, make sure they are actually connected to each other...

  Section "ServerLayout"
Identifier "Layout0"
Screen "Screen0"
InputDevice "Mouse0" "CorePointer"
InputDevice "Keyboard0" "CoreKeyboard"
EndSection

Section "ServerLayout"
Identifier "Layout1"
Screen "Screen1"
InputDevice "Mouse1" "CorePointer"
InputDevice "Keyboard0" "CoreKeyboard"
EndSection


Section "ServerLayout"
Identifier "Layout2"
Screen "Screen2"
InputDevice "Mouse2" "CorePointer"
InputDevice "Keyboard0" "CoreKeyboard"
EndSection

Now we're getting somewhere! The layouts combine all hardware.

You should now be able to do (one at a time):

  • X -layout Layout0
  • X -layout Layout1
  • X -layout Layout2

All of them should work, i.e. have a different working monitor and different moving mouse.

Upgrading your kernel

What you did till now did not require any non-standard software. Do not go on after this point if it didn't all work! It will only get more confusing if you do.

To get Linux to accept more then one keyboard at the same time, we'll have to patch the kernel. Linux keyboard support (at least in version 2.4) is still assuming a computer has a keyboard, and not more than one. Any other keyboard will be added to the same console, so you can both type at the same email.

I used the Backstreet Ruby driver to let Linux know about more than one console. If you try another one, please let me know your experiences!

The Backstreet Ruby driver can be downloaded from: http://startx.times.lv/download.html

i used the 2.4.20 patch (local copy here)

If you never compiled a kernel for your system before, do that first (without the patch) and make sure it works and all your hardware is supported. Then apply the patch:

cd /usr/src/linux-2.4.20

bzcat /path/to/patch/bruby-2.4.20-20021226.bz2 |patch -p1

There are a few things you should change when using this patch:

Input device support --->

Input device support

i8042 aux+kbd controller

AT and PS/2 keyboards

PS/2 mouse

Mouse interface

Event interface

Input device support --->

Serial port input line discipline

Serial mouse

Mouse interface

Event interface

Character devices --->

Virtual terminal

Support for console on virtual terminal

Serial Support->

Standard/generic (8250/16550 and compatible UARTs) serial support

Support for frame buffer devices (EXPERIMENTAL)

Frame-buffer support --->

--- Console drivers

VGA text console

Dumb device console

Video mode selection support

MDA text console (EXPERIMENTAL)

NVIDIA hardware text console

Support for frame buffer console

Select compiled-in fonts

FIXME: these values come from the kernel install docs and were not entirely right.

Note that framebuffer support should not be selected, as it is not supported by this patch (yet).

If you get confused, read http://startx.times.lv/quickeng.html for more info. Note that the kernel options on that page seem to be outdated.

Make links to your usb devices:

I suppose your distribution does know about usb so /dev/input and it's contents do exist. If not, see the above document for how to make them. If you do have /dev/input, you will need some extra links in /dev:

ln -s input/js0 js0 for your first usb keyboard

ln -s input/js1 js1 for your second usb keyboard

ln -s input/mice mouse for a usb mouse

Install your kernel and reboot. Your machine should still work, but your usb keyboard (that used to type on the same console) should not work any more.

Installing the patched XFree86

I was lucky: my X version was identical to the 4.2.0 binaries on http://startx.times.lv/. You might have to compile your own version. If not:

  • download the binary
  • move it to /usr/X11R6/bin/XFree86-patched

do: ln -s XFree86-patched X0

ln -s XFree86-patched X1

ln -s XFree86-patched X2

in /usr/X11R6/bin

(this is just so you can see which process is what with ps auxw).

Now you should be able to start:

startx
X0 -layout Layout0 vt7
startx
X1 -layout Layout1 vt8
startx
X2 -layout Layout2 vt16

FIXME: a short story on how to get gdm to start on all screens.

Bugs:

If you get permission denied errors on /var/log orso, try chmod ug+s on the X binary you are using.

--------------------------------

This howto was last updated: February 25, 2003

Jaap