Initialize Seats Automaticaly

I wrote a new script to launch a gdm login screen when a Plugable Docking Station is attached on the machine. To use this script, I reduced the number of ConsoleKit display.d, session.d and seat.d files. Now there is only one of each kind of file. The current version of my work is hosted at my git repository. To test it just follow the same tutorial of the last post and then attach a Dock Station on the machine. A gdm login should appear at the monitor.

Tutorial to set up a multiseat with Plugable Dock Stations, gdm 2.27, ConsoleKit 0.4.1 and Xorg 1.8 on Ubuntu 10.4

This is a tutorial to set up a multiseat with Plugable Dock Stations, gdm 2.27, ConsoleKit 0.4.1 and Xorg 1.8 on Ubuntu 10.4. Basically is necessary to download and install the latest version of Xorg, gdm (display-configuration branch) and ConsoleKit (multi-seat branch) from git repository. Then is need to create and modify some configuration files to create or modify (xorg.conf, sessions.d, displays.d, seats.d, …). I’m developing scripts to make this instalation more automatic.

First of all, become root user:

$ sudo su

– Install some dependences packages for compile things:

Change the repository to download latest packages from Ubuntu Unstable version. Open the file /etc/apt/sources.list and change the lines:

deb http://br.archive.ubuntu.com/ubuntu/ lucid main restricted
deb-src http://br.archive.ubuntu.com/ubuntu/ lucid main restricted

to

deb http://br.archive.ubuntu.com/ubuntu/ maverick main restricted
deb-src http://br.archive.ubuntu.com/ubuntu/ maverick main restricted

# apt-get update

# apt-get install git-core build-essential automake autoconf libtool libpthread-stubs0-dev libx11-dev diffstat libexpat1-dev libxdamage-dev libxext-dev libxfixes-dev libxxf86vm-dev quilt x11proto-damage-dev x11proto-fixes-dev x11proto-gl-dev x11proto-xext-dev gettext x11proto-xf86vidmode-dev xutils-dev libxt-dev libxmu-dev libxi-dev libpixman-1-dev libgcrypt11-dev libpciaccess-dev x11proto-dri2-dev libfreetype6-dev gnome-common dpkg-dev autogen fakeroot pkg-config module-assistant libgl1-mesa-dri libgl1-mesa-dev

– Compile Xorg 1.8 from git using this tutorial. It will install Xorg at /opt/xorg.

– Compile mouse, keyboard and evdev Xserver drivers:

# git clone git://anongit.freedesktop.org/driver/xf86-input-mouse
# cd xf86-input-mouse
# ./autogen --prefix=/opt/xorg
# make
# make install

# git clone git://anongit.freedesktop.org/driver/xf86-input-keyboard
# cd xf86-input-keyboard
# ./autogen --prefix=/opt/xorg
# make
# make install

# git clone git://anongit.freedesktop.org/driver/xf86-input-evdev
# cd xf86-input-evdev
# ./autogen --prefix=/opt/xorg
# make
# make install

– Download and Install xkeyboard configuration:

# git clone git://anongit.freedesktop.org/xkeyboard-config
# cd xkeyboard-config
# ./autogen --prefix=/opt/xorg
# make
# make install

– Download and Install DisplayLink FrameBuffer Driver:

# module-assistant prepare
# git clone http://git.plugable.com/webdav/udlfb/
# cd udlfb
# make
# make install
# depmod -a

Now, when you plug in a DisplayLink device, you should see a “green screen” as
the driver successfully loads and sets the graphics mode to match your monitor.

– Download and Install DisplayLink Xserver Driver:

# git clone http://git.plugable.com/webdav/xf-video-udlfb/
# cd xf-video-udlfb
# ./configure --prefix=/opt/xorg
# make
# make install

– Make a link in /opt/xorg/bin to xkbcomp

# ln -s /usr/bin/xkbcomp /opt/xorg/bin/xkbcomp

– Download gdm (display-configuration branch) from git repository and install it:

# git clone git://git.gnome.org/gdm -b display-configuration
# sudo apt-get build-dep gdm
# cd gdm
# CFLAGS="-g -O2 -g -Wall -O2" CXXFLAGS="-g -O2 -g -Wall -O2" CPPFLAGS="" LDFLAGS="-Wl,-Bsymbolic-functions" ./autogen.sh --build=i486-linux-gnu --prefix=/usr --includedir="\${prefix}/include" --mandir="\${prefix}/share/man" --infodir="\${prefix}/share/info" --sysconfdir=/etc --localstatedir=/var --libexecdir="\${prefix}/lib/gdm" --disable-maintainer-mode --disable-dependency-tracking --disable-silent-rules --srcdir=. --disable-scrollkeeper --with-at-spi-registryd-directory=/usr/lib/at-spi --enable-ipv6=yes --with-incomplete-locales --with-selinux
# make
# make install

