Multiseat setup on Ubuntu 14.04

Multiseat mode on Ubuntu 14.04

Hello our blog readers! Recently, I have encountered with a question of how to set up several work places on one single computer within Ubuntu 14.04 operating system. I succeeded setting up Multiseat mode, as I wanted, three workplaces working on single computer system.

Ofcourse, this article does not have any relations with programming in 1C, PHP or Delphi, but still you will see some programming at the end of this article. I think this article will be useful for those who want to set up a Multiseat mode on their computers. In my previous articles I was sharing with you on how to set up XAMPP on MAC OS X, and today lets deal with Multiseat. Lets go!

Contents

  1. Selecting Videocards
  2. Defining videocards and USB ports among devices registered in Ubuntu
  3. Setting up rules for Multiseat mode
  4. Autostart Firefox

Selecting Videocards

Firstly, lets deal with videocards. It is preferred that these videocards are from the same producer, for example Nvidia. I had three of them: GeForce 7300GS, GeForce 210, GeForce GT 220. On my motherboard I had three PCI slots, and I used them for my videocards.

I have tried with different motherboard with two PCI slots and one integrated videocard, but BIOS denied, it denied working at the same time with external and integrated videocards, that is why there was only option left with three external video cards In order to make sure that all three videocards are detected by the system you can use a command prompt line in Linux:

	$ lspci |grep VGA

Defining videocards and USB ports among other devices registered in Ubuntu

In order to properly set up Multiseat in Ubuntu 14.04 you need to know unique identificator number of each device and port. For this purpose you need to use command prompt line shown below:

	
	$ udevadm info --export-db > /home/user/udevadm.txt

This command will create a file within the path given and save information about devices. If you open this file with a text editor you can then search and find your ports and devices.This file is very big, thus in search dialogue you can type “GeForce” for searching videocards or “usb7” for searching indetificators of USB ports. Let’s have a brief look to some parts of my file:

E: DEVPATH=/devices/pci0000:00/0000:00:1c.0/0000:05:00.0
E: DRIVER=nouveau
E: ID_MODEL_FROM_DATABASE=G72 [GeForce 7300 GS]
E: ID_PCI_CLASS_FROM_DATABASE=Display controller
E: ID_PCI_INTERFACE_FROM_DATABASE=VGA controller
E: ID_PCI_SUBCLASS_FROM_DATABASE=VGA compatible controller
E: ID_VENDOR_FROM_DATABASE=NVIDIA Corporation
...
N: bus/usb/007/001
E: BUSNUM=007
E: DEVNAME=/dev/bus/usb/007/001
E: DEVNUM=001
E: DEVPATH=/devices/pci0000:00/0000:00:1d.1/usb7
E: DEVTYPE=usb_device
...

DEVPATH values that are highlighted in bold – «/devices/pci0000:00/0000:00:1c.0/0000:05:00.0» and «/devices/pci0000:00/0000:00:1d.1/usb7», are those that we need. We will need them on our next step.

To see connected USB devices you can use the command below:

	$ lsusb

With the help of this command you can now see to which physical port belongs identificator from the file “udevadm.txt”. To understand this, eject one of the devices, (for example, mouse or keyboard) from USB-port, and then enter the command again, compare the changes, that occured after entering the same command “1susb” again.

Setting up rules for Multiseat mode

Let’s set up a file for rules of Multiseat, by susing the information provided in previous step. For this purpose let’s create a file:

	$ sudo touch /etc/udev/rules.d/99-multiseat.rules

Let’s type in this information:

# ************************ SEAT-1 ************************

# USB port function mouse for seat-1 
TAG=="seat", DEVPATH=="/devices/pci0000:00/0000:00:1a.2/usb5*", 
ENV{ID_SEAT}="seat-1", TAG+="seat-1"

# USB port function keyboard for seat-1 
TAG=="seat", DEVPATH=="/devices/pci0000:00/0000:00:1d.0/usb6*", 
ENV{ID_SEAT}="seat-1", TAG+="seat-1"

# Videocard function GeForce for seat-1
TAG=="seat", DEVPATH=="/devices/pci0000:00/0000:00:06.0/0000:02:00.0*", 
ENV{ID_SEAT}="seat-1", TAG+="seat-1"

# ************************ SEAT-2 ************************

# USB port function mouse for seat-2
TAG=="seat", DEVPATH=="/devices/pci0000:00/0000:00:1d.1/usb7*", 
ENV{ID_SEAT}="seat-1", TAG+="seat-1"

# USB port function keyboard for seat-2
TAG=="seat", DEVPATH=="/devices/pci0000:00/0000:00:1d.2/usb8*", 
ENV{ID_SEAT}="seat-1", TAG+="seat-2"

# Videocard function GeForce 7300 GS for seat-1
TAG=="seat", DEVPATH=="/devices/pci0000:00/0000:00:1c.0/0000:05:00.0*",  
ENV{ID_SEAT}="seat-2", TAG+="seat-2"


As you probably guessed, values highlighted in bold are taken from «udevadm.txt» file (values without asterix). We are setting up three working places, but in rules file we are typing only for two. Why? Because, the videocard and not defined USB ports will be automatically setted up within the workplace with the name “seat0” (without a dash in the name, these are the rules of naming workplaces). After all steps have been followed you need to restart your computer in order for all changes to be applied. After restarting you can see a list of connected workplaces by typig in the command below:

	$ loginctl list-seats

Also check this file «/etc/lightdm/lightdm.conf» for the section that includes values of identificators:

[LightDM]
logind-load-seats=true

Autostart Firefox

For total solution to our task it was required to launch Firefox for every workplace. Firefox was programmed to be lauched in Autostart, however while lauchning, Firefox started only on one single workplace, on others there were error:

Firefox is already running, but is not responding. 
To open a new window, you must first close the existing Firefox process, 
or restart your system.

The reason for this was that workplaces are initiated from one user, that is why we were getting this error. We solved the problem by creating several profiles for Firefox:

  1. In command prompt we launch profile manager:
    	$ firefox -P
    
  2. Create three profiles in profile manager window FullScreenStorage0, FullScreenStorage1, FullScreenStorage2.
  3. Create initiating file «firefox.multiseat»:
    	$ sudo touch /home/user/firefox.multiseat
    
  4. In this file we type it for every workplace:
    	
    	#!/bin/bash
    	firefox -P FullScreenStorage`echo $DISPLAY | cut -f2 -d\:`
    
  5. Type in the initiation of the file «firefox.multiseat» in autostart.

[subscribe2]