¿Cómo puedo hacer un Multiseat con Xephyr?

¿Cómo puedo hacer un Multiseat con Xephyr?

Estoy intentando utilizar varios puestos con Ubuntu, pero no puedo hacer que esto funcione.

He leído muchos "cómo hacerlo", y la mayoría trata sobre cómo hacer una distribución multipuesto con alguna distribución con GDM2 o KDM. Pero estoy usando lightdm de Ubuntu.

Así que ahora estoy intentando hacer este multipuesto con Xephyr, que ya usé para hacer un multipuesto con la versión Debian 4. Pero no sé cómo llamar a Xephyr en lightdm.conf.

Respuesta1

Hay una muestra de configuración de LightDM para varios puestos usando Xephyr. Parece que Andrzej Pietrasiewicz (el autor del blog copiado/referenciado a continuación) creó unAPPcon todo el código que se muestra a continuación. Al instalar ese PPA, debería poder hacer que una instalación de lightdm funcione "mágicamente".

Nota:Mientras intentaba que eso funcionara, todavía no lo he logrado. Sin embargo, puedo decirles que hay una cierta cantidad de parámetros contradictorios a continuación.

Algunas partes importantes:

  1. La entrada [Seat:0] que define el "servidor de hardware". Eso inicia el servidor X. Representa Pantalla :0
  2. Las entradas del comando xserver que definen exactamente qué se debe iniciar para obtener asientos. Xephyr se inicia con Display :1 y Display :2. Entonces, en efecto, los usuarios iniciarán sesión en Display :1 y :2, pero no en :0.

Algo como eso:

+------------------------------- Display :0 -----------------------------+
|  X server                                                              |
|                                                                        |
|  +--------- Display :1 ----------+  +--------- Display :2 ----------+  |
|  |  Xephyr 1                     |  |  Xephyr 2                     |  |
|  |  User A                       |  |  User B                       |  |
|  |                               |  |                               |  |
|  |                               |  |                               |  |
|  |                               |  |                               |  |
|  +-------------------------------+  +-------------------------------+  |
|                                                                        |
+------------------------------------------------------------------------+

El archivo xorg.conf:

# File: /etc/X11/xorg.conf

Section "ServerLayout"
    Identifier     "Layout0"
    Screen      0  "Screen0" 0 0
    Option         "Xinerama" "0"
EndSection

Section "Files"
EndSection

Section "Module"
    Load           "dbe"
    Load           "extmod"
    Load           "type1"
    Load           "freetype"
    Load           "glx"
EndSection

Section "ServerFlags"
    # start even without the mouse
    Option "AllowMouseOpenFail" "yes"
    # disable VT switching
    #Option "DontVTSwitch" "yes"
    # Ctrl+Alt+Backspace disable
    #Option "DontZap" "yes"
EndSection

Section "Monitor"
    # HorizSync source: edid, VertRefresh source: edid
    Identifier     "Monitor0"
    VendorName     "Unknown"
    ModelName      "Philips 170B4"
    HorizSync       30.0 - 82.0
    VertRefresh     56.0 - 76.0
    Option         "DPMS"
EndSection

Section "Device"
    Identifier     "Device0"
    Driver         "nvidia"
    VendorName     "NVIDIA Corporation"
    BoardName      "GeForce 8400 GS"
EndSection

Section "Screen"
    Identifier     "Screen0"
    Device         "Device0"
    Monitor        "Monitor0"
    DefaultDepth    24
    Option         "TwinView" "1"
    Option         "TwinViewXineramaInfoOrder" "DFP-0"
    Option         "metamodes" "CRT: nvidia-auto-select +0+1080, DFP: nvidia-auto-select +0+0"
    SubSection     "Display"
        Depth       24
    EndSubSection
EndSection

Fuente:http://beforeafterx.blogspot.com/2011/02/multiseat-setup-xorgconf.html

El script en lightdm.conf:

# File: /etc/lightdm/lightdm.conf
[LightDM]
greeter-user=root
user-authority-in-system-dir=false
common-vt=true

[SeatDefaults]
xserver-allow-tcp=false
greeter-hide-users=true
user-session=lightdm-xsession
session-wrapper=/etc/X11/Xsession

[Seat:0]
xserver-command=X -br -dpms -s 0 -novtswitch
greeter-session=xinerama