– Download and Install ConsoleKit (multi-seat branch) from git repository:

# git clone git://anongit.freedesktop.org/ConsoleKit -b multi-seat
# cd ConsoleKit
# CFLAGS="-g -O2 -g -Wall -O2" CXXFLAGS="-g -O2 -g -Wall -O2" LDFLAGS="-Wl,-Bsymbolic-functions" ./autogen.sh --build=i486-linux-gnu --prefix=/usr --includedir="\${prefix}/include" --mandir="\${prefix}/share/man" --infodir="\${prefix}/share/info" --sysconfdir=/etc --localstatedir=/var --libexecdir="\$(prefix)/lib/ConsoleKit" --disable-maintainer-mode --disable-dependency-tracking --disable-silent-rules --srcdir=. --enable-pam-module --with-pid-file=/var/run/console-kit-daemon.pid
# make
# make install

– Download and Install udev rules to detect the Dock Stations and a script to name the seats in /dev directory. It also install xorg.conf and ConsoleKit files for two seats.

# git clone
git://anongit.freedesktop.org/~lucasferreira/usbseat

# cd usbseat
# ./install.sh

– Fbcon workaround

fbcon is a standard Linux kernel module, which aggressively assumes it can open any framebuffer device and take it over for use as a text terminal. Unfortunately, that’s not what we want if we’re going to be using that
framebuffer to run its own X server. So we need to add a file /etc/modprobe.d/fbcon.conf to disable fbcon and leave our framebuffers free for other uses.

# echo "blacklist font
blacklist tileblit
blacklist bitblit
blacklist fbcon" > /etc/modprobe.d/fbcon.conf

# update-initramfs -u

Now, when you reboot and run “lsmod” you should not see fbcon in the loaded modules. And in /sys/class/graphics you should see fb0, instead of fbcon.

– To test this new environment restart gdm and ConsoleKit:

# service gdm stop; sudo pkill -f /usr/sbin/console-kit-daemon
# /usr/sbin/console-kit-daemon && sudo service gdm start

This is just the hard work to set up a multiseat with Plugable Dock Stations and latest versions of gdm, ConsoleKit and Xorg. I’m working to make this configuration more easy and automatic. This tutorial is for
a static environment, I’m also working to use ‘ck-seat-tool’ for make the environment dynamic.

Seted up a multiseat on Ubuntu 10.04 with Xorg 1.8 and gdm 3.30

Good News! Today I finally finished to configure correctly the xorg.conf files and all the gdm and ConsoleKit stuff. I’m using gdm 3.30 and ConsoleKit 0.4.1 cloned from their git repository. I’m also using Xorg 1.8 cloned from git repository. This post is just to announce the news, still at this week I will post a tutorial to reproduce the steps that I had to make for the things work.

Git repository created and a lot of tests

I was missed of GSOC work this last days because in Brazil we are at the end of the semester of classes, so  I have a lot of works and tests at University. Well, basically what  I have done is configure my account at Freedesktop.org to host the git repository of this project. I also spent some time to compile the GDM 3.30. I’m testing the GDM 3.30 with Ubuntu 10.04  to try to set up a multiseat with this pieces and Plugable’s Dock Stations. For this day forward I will work hard to finish those tests, to start to develop ConsoleKit scripts to open several GDM login screens on different Dock Stations.

Seted up a multiseat on Ubuntu 9.04 and new udev rules written

In this last days I seted up a multiseat on Ubuntu 9.04 with Plugable’s solution (photo above). I also wrote new udev rules to label the seats. Basically, I’m using the Bus ID of the devices to discover the set of devices (mouse, keyboard, display, …) that are at the same Dock Station. When a new device is attached on the machine through the Dock Station, is passed the Bus Id of the USB port that the device was attached to a Bash script. Like all device at the same Dock Station has the same parent Bus ID, this script uses it to label the devices with the same Seat ID. I’m configuring my account at freedesktop.org to host the project, so soon I will publish a git repository address with the source code of the project.

