Ubuntu – How to properly configure Virt-Manager (QEMU/KVM) with Windows guest

18.04kvmqemuvirtualization

I'm currently switching to Virt-Manager (QEMU/KVM) and leave VirtualBox behind (as it is slow), but I find Virt-Manager hard to configure. In VBox and VMware, all you have to do is install the guest additions, then everything will work including the display, folder sharing, etc..

I would like to have a Windows guest (either 7 or 10) with at least a working network, display drivers, and folder sharing. Setting a Filesystem passthrough does not seem to work in Windows guests (and I also got sick and tired of trying Samba to work).

What's the proper way to create a Windows guest with working display and sharing? Maybe I missed some dependencies or Virt-Manager specific settings?

"How to" guides I followed:

I tried the nautilus-share, and the manual /etc/samba/smb.conf configuration, and try to mount the folder in guest OS with \\IP.ADDRESS\SHARED_FOLDER, but nothing worked.


EDIT

Sadly, no 3D acceleration support for Windows guest… Guess I'll just stick to VirtualBox/VMware for now…

For future reference, here's my fully working Network, Display, and Folder Sharing QEMU/KVM setup on Ubuntu-based 18.04 LTS (specifically, Pop! OS 18.04). Initially, I'm using the Android Emulator for development with KVM installed. So, then I decided to switch from VBox and VMware to Virt-Manager for OS testing, and primarily, for softwares I used in Windows, since it also target Kernel-based VMs and is faster.

Setup

1. Install and verify KVM:

$ sudo apt install qemu-kvm libvirt-bin ubuntu-vm-builder bridge-utils
$ kvm-ok

Needs restart to work properly.

2. Install Red Hat Virtual Machine Manager:

$ sudo apt install virt-manager

3. Create Windows VM:

I use dynamically allocated QCOW2 storage format:

$ sudo qemu-img create -f qcow2 /var/lib/libvirt/images/test-vm.qcow2 30G

with VirtIO-type Storage and Network (requires VirtIO drivers):

VirtIO Storage

VirtIO Network

Include VirtIO drivers image file:

VirtIO Drivers

4. Windows guest installation:

Load VirtIO Storage and Network drivers (and proceed to standard installation):

Windows VirtIO Storage Driver

For the Network driver, you'll probably don't see any listed drivers while loading it during installation. This occurred to me when I use NAT in network interface, but not in Bridge mode. If that's the case, then you can manually update the driver later on.

Windows VirtIO Network Driver

5. Install and configure Samba for basic public folder sharing over network:

Install Samba on host OS:

$ sudo apt install samba

Add a basic public folder config:

$ sudo nano /etc/samba/smb.conf

Append the following lines:

[Public]
  comment = Public shared folder
  path = /path/to/public/folder
  read only = yes
  guest ok = true
  acl allow execute always = true

Restart Samba service (or perform a full reboot):

$ testparm
$ sudo service smbd restart

You can then map the folder in Windows guest with \\<host-ip-address>\Public:

Windows Map Shared Folder

Windows Mapped Shared Folder

6. Download the SPICE guest tools for Display and other VirtIO drivers, etc..

You can then use the public shared folder to install it to the Windows guest OS.

Best Answer

The easiest way to get all of the required drivers into a Windows guest is to use the SPICE Guest Tools Windows installer. Downloading spice-guest-tools-latest.exe should always give you the latest version.

This package includes the Windows QXL/WDDM display driver along with all of the virtio drivers for virtual hardware provided by KVM, and installs all of them at once.

Note that KVM does not provide file sharing to Windows guests. You still need to set up Samba yourself for that.