VNCからローカルマルチモニタへのリモートヘッドレスLinuxのマルチ仮想モニタ

VNCからローカルマルチモニタへのリモートヘッドレスLinuxのマルチ仮想モニタ

勝ちました。複数のローカルモニタを使用してVNC経由で接続できるように、リモートLinuxシステムに2つの仮想モニタを持つように設定しようとしました。誰もウェブ上で何かを見つけるのに助けが必要ないという事実は驚くべきことです。

また、Linuxシステムでデュアル幅モニタを作成してみました。次に、x11vnc を使用して各モニターの領域を切り取ります。しかし、仮想ドライバを使用してこのような大きなディスプレイを作成するのに問題があります。

2つのDisplayPortを備えたグラフィックアダプタをインストールしましたが、使用する予定はありません。実際のアダプターを使用すると応答しない問題がありました。仮想アダプタを使用しようとすると、反応は非常に良いです。だから別の仮想アダプタを作成したいと思います。

私はKDE DMを使用しています。

VIRTUAL1を使用する例をたくさん見ましたが、仮想ドライバと連携させることはできません。構成に「VirtualHeads」「2」オプションを追加しようとしましたが、仮想ドライバーはそれを認識しませんでした。

Xvfbを使用することを提案しましたが、2016年以降、仮想ドライバでは廃止されました。

以下はいくつかの詳細です。

$ uname -a
Linux bgrupczy-linux 5.8.0-53-generic #60~20.04.1-Ubuntu SMP Thu May 6 09:52:46 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

/usr/share/X11/xorg.conf.d/xorg.conf が空です。

次の内容は、インターネット検索で収集されました。いったん機能すると欠陥がある可能性があるので調整を中断しましたが、それは私をいじめないようです。

/usr/share/X11/xorg.conf.d/dummy-1920x1080.confには、単一の1920x1080を取得できる次のコンテンツがあります。

Section "Monitor"
  Identifier "Monitor0"
  HorizSync 28.0-80.0
  VertRefresh 48.0-75.0
  Modeline "1920x1080_60.00" 173.00 1920 2048 2248 2576 1080 1083 1088 1120 -hsync +vsync
EndSection

Section "Device"
  Identifier "Card0"
  Driver "dummy"
  VideoRam 256000
EndSection

Section "Screen"
  Identifier "Screen0"
  Device "Card0"
  Monitor "Monitor0"
  DefaultDepth 24
  SubSection "Display"
    Depth 24
    Modes "1920x1080_60.00"
  EndSubSection
EndSection
$ xrandr
xrandr: Failed to get size of gamma for output default
Screen 0: minimum 320 x 240, current 1920 x 1080, maximum 1920 x 1080
default connected 1920x1080+0+0 0mm x 0mm
   1920x1080     60.00* 
   1680x1050     70.00    60.00  
   1400x1050     70.00    60.00  
   1600x900      60.00  
   1280x1024     75.00    60.00  
   1440x900      60.00  
   1400x900      60.00  
   1280x960      60.00  
   1368x768      60.00  
   1360x768      60.00  
   1280x800      60.00  
   1152x864      75.00    70.00    60.00  
   1280x720      60.00  
   1024x768      75.00    70.00    60.00  
   1024x576      60.00  
   960x600       60.00  
   832x624       75.00  
   960x540       60.00  
   800x600       75.00    72.00    60.00    56.00  
   840x525       70.00    60.00  
   864x486       60.00  
   700x525       70.00    60.00  
   800x450       60.00  
   640x512       75.00    60.00  
   720x450       60.00  
   700x450       60.00  
   640x480       75.00    73.00    60.00  
   684x384       60.00  
   680x384       60.00  
   640x400       60.00  
   576x432       75.00    70.00    60.00  
   640x360       60.00  
   512x384       75.00    70.00    60.00  
   512x288       60.00  
   416x312       75.00  
   480x270       60.00  
   400x300       75.00    72.00    60.00    56.00  
   432x243       60.00  
   320x240       75.00    73.00    60.00  
$ lspci | grep VGA
00:02.0 VGA compatible controller: Intel Corporation Device 9bc5 (rev 05)

xrandrでは、私のモニターが「default」と呼ばれることがわかります。だから私はこれを試しました:

$ cvt 3840 1080
# 3840x1080 59.96 Hz (CVT) hsync: 67.16 kHz; pclk: 346.00 MHz
Modeline "3840x1080_60.00"  346.00  3840 4088 4496 5152  1080 1083 1093 1120 -hsync +vsync
$ xrandr --newmode "3840x1080_60.00"  346.00  3840 4088 4496 5152  1080 1083 1093 1120 -hsync +vsync
$ xrandr --addmode default "3840x1080_60.00"
$ xrandr --output default --mode "3840x1080_60.00"

最後の行は私に以下を与えます:

xrandr: Configure crtc 0 failed

スペースがあるかどうかを確認するために、VideoRamを512000(デュアル)に増やしました。そこで何をすべきかわかりません。 32Gメモリがあります。

すべてのxrandrコマンドは以下を提供します。 xrandr: Failed to get size of gamma for output default ガンマのない仮想ディスプレイだからだと思います。

現在、VNCセッションで作業しています。 xrandxを完了するにはx11vncを閉じる必要がありますか?私は何をするのか分からない。

次のようにx11vncを起動します。

x11vnc -loop -forever -shared -repeat -noxdamage -xrandr -display :0 -clip 1920x1080+0+0

Linuxボックスは私のローカルネットワーク内にあるので、認証/パスワードは気にしません。

2021年5月27日に修正:

