更改/重置默认显示

更改/重置默认显示

我将很难解释这个问题,但是......

我正在运行 Ubuntu 22.04,其中有一个大量使用显卡的 docker,即 Nvidia 显卡。

由于交换文件已满 [我的 SSD 上有 32GB+8GB 的​​交换空间],当我进入 docker 时,机器卡住了。这通常发生在我尝试编译一个大型 C++ 项目并且不确保交换空间可用时 [所以我猜操作系统很难检测到从哪里获取额外内存]。

问题开始于当我错过了交换文件已满的时间点并且机器卡住(或者硬重置)时。

重新启动后,Ubuntu 无法在显示器 :1(即显卡)上运行应用程序。尽管 HDMI 电缆仍处于连接状态并且 GUI 已显示。

可行的方法是关闭机器。将 HDMI 连接到主板。启动 Ubuntu。然后关闭并重新连接到显卡。

此后问题就消失了。

但是,这只有当我可以物理访问我的机器时才有效。不幸的是,目前还不存在这种情况。

我有以下输出 xrandr -q --display :0

Screen 0: minimum 320 x 200, current 2560 x 1440, maximum 16384 x 16384
HDMI-A-0 disconnected (normal left inverted right x axis y axis)
DisplayPort-0 disconnected (normal left inverted right x axis y axis)
DisplayPort-1 disconnected (normal left inverted right x axis y axis)
DisplayPort-2 disconnected (normal left inverted right x axis y axis)
HDMI-1-0 connected primary 2560x1440+0+0 (normal left inverted right x axis y axis) 597mm x 336mm
   2560x1440     59.95*+
   2048x1080     60.00  
   1920x1200     59.88  
   1920x1080     60.00    59.94    50.00  
   1680x1050     59.95  
   1600x1200     60.00  
   1280x1024     75.02    60.02  
   1280x800      59.81  
   1280x720      60.00    59.94    50.00  
   1152x864      75.00  
   1024x768      75.03    60.00  
   800x600       75.00    60.32  
   720x576       50.00  
   720x480       59.94  
   640x480       75.00    59.94    59.93  
DP-1-0 disconnected (normal left inverted right x axis y axis)
DP-1-1 disconnected (normal left inverted right x axis y axis)
DP-1-2 disconnected (normal left inverted right x axis y axis)
DP-1-3 disconnected (normal left inverted right x axis y axis)
DP-1-4 disconnected (normal left inverted right x axis y axis)
DP-1-5 disconnected (normal left inverted right x axis y axis)

xrandr -q --display :1

Can't open display :1

此时我的屏幕已连接到视频卡,看起来,这是 DISPLAY :1。但是,在该显示器上启动程序无法按预期工作。

例如,运行DISPLAY=:1 firefox输出以下内容:

Gtk-Message: 09:01:12.579: Not loading module "atk-bridge": The functionality is provided by GTK natively. Please try to not load it.
Error: cannot open display: :1

以自然方式运行 Firefox 会产生以下图形: Firefox 看起来像这样

lspci输出:

