111Proxmox - amagerard/TemplateVM GitHub Wiki

Home

RedHat10/TemplateVM.

1- Installation 2- Network 3- Firewall 4- Selinux
5- Logs 6- Certificates 7- PassphraseSSH 8- Sudo
9- GnomeShell 10- Volumes 11- Proxmox 12- Troubleshoots

11. Proxmox

11.1 Spice.

Warning:
Spice is deprecated. with RedHat.
Red Hat recommends using alternate solutions for remote display streaming.
For remote console access, use the VNC protocol.
Please use Debian 13 instead of RedHat.

SPICE Simple Protocol for Independent Computing Environments.

Spice is a graphical interface for remote desktop.
You can add usb and audio devices to the VM.

Check that spice-vdagent is installed on the VM.
rpm -qa | grep spice-vdagent

spice-vdagent-0.22.1-7.el10.x86_64  

Check that virt-viewer is installed on your computer.
Example for debian.
dpkg --list| grep virt-viewer

virt-viewer   11.0-2 Displaying the graphical console of a virtual machine  

Go to VM settings.
Hardware:
Display: Choose SPICE memory 128M.
Add
USB device : Spice port
Audio device: ich9-intel-hda SPICE

Options:
QEMU Guest agent enabled.
SPICE Ehancements : Folder Sharing et all (root permission).

Start the VM and choose Spice console and click on the file that belonged to the screen.
You will have sound and usb mounts from your computer if you add it in the VM settings.

11.2 Passthrough the host's graphics card.

Make a backup of your TemplateVM.
Clone your TemplateVM.
Use this clone for GPU passthrough.

Proxmox allows you to use the host's graphics card for your VM.
The advantage is you can test graphics tools like 3D video software (BricsCAD) with different operating system versions.

11.2.1 Host (Proxmox).

Example:
Host: Intel Proxmox 8.4.3.
VideoCard: MSI GT 1030

Plug a screen on hdmi, keyboard and mouse on usb.

Check if clocksource0 is tsc.
cat /sys/devices/system/clocksource/clocksource0/current_clocksource
If not present.
Install the latest linux-image.xxxx.amd.
apt-cache pkgnames| grep linux-image
apt-get install linux-image.xxxx.amd
reboot

Check if interrupt mapping is supported.
dmesg | grep remapping
If you see these lines.

AMD-Vi: Interrupt remapping enabled  
DMAR-IR: Enabled IRQ remapping in x2apic mode  

If you don't see these lines.
echo "options vfio_iommu_type1 allow_unsafe_interrupts=1" > /etc/modprobe.d/iommu_unsafe_interrupts.conf

To avoid nvidia video card crashes.
echo "options kvm ignore_msrs=1" > /etc/modprobe.d/kvm.conf
echo "report_ignored_msrs=0" >> /etc/modprobe.d/kvm.conf

To avoid crashes on AMD video cards.
https://asded.fr/posts/2023-07-01/.
https://github.com/gnif/vendor-reset.

Enable IOMMU in grub.
vi /etc/default/grub
Add intel_iommu=on iommu=pt in GRUB_CMDLINE_LINUX_DEFAULT.

GRUB_CMDLINE_LINUX_DEFAULT="quiet intel_iommu=on iommu=pt pcie_acs_override=downstream multifunction nofb nomodeset video=vesafb:off video=efifb:off initcall_blacklist=sysfb_init clocksource=tsc tsc=reliable "  

vi /etc/modules

vfio  
vfio_iommu_type1  
vfio_pci  
vfio_virqfd  

Start vfio modules when proxmox starts.
update-initramfs -u
Update grub.
update-grub

Restart the proxmox server.
reboot

Check that IOMMU is enabled.
dmesg | grep -e DMAR -e IOMMU| grep "enabled"
If it's not good, it means I forgot a step.
https://pve.proxmox.com/wiki/PCI_Passthrough

Find the GPU and vfio video and audio driver.

Example the GPU is MSI GT 1030.
lspci -nn| grep NVIDIA

NVIDIA Corporation GP108 [GeForce GT 1030] [10de:1d01] (rev a1)  
NVIDIA Corporation GP108 High Definition Audio Controller [10de:0fb8] (rev a1)  

GeForce GT 1030 [10de:1d01]
Audio Controller [10de:0fb8]

vi /etc/modprobe.d/vfio.conf

options vfio-pci ids=10de:1d01,10de:0fb8 disable_vga=1  

Blacklist nvidia et amd;

vi pve-blacklist.conf

blacklist nvidiafb  
Blacklist lbm-nouveau  
blacklist nouveau  
blacklist nvidia  
blacklist nvidia-drm  
blacklist snd_hda_codec_hdmi  
blacklist snd_hda_intel  
blacklist snd_hda_codec  
blacklist snd_hda_core  
blacklist radeon  
blacklist amdgpu  

Other blacklists. May already be done.

vi kvm-intel.conf

options kvm-intel nested=Y  

vi intel-microcode-blacklist.conf

blacklist microcode  

Start vfio modules when proxmox starts.
update-initramfs -u

Restart the proxmox server.
reboot

After reboot, check that the GPU is bound to the VFIO driver.
lspci -nnk -d 10de:1d01