[Seat:1]
xserver-command=/etc/multiseat/scripts/Xephyr-seat-1
greeter-session=multiseat-greeter-1

[Seat:2]
xserver-command=/etc/multiseat/scripts/Xephyr-seat-2
greeter-session=multiseat-greeter-2

Fuente:http://beforeafterx.blogspot.com/2012/08/multiseat-setup-lightdmconf.html

Los scripts multiasiento inician Xephyr con parámetros que describen el mouse y el teclado que se usarán para ese asiento. Haré todo lo posible para encontrar esa información y proporcionarla aquí también.

#!/bin/bash
# File: /etc/multiseat/scripts/Xephyr-seat1, Xephyr-seat2, ..., Xephyr-seatN
#
# $1 - display number of this Xephyr

. /etc/multiseat/scripts/helper-functions

trap "" usr1

XEPHYR=/root/Xephyr-new
export DISPLAY=:0
export XAUTHORITY=/var/run/lightdm/root/:0

SEAT=1

SIZE=`get_conf $SEAT SIZE`
KEYBOARD=`get_conf $SEAT KEYBOARD`
LAYOUT=`get_conf $SEAT LAYOUT`
MOUSE=`get_conf $SEAT MOUSE`
DPI=`get_conf $SEAT DPI`

exec $XEPHYR -retro -screen ${SIZE} -keybd evdev,,device=/dev/input/${KEYBOARD},xkbrules=evdev,xkbmodel=evdev,xkblayout=${LAYOUT} -mouse evdev,,device=/dev/input/${MOUSE} -dpi ${DPI} $1

Fuente:http://beforeafterx.blogspot.com/2012/08/multiseat-configuration-xephyr-seat-1.html

El mayor al que se hace referencia en lightdm también es un script de shell independiente. Tenga en cuenta que le recomendaría hacer referencia /bin/shen lugar de /bin/bash. No vi nada que requiriera bash. Tenga en cuenta que hace referencia al lightdm-gtk-greeter predeterminado al final.

#!/bin/bash
# File: /etc/multiseat/scripts/multiseat-greeter-1, ..., multiseat-greeter-n
#
# multiseat wrapper around ligthdm greeter in order to position a Xephyr instance
#
. /etc/multiseat/scripts/helper-functions

PRIMARY=`get_conf 0 PRIMARY`
SEAT=1

if [ $SEAT != $PRIMARY ]; then
    XEP=`XAUTHORITY=/var/run/lightdm/root/:0 xwininfo -root -children -display :0 | grep "Xephyr on :$SEAT" --max-count=1`;
    XEPHYR_WIN_ID=`echo ${XEP} | cut -d' ' -f1`;
    DISPLACEMENT=`get_conf $SEAT DISPLACEMENT`
    DISPLAY=:0 XAUTHORITY=/var/run/lightdm/root/:0 wmctrl 2>&1 -v -i -r ${XEPHYR_WIN_ID} -e 0,0,${DISPLACEMENT},-1,-1;
fi

XAUTHORITY=/var/run/lightdm/root/:$SEAT
DISPLAY=:$SEAT
exec /usr/sbin/lightdm-gtk-greeter

Algunas de las funciones pueden definirse en el siguiente script. De alguna manera, incluye otro guión multipuesto que aún no he visto...

# File: /etc/multiscript/scripts/helper-functions

. /etc/default/multiseat

#
# private implementation of get_sect
#
# get given section's contents from the given config file
#
# $1 filename
# $2 section number
#
__get_sect()
{
    cat $1 | awk -v sect=$2 '
    BEGIN {
        SECT="^\\[" sect "\\]"
        NEXT_SECT="^\\[" (sect + 1) "\\]"
    }
    $0 ~ SECT, $0 ~ NEXT_SECT {
        if ($0 ~ SECT)
            next;
        if ($0 ~ NEXT_SECT)
            next;
        if (substr($1, 1, 1) == "#")
            next;
        print
    }
    '
}

#
# private implementation of get_conf
#
# get given key's contents from the given section
# from the given config file
#
# does not work for tables in the config file
#
# $1 filename
# $2 section name
# $3 key name
#
__get_conf()
{
    __get_sect $1 $2 | awk -F"=" -v key=$3 '
    BEGIN {
        KEY=key
    }
    $1==KEY {
        print substr($0, index($0, "=") + 1)
    }
    '
}

