Linux KVM: How to Upgrade Windows 7 to Windows 10
We have a couple of Windows 7 development machines and decided to upgrade one of the Windows 7 to Windows 10 in our KVM host. Our KVM host is currently running on Linux CentOS 6.x. It seems it’s not simple and straight forward to upgrade Windows 7 to Windows 10 in Linux KVM.
First, it’s advise to use Windows Media Creation Tools to upgrade Windows 7 machine into Windows 10 instead of the pop up appear on your taskbar. Earlier we run the upgrade from taskbar it didn’t return error and it literally just “hang” there. After we tried upgrade using Windows Media Creation Tools, found that the upgrade was stuck with SAFE_OS error.
Beside seeing SAFE_OS error, we also seeing CompareExchange128 error message.
According to some forums we’ve googling on, it has something to do with Processor or CPU setting on Linux KVM qemu setting. To fix all the error messages related to above and make sure the KVM guest is able to upgrade to Windows 10 (from Windows 7 for our example), here is the setting need to be added into KVM guest xml file.
Next, we will make changes our KVM guest xml settings by the command below with our Windows 10 guest KVM name windows10
# virsh edit windows10
Next, we need to define custom CPU setting for the KVM guest by adding the lines below
<cpu mode='custom' match='exact'> <model fallback='allow'>kvm64</model> <feature policy='require' name='nx'/> <feature policy='require' name='lahf_lm'/> </cpu>
The line above emulate the processor as kvm64. A KVM 64 bits processor, and required policies such as nx and lahf_lm. Where to add the cpu tweak? Refer to our partial config file for KVM guest.
<features> <acpi/> <apic/> <pae/> </features> <features> <acpi/> <apic/> <pae/> </features> <cpu mode='custom' match='exact'> <model fallback='allow'>kvm64</model> <feature policy='require' name='nx'/> <feature policy='require' name='lahf_lm'/> </cpu> <clock offset='localtime'> <timer name='rtc' tickpolicy='catchup'/> </clock>
After that, start your current Windows 7 KVM guest and get ready with the upgrade to Windows 10 Media Creation Tools.
Follow the step by step prompt by Windows 10 Media Creation Tools, it should be able to perform the upgrade and seeing the screen as below.
The kvm CPU tweak settings also worked with Windows 8.1 upgrade. We didn’t remove the CPU setting, kept it as it’s for time being, we will update again if we found it’s necessary to untweak the CPU setting on KVM in order to have the systems run in reliable state.