もっと隠れていて、いくつかのオプションが見つかりました。ダブルワイドスクリーンを取得した後、2つのx11vncインスタンスを作成できました。しかし、これは最適ではありません。 Linuxシステムでは依然として単一の画面で表示されます。今、その画面をインポートしてLinuxボックスに分割するように指示する方法はありますか?たとえば、KDEでウィンドウを最大化すると、2つのローカル画面にまたがっていませんか?

Xorg設定ファイル:

Section "Monitor"
  Identifier "Monitor0"
EndSection

Section "Device"
  Identifier "Card0"
  Driver "dummy"
  VideoRam 512000
EndSection

Section "Screen"
  Identifier "Screen0"
  Device "Card0"
  Monitor "Monitor0"
  DefaultDepth 24
  SubSection "Display"
    Depth 24
    Virtual 3840 1080
  EndSubSection
EndSection
x11vnc -loop -forever -shared -repeat -noxdamage -xrandr -display :0 -rfbport 5900 -clip 1920x1080+0+0
x11vnc -loop -forever -shared -repeat -noxdamage -xrandr -display :0 -rfbport 5901 -clip 1920x1080+1920+0

その後、VNCに接続して:0と:1を表示し、それをローカルモニターに合わせて、そのモニターに合わせてウィンドウのサイズを変更できます。

ダイアログウィンドウが表示されたら、Linuxの「大きな画面」の途中で何度も表示されます。私には両方のモニターにまたがっていました。

2021年11月12日に修正:

1つの解決策:https://superuser.com/a/1188573/514658

本当の問題は、VNCビューアをフルスクリーンに切り替えることができず、3つのモニターのうち2つのモニターでのみ可能です。ビューアで使用できる唯一のオプションはすべてのモニターを使用することです。これにより、Windows側を使用できなくなります。上記のリンクのDisplayFusionが機能しました。これで、1つのモニターの端に閉じ込めずに2つのモニターの間をスムーズにドラッグできます。

2021年11月16日に修正:

「解決済み」:(大きなハンマー)DisplayFusionを使用する代わりに、追加の検索でWindows PowerShellを見つけました。サードパーティのユーティリティは必要ありません。 3台のモニターのうち、2台の全画面に合わせて特定のウィンドウを移動/サイズ調整するだけです。ここにいる:

Add-Type @"
  using System;
  using System.Runtime.InteropServices;

  public class Win32 {
    [DllImport("user32.dll")]
    [return: MarshalAs(UnmanagedType.Bool)]
    public static extern bool GetWindowRect(IntPtr hWnd, out RECT lpRect);

    [DllImport("user32.dll")]
    [return: MarshalAs(UnmanagedType.Bool)]
    public static extern bool GetClientRect(IntPtr hWnd, out RECT lpRect);

    [DllImport("user32.dll")]
    [return: MarshalAs(UnmanagedType.Bool)]
    public static extern bool MoveWindow(IntPtr hWnd, int X, int Y, int nWidth, int nHeight, bool bRepaint);
  }

  public struct RECT
  {
    public int Left;        // x position of upper-left corner
    public int Top;         // y position of upper-left corner
    public int Right;       // x position of lower-right corner
    public int Bottom;      // y position of lower-right corner
  }

"@

$h = (Get-Process vnc-E4_6_3-x86_win32_viewer).MainWindowHandle
[Win32]::MoveWindow($h, 1920, 0, 3840, 1080, $true )

ベストアンサー1

次のX構成はヘッドレスワークステーションで機能し、x11vnc + vncviewerを使用してデュアル仮想モニターを有効にします。 Xダミードライバ(dummy_drv.so)を使用してください。 Xvfbアプリを使用して設定しようとしましたが、うまくいく可能性があります。しかし、KDEにはウィンドウの移動に関連するいくつかのバグがあります。

# darwin
Section "Monitor"
    Identifier  "Monitor1"
    HorizSync   60.0-100.0
    VertRefresh 60-120
    Option "Primary" "True"
    Option "Enable" "True"
    Option "Position" "0 0"
EndSection

Section "Monitor"
    Identifier  "Monitor2"
    HorizSync   60.0-100.0
    VertRefresh 60-120
    Option "Primary" "False"
    Option "Enable" "True"
    Option "Position" "1280 0"
    Option "RightOf" "Monitor1"
EndSection

Section "Device"
    Identifier  "Device1"
    Driver      "dummy"
    VideoRam    512000
    # DUMMY0 and DUMMY1 are driver names guessed from
    # errors in /var/log/Xorg.0.log and also
    # checking xorg-server src pkg.
    Option "Monitor-DUMMY0" "Monitor1"
    Option "Monitor-DUMMY1" "Monitor2"
EndSection

Section "Screen"
    Identifier  "Screen1"
    Device      "Device1"
    Monitor     "Monitor1"
    DefaultDepth 24
    SubSection "Display"
            Modes "1280x1024"
    EndSubSection   
EndSection

Section "Screen"
    Identifier  "Screen2"
    Device      "Device1"
    Monitor     "Monitor2"
    DefaultDepth 24
    SubSection "Display"
            Modes "1280x1024"
    EndSubSection   
EndSection

Section "ServerLayout"
    Identifier "Layout 1"
    Screen 0 "Screen1"
    Screen 1 "Screen2" RightOf "Screen1"
EndSection
                
Section "ServerFlags"
    Option "DefaultServerLayout" "Layout 1"
    # XRANDR extension is more recent and can replace older XINERAMA extension.
    # dummy_drv.so can easily be recompiled from latest source to support XRANDR.
    # If XRANDR is supported by dummy_drv.so, set the following to false.
    # Ubuntu 20.04 dummy_drv.so don't support XRANDR yet,
    # so the following must be set to true.
    Option "Xinerama"  "False"
EndSection

おすすめ記事