Like most others, if you tried installing Windows 8.1 or Windows Server 2012 R2 64Bit in Oracle Virtualbox, you must have encountered the following error.
This error occurs when the instruction CMPXCHG16B is disabled in your CPU. It is so by default in Oracle Virtualbox. The simple solution is to enable this instruction & then you should not get the error on initializing the Windows 8.1/Windows 2012 virtual machine.
To do this on your linux system first issue the following command,
$VBoxManage list vms
The above command will list all the virtual machines present. Be sure to run this command as a normal user. You won’t see a list of vm’s if the command is executed as a root. The VboxManage command is case-sensitive, keep that in mind. So make sure you use it properly as VboxManage.
Once done, copy down the vms name. In my case “Windows”.
[shuttertux@localhost ~]$ VBoxManage list vms
Now to enable the CMPXCHG16B CPU instruction one needs to execute,
$VBoxManage setextradata “Windows” VBoxInternal/CPUM/CMPXCHG16B 1
The value ‘1’ at the end of the command enables the desired CPU instructions. Now you can go ahead successfully and install Windows 8.1/Windows 2012 64Bit in Oracle VirtualBox.
The wikipedia explains the following on CMPXCHG16B CPU instructions:
Early AMD64 processors lacked the CMPXCHG16B instruction, which is an extension of the CMPXCHG8B instruction present on most post-80486 processors. Similar to CMPXCHG8B,CMPXCHG16B allows for atomic operations on octal words. This is useful for parallel algorithms that use compare and swap on data larger than the size of a pointer, common in lock-free and wait-free algorithms. Without CMPXCHG16B one must use workarounds, such as a critical section or alternative lock-free approaches. This also prevents 64-bit Windows from having a user-mode address space larger than 8 terabytes. The 64-bit version of Windows 8.1 requires this feature.