Issue with vGPU passthrough to Ubuntu VM for plex/jellyfin

mavericknik

New Member
Nov 6, 2023
7
1
3
Hi Guys! I wanted to setup my own server and recently purchased a dell optiplex with an 8th gen i5 8500 CPU for its intel quicksync capabilities. The idea was to use this with Plex/Jellyfin for hardware transcoding but I'm hitting a snag. This is the guide I'm trying to follow: vGpu Passthrough Guide

I edited my grub file to enable GVT (IOMMU was already enabled):
Code:
GRUB_CMDLINE_LINUX_DEFAULT="quiet intel_iommu=on iommu=pt video=vesafb:off video=efifb:off initcall_blacklist=sysfb_init i915.enable_gvt=1"

I see dmesg output after rebooting:

Code:
root@homeserver:~# dmesg | grep -e DMAR -e IOMMU
[    0.011068] ACPI: DMAR 0x00000000B9B4B070 0000A8 (v01 INTEL  EDK2     00000002      01000013)
[    0.011101] ACPI: Reserving DMAR table memory at [mem 0xb9b4b070-0xb9b4b117]
[    0.034261] DMAR: IOMMU enabled
[    0.091471] DMAR: Host address width 39
[    0.091472] DMAR: DRHD base: 0x000000fed90000 flags: 0x0
[    0.091477] DMAR: dmar0: reg_base_addr fed90000 ver 1:0 cap 1c0000c40660462 ecap 19e2ff0505e
[    0.091480] DMAR: DRHD base: 0x000000fed91000 flags: 0x1
[    0.091483] DMAR: dmar1: reg_base_addr fed91000 ver 1:0 cap d2008c40660462 ecap f050da
[    0.091485] DMAR: RMRR base: 0x000000ba5a4000 end: 0x000000ba7edfff
[    0.091487] DMAR: RMRR base: 0x000000bd000000 end: 0x000000bf7fffff
[    0.091489] DMAR-IR: IOAPIC id 2 under DRHD base  0xfed91000 IOMMU 1
[    0.091490] DMAR-IR: HPET id 0 under DRHD base 0xfed91000
[    0.091492] DMAR-IR: Queued invalidation will be enabled to support x2apic and Intr-remapping.
[    0.094666] DMAR-IR: Enabled IRQ remapping in x2apic mode
[    0.319766] DMAR: No ATSR found
[    0.319767] DMAR: No SATC found
[    0.319768] DMAR: IOMMU feature fl1gp_support inconsistent
[    0.319769] DMAR: IOMMU feature pgsel_inv inconsistent
[    0.319771] DMAR: IOMMU feature nwfs inconsistent
[    0.319772] DMAR: IOMMU feature pasid inconsistent
[    0.319773] DMAR: IOMMU feature eafs inconsistent
[    0.319774] DMAR: IOMMU feature prs inconsistent
[    0.319774] DMAR: IOMMU feature nest inconsistent
[    0.319775] DMAR: IOMMU feature mts inconsistent
[    0.319776] DMAR: IOMMU feature sc_support inconsistent
[    0.319777] DMAR: IOMMU feature dev_iotlb_support inconsistent
[    0.319778] DMAR: dmar0: Using Queued invalidation
[    0.319781] DMAR: dmar1: Using Queued invalidation
[    0.320216] DMAR: Intel(R) Virtualization Technology for Directed I/O

Added the required modules:
Code:
root@homeserver:~# cat /etc/modules
# /etc/modules: kernel modules to load at boot time.
#
# This file contains the names of kernel modules that should be loaded
# at boot time, one per line. Lines beginning with "#" are ignored.
# Parameters can be specified after the module name.

vfio
vfio_iommu_type1
vfio_pci
vfio_virqfd


# Modules required for Intel GVT
kvmgt
exngt
vfio-mdev

Then rebooted and added the GPU to the ubuntu VM:
1699256382673.png

But every time I try to start the VM, it freezes at the Ubuntu splash screen. I suspect there is some issue with GPU conflicts/drivers I need to solve here but not sure how to move further ahead here. Any pointers would be appreciated. I tried looking at the Syslog and the Task log in the proxmox gui for the vm but dont really see any errors that would give me more info.

This is the vm conf file if required:

Code:
/etc/pve/nodes/homeserver/qemu-server/101.conf

