Summary

Dual booting Linux and Windows is a pain. It’s an involved process, and one that is very prone to breakage. More so if you happen to install both operating systems on the same drive. It was for this particular reason (among many others) that made me ultimately give up on Windows and choose to daily drive Arch Linux instead. That said, there are still a few uses for Windows, and it’s not always possible to carry a second machine. This is where virtual machines come into play, and they’ve entirely replaced my dual boot system for the better. Running a Windows virtual machine under QEMU Initializing it properly is the hard part Running Windows 11 inside a virtual machine is quite doable, but it requires a fair bit of tinkering if you happen to want to go down the manual path. If you’re looking for something that’s more plug and play, Winboat is a decent alternative that does most of the heavy lifting for you. In my case, I wanted to try out GPU pass-through, so QEMU was the natural choice here, along with the virt-manager GUI interface. I also had to make sure I had the right Windows 11 ISO image, along with the virtio-win drivers, which will help the host communicate with the guest better. Setting up the VM in virt-manager was a bit of an arduous task, but I’ll take it over typing in commands to QEMU any day of the week. That doesn’t mean that the virtual machine was simple to set up either — far from it, and I needed to take a lot of things into account before hitting that start button. Since this was a Ryzen-based AM4 system, I had to edit a few things in the XML file. For starters, I had to enable the CPU model to “host-passthrough” and change a line in the CPU topology section to get some decent performance out of it. As for the specs of the virtual machine, it was a modest 12 GB of RAM, 8 vCPUs (4 cores and 8 threads) and a virtual hard disk sized at 200 GB. I also intentionally chose Windows 11 LTSC instead, since I didn’t want to spend an hour debloating the installation. With everything ready, it was time to hit the start button, and Windows 11 installed as it would normally. I did, however, have to install the virtio-win drivers from the ISO mentioned earlier, and this did fix a lot of the stuttering I was having. With the rest of the updates completed, the virtual machine was, by all accounts, entirely usable. I could run Windows-only programs like MS Office on it without hiccups, although in its current state the VM is quite limited. It’s nothing more than just a tinker box, and I’d need some devices, along with actual hardware acceleration to get things going. GPU and USB passthrough transforms it into an actually usable installation Games, driver updates and more You can pass through both PCIe and USB devices using virt-manager, and this opens up a world of possibilities. GPU pass-through in particular is something I am familiar with, having used it on laptops with dGPUs before. It essentially detaches a GPU from the Linux host, and passes it onto a virtual machine in its entirety. The guest operating system quite literally cannot tell the difference, and sees it as a part of its own hardware lineup. This lets you use the GPU in the guest, along with updated drivers. In my case, it was an RTX A2000 that I had passed over to the Windows 11 guest. The system detected it without any issues, and driver installation followed through. All that remained was connecting a display cable to the GPU, and I was able to access the VM! If you’re looking into headless displays or just want to run the VM without plugging it into a monitor, try out HDMI dummy plugs. They’re relatively cheap and are a great option when paired with something like Looking Glass. I also had to pass through my USB keyboard, mouse and gamepad in order to actually use the virtual machine. And herein we come to the main benefit of having a VM: being able to run Windows-only software. A lot of these devices have software that is strictly Windows-only, and this also gates certain updates. Passing through a USB dongle to Windows and running the update software within the virtual machine is often the only way to update the firmware for these kinds of devices. This is especially true for things like headsets and mice. Going back to the Nvidia drivers, once they were installed, I had full 3D hardware acceleration. This means we can (finally) play some games! And they run fantastically well, depending on the amount of resources you have allocated to the virtual machine. You’d ideally want at least 6 cores and 12–16 GB of RAM here, in addition to the GPU. This is my preferred way to play games and launchers that lack Linux ports, or are entirely incompatible with Proton. It’s also another (albeit convoluted) way to get Xbox Game Pass working under Linux. Some programs (and games) do not behave nicely when in a virtual machine Unfortunately, not every program is compatible with a virtual machine. If needed, most programs can detect that they’re inside of a virtual environment, and can take steps to restrict your access accordingly. This includes most games with kernel level anticheat, and while there are exceptions, the majority of titles block this in the name of “security.” This makes a GPU-accelerated Windows VM a bit of a niche thing to have, although it is still perfect for the odd device update (even if driver updates do not need GPU pass-through). I don’t play any of these games, and my usage of Windows-exclusive apps is rather limited, and so I really don’t have a need for a separate Windows device. A virtual machine covers all my needs, and I haven’t gone back to dual booting in years, which has saved me from a lot of headache.

By Dipan Saha

Original Article