![Gnome 忽略第二台显示器 Ubuntu 19.10](https://linux22.com/image/918701/Gnome%20%E5%BF%BD%E7%95%A5%E7%AC%AC%E4%BA%8C%E5%8F%B0%E6%98%BE%E7%A4%BA%E5%99%A8%20Ubuntu%2019.10.png)
总结:我有一个 Ubuntu 19.10 设置,可以识别两个显示器(lspci
同时显示两个显示器,并在第二个显示器上显示光标),但xrandr -q
GNOME 只能看到其中一个。可能是什么问题?
我建立了一个新系统,其中有一对 GeForce RTX 2080 Ti 卡和一个通过 USB-C 连接到每个卡的 4K 显示器。
安装 Ubuntu 19.10 后,只出现了一个监视器。运行后,sudo nvidia-settings
我得到了一个示例 xconfig,我将其附加到/usr/share/X11/xorg.conf.d/10-nvidia.conf
。结果:
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
重启后,我仍然可以在一个显示器上看到 GNOME。但是,另一个显示器是黑屏,只有默认的 X 光标(右侧的光晕只是显示器上的反射):
我还注意到 htop 中有两个 gdm3 会话,其中一个正在运行:
/usr/lib/xorg/Xorg vt2 -displayfd 3 -auth /run/user/1000/gdm/Xauthority -background none -noreset -keeptty -verbose 3
另一个运行相同的命令行,但使用的是 vt1 而不是 vt2。关闭 vt2 会终止我的 GNOME 会话。但是,关闭另一个似乎没有任何作用。我甚至还能在第二个显示器上看到光标。
据我所知Settings | Devices | Screen Display
,只有一个监视器:
一些附加数据:
$ 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 |
+-----------------------------------------------------------------------------+
问题:为什么我的其中一个显示器被 GNOME 选中,我该如何修复这个问题?
更新:我有上传了我的/var/log/Xorg.0.log
. 据我所知,没有确凿的证据。
答案1
您的 xorg.conf 显示以下设置。您已配置两个屏幕,一个很可能是localhost:0.0
,另一个是localhost:0.1
(或:0.0
和:0.1
更短)。也可能是:1.0
和:1.1
或:2.0
和:2.1
,但因为您有 Xorg。0.log 是:0.0
和:0.1
。仅供参考。如果您运行更多 Xorg 实例,您将获得更高的显示数字。它对于多座席设置很方便(https://www.x.org/wiki/Development/Documentation/Multiseat/),但你不需要这个。
我看到您注意到有两个 Xorg 程序正在运行。一个在 vt1 上,另一个在 vt2 上。您可以使用AltCtrlF1和在它们之间切换AltCtrlF2。请参阅使用 Nvidia 驱动程序在 Ubuntu 18.04 上创建重复的 xorg 会话了解更多信息。
尝试从命令提示符运行以下命令:
DISPLAY=:0.0 xclock &
DISPLAY=:0.1 xclock &
他们应该在一个屏幕上分别打开两个 xclock。第二个屏幕上的 xclock 无法移动,因为那里没有窗口管理器。第二个屏幕上的“X”光标表示 Xorg 在那里正常运行。您只是在那个屏幕上没有窗口管理器。您遇到的问题是 GNome 显然无法处理两个屏幕(:0.0
、 和:0.1
)。在 xorg.conf 中可以看到,每个屏幕都在自己的图形适配器上运行(BusID "PCI:10:0:0"
、BusID "PCI:04:0:0"
)。
您可以在第二个屏幕上运行另一个窗口管理器,但我认为您也不想这样做。它在某些配置中很方便。在这种情况下,您无法将窗口从一个屏幕移动到另一个屏幕。
我认为您的解决方案是使用 Xinerama (https://en.wikipedia.org/wiki/Xinerama,https://help.ubuntu.com/community/XineramaHowTo),您已在 xorg.conf 中禁用了该功能。从 xorg.conf 中可以看出 Xinerama 已被禁用 ( Option "Xinerama" "0"
)。
您可以尝试在 xorg.conf () 中启用 Xinerama Option "Xinerama" "1"
,或者生成另一个 xorg.conf 并nvidia-settings
启用 Xinerama。
更多想法:
- 我建议以与启动 xclock 相同的方式运行程序,并使用不同的目标显示器。您也可以从文本 tty 终端(vt3、vt4 等)执行此操作。这样,您将看到您拥有哪些显示器。使用活动的 Xinerama,您应该只有一个显示器。
- 我要尝试的下一步是调查 Xorg.0.log。根据您的评论,您还应该有 Xorg.1.log。
- 如果 Xorg 正确启动,我会查找 Gnome 错误(
$HOME/.xsession-errors
)。 - 还有一件非常重要的事情 - 尝试不同的 XServers。登录时,除了
Sign in
按钮之外,您还可以看到设置图标。选择不同的选项(我最喜欢的问题候选Gnome on Xorg
)。我见过很多关于 wayland 的奇怪问题。:-(
答案2
我使用 nvidia-settings 强制解决了我的问题:
- 仅一个 GPU
- 将两个屏幕连接到同一个 XServer
我的 /etc/X11/xorg.conf 如下所示:
# 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
我希望这可以帮助你!