bios: ovmf
boot: order=scsi0;ide2;net0
cores: 6
cpu: host
efidisk0: local-lvm:vm-101-disk-0,efitype=4m,pre-enrolled-keys=1,size=4M
hostpci0: 0000:00:02.0,mdev=i915-GVTg_V5_4
ide2: none,media=cdrom
machine: q35
memory: 8192
meta: creation-qemu=8.0.2,ctime=1698431405
name: UbuntuLTS-Server
net0: virtio=42:8E:F3:3C:D8:B4,bridge=vmbr0,firewall=1
numa: 0
ostype: l26
scsi0: local-lvm:vm-101-disk-1,iothread=1,size=100G
scsihw: virtio-scsi-single
smbios1: uuid=57a0d333-bd46-472c-a518-7fefbda1e638
sockets: 1
vga: qxl,memory=24
vmgenid: c7044731-a9e2-4ffa-a38a-6ca222c8a5d8

Also, this is where the VM crashes everytime I try to start it:

1699257156308.png
 
Last edited:
It doesn't look like IOMMU is enabled.
I saw this line and believe it is:

Code:
  0.034261] DMAR: IOMMU enabled

I also successfully passed through a hba card to another Xpenology VM so this shoukd confirm no issue with IOMMU correct?
 
so this shoukd confirm no issue with IOMMU correct?
Yes, if that's the case... so, now you need to create and add to: /etc/modprobe.d/vfio_pci.conf
options vfio-pci disable_denylist=1

However, if you had already successfully passthrough other pci devices, you should already that file configuration...
 
T
Yes, if that's the case... so, now you need to create and add to: /etc/modprobe.d/vfio_pci.conf
options vfio-pci disable_denylist=1

However, if you had already successfully passthrough other pci devices, you should already that file configuration...
Didnt have the vfio_pci.conf file created in my node, so went ahead and added it:

Code:
root@homeserver:~# cat /etc/modprobe.d/vfio_pci.conf
options vfio-pci disable_denylist=1

Refreshed the initramfs:
Code:
update-initramfs -u -k all