03:00.0 VGA compatible controller [0300]: NVIDIA Corporation GP108 [GeForce GT 1030]  
[10de:1d01] (rev a1)  
        Subsystem: Micro-Star International Co., Ltd. [MSI] GP108 [GeForce GT 1030] [1462:8c98]  
        Kernel driver in use: vfio-pci  
        Kernel modules: nvidiafb, nouveau  

11.2.2 Redhat 10 VM.

11.2.2.1 Starting the VM with the default video driver.

Go to VM settings.
Add the devices.

Hardware:
Add
PCI Device.
Raw device.

Example MSI GT 1030.
You have two devices.
GP108 [Geforce GT 1030 ]
GP108 High Definition Audio Controller
You must choose for RedHat.
GP108 [Geforce GT 1030 ]
for HDMI video and audio.

Select for video device.
Check ROM bar, PCI Express, Primary GPU.

Hardware:
Add.
USB device, use USB Port.Select the keyboard and repeat for the mouse.

Example:

USB Device(usb1)  host=3-1.2  (keyboard)  
USB Device (usb2) host=3.2    (mouse)  
PCI Device(hostpci0)  0000:03:00,pcie=1,x-vga=1  (video hdmi)  

Start the VM.
Redhat boots to the HDMI screen.
You no longer have access to the VM from the Proxmox VNC interface.
You can access the audio by activating the sound icon in the top right corner and selecting HDMI.
You will notice that your VM displays faster.

11.2.2.2 Installing Nvidia Priority Drivers.

Update Redhat 10 VM .
dnf update
Restart RedHat 10 VM.
reboot

The NVIDIA drivers will be installed without the Gnome GUI.
systemctl set-default multi-user.target
reboot

You have access to the VM from the Proxmox VNC interface.

Remove if exists nvidia-gpu-firmware.
rpm -qa| grep nvidia-gpu-firmware
dnf remove nvidia-gpu-firmware
Check on the Rehat 10 VM that the video card exists.
lspci -nn | grep NVIDIA

01:00.0 VGA compatible controller [0300]: NVIDIA Corporation GP108 [GeForce GT 1030] [10de:1d01] (rev a1)  
01:00.1 Audio device [0403]: NVIDIA Corporation GP108 High Definition Audio Controller [10de:0fb8] (rev a1)  

Remove the nouveau driver at startup.
grubby --args="rd.driver.blacklist=nouveau modprobe.blacklist=nouveau" --update-kernel=ALL"

Again, do not load the nouveau driver.
vi /etc/modprobe.d/blacklist.conf
add

blacklist nouveau  

reboot

Check that the nouveau drivers no longer exist.
lsmod | grep nouveau
Nothing.

To install nvidia drivers you need.
dnf groupinstall "Development Tools"
dnf install libglvnd-devel elfutils-libelf-devel

To install nvidia drivers you need nvidia's proprietary drivers.
https://www.nvidia.com/en-us/drivers/
cd /tmp
wget -c https://fr.download.nvidia.com/XFree86/Linux-x86_64/570.181/NVIDIA-Linux-x86_64-570.181.run
chmod +x NVIDIA-Linux-x86_64-570.181.run
./NVIDIA-Linux-x86_64-570.181.run

Warning :  nvidia-installer was forced to guess….  OK  
           A Install NVIDIA's 32-bit compatibility libraries? Accepter 32libs YES  
           The initramfs will likely need to be rebuilt. Rebuilding  
           initramfs  
           Would you like to run the nvidia-xconfig  OK  
           Your X configuration file has been successfully updated. OK  

Check that nvidia is present.
lsmod | grep nvidia

nvidia_drm            147456  0  
nvidia_modeset       1835008  1 nvidia_drm  
nvidia              97452032  1 nvidia_modeset  
video                  81920  1 nvidia_modeset  
drm_ttm_helper         16384  3 qxl,nvidia_drv  

Add.
vi /etc/modprobe.d/nvidia.conf

## use the suspend/hibernate feature  
options nvidia NVreg_PreserveVideoMemoryAllocations=1  
## use the wayland desktop  
options nvidia-drm modeset=1 fbdev=1  

Reset boot to graphical mode.
systemctl set-default graphical.target

Check if the screen, keyboard and mouse are properly connected to the proxmox host.
reboot

Perform a graphics hardware acceleration test.
dnf install glx-utils
glxinfo | grep rendering

direct rendering: YES  

11.2.3 VR platform for Simulation.

By default on redhat 10, there are not all the codecs.

wget -c https://download1.rpmfusion.org/free/el/rpmfusion-free-release-10.noarch.rpm
rpm -ivh rpmfusion-free-release-10.noarch.rpm
subscription-manager repos --enable "codeready-builder-for-rhel-$(rpm -E %{rhel})-$(uname -m)-rpms"
dnf update
dnf -y groupinstall multimedia --with-optional --allowerasing
dnf -y install ffmpeg --allowerasing
dnf -y install x264
dnf -y install x264-devel
dnf -y install SDL2
dnf -y install ffmpeg-devel
dnf install vlc
dnf install vlc-plugins-all.x86_64

Download Unigine_Heaven-4.0.run
https://benchmark.unigine.com/heaven
cd /tmp
wget -c https://assets.unigine.com/d/Unigine_Heaven-4.0.run
chmod +x Unigine_Heaven-4.0.run
./Unigine_Heaven-4.0.run
cd Unigine_Heaven-4.0
./heaven