Running Windows 10 on Ubuntu with support for 2D accelerated video, disk, network and touch support

How to run windows with acceleration support on Ubuntu


This works on ubuntu from 16.04 to 20.04.

This setup will accelerate the virtual VM for disk, network, video, random device, and memory, it also adds support for touch screen for windows 10 running inside Ubuntu.

Download the iso for windows 10 from Microsoft web site, install the image using a regular gnome-boxes interface.


Then download the virtio-win-XXX.iso from here, pick the latest version.
https://fedorapeople.org/groups/virt/virtio-win/direct-downloads/archive-virtio

Option 1:
  1. Run the virtio-win-gt-x64 on the root of the iso image, follow the instructions.
  2. Install the guest-agent available inside the virtio-win-XXX.iso cd image under the guest agent folder.
Option 2:
  1. Goto the device manager browser on windows 10 and click on all devices with problems, and point these to the where the cdrom is and select update
  2. Do the same for the display driver, the network driver, and the disk driver
  3. This should pick the RedHat drivers, you need to trust Redhat since the drivers are not signed with Microsoft keys
  4. Install the guest-agent available inside the virtio-win-XXX.iso cd image under the guest agent folder.

Goto to https://www.spice-space.org/download.html and download the Spice Windows guest tools, to allow copy paste and resize when running under boxes, and install it.

In a Windows guest, you must then install spice-webdavd service.
https://www.spice-space.org/download/windows/spice-webdavd/

Windows should be running fine now, the instructions below will allow you to run the VM even faster, but if you want you can stop here.



When all drivers are installed you can change these settings with a permanent way using

sudo apt-get install virt-manager gnome-boxes

Use virt-manager to change the configs for the vms created by gnome-boxes and set all the virtio devices you can (disk and network are a must for speed).
After these changes gnome-boxes will pick the same settings. Don't forget to create a qemu/kvm user session connection to be able to see the gnome-boxes vms in virtual machine manager, in case they are missing.

Some device like the virtio-keyboard virtio-mouse and virtio-tablet are still missing from virtual machine manager interface, so the default ps2 mouse and keyboard are used in this example, and the tablet usb device is used for the mouse to lose focus when it touches the border of the window, but also allowing the windows 10 to be used on a touch screen laptop inside Ubuntu.

Also for all virtio disks setup set the cache to none and mode to native, that should make the VMs more reliable and faster if you are using an SSD disk, you can check the picture for the settings.

There is some overlap between the agent and the drivers from the iso file, but it will work fine in the end.

Using the Virtual Machine Manager change the following:
- removed IDE drives.
- added a SATA disk.
- changed the network interface to use virtio.
- changed the sound controller to ich9.
- added a USB mouse and USB keyboard without removing the PS2 mouse and keyboard.
- Installed Spice Windows guest tools.
- Installed Virtio-win-XXX driver for all devices that where marked as red on windows device manager.
- add a small VirtIO disk 2Gb just to force windows to load drivers.
- at this point, install all updates and make not red devices are showing under windows device manager.

After shutting down:

- for all virtio disks setup the cache to "none" and the mode to "native".
- shutdown the vm, then I switched the SATA drive with a VitrIO disk pointing to the same file, remove the SATA drive and fixed the Boot options to use this new drive and windows loaded the new drive just fine.

After all these changes the windows 10 vm works much faster and is integrated with copy-paste support. You can also share folders from gnome file manager, using Local Network Share and browse windows shared folders by using gnome file manager "other locations" followed by "windows network".

Advanced

Editing the xml config file with virsh

<input type='tablet' bus='virtio'/>
<input type='mouse' bus='virtio'/>

Replacing the usb tablet and mouse with a virtio tablet, possibly eliminating the need to have a usb host adapter in your virtual machine as often the usb tablet is the only usb device.

At the moment the firmware (edk2/slof) lacks support for virtio keyboards, so switching from usb to virtio looses the ability to do any keyboard input before the linux kernel driver loads, i.e. you can’t operate the grub boot menu. I hope this changes in the future.

If you have to stick to the usb keyboard or usb tablet due to missing guest drivers for virtio input I strongly suggest to use xhci as usb host adapter. Under the USB controller in "Virtual Machine Manager" change it to USB3, windows 10 supports USB 3, you might need to remove some usb devices from your VM.

Opengl version 2 support


There is some work going on to support opengl in Linux and windows guests but this work is not yet supported in Ubuntu 16.04, see references below.

The qemu command line will look something like this to enable the opengl on guest systems.

qemu-system-x86_64 ... -display sdl,gl=on -device virtio-vga -vga virtio

To my very naive knowledge, qemu on Ubuntu needs to be compiled with gtk3 or sdl2 and this is not the case. Ubuntu qemu binaries do not support gtk3 or sdl2, only sdl1.
Everything else seems to be OK, mesa, kernel and qemu all are the versions that should support opengl initial versions, it should be possible to run a linux guest OS with opengl.

<controller type='usb' model='nec-xhci'/>
<input type='tablet' bus='usb'/>


References


https://wiki.archlinux.org/index.php/QEMU
https://virgil3d.github.io/
http://www.spice-space.org/download.html
https://www.kraxel.org/blog/
https://www.kraxel.org/slides/qemu-gfx.pdf




Comments