#Help make GPU Passthrough VM

367 messages · Page 1 of 1 (latest)

slow gyro
#

Hello, I have installed Arch Linux with Hyprland onto my main personal Laptop, however I still need Windows for some select Programs and I don’t really want to do a DualBoot, instead I want a VM with GPU Passthrough, I have a Intel Core i7-14700HX and a Nvidia RTX 4060 GPU inside my Laptop and wish to have the iGPU used for Arch and the RTX used for the Windows VM, Thanks!

#

I already looked for guides on the Internet but I couldn’t seem to get them to work, they didn’t show what I need to install or just didn’t work, I am on a fresh installation rn.

slender wedge
#

wsg

#

are you using proxmox or kvm qemu?

slow gyro
slow gyro
#

Lemme check

#

Idk I don’t have anything installed rn

#

Fresh install

#

But I used QEMU before

slender wedge
#

what kind of setup are you looking for? a setup where you want a main OS to manage different virtual machines? or do you want a normal linux distro with a virtual machine manager

slow gyro
#

Essentially Arch Linux using iGPU and Windows using GPU

slender wedge
#

then you'd want to look at kvm qemu

#

keep in mind that some games wont with under a VM, this wont let you bypass kernel anti cheat

#

so if you already have arch linux installed, i'd start by setting up kvm qemu

slow gyro
#

I never really play AAA Games

#

Its only really Minecraft Bedrock and Forza Horizon 4

#

Adobe Creative Cloud & Office too

slender wedge
#

fair

#

thats going to be all the qemu tools

slow gyro
#

What command do I need to do to Install

#

Sudo pacman -S?

slender wedge
#

yes

#

so that would be sudo pacman -S qemu-full

slow gyro
#

I think it is nearly done

#

Alright

#

Let me install it

slender wedge
#

also check if your cpu supports virtualization by doing "lsmod | grep kvm"

#

you should see something like this

slender wedge
#

yes great. virtualization will work

slow gyro
#

So all this?

slender wedge
#

yes

slow gyro
#

Ok

#

It’s Installing I’ll say when it’s done

#

Ok it’s done

slender wedge
#

alright, now do "sudo systemctl enable --now libvirtd.service"

#

that makes it so libvirtd starts on log in

#

otherwise you'd have to start it manually everytime

slow gyro
#

Failed to enable unit: unit libvirtd.service does not exist

slender wedge
#

try sudo systemctl enable --now libvirtd.socket ?

slow gyro
#

Does not exist

slender wedge
#

strange, i thought the qemu full included it

#

do sudo pacman -S libvirt

slow gyro
slender wedge
#

yeah

#

or socket

#

just not both

slow gyro
#

Ok I did Service

slender wedge
#

good.

#

okay few more packages

#

virt-manager

#

virt-install

#

virt-viewer

#

dnsmasq

#

bridge-utils

#

edk2-ovmf

#

iptables-nft

slow gyro
slender wedge
#

thats all

slow gyro
slender wedge
#

actually ur gonna do a windows vm right?

#

install edk2-ovmf

slow gyro
slender wedge
#

ignore bridge utils thats fine

slow gyro
slender wedge
#

leave it alone

slow gyro
slender wedge
#

i think ur done with the virtual machine manager side

slow gyro
#

I put in the install command then it does this and quit?

slender wedge
#

open virt manager

slow gyro
slender wedge
#

?

#

we installed it though

slow gyro
slender wedge
#

its okay

slow gyro
#

Or do I install them individually 1 by 1?

#

Ok I got it Installed

#

I removed Bridge-Utils

#

I opened Virt-Manager

slender wedge
#

i have no idea how you got that haha

#

put in ur password ig?

slow gyro
slender wedge
#

details?

slow gyro
slender wedge
#

yeah idk tbh

slow gyro
#

Idk but QEMU seems to be connected

slender wedge
#

when you open it ur supposed to see this

slow gyro
slender wedge
#

what does it say instead?

slow gyro
#

Wai

#

This

slow gyro
# slow gyro

@slender wedge Sorry for long wait but I think this is right

#

I also clicked Close on Error and whenever I relaunch QEMU it doesnt show Error anymore

slender wedge
#

yeah thats good then that means its connected im pretty sure

#

does it let you make a new virtual machine?

slender wedge
#

click the screen button on the far left

#

upper

slow gyro
#

I need ISO tho

#

Dont we still have to setup GPU Passthrough?

slender wedge
#

set up a windows 11 VM first before doing passthrough

slow gyro
#

Okay

slender wedge
#

