Thursday, July 26, 2007

How I made my linux Multiseat X setup using faketty

I haven't updated my blog in a long time, but I decided to post my multiseat setup using faketty, hoping it's useful to someone.

My setup is pretty simple (only two heads), but I wasn't able to get it to work using userful [1], and I had various keyboard troubles using evdev.

Hardware:
Pentium III 800mhz
256Mb RAM
nVidia Geforce 2 MX 400 (nv driver)
S3 Virge DX (s3virge driver)

Software:
Ubuntu Linux 6.10
(Should work with 7.04; faketty 0.06 doesn't compile with linux >= 2.6.22, so you will have problems under 7.10)

I pretty much followed the wikibooks faketty guide [2], except for the xorg probe stuff, I didn't need it. If you hack you own xorg.conf (like I did), don't forget to include
Option          "CorePointer"
on each mouse.

For reference, you'll find my xorg.conf and gdm.conf at the end of this post.

The problem with faketty is that /dev symlinks go away each boot, and the ftty's also like to change once in a while.

So I did a script, called findkeyb.sh, that runs every boot before gdm and sets up the symlinks:

#!/bin/bash

# This script finds keyboards and sets up the tty symlinks for use with
# multiseat and faketty

# how many keyboards are there
QT_TEC=`cat /proc/bus/input/devices | grep Keyboard -A 3 | grep -v Name \
| grep -v "Sys" | grep -v "\-\-" | grep input0 -A 1 | grep -v "\-\-" \
| grep -v "input" | wc -l`

echo "$QT_TEC keyboards:"
cat /proc/bus/input/devices | grep Keyboard -A 3 | grep -v Name | grep -v "Sys" \
| grep -v "\-\-" | grep input0 -A 1 | grep -v "\-\-" \
| grep -v "input" | awk '{print $4;}'

echo "$QT_TEC keyboards:" > /findkeyb.log
cat /proc/bus/input/devices | grep Keyboard -A 3 | grep -v Name | grep -v "Sys" \
| grep -v "\-\-" | grep input0 -A 1 | grep -v "\-\-" | grep -v "input" \
| awk '{print $4;}' >> /findkeyb.log

TEC=`cat /proc/bus/input/devices | grep Keyboard -A 3 | grep -v Name \
| grep -v "Sys" | grep -v "\-\-" | grep input0 -A 1 | grep -v "\-\-" \
| grep -v "input" | awk '{print $4;}'`

COUNTER=50
for i in $TEC; do
rm -f /dev/tty$COUNTER
ln -s /dev/$i /dev/tty$COUNTER
let COUNTER=COUNTER+1
done

I added symlinks to this script to /etc/rc.2, rc3.d, rc4.d and rc5.d (ugly ugly hack, heh).
ln -sf  /etc/rc.2/S11keyb
ln -sf /etc/rc.3/S11keyb
ln -sf /etc/rc.4/S11keyb
ln -sf /etc/rc.5/S11keyb

Hope this helps, and soon someone comes up with an easier way to set up multiseat.

Links:
[1] Userful Desktop Multiplier / Desktop Server
[2] http://en.wikibooks.org/wiki/Multiterminal_with_faketty
[3] Faketty 0.06
[4] Other faketty versions and multiseat patches

Files:
xorg.conf
findkeyb.sh
gdm.conf
faketty-0.06.tar.bz2

Multiseat links not related to my setup (but might be useful):

MULTILINUX
netpatia (ubuntu)
Multiterminal with Xephyr - Wikibooks, collection of open-content textbooks
HOWTO Multiseat X - Gentoo Linux Wiki
Multiseat X Under X11R6.9/7.0 - Chris Tyler's Blog
Build a Six-headed, Six-user Linux System
Multiseat Linux - One computer, multiple monitors, mice, and keyboards - Linux Agora Forums
Multiseat - Wikipedia, the free encyclopedia
BeTwin 2000/XP
Slashdot | Multiple Desktop Users on a Single Machine?
http://en.wikibooks.org/wiki/Multiterminal_with_Xnest