Trouble getting separate X screens using GT 710 on Ubuntu Server

  • My ultimate goal (not the question here, just for context): I want to run LXC GUI containers from the command line, display each one on a different monitor attached to my GT710. I want to share a keyboard and mouse between the monitors, but I will never move windows between them.
  • What I think I need to do: I think I need to set up multiple X screens so that I can start a container with DISPLAY=:0.0, DISPLAY=:0.1, or DISPLAY=:0.2. In order to do that, I think I need to create multiple screen, device, and monitor sections in xorg.conf. I might or might not need to use ZaphoHeads. I’m fairly sure that TwinView is not what I want.
  • My attempts with xorg.conf:
    I’ve tried so many things that I am not sure which version of my xorg.conf would be most relevant, so I will just give the most recent one:
ection "ServerLayout"
    Identifier     "Layout0"
    Screen      0  "Screen0" 0 0 
    Screen      1  "Screen1" rightOf "Screen0" 
    InputDevice    "Keyboard0" "CoreKeyboard"
    InputDevice    "Mouse0" "CorePointer"
EndSection

Section "Files"
EndSection

Section "InputDevice"

    # generated from default
    Identifier     "Mouse0"
    Driver         "mouse"
    Option         "Protocol" "auto"
    Option         "Device" "/dev/psaux"
    Option         "Emulate3Buttons" "no"
    Option         "ZAxisMapping" "4 5"
EndSection

Section "InputDevice"

    # generated from default
    Identifier     "Keyboard0"
    Driver         "kbd"
EndSection

Section "Monitor"
    Identifier     "Monitor0"
    VendorName     "Unknown"
    ModelName      "Unknown"
    Option         "DPMS" "DVI"
EndSection

Section "Device"
    Identifier     "Device0"
    Driver         "nvidia"
    Screen          0
    VendorName     "NVIDIA Corporation"
    Option         "ZaphodHeads" "Monitor0"
EndSection

Section "Screen"
    Identifier     "Screen0"
    Device         "Device0"
    Monitor        "Monitor0"
    DefaultDepth    24
    SubSection     "Display"
        Depth       24
    EndSubSection
EndSection

Section "Monitor"
    Identifier     "Monitor1"
    VendorName     "Unknown"
    ModelName      "Unknown"
    Option         "DPMS" "HDMI"
EndSection

Section "Device"
    Identifier     "Device1"
    Driver         "nvidia"
    Screen          1
    VendorName     "NVIDIA Corporation"
    Option         "ZaphodHeads" "Monitor1"
EndSection

Section "Screen"
    Identifier     "Screen1"
    Device         "Device1"
    Monitor        "Monitor1"
    DefaultDepth    24
    SubSection     "Display"
    Depth       24
    EndSubSection
EndSection

Although I have a second HDMI monitor attached, it does not show in xrandr with this configuration. However with X started, I can move my cursor between monitors, so X is seeing the HDMI monitor somehow.

~$ sudo xrandr -q
Screen 0: minimum 8 x 8, current 1600 x 1200, maximum 16384 x 16384
VGA-0 disconnected primary (normal left inverted right x axis y axis)
DVI-D-0 connected 1600x1200+0+0 (normal left inverted right x axis y axis) 367mm x 275mm
   1600x1200     60.00*+
   1280x1024     75.02    60.02  
   1152x864      75.00  
   1024x768      75.03    60.00  
   800x600       75.00    60.32  
   640x480       75.00    59.94  

If I remove the ServerLayout section, xrandr can get info for both monitors:

Screen 0: minimum 8 x 8, current 4160 x 1440, maximum 16384 x 16384
VGA-0 disconnected primary (normal left inverted right x axis y axis)
DVI-D-0 connected 1600x1200+0+0 (normal left inverted right x axis y axis) 367mm x 275mm
   1600x1200     60.00*+
   1280x1024     75.02    60.02  
   1152x864      75.00  
   1024x768      75.03    60.00  
   800x600       75.00    60.32  
   640x480       75.00    59.94  
HDMI-0 connected 2560x1440+1600+0 (normal left inverted right x axis y axis) 597mm x 336mm
   2560x1440     59.95*+
   2048x1152     60.00  
   1920x1440     60.00  
   1920x1200     59.88  
   1920x1080     60.00    59.94    50.00    60.05    60.00    50.04  
   1680x1050     59.95  
   1440x900      59.89  
   1440x576      50.00  
   1440x480      59.94  
   1280x1024     75.02    60.02  
   1280x720      60.00    59.94    50.00  
   1024x768      75.03    70.07    60.00  
   800x600       75.00    72.19    60.32    56.25  
   720x576       50.00  
   720x480       59.94  
   640x480       75.00    72.81    59.94    59.93 

If I specify the PCI BusID with BusID "PCI:44:0:0" under the Device entries, X cannot start:

[ 44357.124] (WW) xf86OpenConsole: setpgid failed: Operation not permitted
[ 44357.124] (WW) xf86OpenConsole: setsid failed: Operation not permitted
[ 44357.125] (WW) Falling back to old probe method for modesetting
[ 44357.125] (WW) Falling back to old probe method for fbdev
[ 44357.125] (WW) Falling back to old probe method for modesetting
[ 44357.125] (WW) Falling back to old probe method for fbdev
[ 44357.125] (EE) No devices detected.
[ 44357.125] (EE) 
Fatal server error:
[ 44357.125] (EE) no screens found(EE) 

I’ve looked at a bunch of documentation, but am still confused. These include:
http://http.download.nvidia.com/XFree86/Linux-x86_64/470.82.01/README/configmultxscreens.html
https://nvidia.custhelp.com/app/answers/detail/a_id/176/~/linux---configuring-multiple-x-screens-on-one-card
https://www.x.org/archive/X11R6.9.0/doc/html/xorg.conf.5.htm

Also, my driver info:

nvidia-smi
Tue Nov 23 01:26:12 2021       
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 470.82.01    Driver Version: 470.82.01    CUDA Version: 11.4     |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|                               |                      |               MIG M. |
|===============================+======================+======================|
|   0  NVIDIA GeForce ...  Off  | 00000000:44:00.0 N/A |                  N/A |
| 40%   38C    P0    N/A /  N/A |      0MiB /   973MiB |     N/A      Default |
|                               |                      |                  N/A |
+-------------------------------+----------------------+----------------------+
                                                                               
+-----------------------------------------------------------------------------+
| Processes:                                                                  |
|  GPU   GI   CI        PID   Type   Process name                  GPU Memory |
|        ID   ID                                                   Usage      |
|=============================================================================|
|  No running processes found                                                 |
+-----------------------------------------------------------------------------+

You got this right in the first place. When you run xrandr, it will only show the first screen (:0.0),says “Screen0:”. To get the xrandr output from the second screen, run
DISPLAY=:0.1 xrandr
to get the output from the second screen.

1 Like

Yes, you are right!!! That’s all I had to do.