But still same issue :(
 
GRUB_CMDLINE_LINUX_DEFAULT="quiet intel_iommu=on iommu=pt video=vesafb:eek:ff video=efifb:eek:ff initcall_blacklist=sysfb_init i915.enable_gvt=1"
You're using an Intel machine with uefi (q35)...correct? if so, you should be using systemd instead of grub...
here is what I have using Intel hardware with ZFS...
/etc/kernel/cmdline
root=ZFS=rpool/ROOT/pve-1 boot=zfs intel_iommu=on iommu=pt
 
Last edited:
You're using an Intel machine with uefi (q35)...correct? if so, you should be using systemd instead of grub...
here is what I have using Intel hardware with ZFS...
/etc/kernel/cmdline
root=ZFS=rpool/ROOT/pve-1 boot=zfs intel_iommu=on iommu=pt
Intel machine with UEFI, yes. I did make changes in my systemd too, initially this is what I had in there:

Code:
intel_iommu=on i915.enable_gvt=1

I updated it to add the pt command:
Code:
intel_iommu=on iommu=pt i915.enable_gvt=1

Did a
Code:
proxmox-boot-tool refresh

But still no dice.

I appreciate you taking the time to reply BTW!
 
Still getting nowhere with this, would appreciate any help.

I tried to load a Ubunt VM from scratch passing through the vGPU without installing it and I see this error (cant copy anything since the screen freezes):

Code:
i915 ... *ERROR* DC state mismatch (0x0 -> 0x2)

I tried a couple things, tried to disable the i915 in the pve-blacklist.conf

Code:
root@homeserver:~# cat /etc/modprobe.d/pve-blacklist.conf
# This file contains a list of modules which are not supported by Proxmox VE

# nvidiafb see bugreport https://bugzilla.proxmox.com/show_bug.cgi?id=701
blacklist nvidiafb
blacklist nouveau
blacklist nvidia
blacklist snd_hda_codec_hdmi
blacklist snd_hda_intel
blacklist snd_hda_codec
blacklist snd_hda_core
blacklist radeon
blacklist amdgpu
blacklist i915

Then for good measure did:
Code:
proxmox-boot-tool refresh
update-initramfs -u -k all && reboot

But still saw the module loaded when I tried

On this thread on the forum, I found another way to not load the module in my host:

Code:
root@homeserver:~# cat /etc/modprobe.d/intel-uhd-passthru.conf
install i915 /bin/false

I did this, then again
Code:
proxmox-boot-tool refresh
update-initramfs -u -k all && reboot

Didn't see the i915 loaded when I did a
Code:
lspci | grep i915
But still the same issue in my VM from scratch. After doing this though, I was not able to specify a Mdev type for the gpu at all so not sure if I am doing this right.

Not really sure where to go from here.
 
To anyone that stumbles on this thread:

Wasn't able to figure out how to pass through the GPU to my current VM. I was using a OVMF/q35 system and was trying to pass the GPU through to that, but it never booted with the passthrough. I noticed that if I switched to i440fx instead of q35, I could get my system to boot but it was extremely unstable. Like crash every few hours unstable, sometimes wouldnt even reboot properly.

I ended up creating a privileged lxc container and passing through the GPU to this, works fine. Not what I wanted to do but don't really have a lot of resources to spin up another full VM so wanted to go the LXC route. Used this in the lxc config:

Code:
root@homeserver:~# cat /etc/pve/lxc/106.conf
arch: amd64
cores: 4
features: mount=nfs;cifs
hostname: PlexJF-Transcode
memory: 2048
net0: name=eth0,bridge=vmbr0,firewall=1,gw=192.168.86.1,hwaddr=36:8B:2C:21:93:28,ip=192.168.86.20/24,ip6=dhcp,type=veth
ostype: ubuntu
rootfs: local-lvm:vm-106-disk-0,size=16G
swap: 2048
lxc.cgroup2.devices.allow: c 226:0 rwm
lxc.cgroup2.devices.allow: c 226:128 rwm
lxc.cgroup2.devices.allow: c 29:0 rwm
lxc.cgroup2.devices.allow: c 13:* rwm
lxc.mount.entry: /dev/dri dev/dri none bind,optional,create=dir
lxc.mount.entry: /dev/fb0 dev/fb0 none bind,optional,create=file
lxc.autodev: 1

Installed both Plex and JF on the LXC, added my network share, enabled passthrough in both plex and JF and tested it out using intel_gpu_top, works fine now:

1700607372466.png
 
Last edited:
I have had the exact same issues as you with an i7 10700k, and I have also concluded that the only way to make the vms run at all is to have the cpu set to i440fx. I can't comment on stability yet as I have not ran the system for long enough, spent the last 15+ hours trying to deal with this. Probably tried every variation of configs published online in the last 10 years...

At this point I am getting quite annoyed as when I was researching what OS to put on baremetal (also in the context of a media server to at least some extent) everyone was praising proxmox and said that if anything I should use it and dedicate one of the vms to the media server stuff. And I do agree, it's quite cool to have the option/flexibility it offers.

Then as a part of general proxmox research q35 is recommended because it offers more upto date instruction sets, yada yada.

And now 15h+ later it turns out that the, well at least more or less from my "beginner" POV ideal settings are broken. And I do wonder about the performance as I have read at least some people saying that there is a significant penalty by using passthrough. So in the end, is this a fool's errand? Should I just go back to ubuntu server and run docker?
 
I have had the exact same issues as you with an i7 10700k, and I have also concluded that the only way to make the vms run at all is to have the cpu set to i440fx. I can't comment on stability yet as I have not ran the system for long enough, spent the last 15+ hours trying to deal with this. Probably tried every variation of configs published online in the last 10 years...

At this point I am getting quite annoyed as when I was researching what OS to put on baremetal (also in the context of a media server to at least some extent) everyone was praising proxmox and said that if anything I should use it and dedicate one of the vms to the media server stuff. And I do agree, it's quite cool to have the option/flexibility it offers.

Then as a part of general proxmox research q35 is recommended because it offers more upto date instruction sets, yada yada.

And now 15h+ later it turns out that the, well at least more or less from my "beginner" POV ideal settings are broken. And I do wonder about the performance as I have read at least some people saying that there is a significant penalty by using passthrough. So in the end, is this a fool's errand? Should I just go back to ubuntu server and run docker?

I agree with you, nowhere did I stumble upon anything that said passthrough wouldn't work well with q35 systems. Would've setup my VM using i440fx in the first place if that was the case and saved me a few days of frustration.

I do like the flexibility of proxmox, but honestly I'm glad I took some time to set everything up while my other system is still serving data. Since my goal going in was to learn about virtualization, I'm enjoying the overall experience. I think a good way to go about this is to get everything setup in proxmox, and actually analyze what your needs are. Eventually, if a set it and forget system is what your end goal is, proxmox is probably overkill for that.

In a month or so, if I realise all I am using proxmox for is a couple of VM's for storing/serving data (Xpenology, *Arr stack, pihole), I plan to just move to a Truenas system which should handle everyhting without the complexity. Since I am using dockers inside a Ubuntu VM to run all this, setup shoulf be pretty easy.
 
  • Like
Reactions: dukotron

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!