Return to Level1Techs.com

Ubuntu 17.04 -- VFIO PCIe Passthrough & Kernel Update (4.14-rc1)

vfio
passthrough

#42

Gonna try it this weekend again, if its gonna go well, i will post updated tutorial (probably this one with some updates), wish me luck :smiley:


#43

Just an FYI, on 18.04.1, I had to install the latest 4.18-rc8 kernel to get everything working correctly. I’d get issues with SEGFAULTS in libvirtd when using Virtual Machine Manager. So far, things have been good on that kernel. :slight_smile:


#44

hmmm, could be why it was fucked up in Elementary OS… sadly, i cant test it this week, cuz moving stuff in my room, maybe on sunday if i get lucky :open_mouth:


#45

just a quick question,

do I need dual GPU cards installed to passthrough? or can I passthrough a single card?

If i use dual cards, which would I passthrough if one is older then the other?


#46

No and yes.
Technically you can pass-through a single GPU, but then you don’t have anything to display the host. You can run the host headless, and put a monitor on the GPU and it will display the guest only.

Depends on your needs. If you need the faster card on the VM, use the faster card, otherwise use the slower one. There’s no need to pass through a specific card.


#47

thanks @mihawk90


#48

I’ve just finished up setting up my Ubuntu 18.04 LTS machine with a Windows 10 Guest VM that uses Looking Glass, and I’ve written down in extreme detail all of the problems I ran into while attempting to do so, here:

Hopefully some of you will find this useful!


#49

i pretty much rewrote and updated this tutorial (with a bit detailed guide in some parts) for Elementary OS 5.0, but i got stuck cuz my second GPU i passed is too old to initialize correctly :smiley: but ubuntu is able to re-init on boot, not windows tho, so i gotta get better gpu then update it and publish it on forums then


#50

Hi guys.

My windows 10 install recently borked after another update gone wrong… Third time in a year… So I’ve decided to check again if I could maybe switch to Linux and still game sometimes (Warframe mostly), and down the GPU passthrough rabbit-hole I went.

I’m writing this because I finally got it to work and I haven’t seen a guide (at least a pretty recent one) to this particular combo of hardware. And also because I want to write down the steps so I can do it again if I have to :slight_smile:

So my Hardware/Software :

Intel CPU (i5 6600K)
ASUS MB (z170 Pro Gaming)
Host GPU : idGPU
Guest GPU : Nvidia Card (GTX 1070)
UBUNTU 18.04

I won’t go into super detail of all you have to do, this existing guide is pretty much all you have to know, this is just what you have to do to make it work with this particular combo of hardware/software. AGAIN, PLEASE READ ORIGINAL GUIDE SO YOU KNOW WHAT YOU ARE DOING.

Without further adoo :

sudo nano /etc/default/grub

locate this line and modify it like so, and of course add your ids.

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash iommu=1 intel_iommu=on vfio_pci.ids=10de:1b81,10de:10f0"

Yes, I had to specify the vfio ids here as well, couldn’t get vfio to snag the GPU, nouveau always won the battle even when I was using softdep as you will see later on. Also don’t forget to :

sudo update-grub

Then lets edit :

sudo nano /etc/initramfs-tools/modules

Like so:

softdep nouveau pre: vfio vfio_pci
vfio
vfio_iommu_type1
vfio_virqfd
options vfio_pci ids=10de:1b81,10de:10f0
vfio_pci ids=10de:1b81,10de:10f0
vfio_pci
#nouveau

Then :

sudo nano /etc/modules

has to contain :

vfio
vfio_iommu_type1
vfio_pci 

Then make this file :

sudo nano /etc/modprobe.d/nouveau.conf

and paste the following :

softdep nouveau pre: vfio vfio_pci

Then :

sudo nano /etc/modprobe.d/vfio_pci.conf

and add :

options vfio_pci ids=10de:1b81,10de:10f0

Pheeeewww! But wait there’s more :slight_smile:

Okay right now you should really

sudo update-initramfs -u

And at this point if you have your monitor hooked up to the HDMI port of your MB and you reboot you will get a a blank screen upon rebooting. Fret not It should actually be kinda ok. If you check : lspci -nnv |less
you should have vfio-pci as the loaded kernel module for your GPU. If you rebooted and are stuck at POST screen then do the following, if you haven’t rebooted then just continue along.

CTRL-ALT-F2

Then we will force UBUNTU to use Xorg and not Wayland:

sudo nano /etc/gdm3/custom.conf

and uncomment the following line :

WaylandEnable=false

and finally let’s tell Xorg which GPU he should use to display :

sudo nano /etc/X11/xorg.conf

and add the following :

Section "Device"
    Identifier "Intel GPU"
    Driver "modesetting"
    BusID "PCI:0:2:0"
EndSection

Where BusID is the BusID of your IDGPU. (find it using lspci -nnv |less)

That’s it, if you reboot now, everything should be ready to create your VM.

Have Fun!

P.S. : Fun fact : Nvidia drivers check to see if they are running inside a VM or not, if they see they are inside a VM they give you an error and stop working/Installing… anyway :

virsh edit [your vm name]

and make sure to have the followwing inside :

<hyperv>
  <relaxed state='on'/>
  <vapic state='on'/>
  <spinlocks state='on' retries='8191'/>
  <vendor_id state='on' value='ab5485961025'/>
</hyperv>
<kvm>
  <hidden state='on'/>
</kvm>

Peace!


#51

“I haven’t seen a guide (at least a pretty recent one)”

well, that escalated quickly , here you go :smiley:

https://forum.level1techs.com/t/elementary-os-5-0-beta-vfio-pcie-passthrough-guide-tutorial/131420/11