PVE core display pass-through virtual machine PCIE device and SR-IOV core display pass-through

1. Remove the PVE login pop-up window

Proxmox VE 6.3 / 6.4 / 7.0 / 7.1 / 7.2 / 7.3 / 7.4 / 8.0 / 8.1 Remove unsubscribed prompts

Note: After removing the subscription pop-up reminder, you must clear the browser cache data (clear the browser cache) to take effect.

sed -i_orig "s/data.status === 'Active'/true/g" /usr/share/pve-manager/js/pvemanagerlib.js
sed -i_orig "s/if (res === null || res === undefined || \!res || res/if(/g" /usr/share/javascript/proxmox-widget-toolkit/proxmoxlib.js
sed -i_orig "s/.data.status.toLowerCase() !== 'active'/false/g" /usr/share/javascript/proxmox-widget-toolkit/proxmoxlib.js
systemctl restart pveproxy

2. Replace the PVE source

Back up source files

cp /etc/apt/sources.list /etc/apt/sources.list.backup
图片[2]-VUM-PVE整合包关于如何更换国内源问题「VUM-PVE说明书」-VUM星球

Add domestic sources

There are two pieces of code. The entire first piece of code is copied at once.

cat <<EOF > /etc/apt/sources.list
deb http://mirrors.ustc.edu.cn/debian/ bookworm main non-free-firmware
deb-src http://mirrors.ustc.edu.cn/debian/ bookworm main non-free-firmware

deb https://mirrors.ustc.edu.cn/debian-security bookworm-security main contrib

deb http://mirrors.ustc.edu.cn/debian/ bookworm-updates main non-free-firmware
deb-src http://mirrors.ustc.edu.cn/debian/ bookworm-updates main non-free-firmware
EOF
图片[3]-VUM-PVE整合包关于如何更换国内源问题「VUM-PVE说明书」-VUM星球
echo "deb https://mirrors.tuna.tsinghua.edu.cn/proxmox/debian bookworm pve-no-subscription" > /etc/apt/sources.list.d/pve-no-subscription.list
图片[4]-VUM-PVE整合包关于如何更换国内源问题「VUM-PVE说明书」-VUM星球

Block corporate sources

sed -i 's/^deb https:\/\/enterprise.proxmox.com\/debian\/pve/#deb https:\/\/enterprise.proxmox.com\/debian\/pve/' /etc/apt/sources.list.d/pve-enterprise.list
图片[5]-VUM-PVE整合包关于如何更换国内源问题「VUM-PVE说明书」-VUM星球

Block Ceph sources

sed -i 's/^deb https:\/\/enterprise.proxmox.com\/debian\/ceph-quincy/#deb https:\/\/enterprise.proxmox.com\/debian\/ceph-quincy/' /etc/apt/sources.list.d/ceph.list
图片[6]-VUM-PVE整合包关于如何更换国内源问题「VUM-PVE说明书」-VUM星球

update source