#
# private implementation of get_num_seats
#
# get number of seats from the default config file
#
# $1 filename
#
__get_num_seats()
{
    cat $1 | awk '
    BEGIN {
        count=0
    }
    /^\[[0-9]*\]/ {count++}
    END {
        print count - 1
    }
    '
}

#
# get given section's contents from the default config file
#
# $1 section name
#
get_sect()
{
    __get_sect $CONFIG $1
}

#
# private implementation of get_table
#
# $1 filename
# $2 section number
# $3 table name
# $4 size/entry switch [-size => size, <number> for entry]
#
__get_table()
{
    SIZE=0;
    ENTRY=-1

    if [ $4 == "-size" ];
    then
        SIZE=1;
    else
        ENTRY=$4
    fi

    RESULT=`__get_sect $1 $2 | awk -v table=$3 -v get_size=$SIZE -v entry=$ENTRY '
    BEGIN {
        print BEGIn
        TABLE=table "\\\=" "\\\("
        GET_SIZE=get_size
        ENTRY=entry
        size=0
    }
    $0 ~ TABLE, /^\)/ {
        if ($0 ~ TABLE)
            next;
        if ($0 ~ /^\)/)
            next;
        if (substr($1, 1, 1) == "#")
            next;
        if (get_size == 0 && size == entry){
                print
                exit
        }
        size++;
    }
    END {
        if (get_size)
            print size;
    }
    '`
    RESULT=`echo $RESULT | sed 's/^[ \t]*//g'`

    echo $RESULT
}

#
# get given key's contents from the given section
# from the default config file
#
# does not work for tables in the config file
#
# $1 section name
# $2 key name
#
get_conf()
{
    __get_conf $CONFIG $1 $2
}

#
# get number of seats from the default config file
#
get_num_seats()
{
    __get_num_seats $CONFIG
}

#
# get size of a given table in the given section of the config file or
# get specified entry of the table
#
# $1 section number
# $2 table name
# $3 size/entry switch [-size => size, <number> for entry]
#
get_table()
{
    __get_table $CONFIG $1 $2 $3
}

El guión del falso saludador está dormido. Simplemente duerme hasta que un apagado completo lo mata. Al parecer, esto no es necesario. Según un comentario, la -noresetopción es suficiente para no tener que esperar así. Informaré más tarde una vez que lo haya probado yo mismo.

#!/bin/bash
# File: /etc/multiseat/scripts/fake-greeter

pid_set=0

kill_sleep()
{
    if [ $pid_set -ne 0 ];
    then
        kill -15 $pid
    fi
    exit 0
}

trap 'kill_sleep' TERM

while true;
do
    sleep 1000 &

    pid=$!
    pid_set=1

    wait $pid
done

El mismo blog dice que está teniendo problemas con udev y que tiene que reiniciarlo para que el sistema multipuesto funcione correctamente. Esto fue en agosto de 2012, por lo que no sé si esto se seguiría aplicando en 2014.

#!/bin/sh
# File: /etc/init.d/multiseat
### BEGIN INIT INFO
# Provides:          multiseat
# Required-Start:    bootlogs
# Required-Stop:
# Default-Start:     1 2 3 4 5
# Default-Stop:
# Short-Description: Trigger udev rules
# Description:       For some reason the rules for multiseat config need to be
#                    fired once more and later than at the very beginning.
### END INIT INFO

/sbin/udevadm trigger

Para configurar correctamente este script en su sistema, ejecute el siguiente comando:

sudo update-rc.d multiseat defaults

Nuevamente, no sé si este script es necesario en este momento. Simplemente organizando los guiones ofrecidos porantes después x.

Fuente:http://beforeafterx.blogspot.com/2012/08/multiseat-setup-initdmultiseat.html

Respuesta2

Pruebe xrdp, será la solución más sencilla. Instalé vnc4server y luego instalé xrdp. y luego usé rdesktop/tsclient/remmina para conectar la máquina xrdp usando la dirección IP.

Respuesta3

Hay unmaravilloso blogdetallando el proceso de configuración de un multiasiento basado en Xephyr. Él también está usando Lightdm. Espero eso ayude.

información relacionada