My GSOC 2010 Proposal: Use upstream pieces to make a fully plug-and-play USB multiseat solution.

Hi everyone! To start this blog I’m posting my accepted proposal on Google Summer of Code. It is useful for everyone who wants to know what are the multiseat’s problems and what I will do to solve them. From this day forward I will post weekly the updates of the project.

The Proposal:

Use upstream pieces to make a fully plug-and-play USB multiseat solution.

Name: Lucas Nascimento Ferreira
e-mail: lnf07@c3sl.ufpr.br
website: www.inf.ufpr.br/lnf07

Synopsis

    Over the last years many multiseat solutions have appeared, but many are
    closed projects and some are open projects that never became stable on any
    distribution. Nowadays a lot of features are being added in Xorg and Linux,
    and now is possible to make a clear and general solution that distributions
    can easily include it.

    One of these features is the correct VGA arbitration in Xorg 1.7 and
    Linux Kernel 2.6.32 [0]. This allows to set up a multiseat using multiple X
    servers on different graphical devices, and shows the interest of the X.org
    community on this area. Another feature that is important to multiseat
    solutions is the secondary video cards initialization [1], that was included
    in Xorg 1.7 too. These features make possible to set up a multiseat with
    multiple instances of X server, but a tool that is extremely useful to
    manage sessions and seats is the ConsoleKit. All these pieces together and
    correctly integrated make a clear multiseat solution.

    Two common problems in multiseat environments are the association and
    detection of the devices, one solution based on a USB hierarchy [2] makes
    this environment more controlled and this turns the problem easier to be
    solved. A USB hierarchy is a way of dispose the devices, a set of devices
    (keyboard, mouse, ...) are attached in one USB HUB and this HUB is
    associated to one user, making one seat. The Plugable HUBS [3] are more
    useful to make a USB hierarchy because the video is also in the HUB, so the
    seats are totally separated. This kind of solution has some problems,
    because those USB HUBS must be fully plug-and-play, because user doesn't
    want to manually reconfigure the devices every time a USB HUB is detached
    from the machine. This problem can be solved with the udev[4] tool, that
    provides a way to do a dynamic detection and association of the devices.

    A USB Multiseat solution based on Plugable HUBS has another advantage, and
    this is the main attraction to end users, the cost/benefit.  The USB
    terminals themselves are a significant cost savings over buying even
    low-costs netbooks. The cost of maintaining PCs goes way down, as many
    terminals share a single server. Plug and play nature also provides big
    savings.  This solution is perfect to "office user", in other words, those
    users who only use browsers, messengers, text editors and other common
    applications like these.

    A hard work must be done to correctly integrate the new features + Linux
    Kernel tools (udev) + ConsoleKit + display managers to make a fully
    plug-and-play multiseat solution. What I am going to do is to study the
    state of all these pieces nowadays and, using the existing source code [5]
    of Plugable solution, refine and document it to make easily for
    distributions to include it.

Why Multiseat ?

    I would like to work in the "USB Multiseat Refinement" idea because I think
    is very important that linux distributions have an easy way to configure a
    multiseat environment. This is because in Brazil multiseats are becoming
    very common on public schools and I have saw that they are having many
    problems with it. Another big incentive to work with multiseats is because
    this kind of solution decreases the cost of computing, so this is a good
    tool to the digital inclusion. Three important points that justify the
    advantages of multiseats are the energy-saving, CPU optimization and ease of
    management. The first point is the most important, because with multiseats
    is possible to increase the number of users in a lab just using a little
    more of energy. This is because there is a large decrease of devices (CPUs,
    hard disks, etc) by the total number of users.  The second point is because
    in a common "office environment" (with common computers) which people are
    using only applications like browsers, messengers, text editors, a great part
    of time the CPU is idle. This is because the user is reading a document,
    seeing a website that is already loaded or something like these. So if in
    this environment is changed the common computers to multiseats, the time
    that the CPU is idle will be decreased, optimizing the use of CPU. The last
    point occurs due to the decrease of computer amount, so it turns easier the
    network management and the hardware maintenance.

