Installing Windows 8 in a Virtual Machine

About a month ago, Microsoft released the RTM version of Windows 8 to MSDN subscribers or via a 90-day trail version. I thought about checking it out, so I decided to test it out in a Virtual Machine.

Warning: the trail version cannot be upgraded to the final version, so if you replace your current OS with it, you’ll have to do a complete reinstall! That’s why I’m going for the VM 🙂

1. Get the bits
You can get the trail version from the dev center website. For the VM I’m using Oracle Virtual Box.

2. Create the VM
After installing Virtual Box you can add a new VM to it. The later versions explicitly have Windows 8 support, which is super for what we are doing here 🙂 Give it a fancy name (like ‘Windows 8’. Very original…) and decide how much memory and CPU’s you want to allocate. Don’t overspend, or your host operating system will start to slow down a lot.

After that it’ll ask you to create a hard drive. I created a VDI of 50 gigs. You could also create one that dynamically expands, but this is slower and you’ll need to monitor the size yourself.

3. Configure the VM
Once the machine is created, open up its settings. Under System > Acceleration make sure “enable VT-x/AMD-V” is checked. This will allow your VM and host OS to directly share the processor resources, instead of the VM always going via the host OS.

Now you can make the Windows 8 ISO available to the VM via the Storage tab. Click on the empty IDE controller and mount your ISO into it.

4. Booting things up and down (problems)
Normally this should do the trick and you can start installing Windows 8 into the VM, but after startup I got this error:

VT-x features locked or unavailable in MSR. (VERR_VMX_MSR_LOCKED_OR_DISABLED).

Result Code:E_FAIL (0x80004005)

After tinkering with my VM a little I noticed I could get past this error if I decreased the allocated CPU’s to one. But that got me to the next error:

VT-x/AMD-V hardware acceleration has been enabled, but is not operational. Your 64-bit guest will fail to detect a 64-bit CPU and will not be able to boot.
Please ensure that you have enabled VT-x/AMD-V properly in the BIOS of your host computer.

And as the error predicted, the Windows installer gave me this message:

Your pc needs to be repaired.
This 64-bit application couldn’t load, because your PC doesn’t have a 64-bit processor.

Luckily the solution to my problem was in the second VM’s error message. When I opened up the BIOS of my laptop, virtualization was indeed disabled (apparently this is the default).

After enabling it, I could once again bump up the number of CPU’s and start the VM successfully.

5. Installing
Installation was a breeze.
The only part that was a bit confusing is the type of installation options. Default it suggests an Upgrade (which won’t do us much good in an empty VM). The other option is confusingly named ‘Custom (advanced)’. That’s the new install option 🙂

6. Running
After you complete the install and registration, you can bask in the glory of your new Windows 8 installation. I’m going to look into the development of a Windows 8 metro style app, but I noticed that just running the clean Windows 8 VM gave too much of a performance hit on my humble laptop.

But I still have another option! I’m going to try to follow Scott Hanselman’s post on running Windows 8 inside of a Virtual HD. This means I get a minimal performance hit on my virtual drive, but all the rest works directly on your hardware.

The VHD is a bit more risky than a VM, so if you just want to take a peek at the new OS, but want to keep risks to a minimum, go for the VM. For development, which requires some performance, the VHD seems like a better option.

I’ll keep you posted on my progress!