Workaround: Multiple GPUs required for Passthrough to VM

am3s

Cadet
Joined
Oct 8, 2023
Messages
1
Wanted to share a workaround I discovered for TrueNAS Scale's pesky desire to use at least one GPU for the host system, without eating up extra PCIe or PCI slots. A CPU with integrated graphics (for me a Ryzen 5700g) has been enough to solve the issue for myself, passing on my gtx 1660 into a windows VM, without the need for a second, dedicated graphics card.

Build: Asus Prime B550 Plus, Ryzen 5700g (upgraded from a Ryzen 3600), 32gb DDr4 (not ECC), gtx 1660 (previously paired with a gtx 1050 ti to appease the host gpu issue), 256 gb m.2 NVMe SSD for a booth, 1 tb m.2 NVMe SSD for a cache drive, and 2x Seagate IronWolf 4tb HDDs, all wrapped up in a Fractal Design Define R5 for storage expandability.

Here's how I got it to work, and the issues I ran into— After installing the 5700g and installing TrueNas Scale, Ryzen's integrated graphics were not immediately picked up by Scale. This is because after my initial attempt of installation and frustration with the multiple graphics card issue, I reinstalled windows onto the machine, which was using my 1660 as the primary video output device. To fix this, I went into the Bios and switched my primary video output to IGFX, but Scale STILL did not recognize the integrated graphics. I turned shut down the system fully, turned off the power supply, held the power button to flush any charge that was still in the motherboard's capacitors, removed the GPU, and removed then reinstalled the motherboard's CMOS battery to reset the bios. (I'm not 100 percent sure if this last step is necessary, but I saw it recommended at it worked for me).

With the graphics card removed, I restarted the system and immediately booted into the bios to reenable any setting essential for VM functions, such as virtualization, IOMMU, and ensuring that the primary video output was set to IGFX. With that, scale finally recognized the 5700g's integrated graphics! I powered off the machine, reinstalled the gtx 1660, booted up Scale and both GPU's were finally recognized. (Make sure to keep any display cables plugged into the motherboard's display output, just incase the motherboard wants to switch the primary display output). From there, I immediately went to settings/ advanced to isolate the gtx 1660 for PCIe pass through, and it worked!

VM setup was standard and simple, and the graphics card is easily added and deleted from VMs under the Virtual Machines tab on the web interface. However, I got a little discouraged when the graphics card wasn't being picked up in task manager. Almost gave up again when I realized that the card was recognized in the device manager, and I just needed to install Nvidia's drivers. After installing the drivers, my graphics card was showing up and could be used with no issues, saving me the extra PCIe slots that the gtx 1050 ti was taking up for upgrades like a NIC or and HBA.

So to summarize, the steps I took were:
  • Install CPU with some form of integrated graphics
  • Boot into the bios, and set IGFX (or your motherboard's equivalent setting) as the primary display output, then shut down the system again. (You may be able to skip this step, but for whatever reason I was not able to)
  • Remove any dedicated graphics card from the system, and reset the bios
  • Boot into the bios again, ensuring IGFX is still enabled, and enable any other settings needed for virtualization
  • In the advanced settings tab, ensure that both the integrated GPU and dedicated GPU are both recognized by scale. If they are, immediately isolate the GPU you'd like to use in your VM
  • Create the VM, and include the isolated GPU
  • Install the relevant drivers for your GPU to your VM if necessary.

While I wish that I could still use the CPU's integrated graphics for hardware encoding in something like a plex server, I think this is a pretty solid workaround to scale's desire for multiple GPU's, especially if you are limited on space/pcie slots on your motherboard. If anyone has any holes to poke in this, please go ahead. I readily recognize that I'm pretty new to the homelabs community, and have shook hands with Dunning and Kruger more times than I would like to admit. Just wanted to share my findings in case they help anyone else out!
 

cdog89

Explorer
Joined
Jan 19, 2024
Messages
75
Thanks for sharing!
 
Top