Thursday, April 11, 2019

Leveraging the Embedded ACPI windows product key for Windows VMs using KVM

I recently purchased a Lenovo P52 and of course I deleted Windows and installed Fedora 29.  After a few initial bumps, things have been working well!

However I decided it would be beneficial to have a Windows VM and wanted to leverage the product key which came with my laptop.  This is how I was able to accomplish this:

  • Make a copy of your MSDM and SLIC ACPI tables.
The MSDM and SLIC tables contain software license keys, which are leveraged by Windows.  I placed these files in my /var/lib/libvirt directory and set the ownership of the MSDM file to qemu.

cd /var/lib/libvirt
cp /sys/firmware/acpi/tables/SLIC .
cp /sys/firmware/scpi/tables/MSDM .
chown qemu MSDM
  • Edit your VMs XML configuration file.
Next open up the xml configuration file associated with your VM.  If you have not created your VM at this time, perform that task.  If you're using libvirt Manager just click on "begin install" then power off the vm on the first screen.    In my case the VM is called "Windows10OEM."

virsh edit Windows10OEM

At the top of the file you will need to change the  name space used as some of the options are not in the default namespace.
<domain type='kvm' xmlns:qemu='http://libvirt.org/schemas/domain/qemu/1.0'>

Next in the "os" section add the SLIC table
<os>
<type arch='x86_64' machine='pc-q35-3.0'>hvm</type>
<acpi>
   <table type='slic'>/var/lib/libvirt/SLIC</table>
</acpi>
   <bootmenu enable='no'/>
</os>

Then add a section for qemu command line options.  This can go anywhere in the file, so long as it is under the main "domain" section only.

<qemu:commandline>
   <qemu:arg value='-acpitable'/>
   <qemu:arg value='file=/var/lib/libvirt/MSDM'/>
</qemu:commandline>

Close the file.

  • Start and enjoy!
I recommend starting the VM using the command line.  This way if you have a permissions issue to one of the ACPI tables you will be able to see the message.
virsh start Windows10OEM

If you started an install earlier and stopped it, you may need to go to the boot settings of the VM and enable the CDROM device as a bootable device.  In addition you may need to verify that the CDROM device points to the proper location for your boot ISO.

At this point you can install Windows using the ISO installer, and if all works correctly you should never be prompted for a product key.