NVIDIA 驱动更新后显示器无法识别问题排查与解决

日期: 2026-06-19
系统: Ubuntu 22.04 LTS
显卡: NVIDIA GeForce GTX 660 Ti (GK104)
显示器: 未知品牌 1080p 显示器(DVI 接口)
驱动版本: 470.256.02(从 470.223.02 升级后出现问题)

下面是我使用 OpenClaw, 采用 xunfei GLM 5.0 大模型自动的解决的问题,并记录成技术文档;
讯飞星辰 MAAS 平台的 内推吗:邀请码【MAAS-4C5F3FF6】
可点击链接 前往页面:https://maas.xfyun.cn/packageSubscription?inviteCode=MAAS-4C5F3FF6


问题现象

更新 NVIDIA 驱动后,显示器无法显示,系统进入黑屏状态。通过 SSH 远程连接后检查:

$ xrandr --props
# 无输出或报错

$ cat /var/log/Xorg.0.log | grep -i connected
(--) NVIDIA(GPU-0): CRT-0: disconnected
(--) NVIDIA(GPU-0): DFP-0: disconnected
(--) NVIDIA(GPU-0): DFP-1: disconnected
(--) NVIDIA(GPU-0): DFP-2: disconnected
(--) NVIDIA(GPU-0): DFP-3: disconnected

所有输出端口均显示 disconnected,显示器无法被识别。


排查过程

1. 确认显卡状态

$ nvidia-smi
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 470.256.02   Driver Version: 470.256.02   CUDA Version: 11.4     |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Ev|   Memory-Usage       | GPU-Util  Compute M. |
|===============================+======================+======================|
|   0  NVIDIA GeForce ...  Off  | 00000000:01:00.0 N/A |                  N/A |
+-------------------------------+----------------------+----------------------+

显卡被正确识别,驱动加载正常,但 Disp.A 显示 N/A,说明无显示输出。

2. 检查 DRM 接口

$ ls -la /sys/class/drm/
total 0
drwxr-xr-x  2 root root    0 Jun 19 11:02 .
drwxr-xr-x 75 root root    0 Jun 19 11:02 ..
lrwxrwxrwx  1 root root    0 Jun 19 11:02 card0 -> ...
lrwxrwxrwx  1 root root    0 Jun 19 11:02 renderD128 -> ...

只有 card0renderD128,没有 card0-DVI-*card0-HDMI-* 子目录,说明内核 DRM 层也没有检测到显示器。

3. 检查 EDID 信息

$ cat /sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/drm/card0/card0-DVI-I-1/edid
# 文件不存在或为空

EDID 信息缺失:显示器没有通过 DDC/CI 协议向显卡传递 EDID 信息。

4. 分析 Xorg 日志

$ cat /var/log/Xorg.0.log | grep -E '(Output|connected|DFP|CRT)'
(--) NVIDIA(0):     CRT-0
(--) NVIDIA(0):     DFP-0 (boot)
(--) NVIDIA(0):     DFP-1
(--) NVIDIA(0):     DFP-2
(--) NVIDIA(0):     DFP-3
(--) NVIDIA(GPU-0): CRT-0: disconnected
(--) NVIDIA(GPU-0): DFP-0: disconnected
(--) NVIDIA(GPU-0): DFP-1: disconnected
(--) NVIDIA(GPU-0): DFP-2: disconnected
(--) NVIDIA(GPU-0): DFP-3: disconnected

GTX 660 Ti 的输出端口映射:

  • CRT-0 = DVI-I(可转 VGA,模拟信号)
  • DFP-0 = DVI-D(纯数字,标记为 boot 设备)
  • DFP-1 = HDMI
  • DFP-2/3 = DisplayPort

用户使用 DVI 接口连接显示器,但 DFP-0 和 CRT-0 都显示 disconnected。


根本原因

EDID 通信失败,可能原因:

  1. DVI 线缆问题:线缆不支持 DDC 通道,或 DDC 线断裂
  2. 显示器 EDID 损坏:显示器内部 EDID EEPROM 损坏或未写入
  3. 驱动兼容性:新版驱动对 EDID 解析更严格,旧驱动可能容错处理
  4. 硬件老化:GTX 660 Ti 是 2012 年产品,DVI 接口可能老化

由于无法物理检查硬件(远程主机),采用软件方案:强制指定 EDID


解决方案:强制指定 EDID

步骤 1:生成 EDID 文件

