KVM GPU Passthrough on Ubuntu 20.04
For a better development environment
2 min read
I can summarize the objectives of the project like the following:
- Dual OS but without dual boot
- Ubuntu as the host OS
- Windows on a VM, but empowered by dGPU
Pros and cons
Everything is changed in a positive way:
- Ubuntu wakes up much better from sleep; before, Windows sometime does not.
- Ubuntu is more keyboard-friendly.
- KVM supports GPU Passthrough, which makes Windows based VMs as powerful as host machines.
The only one thing I lost was:
- However, the process was painful because not any single tutorial leads to success.
Summary of the whole process
The following is a short note for my later use.
- Edit and update GRUB for the host OS not to occupy dGPU
- Install QEMU/KVM for virtualization
- Install Windows as a VM, but, at first, without dGPU support
- Enable Remote Desktop in Windows, without which you cannot see anything on display
- Change the VM hardware configuration for Windows to use dGPU
- Install RemoteFX, which connects to the Windows VM and displays what the VM shows on its desktop
After many failures, I managed to make it. It really works. If someone requests, I would post a detailed tutorial but I recommend refer to the references below.
Optimus laptop dGPU passthrough
This is a comprehensive tutorial for GPU Passthrough only for Optimus laptops. The others than this are for more general settings for VM users: a desktop PC with multiple displays.
This article is great in many respects but my laptop does not work as it says. If you keep the summary above in mind, you can use this tutorial more actively and proactively.
GPU passthrough guide for Ubuntu 20.04
This tutorial is great but works best for desktops with multiple displays. This tutorial includes essential steps to GPU passthrough. After you follow this video tut, you should set up remote desktop because, in a single monitor environment, the display cannot show what VMs supported by GPU Passthrough show.