Tuesday, 1 April 2014

Enabling Virtio drivers in kernel for running androidx86 on Openstack

Guest operating systems running on virtualised systems needs to cooperate with the underlying hypervisors when using virtualised resources.  Virtio is a set of standard for disk and network virtualisation that is required to be installed on instances that runs on Openstack. The default Androidx86 kernel does not come with these modules installed. Also, you have to edit the source code of Androidx86 OS to detect the virtualised block devices. Otherwise you will see a screen with "Detecting Android-x86... (continuous dots :s)".

This is what you will see in androidx86 debug mode:

If you do not want to compile the source and set it up yourself. I have already created the image for you. Download it from here.

1. First,  to compile the OS you have to initialise the build environment.  Follow instructions here.

2. Download and install the repo client using instructions here.

3. Download Androidx86 source from here.

4. Alter the kernel defconfig files in "kernel/arch/x86/configs/android-x86_defconfig"
and "kernel/arch/x86/configs/android-x86_64_defconfig" by adding following lines.


5. To be able to detect virtual block devices, alter the "bootable/newinstaller/initrd/init" file. 
In line 124, Change

for device in ${ROOT:-/dev/sr* /dev/[hs]d[a-z]* /dev/mmcblk*}; do


for device in ${ROOT:-/dev/sr* /dev/[hsv]d[a-z]* /dev/mmcblk*}; do

6. Insert following lines to device/generic/x86/init.sh

#Force dhcp on eth0 interface.
netcfg eth0 dhcp
#Start SSH daemon at startup.

7. Add follwing packages to PRODUCT_PACKAGES in device/generic/x86/packages.mk.


8. Then compile.

9. Install androidx86 OS onto a disk storage (dvi, vmdk, qcow2) .

10. To fetch the nova keypair, create fetchsshkeys script with following lines in /data/local/.


# Fetch public key using HTTP
cd /data
cat /data/openssh-key > /data/ssh/authorized_keys

chmod 0600 /data/ssh/authorized_keys
restorecon /data/ssh/authorized_keys

rm /data/openssh-key 

11. Make the script executable.

chmod 755 /data/local/fetchsshkeys

12. Call the script in /etc/init.sh file.

#Fetch ssh keys from openstack metadata service.

13. Upload the disk to Glance.

It should now detect /dev/vda1.

14. Create a virtual machine using the uploaded image. Your VM should get a private ip. (Make sure to specify a keypair)

15. You should be able to ssh into the androidx86 VM now.

16. To get get GUI, add "nomodeset" to grub.

Thanks to everyone helped me on this issue from Androidx86 mailing list.


  1. open stack cloud computing key words: open stack training, open stack online training, open stack cloud computing training, open stack cloud computing online training, open stack corporate training, best open stack training, open stack cloud computing training, expert open stack training, expert open stack cloud computing training

  2. Unable to GUI could you provide your grub menu.lst setting ?

  3. This comment has been removed by the author.

  4. This solution is a little bit outdated since all the source code has been modified like this:
    for device in ${ROOT:-/dev/[hmsv][dmr][0-9a-z]*}; do

    I am confused with your last sentence of this post: "To get get GUI, add "nomodeset" to grub." So basically we can install android on Openstack with GUI right?
    Could you please take a look at the newest versions of android x86 and OpenStack, I could not make it run properly, even though the source code has been fixed by the developer.
    The kernel cannot recognize the Virtual hard disk of the instance but can recognize the volume (i added) - this is the workaround and i can install the OS to the volume. After that, I tried to detach the volume, but it could not boot into the installed OS on that volume anymore.. weird