Description

    To create a fully plug-and-play USB multiseat solution is necessary to solve
    two common problems of multiseats: detection and association of devices.

    In a USB multiseat environment is necessary to detect every hub connected to
    the machine. Actually we need to detect the devices, but they will be
    plugged on the machine through the hub, for solve it will be created udev
    rules.  Every hub connected will be a seat, so is necessary to create some
    udev attributes to label this set of devices with a common seat ID. With
    this settings the detection problem is solved.

    The association problem will be divided into two classes: basic devices and
    other devices. What is considered basic devices are keyboard, mouse and
    video. Other devices are storage/audio devices. To solve it we need to get
    the devices that were detected and labeled through the udev rules/attributes
    and write a ConsoleKit script to launch independent GDM/X session to each
    set of devices (HUB). Before it, is necessary to check if in each hub are
    connected the 3 basic devices (keyboard, mouse and video). Then is important
    to create some InputClass rules to cause the primary X session to ignore
    multiseat-assigned devices, and the appropriate seat to use them.  Other
    devices like pendrives, mp3 players which will be attached on the machine
    when the sessions is already started, will also need to be detected and
    associated correctly. Since each seat has its own HUB, each new device
    attached into a hub must be associated and become available to that session
    user.  By creating some udev rules and X init scripts this can become
    automatic.

Project Plan

    Following the Google Summer of Code Timeline, these is my program schedule:

      April 27 - May 24

      Basically it is a study period, but detailed it is:

        - Get some Display Link USB Hubs and set up a multiseat environment with
          the source code that already exists.

        - Study the existent source code to become expert in what already been
          done.

        - Understand how does udev works

        - Study the state of Xorg today to know how to set up a good
          configuration file and explore the new features.

        - Study if there is some configuration or module that will need to set
          up on kernel.

      May 24 - June 7

        - Define the udev rules to detect hubs/devices which should be
          collectively treated as terminals

        - Define the udev attributes to label the set of devices with a common
          seat id

      June 8 - June 30

      At this period I will be more busy because I will be at the end of
      semester and I will have a lot of exams.

        - udev triggers for on-demand generation of the appropriate Xorg config
          files, to allow seats to coexist with the primary display/devices.

        - Implement ConsoleKit scripts to launch independent GDM/X sessions for
          each USB terminal seat

      June 1 - July 15

        - Write documentation and make a lot of tests (performance,
          plug-and-play tests, ...)

      July 16

        - Submit mid-term evaluation.

      July 17 - July 29

        - InputClass rules to cause the primary X session to ignore
          multiseat-assigned devices, and the appropriate seat to use them

        - udev rules and X init scripts to grant access to audio, storage, and
          other devices to the person logged into the matching seat

      July 30 - August 9

        - Study the state of some of the principal distros today to assess the
          best way to include a multiseat solution on it.

        - Adapt the code to include the solution to an example distribution, like
          Debian or Gentoo.

        - Write documentation and make a lot of tests (performance,
          plug-and-play tests, ...)

Personal Information

        My name is Lucas Nascimento Ferreira, I'm a 20 years old student of
        Computer Science at UFPR [6] (Federal University of Paraná). I live in
        Curitiba, capital of Paraná state, Brazil. I have worked with multiseats
        over the last 3 years in MDM project [7] at C3SL [8] (Center of
        Scientific Computing and Free Software). In 2008 I wrote a considerable
        amount of code [9] to MDM project and in 2009 I published a summary
        [10, 11] (only in portuguese) about the performance of the X Window
        System on the labs of the Informatics Department of UFPR. I have done
        one presentation (only in portuguese) [12] about multiseats to students
        of UFPR explaining the common problems and the MDM solution.  From 2009
        I started to work with NX server of NoMachine and Google's NeatX.

References

[0] http://bugs.freedesktop.org/show_bug.cgi?id=20817
[1] http://bugs.freedesktop.org/show_bug.cgi?id=20816
[2] http://www.ndiyo.org/systems/hubster/basics
[3] http://plugable.com/products/UD-160-A
[4] http://www.kernel.org/pub/linux/utils/kernel/hotplug/udev.html
[5] http://plugable.com/2009/11/16/setting-up-usb-multiseat-with-displaylink-on-linux-gdm-up-to-2-20
[6] http://www.ufpr.br
[7] http://wiki.c3sl.ufpr.br/multiseat
[8] http://www.c3sl.ufpr.br
[9] http://git.c3sl.ufpr.br/gitweb?p=multiseat/mdm.git;a=summary
[10] http://www.inf.ufpr.br/lnf07/en_us/publicacoes.html
[11] http://www.inf.ufpr.br/lnf07/arquivos/apresentacoes/apresentacao-17evinci.pdf
[12] http://www.inf.ufpr.br/lnf07/arquivos/apresentacoes/Multiterminal.pdf