Gnome ignoring second monitor Ubuntu 19.10

tl;dr: I have an Ubuntu 19.10 setup that recognises both monitors (lspci shows both and I get a cursor on the second one) but xrandr -q and GNOME only see one of them. What might be the problem?


I set up a new system with a pair of GeForce RTX 2080 Ti cards and a 4K monitor connected to each via USB-C.

After installing Ubuntu 19.10, only one monitor came up. Running sudo nvidia-settings gave me a sample xconfig, which I appended to /usr/share/X11/xorg.conf.d/10-nvidia.conf. The result:

Section "OutputClass"
    Identifier "nvidia"
    MatchDriver "nvidia-drm"
    Driver "nvidia"
    Option "AllowEmptyInitialConfiguration"
    ModulePath "/usr/lib/x86_64-linux-gnu/nvidia/xorg"
EndSection

# nvidia-settings: X configuration file generated by nvidia-settings
# nvidia-settings:  version 435.21

Section "ServerLayout"
    Identifier     "Layout0"
    Screen      0  "Screen0" 0 0
    Screen      1  "Screen1" RightOf "Screen0"
    InputDevice    "Keyboard0" "CoreKeyboard"
    InputDevice    "Mouse0" "CorePointer"
    Option         "Xinerama" "0"
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"
    # HorizSync source: edid, VertRefresh source: edid
    Identifier     "Monitor0"
    VendorName     "Unknown"
    ModelName      "LG Electronics LG HDR 4K"
    HorizSync       30.0 - 135.0
    VertRefresh     56.0 - 61.0
    Option         "DPMS"
EndSection

Section "Monitor"
    # HorizSync source: unknown, VertRefresh source: unknown
    Identifier     "Monitor1"
    VendorName     "Unknown"
    ModelName      "LG Electronics LG HDR 4K"
    HorizSync       0.0 - 0.0
    VertRefresh     0.0
    Option         "DPMS"
EndSection

Section "Device"
    Identifier     "Device0"
    Driver         "nvidia"
    VendorName     "NVIDIA Corporation"
    BoardName      "GeForce RTX 2080 Ti"
    BusID          "PCI:10:0:0"
EndSection

Section "Device"
    Identifier     "Device1"
    Driver         "nvidia"
    VendorName     "NVIDIA Corporation"
    BoardName      "GeForce RTX 2080 Ti"
    BusID          "PCI:4:0:0"
EndSection

Section "Screen"
    Identifier     "Screen0"
    Device         "Device0"
    Monitor        "Monitor0"
    DefaultDepth    24
    Option         "Stereo" "0"
    Option         "nvidiaXineramaInfoOrder" "DFP-6"
    Option         "metamodes" "nvidia-auto-select +0+0"
    Option         "SLI" "Off"
    Option         "MultiGPU" "Off"
    Option         "BaseMosaic" "off"
    SubSection     "Display"
        Depth       24
    EndSubSection
EndSection

Section "Screen"
    Identifier     "Screen1"
    Device         "Device1"
    Monitor        "Monitor1"
    DefaultDepth    24
    Option         "Stereo" "0"
    Option         "metamodes" "nvidia-auto-select +0+0 {AllowGSYNC=Off}"
    Option         "SLI" "Off"
    Option         "MultiGPU" "Off"
    Option         "BaseMosaic" "off"
    SubSection     "Display"
        Depth       24
    EndSubSection
EndSection

After rebooting, I still get GNOME on the one monitor. The other monitor, however, is a black screen with just the default X cursor (the glow on the right is just reflections on the monitor):

enter image description here

I also noticed two gdm3 sessions in htop, one running:

/usr/lib/xorg/Xorg vt2 -displayfd 3 -auth /run/user/1000/gdm/Xauthority -background none -noreset -keeptty -verbose 3

The other running the same command line but with vt1 instead of vt2. Killing the vt2 one killed my GNOME session. Killing the other one, however, seemed to do nothing. I can even still see a cursor on the second monitor.