apt-get update
图片[7]-VUM-PVE整合包关于如何更换国内源问题「VUM-PVE说明书」-VUM星球

    3. Downgrade the kernel version

    Q: Why downgrade the kernel?

    A: Because the PVE version we are currently using is the latest 8.2.4 and the kernel version is 6.8.4, and the author of the i915-sriov-dkms project used has only updated the latest supported kernel version to 6.5, so the kernel needs to be downgraded.

    1. First check the current version and kernel

    Enter the following command to see that the current PVE version is 8.2.4 and the kernel version is 6.8.4

    pveversion
    图片[1]-2024陪伴级教程PVE无论什么版本正确开启SR-IOV虚拟化核显方式-VUM星球

    2. Check the currently available kernels

    proxmox-boot-tool kernel list
    图片[2]-2024陪伴级教程PVE无论什么版本正确开启SR-IOV虚拟化核显方式-VUM星球

    At this point, you can see that the system has a kernel version of 6.5.13-5 by default, which is version 6.5 that meets the project requirements. However, the author of the i915-sriov-dkms project has not yet updated to this version, so compilation cannot be successful using this version directly, so we still need to continue to downgrade the kernel operation.

    After my testing, version 6.5.13-1 is relatively stable, so we downgraded to this version.

    3. Start the downgrade operation

    update source

    apt update

    Find available cores

    apt-cache search pve-kernel
    图片[3]-2024陪伴级教程PVE无论什么版本正确开启SR-IOV虚拟化核显方式-VUM星球

    Install this version of the kernel

    apt install pve-kernel-6.5.13-1-pve
    图片[4]-2024陪伴级教程PVE无论什么版本正确开启SR-IOV虚拟化核显方式-VUM星球

    Update Grub boot configuration

    update-grub
    图片[5]-2024陪伴级教程PVE无论什么版本正确开启SR-IOV虚拟化核显方式-VUM星球

    4. Solidify this version of the kernel

    proxmox-boot-tool kernel pin 6.5.13-1-pve
    图片[6]-2024陪伴级教程PVE无论什么版本正确开启SR-IOV虚拟化核显方式-VUM星球

    Check if curing is successful

    proxmox-boot-tool kernel list

    If you see the red box in the picture below, it means the curing is successful.

    图片[7]-2024陪伴级教程PVE无论什么版本正确开启SR-IOV虚拟化核显方式-VUM星球

    5. Install the header files of this version of the kernel

    apt install pve-headers-6.5.13-1-pve
    图片[8]-2024陪伴级教程PVE无论什么版本正确开启SR-IOV虚拟化核显方式-VUM星球

    6. Configure the basic environment for direct passthrough

    1. Enable IOMMU pass-through function

    sed -i '/^GRUB_CMDLINE_LINUX_DEFAULT/c\GRUB_CMDLINE_LINUX_DEFAULT="quiet intel_iommu=on iommu=pt pcie_acs_override=downstream i915.enable_guc=3 i915.max_vfs=7"' /etc/default/grub

    2. Add virtualization driver and load vifo system module

    If you use our VUM-PVE integration package, you don’t need to configure this step.

    echo -e "vfio\nvfio_iommu_type1\nvfio_pci\nvfio_virqfd" | tee -a /etc/modules

    3. Shield the graphics card driver

    This step is a huge pitfall. Be sure to pay attention. If you have configured this step before, go in and delete them all. If you have not configured it, leave it alone.

    nano /etc/modprobe.d/blacklist.conf
    图片[9]-2024陪伴级教程PVE无论什么版本正确开启SR-IOV虚拟化核显方式-VUM星球

    4. Update Grub boot configuration and initramfs

    update-grub
    update-initramfs -u -k all

    5. Restart PVE

    reboot

    6. After restarting, check whether the hardened and downgraded kernel takes effect.

    uname -r

    PVE has been successfully started with the 6.5.13-1 kernel version and cured successfully.

    图片[10]-2024陪伴级教程PVE无论什么版本正确开启SR-IOV虚拟化核显方式-VUM星球

    7. Configure and enable SR-IOV virtualization core display

    1. Install compilation environment dependencies

    apt-get install --no-install-recommends git mokutil sysfsutils -y
    apt install --reinstall dkms -y

    2. Add a temporary KERNEL environment variable

    KERNEL=$(uname -r); KERNEL=${KERNEL%-pve}

    3. Clone project

    Project address: https://github.com/strongtz/i915-sriov-dkms.git

    git clone https://github.com/strongtz/i915-sriov-dkms.git
    
    cd i915-sriov-dkms/
    
    sed -i 's/"@_PKGBASE@"/"i915-sriov-dkms"/g' ~/i915-sriov-dkms/dkms.conf
    
    sed -i 's/"@PKGVER@"/"'"$KERNEL"'"/g' ~/i915-sriov-dkms/dkms.conf

    4. Check whether the correct kernel version and i915-sriov-dkms are configured in the dkms.conf configuration file

    cat ~/i915-sriov-dkms/dkms.conf
    图片[11]-2024陪伴级教程PVE无论什么版本正确开启SR-IOV虚拟化核显方式-VUM星球

    5.Create a symbolic link to a directoryGo to the /usr/src/ directory

    dkms add .
    图片[12]-2024陪伴级教程PVE无论什么版本正确开启SR-IOV虚拟化核显方式-VUM星球

    6. Go to the linked directory

    cd /usr/src/i915-sriov-dkms-$KERNEL
    图片[13]-2024陪伴级教程PVE无论什么版本正确开启SR-IOV虚拟化核显方式-VUM星球

    7. View installed DKMS modules and their status

    dkms status
    图片[14]-2024陪伴级教程PVE无论什么版本正确开启SR-IOV虚拟化核显方式-VUM星球

    8. Start compiling the kernel and add the i915-sriov driver

    dkms install -m i915-sriov-dkms -v $KERNEL -k $(uname -r) --force -j 1

    The compilation process takes a little longer and you need to wait.

    图片[15]-2024陪伴级教程PVE无论什么版本正确开启SR-IOV虚拟化核显方式-VUM星球
    图片[16]-2024陪伴级教程PVE无论什么版本正确开启SR-IOV虚拟化核显方式-VUM星球

    Check again whether the compilation is successful

    dkms status
    图片[17]-2024陪伴级教程PVE无论什么版本正确开启SR-IOV虚拟化核显方式-VUM星球

    9. Query the current nuclear display ID

    lspci | grep VGA
    图片[18]-2024陪伴级教程PVE无论什么版本正确开启SR-IOV虚拟化核显方式-VUM星球

    Here it shows 00:02.0, the complete PCI address 0000:00:02.0

    10. Modify the core display ID and virtual core display number of the following code

    echo "devices/pci0000:00/0000:00:02.0/sriov_numvfs = 7" > /etc/sysfs.conf
    
    # 0000:00:02.0 Change this to your ID
    # Change the 7 in sriov_numvfs = 7 to other values, do not exceed 7

    11.Restart PVE

    reboot

    12. After restarting, check whether the startup is successful.

    lspci | grep VGA
    图片[19]-2024陪伴级教程PVE无论什么版本正确开启SR-IOV虚拟化核显方式-VUM星球

    8. Pass-through PCIe device (SR-IOV does not require operation)

    If your CPU does not support SR-IOV, or you do not want to enable SR-IOV, please use the following command to pass through the PCIE device:

    sed -i '/^GRUB_CMDLINE_LINUX_DEFAULT/c\GRUB_CMDLINE_LINUX_DEFAULT="quiet intel_iommu=on iommu=pt pcie_acs_override=downstream"' /etc/default/grub
    echo -e "vfio\nvfio_iommu_type1\nvfio_pci\nvfio_virqfd" | tee -a /etc/modules
    update-grub
    update-initramfs -u -k all
    reboot

    Rotor:https://bozai.me/pve.html

    Newsletter Updates

    Enter your email address below and subscribe to our newsletter