How to fix in Windows 8.1 boot errors in VirtualBox


Updated: October 24, 2014

Windows 8 might soon be going away, which is why the notion of using it as a guest operating system in a virtual machine is more appealing than ever before. Hence, this article. Hence, this situation you are facing. You are trying to boot one of the 64-bit Windows 8.X family operating systems as a guest in VirtualBox. This may be Windows 8 or higher. Either way, the initial boot fails within seconds, and the virtual machine must be closed. The Error Code you get is: 0x000000C4.

This article will show you how to work around this small but cool issue so that you can install Windows 8.1 as a guest operating system inside VirtualBox. You will also learn a little about the nerdy things that happen in the background. Follow me.

Error

Problem

As simple as it sounds, you get the following text on your screen a few moments after booting the virtual machine configured for Windows 8.1, and using either Windows 8.1 DVD or ISO image. This happens with any one version of VirtualBox 4.0 and higher.

Problem

Your PC needs to restart.
Please hold down the power button.
Error Code: 0x000000C4
Parameters:
...

Sounds terrible, especially because you need to close the VirtualBox window instance for this particular virtual machine, and try again. But the results will be identical. Now, what do you do?

Solution

There is a lot you need to do here. First, read and understand the error. If you're somewhat familiar with Windows BSOD, then this will look similar. This is a machine instruction exception, meaning the operating system is trying to perform an illegal operation. But now that we know what to look for, it's gonna be easy.

If you search the VirtualBox forums, tickets and online, in general, you will find quite a few references to what this means. It comes down to the fact the CMPXCHG16B instruction is disabled, and it needs to be enabled. It is mandatory for Windows 8.1 in order to boot. Quoting from Wikipedia: 

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.

Indeed, virtualization is all about creating VIRTUAL hardware. Some of the features are exposed, some are not. VirtualBox has been designed not to expose the CMPXCHG16B instruction to the guests by default, which creates the issue we face. So we need to enable it. This is done by using the VirtualBox command line.

"<VirtualBox Installation>\VBoxManage.exe" setextradata
"<Virtual machine name>" VBoxInternal/CPUM/CMPXCHG16B 1

In order for this command to be successful, you still need a modern processor on your host system regardless. If your processor does not have the NX/XD bit, or if it's disabled in BIOS, then you will have to fix the problem on your host first, before moving forward. In some cases, it might not be possible.

After you execute this command, you will have the instruction available, and Windows 8.1 will boot successfully. After that, you can do the needed, usual stuff, like installing the system, perhaps.

Installing 2

Conclusion

There you are. A bit long, isn't it, this little tutorial. Now, I could have just posted a link to the Oracle tickets database, but that would be missing the point. Dedoimedo is all about education. You want to understand the problem and not just blindly execute random and possibly dangerous commands. Not that you know what this is all about, it's effectively like switching an option on or off in BIOS/UEFI. OK, now you're talking business.

Either way, you've learned a little more about the CPU architecture, about virtualization software, how VirtualBox behaves and works, and how you can control hidden features and settings from the command line. Really neat. And I think we're done here.

Cheers.

RSS Feed icon

del.icio.us del.icio.us stumbleupon stumble digg digg reddit reddit slashdot slashdot



Advertise!

Would you like to advertise your product/site on Dedoimedo?

Read more

Donate to Dedoimedo!

Do you want to
help me take early retirement? How about donating
some dinero to
Dedoimedo?

Read more

Donate