ESXi CentOS 虚拟机 NVIDIA 显卡驱动升级备案文档
问题描述
使用ESXI虚拟化切分显卡,可以让8卡GPU服务器分别运行Windows和Linux环境。 在 ESXi 7虚拟化环境中,通过 PCI Passthrough 直通 NVIDIA 显卡到 CentOS 虚拟机时,加载新版本驱动失败,出现类似与以下关键错误:
bash
NVRM: GPU 0000:0b:00.0: RmInitAdapter failed! (0x26:0x56:1474)
BUG: unable to handle page fault for address: 0000000000004628
解决方案
通过修改虚拟机高级配置 + 使用 NVIDIA 开放内核模块 解决:
ESXi 虚拟机 关键配置项
ini
# ESXi 虚拟机高级选项
hypervisor.cpuid.v0 = FALSE # 隐藏虚拟化特征
pciPassthru0.msiEnabled = FALSE # 禁用 MSI 中断
使用 kernel-open 模式安装驱动
bash
# 必须使用 kernel-open 模式安装 root权限
sh cuda_12.4.0_550.54.14_linux.run -m=kernel-open
# 安装后更新 initramfs 可选
update-initramfs -u
# 重启可选
reboot
完整操作流程
1. ESXi 虚拟机配置
-
关闭虚拟机
-
编辑设置 > VM Options > Advanced:
inihypervisor.cpuid.v0 = FALSE pciPassthru0.msiEnabled = FALSE
-
确认 PCI 设备直通配置
2. 驱动安装准备
bash
# 清理旧驱动 ubuntu 可选
nvidia-uninstall
apt purge -y '^nvidia-*' '^libnvidia-*'
rm -r /var/lib/dkms/nvidia
apt autoremove
update-initramfs -c -k $(uname -r)
3. 安装开放内核驱动
bash
# 下载驱动(示例版本)
axel -n 12 https://developer.download.nvidia.com/compute/cuda/12.4.0/local_installers/cuda_12.4.0_550.54.14_linux.run
# 安装命令(关键参数!)
chmod +x cuda_12.4.0_550.54.14_linux.run
./cuda_12.4.0_550.54.14_linux.run -m=kernel-open
# 验证安装
modinfo nvidia | grep version # 应显示驱动版本
version: 550.54.14
rhelversion: 7.9
srcversion: BABF5253924D36C48E7D170
vermagic: 3.10.0-1160.81.1.el7.x86_64 SMP mod_unload modversions
NVIDIA 显卡持久模式配置指南
持久模式控制命令
1. 启用持久模式
bash
nvidia-smi -pm 1
2. 禁用持久模式
bash
nvidia-smi -pm 0
3. 状态验证
bash
nvidia-smi -q | grep "Persistence Mode"
# 预期输出:Persistence Mode : Enabled
参考文档
NVIDIA Persistence Mode 参考帖子
kernel-open 模式 | Nvidia-smi shows no devices were found although driver is installed
ESXi 显卡直通 | SOLVED - RmInitAdapter failed! to load 530.41.03 (or any nvidia modules other than 450.236.01) Linux via ESXi 7.0u3 Passthrough PCI GTX 1650