00:00.0 Host bridge: Advanced Micro Devices, Inc. [AMD] Device 14d8
00:01.0 Host bridge: Advanced Micro Devices, Inc. [AMD] Device 14da
00:01.1 PCI bridge: Advanced Micro Devices, Inc. [AMD] Device 14db
00:01.2 PCI bridge: Advanced Micro Devices, Inc. [AMD] Device 14db
00:02.0 Host bridge: Advanced Micro Devices, Inc. [AMD] Device 14da
00:02.1 PCI bridge: Advanced Micro Devices, Inc. [AMD] Device 14db
00:03.0 Host bridge: Advanced Micro Devices, Inc. [AMD] Device 14da
00:04.0 Host bridge: Advanced Micro Devices, Inc. [AMD] Device 14da
00:08.0 Host bridge: Advanced Micro Devices, Inc. [AMD] Device 14da
00:08.1 PCI bridge: Advanced Micro Devices, Inc. [AMD] Device 14dd
00:08.3 PCI bridge: Advanced Micro Devices, Inc. [AMD] Device 14dd
00:14.0 SMBus: Advanced Micro Devices, Inc. [AMD] FCH SMBus Controller (rev 71)
00:14.3 ISA bridge: Advanced Micro Devices, Inc. [AMD] FCH LPC Bridge (rev 51)
00:18.0 Host bridge: Advanced Micro Devices, Inc. [AMD] Device 14e0
00:18.1 Host bridge: Advanced Micro Devices, Inc. [AMD] Device 14e1
00:18.2 Host bridge: Advanced Micro Devices, Inc. [AMD] Device 14e2
00:18.3 Host bridge: Advanced Micro Devices, Inc. [AMD] Device 14e3
00:18.4 Host bridge: Advanced Micro Devices, Inc. [AMD] Device 14e4
00:18.5 Host bridge: Advanced Micro Devices, Inc. [AMD] Device 14e5
00:18.6 Host bridge: Advanced Micro Devices, Inc. [AMD] Device 14e6
00:18.7 Host bridge: Advanced Micro Devices, Inc. [AMD] Device 14e7
01:00.0 VGA compatible controller: NVIDIA Corporation Device 2782 (rev a1)
01:00.1 Audio device: NVIDIA Corporation Device 22bc (rev a1)
02:00.0 Non-Volatile memory controller: Samsung Electronics Co Ltd NVMe SSD Controller SM981/PM981/PM983
03:00.0 PCI bridge: Advanced Micro Devices, Inc. [AMD] Device 43f4 (rev 01)
04:00.0 PCI bridge: Advanced Micro Devices, Inc. [AMD] Device 43f5 (rev 01)
04:04.0 PCI bridge: Advanced Micro Devices, Inc. [AMD] Device 43f5 (rev 01)
04:05.0 PCI bridge: Advanced Micro Devices, Inc. [AMD] Device 43f5 (rev 01)
04:06.0 PCI bridge: Advanced Micro Devices, Inc. [AMD] Device 43f5 (rev 01)
04:07.0 PCI bridge: Advanced Micro Devices, Inc. [AMD] Device 43f5 (rev 01)
04:08.0 PCI bridge: Advanced Micro Devices, Inc. [AMD] Device 43f5 (rev 01)
04:09.0 PCI bridge: Advanced Micro Devices, Inc. [AMD] Device 43f5 (rev 01)
04:0a.0 PCI bridge: Advanced Micro Devices, Inc. [AMD] Device 43f5 (rev 01)
04:0b.0 PCI bridge: Advanced Micro Devices, Inc. [AMD] Device 43f5 (rev 01)
04:0c.0 PCI bridge: Advanced Micro Devices, Inc. [AMD] Device 43f5 (rev 01)
04:0d.0 PCI bridge: Advanced Micro Devices, Inc. [AMD] Device 43f5 (rev 01)
0c:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8125 2.5GbE Controller (rev 05)
0e:00.0 USB controller: Advanced Micro Devices, Inc. [AMD] Device 43f7 (rev 01)
0f:00.0 SATA controller: Advanced Micro Devices, Inc. [AMD] Device 43f6 (rev 01)
10:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Device 164e (rev c1)
10:00.1 Audio device: Advanced Micro Devices, Inc. [AMD/ATI] Device 1640
10:00.2 Encryption controller: Advanced Micro Devices, Inc. [AMD] VanGogh PSP/CCP
10:00.3 USB controller: Advanced Micro Devices, Inc. [AMD] Device 15b6
10:00.4 USB controller: Advanced Micro Devices, Inc. [AMD] Device 15b7
10:00.6 Audio device: Advanced Micro Devices, Inc. [AMD] Family 17h (Models 10h-1fh) HD Audio Controller
11:00.0 USB controller: Advanced Micro Devices, Inc. [AMD] Device 15b8

问题是什么?我该如何通过执行一些命令来解决这个问题,而不采用我迄今为止使用的解决方法?

相关内容