Multiple dummy monitors on remote headless Linux for VNC to local multiple monitors
1
vote
1
answer
6170
views
I submit defeat. I have been trying to configure my remote Linux box to have two dummy monitors so that I can use multiple local monitors to VNC into it. I'm surprised that no one else has needed help with this to find something on the web.
I've also tried creating a monitor on the Linux box that is double wide. Then use x11vnc to -clip an area for each display. But I'm having issues creating a monitor that large with the dummy driver.
I do have a graphics adapter installed that has two DisplayPorts but am not planning to use it. When I was using the real adapter, I was getting sluggish behavior. When I tried the dummy, it was very responsive. So I'm hoping to just create another dummy.
I'm using KDE DM.
I have seen many examples of using VIRTUAL1 but I can't get that working with the dummy driver. I tried adding Option "VirtualHeads" "2" into the config but the dummy driver doesn't recognize it.
I’ve seen suggestions of using Xvfb but it has been deprecated by the dummy driver since 2016.
Here are some details.
$ 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 is empty
The following was gleaned from searching the internet. Once I got it working I stopped tweaking it so it may have flaws but that don't seem to affect me.
/usr/share/X11/xorg.conf.d/dummy-1920x1080.conf has the following which gets me my single 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)
I can see from xrandr that my monitor is called "default". So I tried this:
$ 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"
The last line gives me:
xrandr: Configure crtc 0 failed
I tried to increase VideoRam to 512000 (double) to make sure I had room. Not sure what to do there. I have 32G ram.
And ALL xrandr commands give me:
: Failed to get size of gamma for output default
and I figure that's because it's a dummy monitor that has no gamma.
I'm currently Working within the VNC session. Do I need to shut down x11vnc to get xrandx to complete? I'm at my wits end.
I'm starting x11vnc like this:
x11vnc -loop -forever -shared -repeat -noxdamage -xrandr -display :0 -clip 1920x1080+0+0
The linux box is within my local net so I'm not concerned with authentication/passwords.
**Edit 2021-05-27:**
More lurking and I found some options. I was able to get a double wide screen and then create two x11vnc instances. But this isn't optimal. The Linux box still sees this as a single screen. Now is there a way to take that screen and tell the Linux box to split it? For example, if I maximize a window in KDE it will not span both local screens?
Xorg conf file:
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
I can then connect to VNC displays :0 and :1 and arrange them on local monitors and resize the windows to fit those monitors.
When a dialog window appears, many times it's in the middle of the Linux "big screen" which for me spans both monitors...
**Edit 2021-11-12:**
One solution: https://superuser.com/a/1188573/514658
The real issue is not being able to get my VNC viewer to go full screen and only span two of my three monitors. The only option available in the viewer is to use ALL monitors which then blocks my use of the Windows side. DisplayFusion at above link did the trick. Now I can seamlessly drag between my two monitors and not get stuck on the edge of one.
**Edit 2021-11-16:**
"SOLVED": Instead of using DisplayFusion, which is a big hammer, more searching led me to Windows PowerShell. No need for a third party utility. I only need to move/resize a specific window to fit on two of my three monitors full screen. Here it is:
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
Asked by bgrupczy
(11 rep)
May 27, 2021, 09:45 PM
Last activity: Apr 15, 2025, 03:03 PM
Last activity: Apr 15, 2025, 03:03 PM