you dont have to but i like to make sure the VM is working fine before hand

slow gyro
#

My ISO is on my Ventoy USB

slender wedge
slender wedge
slow gyro
slender wedge
#

yes

slow gyro
slender wedge
#

later you are going to want to set up a bridge connection

slender wedge
#

ventoy and windows can be weird

slow gyro
#

Its being fussy about ISO on USB

slender wedge
#

hm?

slow gyro
#

Give me a Minute im moving it to my main Drive

slender wedge
#

that looks fine

slow gyro
#

Its a very fast USB

#

nearly done

slender wedge
slow gyro
#

Okay it is working

slender wedge
#

notably section 3 starting with "Isolating the GPU"

slow gyro
#

I should proceed with Windows Install like normal?

slender wedge
#

yes

slow gyro
#

Does Home or Pro even matter?

slender wedge
#

depends on what your doing. but in most cases no

slow gyro
#

Will it even detect my Laptops Product Key?

slender wedge
#

no

slow gyro
#

Ill js do Pro

#

Ohh

#

My Laptop litreally came with Windows 11

slender wedge
#

thats not how that works

slow gyro
#

Shall I just do 10?

slender wedge
#

you either need to bypass the TPM and secure boot check by doing regedit. or set up TPM and secure boot in ur virtual machine

slow gyro
slender wedge
#

idk i only know how to do it in proxmox, i usually just skip the checks

slow gyro
#

Ima js do Windows 10

#

Windows 11 is crap anyways

#

Gimme a Sec

#

Ok

#

@slender wedge I am Installing Windows

#

What now

slender wedge
#

bypassing the secureboot and tpm checks is really easy

slow gyro
#

What do we do now?

#

While Windows is Installing

#

@slender wedge ?

#

You there?

slender wedge
#

your using a nvidia gpu right?

#

do lspci -nnk | grep 'NVIDIA*'

slow gyro
slender wedge
#

put these numbers in a notepad or something

#

so like 10de:28a0,10de:22be

slow gyro
#

10de:28a0

#

10de:22be

#

Okay

#

I noted them down

slender wedge
#

what bootloader are you using?

#

grub?

#

systemd?

slow gyro
#

Grub

slender wedge
#

okay

#

do nano you need to edit your grub config

slow gyro
#

I forgo

slender wedge
#

uhh

slow gyro
#

sudo nano /etc/default/grub

#

I think this

slender wedge
#

yes

slow gyro
slender wedge
#

ur gonna want to focus on grubcmdline

#

linux default

slow gyro
#

That line?

slender wedge
#

yes that is indeed the line

slow gyro
#

Okay

slender wedge
#

im just remembering what ur supposed to put there

#

you have a intel cpu right?

slow gyro
#

Yes

#

i7-14700HX

slender wedge
#

add intel_iommu=on iommu=pt vfio-pci.ids=10de:28a0,10de:22be

#

after quiet

slow gyro
#

like tgat?

slender wedge
#

after that, save the config, close back to terminal, and then do sudo grub-mkconfig -o /boot/grub/grub.cfg

slender wedge
#

now you need to stop the host from grabbing the gpu

slow gyro
#

So what do we do?

slender wedge
#

create a file in modprobe so do sudo nano /etc/modprobe.d/vfio.conf

slow gyro
#

Ok did that

slender wedge
#

put options vfio-pci ids=10de:28a0,10de:22be
softdep nvidia pre: vfio-pci

slow gyro
#

Like this?

slender wedge
#

idk if the formatting matters, but just in case in the first line put

#

options vfio-pci ids=10de:28a0,10de:22be

#

and then on the second line

#

softdep nvidia pre: vfio-pci

#

thats just how i have it on my system

slow gyro
#

Like this @slender wedge?

slender wedge
#

good

#

save

slow gyro
slender wedge
#

edit /etc/mkinitcpio.conf

slow gyro
#

nano /etc/mkinitcpio.conf?

slender wedge
#

yes any text edit program

#

inside of modules put

#

vfio_pci vfio vfio_iommu_type1

slow gyro
#

Like this?

slender wedge
#

good

#

save

#

do sudo mkinitcpio -P

slow gyro
slender wedge
#

you need to sudo before nano / vim etc

#

so close nano

slow gyro
#

Ok fixed it

slender wedge
#

good

slow gyro
#

I have saved it

#

Now what?

slender wedge
slow gyro
#

Ok done

slender wedge
#

did you already sudo grub-mkconfig -o /boot/grub/grub.cfg?

#

i dont remember

slow gyro
slow gyro
#

Shall I do it just in case?

