Installing Android-x86 on Hyper-V with Windows 8.1 in under 5 minutes

12
Android running on Hyper-V
Android running on Hyper-V

This guide will show one how to install Android-x86 in Hyper-V. We will be using Android 4.3 as our base installation version and using a Windows 8.1 Professional as a host. One great thing about Windows 8 and Windows 8.1 is that Microsoft has enabled a fairly robust version of Hyper-V even it their workstation operating system. The benefit of this is that building development instances is a simple task. In fact, a decently powered workstation or laptop can have multiple virtual machines open at a given time.

Installing Android onto a Hyper-V Virtual Machine

The guide to installing Android on Hyper-V should take only a few minutes to accomplish.

Step 1: Preparing the Hyper-V Host

The first step in getting this to work is to ensure that the host Windows 8 or Windows 8.1 machine has Hyper-V installed. We have a simple Windows 8 and Windows 8.1 Hyper-V guide that works with both versions of the desktop operating system. If Hyper-V is installed either on Windows 8, or a Windows Server/ Hyper-V server, then you are all set and can log into the Hyper-V management console.

One major consideration is which version of Android will you run. For this guide we are going to use an Adroid-x86 build. Further, we decided to use an Android 4.3 version. The reason for this is quite simple, networking in previous versions was very painful because Ethernet did not work out of the box. Android 4.3 changed this and Android 4.4 and newer should also. You can get Android from here: http://www.android-x86.org/download

The next step is quite simple, setting up a new virtual machine. You can simply follow the Linux on Hyper-V guide to set up the VM. The major caveat here is that you do need to utilize the Legacy Ethernet adapter which you can find an example of here. The only major difference is that you will load the Android-x86 iso instead of another operating system.

Android-x86 Hyper-V Legacy Network Adapter
Android-x86 Hyper-V Legacy Network Adapter

Total time for this should be about 3 minutes if using the guides and about 90 seconds if you have ever used Hyper-V before. The good news is, it is simple to get the host setup.

Step 2: Installing Android

Luckily, Android has a fairly simple installation method if one has ever used a text based Linux installer. At this point you can continue to use the LiveCD shown here, but that is not optimal since we may want a persistent development instance. For this guide we are going to install the image to a disk so we will pick the “Installation – Install Android-x86 to harddisk” option. One reason for the above screen capture is that the system will go into LiveCD mode if one does not select installation within 60 seconds. There are a few simple click-through screens which are very obvious so we will skip some of them in the interest of download speeds.

Android-x86 on Hyper-V Boot Screen
Android-x86 on Hyper-V Boot Screen

Of course to install Android we need a drive to install it on. For this, we will go to Create/Modify partitions.

Android-x86 on Hyper-V Create and Modify Partitions
Android-x86 on Hyper-V Create and Modify Partitions

That brings up perhaps the most non-intuitive part of the installation, cfdisk. For those unfamiliar cfdisk will format the virtual hard drive so that Android can be installed. Here you can see we are using a vhd that is around 4GB in size.

Android-x86 on Hyper-V Select Partition
Android-x86 on Hyper-V Select Partition

Here is the command sequence to utilize:

  1. New
  2. Primary
  3. Bootable
  4. Write
  5. Quit

Just before hitting quit the screen should look like the below. It may differ based on disk size but that is OK.

Android-x86 on Hyper-V Create and Modify Partitions - New Primary Boot
Android-x86 on Hyper-V Create and Modify Partitions – New Primary Boot

Now that we have a proper partition sda1 we can now install it by clicking OK.

Android-x86 on Hyper-V Select Created Partition
Android-x86 on Hyper-V Select Created Partition

Now we will select ext3 for the file system. There are many other options, but ext3 works.

Android-x86 on Hyper-V Select Created Partition and ext3
Android-x86 on Hyper-V Select Created Partition and ext3

Once that is complete, we will need GRUB as our boot loader. Click yes.

Android-x86 on Hyper-V Install GRUB
Android-x86 on Hyper-V Install GRUB

At this point you can either reboot or just run Android-x86. Usually it is easiest to just run but rebooting can be good if you wish to make any minor virtual machine tweaks, such as replacing the network adapter with a legacy adapter if you skipped that part in step 1.

Android-x86 on Hyper-V Run
Android-x86 on Hyper-V Run

Once Android 4.3 boots, you will see the standard Android setup. There are a few caveats, mainly that you will encounter two error messages. The first is that Bluetooth share has stopped. This is fine since we do not have a Bluetooth device in the virtual machine.