创建一个标准的 1920x1080 60Hz EDID 文件(128 字节):

import struct

def checksum(data):
    return (256 - sum(data)) & 0xFF

edid = bytearray(128)

# Header
edid[0:8] = bytes([0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00])

# Manufacturer ID: LGD (LG Display)
edid[8] = 0x1E
edid[9] = 0x6D
edid[10] = 0x00

# Week 1, Year 2020
edid[16] = 0x01
edid[17] = 0x14

# EDID version 1.3
edid[18] = 0x01
edid[19] = 0x03

# Basic display parameters (digital, 34x19 cm, gamma 2.2)
edid[20] = 0x80
edid[21] = 0x22
edid[22] = 0x13
edid[23] = 0x78
edid[24] = 0x0A

# Color characteristics (sRGB)
edid[25:35] = bytes([0xEE, 0x91, 0xA3, 0x54, 0x4C, 0x99, 0x26, 0x0F, 0x50, 0x54])

# Established timings
edid[35] = 0x25

# Standard timings (fill with 01 = invalid, will use detailed timing)
for i in range(38, 54):
    edid[i] = 0x01

# Detailed timing descriptor (1920x1080 @ 60Hz)
dtd = bytearray(18)
clk = 14850  # 148.5 MHz in 10kHz units
dtd[0] = clk & 0xFF
dtd[1] = (clk >> 8) & 0xFF
dtd[2] = 0x78  # H active = 1920, low
dtd[3] = 0x02  # H blank = 280, low
dtd[4] = ((1920 >> 8) << 4) | (280 >> 8)
dtd[5] = 0x0D  # V active = 1080, low
dtd[6] = 0x0D  # V blank = 13, low
dtd[7] = ((1080 >> 8) << 4) | (13 >> 8)
dtd[8] = 0x20  # H front porch = 32
dtd[9] = 0x08  # H sync width = 8
dtd[10] = 0x01  # V front porch
dtd[11] = 0x03  # V sync width
dtd[12] = 0x00
dtd[13] = 0x00
dtd[14] = 0x00
dtd[15] = 0x1E
dtd[16] = 0x00
dtd[17] = 0x00
edid[54:72] = dtd

# Monitor name descriptor
name_desc = bytearray([0x00, 0x00, 0x00, 0xFC, 0x00])
name_desc += b'LG FHD\x0A\x20\x20\x20\x20\x20\x00'
edid[72:90] = name_desc

# Monitor range descriptor
range_desc = bytearray([0x00, 0x00, 0x00, 0xFD, 0x00, 0x37, 0x4B, 0x1E, 0x53, 0x0F])
range_desc += b'\x0A\x20\x20\x20\x20\x20\x20\x00'
edid[90:108] = range_desc

# Dummy descriptor
edid[108:126] = bytes([0x00] * 18)

# Checksum
edid[127] = checksum(edid)

with open('/tmp/edid-1080p.bin', 'wb') as f:
    f.write(edid)

保存到 /tmp/edid-1080p.bin(128 字节)。

步骤 2:传输 EDID 文件到远程主机

scp /tmp/edid-1080p.bin user@192.168.1.3:/tmp/

步骤 3:创建 Xorg 配置文件

创建 /etc/X11/xorg.conf.d/10-nvidia-edid.conf

Section "Device"
    Identifier "NVIDIA GPU"
    Driver "nvidia"
    Option "ConnectedMonitor" "DFP"
    Option "CustomEDID" "DFP-0:/tmp/edid-1080p.bin"
    Option "UseEDID" "True"
    Option "AllowEmptyInitialConfiguration" "True"
EndSection

Section "Screen"
    Identifier "Screen0"
    Device "NVIDIA GPU"
    DefaultDepth 24
    Option "ConnectedMonitor" "DFP"
    SubSection "Display"
        Depth 24
        Modes "1920x1080" "1680x1050" "1280x1024" "1024x768"
    EndSubSection
EndSection

关键选项说明

选项 说明
ConnectedMonitor DFP 强制声明连接的是数字显示器
CustomEDID DFP-0:/tmp/edid-1080p.bin 为 DFP-0 端口指定自定义 EDID 文件
UseEDID True 启用 EDID 解析(配合 CustomEDID 使用)
AllowEmptyInitialConfiguration True 允许在无显示器时启动 X server

步骤 4:重启显示管理器