slender wedge
#

okay good

#

no thats alright

slow gyro
#

Ok

slender wedge
#

reboot

slow gyro
slow gyro
#

Ok back

#

I have rebooted

slender wedge
#

okay so now uh

#

do lspci -nnk | grep -A 3 "10de:28a0|10de:22be"

#

and show me what it says

slow gyro
slender wedge
#

do lspci -k | grep -A 2 "NVIDIA" ?

slow gyro
slender wedge
#

mmm

#

kernel driver in use should say vfio-pci

#

let me backtrack

#

right i dont think we blacklisted nouveau

slow gyro
#

Oh

slender wedge
#

do sudo nano /etc/modprobe.d/blacklist.conf

#

this will create a new file

slow gyro
#

Ya

#

What do I put in it?

slender wedge
#

all ur writing in there is

#

blacklist nouveau

#

save that

#

and then

#

sudo mkinitcpio -P

slow gyro
slow gyro
slender wedge
#

now reboot

#

once your back do lspci -k | grep -A 2 "NVIDIA"

slow gyro
#

Uhm

#

@slender wedge

slender wedge
#

im thinking

#

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

#

replace with

#

options vfio-pci ids=10de:28a0,10de:22be
softdep nvidia pre: vfio-pci
softdep nouveau pre: vfio-pci
blacklist nouveau

slow gyro
#

Like this?

slender wedge
#

good

#

sudo nano /etc/default/grub

slow gyro
#

Yea?

slender wedge
#

replace the cmdline linux default with "quiet intel_iommu=on iommu=pt vfio-pci.ids=10de:28a0,10de:22be modprobe.blacklist=nouveau"

#

or just add modprobe.blacklist=nouveau

slow gyro
#

Like this?

slender wedge
#

good

#

do sudo grub-mkconfig -o /boot/grub/grub.cfg now

#

and then sudo mkinitcpio -P

#

and then reboot

#

when ur back do lspci -k | grep -A 2 "NVIDIA"

slow gyro
#

Nvm

#

I forgot Sudo

#

Ok let me Reboot

#

Okay back

#

This is the Issue I was having when I tried to do it originally

#

I couldnt figure out why it wouldnt change Driver to VFIO

slender wedge
#

at this point it would start working for me

#

i set mine up in the way i explained it

slow gyro
#

Bru what

slender wedge
#

since your using a laptop, maybe it has something to do with hybrid graphics?

slow gyro
#

Why wont mine work

slow gyro
#

Any way of Disabling that?

#

I am on MSI Sword 16 HX B14V

slender wedge
#

or maybe your gpu shares a group with other devices?

slender wedge
#

someone else who's pass through hybrid graphics before on a laptop might be a better help. i've only done this on desktop

slender wedge
#

not really,

slow gyro
#

Oh

slow gyro
#

But it’s greyed out

slender wedge
slow gyro
slender wedge
#

find a way to switch ur gpu's to dgpu only

slow gyro
slow gyro
slow gyro
#

It’s set to IGFX

slender wedge
#

idk what any of ur bios settings do

slow gyro
#

It has these options

slow gyro
slender wedge
#

idk what that does

#

okay

#

idk if that turns off hybrid

slow gyro
slender wedge
#

try peg slot ig

slow gyro
#

It doesn’t seem to let me

#

I change it to peg and reboot but screens stays black

#

And when I do a EC reset to fix it goes back to HG

slow gyro
#

@slender wedge Im probably going to do this on my Desktop, Do I just do the same steps as you mentioned for my Desktop?

slow gyro
#

My Desktop is an i7-6700K & GTX 1080 Ti

slender wedge
#

assuming its also arch linux, the steps for gpu passthrough are a bit different on other distros

slow gyro
#

Should I use a Windows GPU Passthrough VM for it

slender wedge
#

idk thats more of a question for you and your needs

#

if i were you i’d just not play those games that cannot be ran on linux

#

or just dual boot

#

or set up a sunshine/moonlight setup to stream ur windows laptop to your linux desktop

slow gyro
#

Well

slender wedge
#

since ur laptop has a much more powerful 4060

slow gyro
#

At moment I dualboot Windows 7 and Arch on my Desktop

slender wedge
#

oh,

slow gyro
#

Im thinking of using Windows 7 with GPU Passthrough VM

slender wedge
#

why out of curiosity

slow gyro
#

And a Windosws 10 VM

slow gyro
slender wedge
#

nothing

#

follow the steps

slow gyro
#

Well

#

I must be stupid or skill issued

#

It does same shit on my Desktop