Contents

Setting up my Windows VM


Who is this post for

Me! I always forget how to set this up after I accidentally break it.

Why is it set up this way?

I realized today that I’d forgotten most of the steps involved in setting up the Windows VM I use every day. This post is just going to be a quick check list of (most of) the important steps to recreating it.

For anyone else reading this, I simply wanted a vm that has access to a gpu that I can shove onto its own monitor and move my mouse freely between monitors as if it were part of the host os. So I wanted full screen, shared audio, and most importantly for the window to be contained in the host (most solutions stop at being able to change monitor input.. but then I lose all my nice linux workspaces on that monitor!

So this setup checks all those boxes. I can interact with it freely, share sound back and forth, share clipboard, everything. And since I have 4 workspaces on my upper monitors, I can swap the vm in and out just like I would with any other window. Its basically a windows “workspace”

Minus the windows part, these steps can apply for any other OS. It is absolutely seamless and there isn’t any perceptible lag in sound or input.

Instructions

  • Setup virt manager with qemu following whatever is the latest on arch wiki
  • Get windows ISO, set up and install windows. Make sure to use UEFI
  • Make sure secondary GPU isn’t being grabbed by host OS on boot. just google it, it was quick to find the first time – but essential step
  • Add secondary GPU video and audio to the devices to pass through
  • Check to see if you need to have a patched ROM . Some GPUs require some don’t. Just try booting without a special ROM.
  • Do I need to specify a ROM if I want it to use default? I don’t remember. But my current vm specifies a rom in the xml
  • For the second GPU to work properly, it needs to be physically plugged into a monitor. Plug it into whatever monitor you want to use. The VM will share the properties with the real physical monitor. E.g. plug into 4k60 monitor and you’ll have 4k60 coming out of the vm. Plug into 2k144 you get 2k144.
  • If you switch the monitor to the input of what you plugged into, you will see the VM. You’ll have to do the rest of the setup like this.
  • On both the VM and the host, install looking glass. Updated instructions should be on the site.
  • Switch the input on the monitor back to the host os and confirm you can use looking-glass cli command to access the vm
  • Last step, to send audio through from vm to host, on both vm and host install scream audio.
  • For some reason on Arch getting scream to work correctly was annoying. The following command sent the audio through to pulse just fine: scream -o pulse -i virbr0 &
  • That should be it. If future me reads this and missed steps, just add them

Updates

2023-02-28:

Ok well I finally bricked my previous OS and had to redo this. Some notes:

  • INSTALL LOOKING GLASS ON WINDOWS AS ADMINISTRATOR. It says it in the instructions but i always miss that part i guess.
  • Make sure looking glass client and host are the same version. They usually are but if they’re at all out of sync it just won’t work.
  • The kernel modules and other config needed to make 2nd gpu use vfio driver is in my nixos-config repo

2023-03-23:

If I don’t want to connect a HDMI cable into an actual monitor, follow this: https://www.reddit.com/r/VFIO/comments/wj6zhz/gpu_passthrough_looking_glass_no_external/