sudo systemctl restart gdm
# 或
sudo systemctl restart lightdm
# 或
sudo systemctl restart sddm

步骤 5:验证结果

$ cat /var/log/Xorg.0.log | grep -E '(EDID|connected|DFP-0)'
(**) NVIDIA(0): Option "UseEDID" "True"
(**) NVIDIA(0): Option "CustomEDID" "DFP-0:/tmp/edid-1080p.bin"
(--) NVIDIA(0):     DFP-0 (boot)
(**) NVIDIA(0): Using ConnectedMonitor string "DFP-0".
(--) NVIDIA(GPU-0): LG Electronics LG FHD (DFP-0): connected
(--) NVIDIA(GPU-0): LG Electronics LG FHD (DFP-0): Internal TMDS
(--) NVIDIA(GPU-0): LG Electronics LG FHD (DFP-0): 330.0 MHz maximum pixel clock
(II) NVIDIA(0): Setting mode "DFP-0:nvidia-auto-select"

成功! 显示器被识别为 “LG Electronics LG FHD”,状态变为 connected。


其他尝试过的方法(未成功)

方法 1:降级驱动

sudo apt install nvidia-driver-470=470.223.02-0ubuntu0.22.04.1

结果:降级后问题依旧,说明不是驱动版本问题。

方法 2:使用内核 EDID

通过 drm.edid_firmware=EDID:edid/1920x1080.bin 内核参数加载 EDID:

sudo apt install edid-decode
# 生成 /lib/firmware/edid/1920x1080.bin
sudo update-initramfs -u
# 编辑 /etc/default/grub 添加内核参数
sudo update-grub
sudo reboot

结果:未尝试,因为 CustomEDID 方案更简单直接。

方法 3:强制模式(无 EDID)

Section "Device"
    Identifier "NVIDIA GPU"
    Driver "nvidia"
    Option "UseEDID" "False"
    Option "ConnectedMonitor" "DFP"
EndSection

Section "Screen"
    Identifier "Screen0"
    Device "NVIDIA GPU"
    DefaultDepth 24
    SubSection "Display"
        Depth 24
        Modes "1920x1080_60"
    EndSubSection
EndSection

结果:未尝试,CustomEDID 方案更可靠。


经验总结

1. EDID 是显示器识别的关键

NVIDIA 驱动严重依赖 EDID 信息来识别显示器和支持的模式。如果 EDID 无法读取:

  • 驱动会认为没有显示器连接
  • 所有输出端口显示 disconnected
  • X server 无法设置显示模式

2. CustomEDID 是通用解决方案

适用于以下场景:

  • DVI/HDMI 线缆不支持 DDC
  • 显示器 EDID 损坏或缺失
  • KVM 切换器干扰 EDID 传递
  • 虚拟机直通 GPU

3. GTX 660 Ti 端口映射

端口名称 物理接口 说明
CRT-0 DVI-I 模拟信号,可转 VGA
DFP-0 DVI-D 数字信号,标记为 boot
DFP-1 HDMI 数字信号
DFP-2/3 DisplayPort 数字信号

4. 排查命令速查

# 检查显卡状态
nvidia-smi

# 检查 Xorg 日志
cat /var/log/Xorg.0.log | grep -i connected

# 检查 DRM 接口
ls -la /sys/class/drm/

# 检查 EDID(如果存在)
hexdump -C /sys/class/drm/card0/card0-DVI-I-1/edid

# 实时查看 Xorg 日志
tail -f /var/log/Xorg.0.log

参考资料


附录:完整 EDID 二进制

00 FF FF FF FF FF FF 00 1E 6D 00 00 00 00 00 00
01 14 01 03 80 22 13 78 0A EE 91 A3 54 4C 99 26
0F 50 54 00 00 01 01 01 01 01 01 01 01 01 01 01
01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01
01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01
32 39 00 78 02 40 0D 0D 20 08 01 03 00 00 1E 00
00 00 FC 00 4C 47 20 46 48 44 0A 20 20 20 20 20
00 00 00 FD 00 37 4B 1E 53 0F 0A 20 20 20 20 20
20 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

(可通过 xxd -r -p 转换为二进制文件)

Logo

中国智能体开发者社区,聚焦智能体与大模型开发,提供前沿资讯、实用工具链、开源项目及行业案例。通过技术沙龙、开发者大赛等活动,促进经验交流与协作,助力开发者快速构建创新智能应用。

更多推荐