Nvidia GPU Passthrough with Prime on Debian 12 (GUIDE)

Hello all,

I know much has been written about this subject, but I was still confused and I think I am not alone.

I recorded all the steps to get an RTX nvidia card passed through (using second screen/input plugged into the video card).

NOTE: This is a work in progress, and there are lots of improvements to be made. Please feel free to help make this better.

First follow this guide up until “preparing the guest”.
Create a Gaming HVM

create standalone HVM qube (not based on a template*)
increase ram and cpu (I did 4000mb, 6 vcpus)
increase system storage to 25gb
Qube Manager → qubes settings → advanced → boot qube from cd-rom
select debian .iso (I used debian 12 KDE live)
configure network manually: disable ipv6, set ipv4 to manual. Copy DNS servers, IP, netmask, and gateway. They’re listed in the qube settings. Afterwards disconnect and reconnect your network connection.

install debian
reboot
attach pci devices
start qube

sudo apt update && sudo apt full-upgrade
add contrib and non-free to /etc/apt/sources.list (comment out deb-src rows)
sudo apt install linux-headers-amd64
sudo apt install nvidia-driver firmware-misc-nonfree
reboot (not sure if necessary)

sudo apt install nvidia-xconfig
sudo nvidia-xconfig --prime (these were the missing sauce for me)
reboot

Now you should be able to switch to your GPU output and have a fully accelerated VM. I got over 100 fps on cyberpunk ultra settings in the benchmark!

Questions:

  1. How can I make this standalone based on a template instead of the raw .iso? When I try this the qube starts silently in the background instead of spawning a virtual display, and I haven’t been able to get nvidia-smi working this way.

  2. What distros have you all successfully achieved this on? I tried a bunch but this is the first I had success with. Was not able to get bazzite, majaro, or nobara working. I am realizing this is probably due to driver/kernel mismatches, and wayland. I’d be very curious to hear if anyone has gotten this functional with wayland, a fresh nobara install displays on wayland but it was not accelerated. Up to date nobara no longer includes xorg, which is unfortunate because I think it would work flawlessly with x11. I tried manually installing x11 but it still did not appear as an option at the lock screen. If anyone more knowledgeable has an idea how to fix this I’d love to hear. Same goes for Fedora workstation, which I’m working to figure out as I think it would be a good fit for this.

  3. Has anyone gotten a gpu passthrough qube working well on wayland? If so I’d love to hear about it!

  4. This uses the proprietary nvidia-driver package. I’m curious about if nvidia-open is worth using, if anyone has insight on the pros and cons, or has a suggestion for which distro to test this with please let me know.

  5. If anyone wants pictures or maybe a video of these steps I can try to do that

Please forgive the rushed post, and don’t hesitate to comment if you need support

1 Like

I had great results with openSUSE tumbleweed and MicroOS, with discrete rendering with PRIME but also GPU output

1 Like

Thanks for the response, I will definitely give tumbleweed a go

Did you create it from a template, or did you manually add the qubes packages after the fact? I’m confused about the different standalone behavior depending on whether it’s based on a template or not.

It was pure hvm without qubes packages

These steps are to recognize a second external monitor?

That’s right. I just switch my monitor’s input.

I’m asking because I have an Acer Predator Helios Neow 16 with Nvidia Geforce RTX 460, and when I plug the HDMI-1 port to see Qubes OS in my wide LG curve OLED, a window pops up from Dom0, but it does not recognize the signal from the monitor, and I am having a hard time with this issue

it did not worked for me

Try reading this thread:
https://forum.qubes-os.org/t/why-does-seamless-gpu-acceleration-only-work-when-using-template-based-hvms/29253

1 Like

What’s this “prime” thingy?


Also, what is the model of your GPU?

It’s a NVIDIA “feature” to offload rendering to a discrete GPU, basically you can display a video game on a slow integrated GPU but do the rendering on a second NVIDIA GPU that is not used for the display.

It’s a 40 series RTX card, sorry I definitely should have mentioned that haha
There’s different ways to do it besides prime but from what I understand (not much haha) prime has the best performance.

1 Like

Is this a dual gpu laptop?

You mean the mobile 4060? I think that should work similarly but can’t say for sure without having it to test. If you mean the GTX 460 it will probably need different steps

What part are you getting hung up on?

what does it say when you run “nvidia-smi”, and “lspci -k”

Thank you, I missed that one. I see I have much to learn.

I am going to try to get a seperate nvme drive to put in a USB enclosure and pass through to the gaming qube. I’m thinking I can put my steam library on the external drive and then do all my gaming in a disposable VM which sounds awesome to me.

Hi Buddy, Yes, the Nvidia RTX 460, I still cannot make an external monitor to receive a signal from my GPU using Qubes OS 4.2.3