Multiseat Configuration/Xnest

This article describes a way to make a Multiterminal with Xnest. For other ways, see multiterminal.

There are modifications in Xnest that make possible to use it in order to implement a multiterminal system. The system is configured to run one X server controlling all video cards, and one Xnest for each screen, running above the main X server.

Contents

Xnest is an X server that runs inside another X server. Xnest is both an X client and an X server, simultaneously. Xnest is a client of the real X server, but also a server to its own clients. Xnest is normally used to allow working on two or more desktops at the same time, however, we've made modifications in its code to make possible to use Xnest to implement a multiterminal system.

The system works in the following way. Only one "real" X server is run, configured to use several screens, each of which will be associated to one video card. After the X start-up, one Xnest is run inside each screen. Each user will use one Xnest, in a transparent way.

The original Xnest gets the input devices events from its parent X server. However, to allow Xnest to be used in the multiterminal, we had to modify its source code to make it read the events directly from kernel event interface, bypassing the X.

The great advantage of this approach is the possibility to make a multiterminal with any combination of video cards, as long as they are supported by the X.

Now, you need to check if your input devices (mouses and keyboards) have been correctly detected by the kernel. In order to do this, analyze the file /proc/bus/input/devices, which show details about the input devices detected by the kernel.

An example of this file is shown below. Only two fields are of interest: the name of each device, shown in the lines starting with “N: Name=”, and the name of the file related to each device, shown in the lines starting with “H: Handlers”.

Notice that the file seem to indicate the presence of 3 keyboards, although the system in question actually has only two. This happens because many USB keyboards have special keys (to control multimedia or access the internet, for instance), which are detected by the kernel as a secoundary keyboard, whose physical address finishes with “input1”. You need to configure only the primary keyboards, whose physical address finishes with “input0”.

The example given show the precense of 2 "primary" keyboards, related to the files /dev/input/event0 and /dev/input/event2, respectively, and 2 mouses, related to the files /dev/input/event1 and /dev/input/event4, respectively.

1. Download the multiXnest binary (version 0.1.3) here. The binary should be put in the directory /usr/local/bin. You can download the patch to Xnest (from Xorg 6.8.2) here. 2. Download the wrapper script necessary to run Xnest: multiXnest.sh. The script must be coppied to /usr/sbin.

The mouse section can be deleted, which is recommended, but you must add the AllowMouseOpenFail option to the ServerFlags Section, as shown below, otherwise the X server will fail to start.

6. Make sure the ServerFlags section has the following options:

Section"ServerFlags"...# These options keep the X Server from entering in power saving mode:Option"BlankTime""0"Option"StandbyTime""0"Option"SuspendTime""0"Option"OffTime""0"# Allow the server to start without mouseOption"AllowMouseOpenFail""yes"# Disable VT SwitchingOption"DontVTSwitch""yes"# This disallows the use of the Ctrl+Alt+Backspace sequenceOption"DontZap""yes"...EndSection

Now it's necessary to create an XKB configuration file for each multiXnest. The XKB configuration for the first multiXnest should be placed in the file /usr/X11R6/lib/X11/xkb/X1-config.keyboard, for the second multiXnest in /usr/X11R6/lib/X11/xkb/X2-config.keyboard, and so on. You can see an example of an XKB configuration file below.

The last step is to configure the login manager to start the main X server and also to run the wrapper scripts that will open Xnest. We'll explain how to do his on GDM, but other managers, like XDM and KDM, can be configured in a similar way.

Edit the file /etc/X11/gdm.conf in the servers section, adding the following:

[servers]0=Hardware# Hardware is the main X server1=multiXnest12=multiXnest23=multiXnest3..N=multiXnestN[server-Hardware]name=Hardwarecommand=/usr/X11R6/bin/Xhandled=false flexible=false[server-multiXnest1]name=multiXnest1command=/usr/sbin/multiXnest.sh -display :0.0 -xauthority /var/lib/gdm/:0.Xauth -geometry 1024x768+0+0-kbd/dev/input/event0-ptr/dev/input/event1-dpi92handled=trueflexible=false## The options -kbd and -ptr identify, respectively, to which keyboard and which mouse the Xnest will be associated.## multiXnest.sh is the wrapper that runs Xnest server....[server-XnestN]name=XnestNcommand=/usr/sbin/multiXnest -display :0.N -xauthority /var/lib/gdm/:0.Xauth -geometry 1024x768+0+0-kbd/dev/input/eventXX-ptr/dev/input/eventYY-dpi92handled=trueflexible=false