ESXi8.3 X99双u主机+2060显卡-ubuntu2404配置显卡直通

ESXI版本:8.0 Update 3

显卡型号:Nvidia 20608GB版本)

操作系统版本:Ubuntu24.04

  1. 关键问题1:ESXI的直通显卡设置

这里我们使用的是ESXI 8.0版本,直通设置需要单独在【导航器】-【主机】-【管理】-【硬件】-【PCI设备】这里做切换,拉到下面找到这个显卡硬件,需要“切换直通”

  1. 关键问题2:虚拟机的设置,以及相关的参数设置
  1. 虚拟机选项】-【引导选项】,这里必须设置为不启用UEFI安全引导,把勾去掉。或者干脆直接选“BIOS”,否则驱动程序可能由于安全保护机制导致安装失败(这个主要是为了保护内核安全的设置,这里必须去掉)

在ubuntu里面,可以用这个命令确认一下,你当前是否是内核保护状态,如果是enabled,则是,这种状态可能导致驱动程序安装不成功:

mokutil --sb-state

如果是显示:SecureBoot enabled,那么这种有可能是不行的;

如果显示: SecureBoot disabled,那么这种可以

  1. 【虚拟机选项】-【高级】-【配置参数】,这里必须添加如下参数:

hypervisor.cpuid.v0 False

pciPassthru.use64bitMMIO True

pciPassthru.64bitMMIOSizeGB 32 (单张显卡,值为32;如果是多张显卡,设置值为64。)

关键问题3:ubuntu屏蔽nouveau,以及驱动安装相关的一些操作

  1. (1)编辑blacklist.conf文件:

sudo vim /etc/modprobe.d/blacklist.conf

 末尾添加如下代码:

blacklist nouveau

options nouveau modeset=0

  1. 编辑nvidia.conf文件

sudo vim /etc/modprobe.d/nvidia.conf

 末尾添加如下代码:

options nvidia NVreg_OpenRmEnableUnsupportedGpus=1

  1. 更新以上配置生效

sudo update-initramfs -u

  1. 重启机器

# sudo reboot

  1. 检查是否生效:如果执行以下命令没有任何输出,那么就代表成功屏蔽了nouveau 

lsmod |grep nouveau

 ----END

关键问题4:安装驱动

  1. 提示如下错误需要关闭

关闭gdm服务:

# systemctl stop gdm

  1. 再安装驱动就简单了,可以从官网下载对应的驱动版本 ,然后传到Ubuntu上面来,执行安装命令即可(找驱动和上传文件的步骤就不赘述了):
  2. 安装编译开发工具

sudo apt install build-essential pkg-config libglvnd-dev

该步骤安装的gcc版本可能和kernel编译用的gcc版本不匹配从而导致,显卡驱动安装失败,需要参考如下页面处理该问题

“ubuntu安装nvidia显卡驱动提示An error occurred while performing the step: “Building kernel modules“.”

ubuntu安装nvidia显卡驱动提示An error occurred while performing the step: “Building kernel modules“._error: an error occurred while performing the step-CSDN博客

  1. 安装nvida显卡驱动

sudo chmod +x NVIDIA-Linux-x86_64-550.135.run

sudo ./NVIDIA-Linux-x86_64-550.135.run -m=kernel-open

sudo ./NVIDIA-Linux-x86_64-550.135.run  -no-x-check -no-nouveau-check -no-opengl-files -m=kernel-open

Would you like to run the nvidia-xconfig utility to automatically update your X configuration file so that the   

  NVIDIA X driver will be used when you restart X?  Any pre-existing X configuration file will be backed up.

选择

安装驱动过程中遇到的问题:

1.If you plan to no longer use the NVIDIA deriver, you should make sure that no X screens are configured to use the NVIDIA X driver X driver in your X configuration file. If you used nvidia-xconfig to configure X, it may have created  a backup of your original configuration. Would you like to run 'nvidia-xconfig --restore-original-backup' to attempt restoration of the original X configuration file?

no

2.Would you like to run the nvidia-xconfig utility to automatically updata your X onfiguration file so that the NVIDIA X driver will be used when you restart X? Any pre-existing X configuration file will be backed up.

yes

3.Would you like to register the kernel module souces with DKMS? This will allow DKMS to automatically build a new module, if you install a different kernel later?

no

  Installation of the NVIDIA Accelerated Graphics Driver for Linux-x86_64 (version: 550.135) is now complete.      

  Please update your xorg.conf file as appropriate; see the file /usr/share/doc/NVIDIA_GLX-1.0/README.txt for      

  details.  

  1. 重启虚拟机,检查终于出来了

# nvida-smi

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值