Android-x86 on Hyper-V Setup - Bluetooth Share
Android-x86 on Hyper-V Setup – Bluetooth Share

Next, when it comes to selecting Wi-Fi you will get another error message. There is no wireless adapter in the virtual machine so you can click Skip anyway here.

Android-x86 on Hyper-V Setup - WiFi Error
Android-x86 on Hyper-V Setup – WiFi Error

Once setup is complete (you can log into you Google account or create a new one and etc.), you are ready to go!

Android running on Hyper-V
Android running on Hyper-V

It should be noted some applications from Google Play do not work on Android-x86 which is a bummer. Hopefully with Intel Bay Trail hitting the tablet scene things will soon change and more applications will have x86 binaries. The major gotcha here is that if the screen goes into power save mode, there is no real way to wake it up. I would strongly suggest raising the sleep limit to at least 30 minutes (which can be done through the Settings UI).

That is it! This should have taken no more than 5 minutes for experienced users and under 10 for newcomers. Microsoft Hyper-V is working very well and this is an interesting alternative to either the development Android emulator or a solution such as Bluestacks.

12 COMMENTS

  1. More info on my error…when I make the new virtual network, it errors out saying BIND FAILED (Out of Paper) The printer is out of paper.

    For real! What’s up with that?

  2. i dont see why it wouldn’t work IF you have a (USB) wireless card chips that’s included/supported in the Linux kernel of this distribution ,is there a log of what they compiled into this image ?

    i dont run win8 so ill not be using hyperv here but rather one of the other emulators later perhaps

  3. This was a nice guide. I noticed there were some issues with ANdroid x86 4.4 RC2. Some time searching the web revealed another decent walkthrough with some tips to get HyperV working:

    https://www.google.com/#q=android+x86+4.4+rc2+hyperv

    http://luisrato.azurewebsites.net/2014/06/30/how-to-install-android-x86-4-4-rc2-on-hyper-v-part-1-install/

    Android x86 4.4 RC2 will not load the HyperV Storage stack. You have to force it with:
    modprobe hv_storvsc
    in order to see the drive during install.

    Afterwards you need to update the initrd.img with a copy of the HyperV modules from the LiveCD.

    Boot into Debug mode
    modprobe hv_storvsc

    Change to a writable folder then:
    mknod sda1 b 8 1
    mount sda1

    Backup initrd.img

    Decompress
    gunzip -c ../mnt/android-4.4-RC2/initrd.img | cpio -i

    Copy the modules from the live CD to the expanded initrd
    /system/lib/modules/3.10.40-android-x86\+/kernel/drivers/hv/hv_vmbus.ko .
    /system/lib/modules/3.10.40-android-x86\+/kernel/drivers/hv/hv_balloon.ko .
    /system/lib/modules/3.10.40-android-x86\+/kernel/drivers/hv/hv_utils.ko .
    /system/lib/modules/3.10.40-android-x86\+/kernel/drivers/hid/hid-hyperv.ko .
    /system/lib/modules/3.10.40-android-x86\+/kernel/drivers/net/hyperv/hv_netvsc.ko .
    /system/lib/modules/3.10.40-android-x86\+/kernel/drivers/scsi/hv_storvsc.ko .

    Edit ‘init’ to load each module before the line ‘echo –n Detecting Android-x86…’
    insmod hv_vmbus.ko
    insmod hv_storvsc.ko
    insmod hv_netvsc.ko
    insmod hv_utils.ko
    insmod hv_balloon.ko
    insmod hid-hyperv.ko

    then recreate the initrd.img with our changes:
    find .| cpio -H newc -o -v | gzip -9 -c > ../mnt/android-4.4-RC2/initrd.img

  4. Hi
    this is not possible on windows 8.1
    I try it more then 100 times
    can’t create a partition
    give me the fatal Error and just retry
    I tried them the link in you’re last comment but also there wasn’t effective
    have any idea

  5. Hi, about android 4.4…
    i must change the setting of NUMA and set 1 “Maxinum number of processor” and configure a legacy network…

    excuse me for my bad english…

  6. is there any way to force a particular size device? the install seems to default to a landscape tablet, but I want to work with a portrait device primarily (and rotation just messes with my head!)

  7. I followed the directions above on a Windows 8.1 PC and had no issues. I used the android 4.4 iso.
    I do have a question, i there any way to change to resolution?

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.