Linux Virtual Gaming Machine

You may wonder what’s wrong with this fellow (meaning me, the author). Has he completely lost his mind when he proposes a Linux virtual gaming machine? Before you discredit the idea, let me explain.

Windows virtual gaming machine

Here and elsewhere Linux users have shown solutions for running Windows as a virtual machine on Linux and passing through a dedicated GPU. Given the right configuration, this “Windows virtual gaming machine” will have little to no performance penalty compared to a native (bare metal) Windows installation.

A Windows virtual gaming machine will allow users to play modern, graphic intensive games inside a virtual machine (VM), using a dedicated GPU for the Windows VM. Typically the IGD or internal graphics device (inside the CPU) will be assigned to the host, and the (powerful) discrete graphics card will be assigned to the Windows VM.

The IGD or a low-power GPU is perfectly capable of handling the less demanding jobs of web surfing, video/movie display and a whole bunch of productivity tasks.

But what if you wish to play a game under Linux? Even without playonlinux and wine, there are numerous Linux-based games available today that do have higher demands on the graphics device.

Single GPU passthrough

One approach is to make the (powerful) discrete GPU available to Linux/Xorg. The most common approach is “single GPU passthrough”, and several tutorials have focused on that subject. Single GPU passthrough uses one graphics card for the Linux host, which is passed through to the Windows VM when needed. Upon termination of the Windows VM, the graphics card is reset and re-attached to the Linux host. However, this approach has it’s downsides:

  • The graphics card needs to be reset before it can be used by another windows manager/OS – some cards behave better than others;
  • After booting the VM, the Linux host will no longer have a graphics device, so one cannot switch back and forth between the two;
  • Single GPU passthrough and the way a graphics card is attached to Xorg is still a little experimental.

Yuri, who has written a script and tutorial for single GPU passthrough, writes:

In one command it kills X, frees the GPU from drivers and console, detaches the GPU from the host, starts the VM with the GPU, waits until the VM is off, reattaches the GPU to the host and starts lightdm.

As you can see, there are a lot of things to consider. Also consider what might happen when a Windows VM crashes? Will the graphics card be reassigned to the host?

Linux gaming VM

Assume you already have a Windows VM with VGA passthrough (i.e. a Windows gaming VM). The steps to create a Linux gaming VM are simple. You can literally use your existing Windows VM configuration, make some slight alterations, create a virtual image, and in no time you have a Linux gaming VM using your powerful discrete graphics card.

The process for creating a Linux gaming VM is described in Installing a Linux Mint 19 (Ubuntu 18.04) VM with VGA Passthrough.

Here the benefits of this approach:

  • Your host system and Windows VM remain untouched – no downtime of host system nor availability of Windows VM!
  • Conserve energy – use the low-power IGD while performing normal tasks;
  • Easy to backup/restore linux.img file that holds the entire Linux VM;
  • Create a slim gaming VM with all your games installed.

As disk space is cheap – even for SSD – I can’t see a reason not to run a 30GB-50GB Linux virtual gaming machine.

I look forward to read your comments.

This site uses Akismet to reduce spam. Learn how your comment data is processed.