Xephyr でマルチシートを作成するにはどうすればいいですか?

Xephyr でマルチシートを作成するにはどうすればいいですか?

Ubuntu でマルチシートを使用しようとしていますが、うまく動作しません。

私はたくさんの「ハウツー」を読みましたが、そのほとんどは、GDM2 または KDM を使用したディストリビューションでマルチシートを実行する方法に関するものでした。しかし、私は Ubuntu の lightdm を使用しています。

そこで、Debian 4 バージョンでマルチシートを作成するためにすでに使用した Xephyr を使用して、このマルチシートを作成しようとしています。ただし、lightdm.conf で Xephyr を呼び出す方法がわかりません。

答え1

Xephyrを使用したマルチシート用のLightDMセットアップのサンプルがあります。Andrzej Pietrasiewicz(以下にコピー/参照されているブログの著者)が作成したようです。ペイパーすべてのコードは以下に表示されます。この PPA をインストールすることで、lightdm インストールが「魔法のように」動作するようになります。

注記:私はそれを機能させようと試みていますが、まだ成功していません。ただし、以下に矛盾するパラメータがいくつかあることは言えます。

重要な部分:

  1. [Seat:0] エントリは「ハードウェア サーバー」を定義します。これは X サーバーを起動します。これはディスプレイ :0 を表します。
  2. シートを取得するために起動する必要があるものを正確に定義する xserver コマンド エントリ。Xephyr はディスプレイ :1 とディスプレイ :2 で起動されます。したがって、実際にはユーザーはディスプレイ :1 と :2 にログインしますが、:0 にはログインしません。

そんな感じ:

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

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

ソース:http://beforeafterx.blogspot.com/2011/02/multiseat-setup-xorgconf.html

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

ソース:http://beforeafterx.blogspot.com/2012/08/multiseat-setup-lightdmconf.html

マルチシート スクリプトは、そのシートで使用するマウスとキーボードを記述するパラメータを使用して Xephyr を起動します。その情報を見つけて、ここでも提供できるよう最善を尽くします。

#!/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

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

lightdm で参照されている greater も、別のシェル スクリプトです。/bin/shの代わりにを参照することをお勧めします/bin/bash。 bash を必要とするものは見つかりませんでした。 最後に、デフォルトの lightdm-gtk-greeter を参照していることに注意してください。

#!/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

いくつかの関数は、次のスクリプトで定義される可能性があります。どういうわけか、まだ見たことのない別のマルチシート スクリプトが含まれています...

# 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
}

fake-greeter スクリプトはスリーパーです。完全なシャットダウンによって終了するまで、ただスリープ状態になります。どうやら、これは必須ではありません。コメントによると、この-noresetオプションは、このように待機する必要を回避するのに十分です。自分でテストしたら、後で報告します。

#!/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

同じブログには、udev に問題があり、マルチシートが正しく動作するように再リセットする必要があると書かれています。これは 2012 年 8 月のことなので、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

このスクリプトをシステム上で適切に設定するには、次のコマンドを実行します。

sudo update-rc.d multiseat defaults

繰り返しますが、この時点でこのスクリプトが必要かどうかはわかりません。ビフォーアフターX

ソース:http://beforeafterx.blogspot.com/2012/08/multiseat-setup-initdmultiseat.html

答え2

xrdp を試してみてください。これが最も簡単な解決策です。vnc4server をインストールしてから xrdp をインストールしました。次に、rdesktop / tsclient / remmina を使用して、IP アドレスを使用して xrdp マシンに接続しました。

答え3

そこには素晴らしいブログXephyr ベースのマルチシート セットアップのプロセスを詳しく説明します。彼は Lightdm も使用しています。お役に立てば幸いです。

関連情報