Afaict from Settings | Devices | Screen Display, only one monitor is present:

enter image description here

Some additional data:

$ lspci | grep -i nvidia
04:00.0 VGA compatible controller: NVIDIA Corporation TU102 [GeForce RTX 2080 Ti Rev. A] (rev a1)
04:00.1 Audio device: NVIDIA Corporation TU102 High Definition Audio Controller (rev a1)
04:00.2 USB controller: NVIDIA Corporation TU102 USB 3.1 Controller (rev a1)
04:00.3 Serial bus controller [0c80]: NVIDIA Corporation TU102 UCSI Controller (rev a1)
0a:00.0 VGA compatible controller: NVIDIA Corporation TU102 [GeForce RTX 2080 Ti Rev. A] (rev a1)
0a:00.1 Audio device: NVIDIA Corporation TU102 High Definition Audio Controller (rev a1)
0a:00.2 USB controller: NVIDIA Corporation TU102 USB 3.1 Controller (rev a1)
0a:00.3 Serial bus controller [0c80]: NVIDIA Corporation TU102 UCSI Controller (rev a1)
$ xrandr -q
Screen 0: minimum 8 x 8, current 3840 x 2160, maximum 32767 x 32767
HDMI-0 disconnected (normal left inverted right x axis y axis)
DP-0 disconnected (normal left inverted right x axis y axis)
DP-1 disconnected (normal left inverted right x axis y axis)
DP-2 disconnected (normal left inverted right x axis y axis)
DP-3 disconnected (normal left inverted right x axis y axis)
HDMI-1 disconnected (normal left inverted right x axis y axis)
USB-C-0 connected primary 3840x2160+0+0 (normal left inverted right x axis y axis) 600mm x 340mm
   3840x2160     60.00*+  30.00  
   2560x1440     59.95  
   1920x1080     60.00    59.94  
   1600x900      60.00  
   1280x1024     60.02  
   1280x800      59.81  
   1280x720      60.00    59.94  
   1152x864      59.96  
   1024x768      60.00  
   800x600       60.32  
   720x480       59.94  
   640x480       59.94    59.93  
$ nvidia-smi
Sun Dec  8 14:19:03 2019       
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 435.21       Driver Version: 435.21       CUDA Version: 10.1     |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|===============================+======================+======================|
|   0  GeForce RTX 208...  Off  | 00000000:04:00.0  On |                  N/A |
| 25%   32C    P8     6W / 260W |     39MiB / 11019MiB |      0%      Default |
+-------------------------------+----------------------+----------------------+
|   1  GeForce RTX 208...  Off  | 00000000:0A:00.0  On |                  N/A |
| 32%   41C    P8     4W / 260W |    571MiB / 11016MiB |      4%      Default |
+-------------------------------+----------------------+----------------------+

+-----------------------------------------------------------------------------+
| Processes:                                                       GPU Memory |
|  GPU       PID   Type   Process name                             Usage      |
|=============================================================================|
|    0      7142      G   /usr/lib/xorg/Xorg                            37MiB |
|    1      7142      G   /usr/lib/xorg/Xorg                           268MiB |
|    1      7351      G   /usr/bin/gnome-shell                         260MiB |
|    1      9360      G   gnome-control-center                           6MiB |
|    1     10505      G   ...no-sandbox --gpu-preferences=IAAAAAAAAA    34MiB |
+-----------------------------------------------------------------------------+

Question: Why is only one of my monitors being picked up by GNOME and what can I do to fix this?

UPDATE: I've uploaded my /var/log/Xorg.0.log. No smoking gun there, afaict.


Solution 1:

Your xorg.conf shows the following setup. You have configured two screens one is most probably localhost:0.0 and the other is localhost:0.1 (or :0.0 and :0.1 shorter). It is also possible :1.0 and :1.1 or :2.0 and :2.1, but since you have Xorg.0.log it is :0.0 and :0.1. Just for info. If you run more Xorg instances, you get higher display numbers. It is handy for multiseat setups (https://www.x.org/wiki/Development/Documentation/Multiseat/), but you don't need this.

I see you noticed two Xorg programs running. One on vt1 and another on vt2. You can switch between them with AltCtrlF1 and AltCtrlF2. See Duplicate xorg session created on Ubuntu 18.04 with Nvidia Drivers for more info.

Try to run these commands from command prompt:

DISPLAY=:0.0 xclock &
DISPLAY=:0.1 xclock &

They should open two xclocks each on one screen. The xclock on second screen cannot be moved because there is no window manager there. The "X" cursor on second screen indicates that Xorg runs properly there. You just don't have window manager on that screen. The problem you have is that GNome obviously cannot handle two screens (:0.0, and :0.1). It can be seen in the xorg.conf, that each screen is running on its own graphics adapter (BusID "PCI:10:0:0", BusID "PCI:04:0:0").

You could run another window manager on second screen, but I think you don't want to do that although either. It comes handy for some configurations. You cannot move windows from on screen to another in that case.

I think the solution in your case would be to use Xinerama (https://en.wikipedia.org/wiki/Xinerama, https://help.ubuntu.com/community/XineramaHowTo), which you have disabled in your xorg.conf. From your xorg.conf it can be seen that Xinerama is disabled (Option "Xinerama" "0").

You can try just to enable Xinerama in xorg.conf (Option "Xinerama" "1"), or generate another xorg.conf with nvidia-settings this time with Xinerama enabled.

More ideas:

  • I would suggest to run programs in the same way as you started xclock with different target displays. You can do that also from text tty terminals (vt3, vt4,...). In that way, you will see which displays you have. With active Xinerama you should have only one DISPLAY.
  • The next thing I would try is to investigate Xorg.0.log. According to your comment you should also have Xorg.1.log.
  • If Xorg starts correctly, I would look for Gnome errors ($HOME/.xsession-errors).
  • And one very important thing - try different XServers. When you log in, you can see settings icon besides Sign in button. Select different options (my favorite candidate for your problem Gnome on Xorg). I've seen to many strange problems with wayland. :-(

Solution 2:

I solved my problem using nvidia-settings to force:

  • ONLY one GPU
  • attach both screens to the same XServer

screen-1

screen-2

dual-screen-3

My /etc/X11/xorg.conf looks like:

# nvidia-settings: X configuration file generated by nvidia-settings

# nvidia-settings:  version 435.21

Section "ServerLayout"
    Identifier     "Layout0"
    Screen      0  "Screen0" 0 0
    InputDevice    "Keyboard0" "CoreKeyboard"
    InputDevice    "Mouse0" "CorePointer"
    Option         "Xinerama" "0"
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"
    # HorizSync source: edid, VertRefresh source: edid
    Identifier     "Monitor0"
    VendorName     "Unknown"
    ModelName      "DELL P2715Q"
    HorizSync       31.0 - 140.0
    VertRefresh     29.0 - 75.0
    Option         "DPMS"
EndSection

Section "Device"
    Identifier     "Device0"
    Driver         "nvidia"
    VendorName     "NVIDIA Corporation"
    BoardName      "GeForce GTX 970"
    BusID          "PCI:2:0:0"
EndSection

Section "Screen"
    Identifier     "Screen0"
    Device         "Device0"
    Monitor        "Monitor0"
    DefaultDepth    24
    Option         "Stereo" "0"
    Option         "nvidiaXineramaInfoOrder" "DFP-2"
    Option         "metamodes" "GPU-7b73f4b2-5211-0f20-32fb-4e29bfc82a31.DP-0: 3840x2160_60 +0+0 {ForceCompositionPipeline=On, ForceFullCompositionPipeline=On}, GPU-48e16c73-84d2-6b66-9625-b44b1ab1642d.DP-0: nvidia-auto-select +3840+0"
    Option         "MultiGPU" "Off"
    Option         "SLI" "off"
    Option         "BaseMosaic" "on"
    SubSection     "Display"
        Depth       24
    EndSubSection
EndSection

I hope this helps you!