Running Windows 11 or 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 22.04 to 23.10.

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.

Windows 11 Support

On Virtual Manager select the x86 firmware to have UEFI support, and create the VM.

There is also a problem with permissions and the swtpm software package that emulates the TPM 2.0 required by windows 11.

You need to run this command before starting the vm.

sudo apt-get install apparmor-utils
sudo aa-complain /usr/bin/swtpm
sudo apparmor_parser -r /etc/apparmor.d/usr.bin.swtpm

Change your Virtual Manager settings to UEFI.




Download the iso for windows 11 or 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

Documentation

https://docs.fedoraproject.org/en-US/quick-docs/creating-windows-virtual-machines-using-virtio-drivers/index.html

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 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.

To share linux folders with windows you need:

Add "Channel (spice-webdav)" using Virtual Machine Manager



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 from https://www.spice-space.org

Download this msi file and install it

https://www.spice-space.org/download/windows/spice-webdavd/spice-webdavd-x64-latest.msi

Then in gnome boxes you can add all folder you want to share with the windows guest, and a Z: drive should should on widows with the shares.

 

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 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 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".

Opengl version 2 support

On Display Spice check the open GL box, and on Video select the virtio and select the 3d acceleration box, both neer to be enable for it to work.

These drivers are slower than the QLX with some lag but it works, so I normally run with QLX.

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