Re: Running Androidx86 on KVM/Qemu

3,208 views
Skip to first unread message

Chih-Wei Huang

unread,
Mar 24, 2014, 11:47:50 PM3/24/14
to Android-x86
2014-03-25 5:05 GMT+08:00 Chathura M. Sarathchandra Magurawalage
<77.ch...@gmail.com>:
> Hello All,
>
> I have been trying to run Androidx86 virtual machine on KVM. Basically it
> runs fine on local KVM/Qemu installation, but it get stuck in the boot when
> I run it on Openstack cloud that uses KVM as it's hypervisor. Not sure what
> is going on.
>

The stuck means it can't detect the media containing
android-x86 image.
The most possible reason is the current kernel doesn't
have the driver of the emulated device.
You may need to rebuild the kernel to add it.
(if you know what it is)


--
Chih-Wei
Android-x86 project
http://www.android-x86.org

Chathura M. Sarathchandra Magurawalage

unread,
Mar 25, 2014, 1:38:33 PM3/25/14
to andro...@googlegroups.com
Thanks Chih-Wei.

If that is the case how come I was able to successfully create a virtual machine manually on KVM? 

On openstack I can boot from the Live CD and it Detects Android on /dev/sr0 fine. So but when I try to install Android on the harddisk it cant see the disk drive.

it throws:

FATAL ERROR: Cannot open disk drive.
Press any key to exit cfdisk.

Second point. I have also installed android on a virtual disk then exported it to openstack. This also works fine when I checked it manually using virt-install and qemu-system-x86 commands but not on openstack. It gets stuck as earlier.

Does this sound like the kernel does not have the right drivers? If so where can I find the drivers and how can I compile with these drivers?

Chathura Sarathchandra Magurawalage

unread,
Mar 26, 2014, 12:58:39 PM3/26/14
to andro...@googlegroups.com
It looks like, this issue is caused because android x86 does not have virtio drivers. Does anyone know if it’s possible to compile androidx86 with these drivers?

--
You received this message because you are subscribed to a topic in the Google Groups "Android-x86" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/android-x86/EkKDwvMpVaA/unsubscribe.
To unsubscribe from this group and all its topics, send an email to android-x86...@googlegroups.com.
To post to this group, send email to andro...@googlegroups.com.
Visit this group at http://groups.google.com/group/android-x86.
For more options, visit https://groups.google.com/d/optout.

Chathura Sarathchandra Magurawalage

unread,
Mar 26, 2014, 1:22:48 PM3/26/14
to andro...@googlegroups.com
Actually what I meant, How can I compile Androidx86 with virtio enabled?

rbg

unread,
Mar 26, 2014, 2:14:03 PM3/26/14
to andro...@googlegroups.com

 start by changing the following in the android-x86_defconfig file from the presently "is not set" to the follwoing:

    CONFIG_VIRT_DRIVERS=y

    #
    # Virtio drivers
    #
    CONFIG_VIRTIO_PCI=m
    CONFIG_VIRTIO_MMIO=m

  then rebuild...

  which one you change of course it also depends on, was the released 4.4 RC1 built with a 32 bit kernel OR a 64 bit kernel????

  Chih-Wei can answer that...

Chathura Sarathchandra Magurawalage

unread,
Mar 26, 2014, 2:20:00 PM3/26/14
to andro...@googlegroups.com
Thanks. Yes it is 4.4 RC1 64 bit. !?

rbg

unread,
Mar 26, 2014, 2:56:16 PM3/26/14
to andro...@googlegroups.com, csa...@essex.ac.uk
so then make the changes in android-x86_64_defconfig file, then rebuild, & test

rbg

unread,
Mar 27, 2014, 7:35:22 PM3/27/14
to andro...@googlegroups.com
Chih-Wei patch file for *_defconfig offered up.....
virt32.diff
virt64.diff

Chih-Wei Huang

unread,
Mar 27, 2014, 9:11:08 PM3/27/14
to Android-x86
2014-03-28 7:35 GMT+08:00 rbg <rbg.hp...@gmail.com>:
> Chih-Wei patch file for *_defconfig offered up.....
>

Thank you.
However, the driver has to be built-in to
be used in booting process.
(because setting the drivers to be modules
means it's in the system.img which is unavailable
before the init detected the android media disk).
So please change it to y.

Chathura Sarathchandra Magurawalage

unread,
Mar 27, 2014, 9:24:13 PM3/27/14
to andro...@googlegroups.com
Hello Chih-Wei,

Sorry what do I have to change to y apart from CONFIG_VIRT_DRIVERS?

rbg

unread,
Mar 27, 2014, 9:48:25 PM3/27/14
to andro...@googlegroups.com
ok...have updated....

had made it m based on kernel documentation.re:

  Currently, the ABI is not considered stable so there is no guarantee that this version of the driver will work with your VMM.

  If unsure, say M.
virt32.diff
virt64.diff
Message has been deleted

Chathura Sarathchandra Magurawalage

unread,
Mar 28, 2014, 3:07:18 PM3/28/14
to andro...@googlegroups.com
I compiled with the mentioned parameters set. Still no luck but get extra two lines in the log when I boot in the debug mode. A screenshot is attached. Thanks!




On 28 Mar 2014, at 02:16, tabletsx86 <rbg.tab...@gmail.com> wrote:

kernel documentation for previous msg...

rbg

unread,
Mar 28, 2014, 4:48:32 PM3/28/14
to andro...@googlegroups.com
in debug mode can you do a lsmod (or busybox lsmod) and show the results..thanks

Chathura Sarathchandra Magurawalage

unread,
Mar 28, 2014, 5:08:26 PM3/28/14
to andro...@googlegroups.com
No because it is stuck and keep printing dots. 

rbg

unread,
Mar 28, 2014, 7:00:46 PM3/28/14
to andro...@googlegroups.com, csa...@essex.ac.uk
that makes sense....

can you install and run ubuntu 12.04 LTS qcow2 disk image???

if so get an lsmod and post it...

Chathura Sarathchandra Magurawalage

unread,
Mar 28, 2014, 7:43:03 PM3/28/14
to andro...@googlegroups.com
Thanks for your response.  Output of lsmod of ubuntu 12.04 LTS is;

ubuntu@test:~$ lsmod 
Module                  Size  Used by
psmouse                97519  0 
serio_raw              13211  0 
virtio_balloon         13108  0 
acpiphp                24231  0 
floppy                 70207  0 

rbg

unread,
Mar 28, 2014, 9:57:03 PM3/28/14
to andro...@googlegroups.com
ok thanks....that appears like an Ubuntu image enhanced with cloud-init...?? (which we don't have)

or maybe a ubuntu cloud image release..

wasn't what I was looking for....

guess unless you can identify other missing drivers and/or issues as I found others have had like yours.....assumed have been solved?

  https://ask.openstack.org/en/question/10602/unable-to-boot-vm-created-from-iso-storage-issue/

  https://ask.openstack.org/en/question/2350/boot-iso-image-on-openstack-installed-on-ubuntu/

Chathura Sarathchandra Magurawalage

unread,
Mar 29, 2014, 8:18:23 AM3/29/14
to andro...@googlegroups.com
Cloud-init does not do any virtualisation enhancements to ubuntu images. It makes the images retrieve the ssh keys for password less ssh… etc.. It is possible to create an image for openstack without cloud-init.

According to http://www.linux-kvm.org/page/Virtio you need following modules enabled. 

  • CONFIG_VIRTIO_PCI=y (Virtualization -> PCI driver for virtio devices)
  • CONFIG_VIRTIO_BALLOON=y (Virtualization -> Virtio balloon driver)
  • CONFIG_VIRTIO_BLK=y (Device Drivers -> Block -> Virtio block driver)
  • CONFIG_VIRTIO_NET=y (Device Drivers -> Network device support -> Virtio network driver)
  • CONFIG_VIRTIO=y (automatically selected)
  • CONFIG_VIRTIO_RING=y (automatically selected)

Could this be the issue? Is it possible to enable above modules for the linux kernel in androidx86?

Best regards,
Chathura

fuzzy7k

unread,
Mar 29, 2014, 8:39:06 AM3/29/14
to andro...@googlegroups.com


On Friday, March 28, 2014 7:43:03 PM UTC-4, Chathura M. Sarathchandra Magurawalage wrote:
Thanks for your response.  Output of lsmod of ubuntu 12.04 LTS is;

ubuntu@test:~$ lsmod 
Module                  Size  Used by
psmouse                97519  0 
serio_raw              13211  0 
virtio_balloon         13108  0 
acpiphp                24231  0 
floppy                 70207  0 


On 28 Mar 2014, at 23:00, rbg <rbg.hp...@gmail.com> wrote:

that makes sense....

can you install and run ubuntu 12.04 LTS qcow2 disk image???

if so get an lsmod and post it...

lspci -v is what you want.  It shows the kernel driver in use.

Chathura Sarathchandra Magurawalage

unread,
Mar 29, 2014, 9:08:56 AM3/29/14
to andro...@googlegroups.com
Thanks for your response. The output for lspci -v on ubuntu qcow2 image.

00:00.0 Host bridge: Intel Corporation 440FX - 82441FX PMC [Natoma] (rev 02)
Subsystem: Red Hat, Inc Qemu virtual machine
Flags: fast devsel

00:01.0 ISA bridge: Intel Corporation 82371SB PIIX3 ISA [Natoma/Triton II]
Subsystem: Red Hat, Inc Qemu virtual machine
Physical Slot: 1
Flags: medium devsel

00:01.1 IDE interface: Intel Corporation 82371SB PIIX3 IDE [Natoma/Triton II] (prog-if 80 [Master])
Subsystem: Red Hat, Inc Qemu virtual machine
Physical Slot: 1
Flags: bus master, medium devsel, latency 0
[virtual] Memory at 000001f0 (32-bit, non-prefetchable) [size=8]
[virtual] Memory at 000003f0 (type 3, non-prefetchable) [size=1]
[virtual] Memory at 00000170 (32-bit, non-prefetchable) [size=8]
[virtual] Memory at 00000370 (type 3, non-prefetchable) [size=1]
I/O ports at c0a0 [size=16]
Kernel driver in use: ata_piix

00:01.2 USB controller: Intel Corporation 82371SB PIIX3 USB [Natoma/Triton II] (rev 01) (prog-if 00 [UHCI])
Subsystem: Red Hat, Inc Qemu virtual machine
Physical Slot: 1
Flags: bus master, fast devsel, latency 0, IRQ 11
I/O ports at c040 [size=32]
Kernel driver in use: uhci_hcd

00:01.3 Bridge: Intel Corporation 82371AB/EB/MB PIIX4 ACPI (rev 03)
Subsystem: Red Hat, Inc Qemu virtual machine
Physical Slot: 1
Flags: medium devsel, IRQ 9

00:02.0 VGA compatible controller: Cirrus Logic GD 5446 (prog-if 00 [VGA controller])
Subsystem: Red Hat, Inc Device 1100
Physical Slot: 2
Flags: fast devsel
Memory at fc000000 (32-bit, prefetchable) [size=32M]
Memory at febf0000 (32-bit, non-prefetchable) [size=4K]
Expansion ROM at febd0000 [disabled] [size=64K]
Kernel modules: cirrusfb

00:03.0 Ethernet controller: Red Hat, Inc Virtio network device
Subsystem: Red Hat, Inc Device 0001
Physical Slot: 3
Flags: bus master, fast devsel, latency 0, IRQ 10
I/O ports at c060 [size=32]
Memory at febf1000 (32-bit, non-prefetchable) [size=4K]
Expansion ROM at febe0000 [disabled] [size=64K]
Capabilities: <access denied>
Kernel driver in use: virtio-pci

00:04.0 SCSI storage controller: Red Hat, Inc Virtio block device
Subsystem: Red Hat, Inc Device 0002
Physical Slot: 4
Flags: bus master, fast devsel, latency 0, IRQ 11
I/O ports at c000 [size=64]
Memory at febf2000 (32-bit, non-prefetchable) [size=4K]
Capabilities: <access denied>
Kernel driver in use: virtio-pci

00:05.0 RAM memory: Red Hat, Inc Virtio memory balloon
Subsystem: Red Hat, Inc Device 0005
Physical Slot: 5
Flags: bus master, fast devsel, latency 0, IRQ 10
I/O ports at c080 [size=32]
Kernel driver in use: virtio-pci


Best regards,
Chathura

rbg

unread,
Mar 29, 2014, 12:57:26 PM3/29/14
to andro...@googlegroups.com
aha...more drivers revealed...LOL

  those are for an older driver which we don't even use......

  are they valid on latest 3.0+ drivers..not sure....but already having the answers you can certainly
  try them out and see....

rbg

unread,
Mar 29, 2014, 1:36:23 PM3/29/14
to andro...@googlegroups.com
the usage of scsi disk maybe an issue.....no!!

Chathura Sarathchandra Magurawalage

unread,
Mar 29, 2014, 2:37:15 PM3/29/14
to andro...@googlegroups.com
I tried enabling all of the virtio options but still no luck! :( I must be doing something wrong. What is the issue with scsi disk usage?


rbg

unread,
Mar 29, 2014, 3:34:40 PM3/29/14
to andro...@googlegroups.com
have you tried an 32 bit kernel instead of an x86_64 bit kernel with all those changes....??

rbg

unread,
Mar 29, 2014, 5:25:39 PM3/29/14
to andro...@googlegroups.com
test image posted...your email

Chathura Sarathchandra Magurawalage

unread,
Mar 30, 2014, 10:23:29 AM3/30/14
to andro...@googlegroups.com, Maciek M
Hello guys,

With Maciek M’s help I can boot to android. The changes I made to the kernel.

Make changes to he kernel/arch/x86/configs/android-x86_defconfig
and kernel/arch/x86/configs/android-x86_64_defconfig

CONFIG_VIRTIO=y
CONFIG_VIRTIO_PCI=y
CONFIG_VIRTIO_MMIO=y
CONFIG_VIRTIO_BALLOON=y
CONFIG_VIRTIO_BLK=y
CONFIG_VIRTIO_NET=y
CONFIG_VIRTIO_RING=y
CONFIG_VIRTIO_CONSOLE=y
CONFIG_HW_RANDOM_VIRTIO=y

Second thing is a bug (?) in the init script
(bootable/newinstaller/initrd/init). The regular expression used there
won't find "/dev/vda1". Change line 124 from:
for device in ${ROOT:-/dev/sr* /dev/[hs]d[a-z]* /dev/mmcblk*}; do
to
for device in ${ROOT:-/dev/sr* /dev/[hsv]d[a-z]* /dev/mmcblk*}; do

One issue. The VM does not get an ip yet. The output of netcfg is attached. eth0 interface is down. Even if I do "ifconfig eth0 up” nothing happens.

Best regards,
Chathura

rbg

unread,
Mar 30, 2014, 12:24:33 PM3/30/14
to andro...@googlegroups.com, Maciek M

Chih-Wei Huang

unread,
Mar 31, 2014, 9:58:51 PM3/31/14
to Android-x86
2014-03-30 22:23 GMT+08:00 Chathura Sarathchandra Magurawalage
<77.ch...@gmail.com>:
> Hello guys,
>
> With Maciek M's help I can boot to android. The changes I made to the kernel.
>
> CONFIG_VIRTIO=y
> CONFIG_VIRTIO_PCI=y
> CONFIG_VIRTIO_MMIO=y
> CONFIG_VIRTIO_BALLOON=y
> CONFIG_VIRTIO_BLK=y
> CONFIG_VIRTIO_NET=y
> CONFIG_VIRTIO_RING=y
> CONFIG_VIRTIO_CONSOLE=y
> CONFIG_HW_RANDOM_VIRTIO=y

Thank you. I'll try to add them.
However, I want to make sure what the minimal set of configs to be y is.
Only the configs requires to find the android media disk
are needed to be set to y.
All the others should be set to m (module) and be loaded
(automatically) after /system is mounted.
The purpose is to reduce the size of the kernel image.

I guess it's enough to set
CONFIG_VIRTIO=y
CONFIG_VIRTIO_PCI=y
probably this is also needed:
CONFIG_VIRTIO_BLK=y

The others could be set to m.

Please test and tell us the result.

Chathura Sarathchandra Magurawalage

unread,
Apr 1, 2014, 10:31:45 AM4/1/14
to andro...@googlegroups.com
Sure I will do that. one problem though. The NIC does not get an ip unless I do a netcfg eth0 dhcp. It is very important to me that it gets the ip automatically. Secondly, my iso does not load the GUI, it stops in the command prompt, even on virtual box. My *_deconfig files are attached.

Best regards,
Chathura
android-x86_64_defconfig
android-x86_defconfig

Maciek M

unread,
Apr 1, 2014, 6:09:44 PM4/1/14
to andro...@googlegroups.com
Hi,
I used two virtual machines for my tests:
A - qemu on my local machine without virtio, harddrive visible as /dev/sda
B - qemu on OpenStack with virtio enabled, under Ubuntu/RedHat harddrive visible as /dev/vda

This is the list of modules taken from Android-x86 on machine A (manual modprobe used):
/ # lsmod -v
Module       Size   Used by   Not tainted
virtio_pci     4876   0
virtio_blk   6712   0
virtio       3405   2 virtio_pci,virtio_blk
virtio_ring 14325   2 virtio_pci,virtio_blk

I preinstalled Android into QCOW2 image on machine A and I managed to run this image on machine B.
To do this bootable/newinstaller/initrd/init also needs to be changed. Line 124 from:

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

However, when I start the installer on B, it doesn't find /dev/vda (there is similar regular expression problem in installer script, but also something more).
Another problem is that Android GUI doesn't start without "nomodeset" on both A and B.

I can create the set of needed patches when I finish investigating all of this.

Chih-Wei Huang

unread,
Apr 2, 2014, 7:13:13 AM4/2/14
to Android-x86
2014-04-02 6:09 GMT+08:00 Maciek M <maciek.m...@gmail.com>:
> Hi,
> I used two virtual machines for my tests:
> A - qemu on my local machine without virtio, harddrive visible as /dev/sda
> B - qemu on OpenStack with virtio enabled, under Ubuntu/RedHat harddrive
> visible as /dev/vda
>
> This is the list of modules taken from Android-x86 on machine A (manual
> modprobe used):
> / # lsmod -v
> Module Size Used by Not tainted
> virtio_pci 4876 0
> virtio_blk 6712 0
> virtio 3405 2 virtio_pci,virtio_blk
> virtio_ring 14325 2 virtio_pci,virtio_blk
>
> I preinstalled Android into QCOW2 image on machine A and I managed to run
> this image on machine B.
> To do this bootable/newinstaller/initrd/init also needs to be changed. Line
> 124 from:
>
> for device in ${ROOT:-/dev/sr* /dev/[hs]d[a-z]* /dev/mmcblk*}; do
> to
> for device in ${ROOT:-/dev/sr* /dev/[hsv]d[a-z]* /dev/mmcblk*}; do

I have pushed a patch to extend the node name patterns.
However, for virtio drivers, I still need someone to confirm
which are necessary to be built-in, which could be modules.

Chathura Sarathchandra Magurawalage

unread,
Apr 2, 2014, 7:30:28 AM4/2/14
to andro...@googlegroups.com
Hello all,

I can confirm that you only need to set following configs to y. The rest can be set to m.

CONFIG_VIRTIO=y 
CONFIG_VIRTIO_PCI=y 
CONFIG_VIRTIO_BLK=y 

Secondly I am compiling kitkat-x86 then installed on a vdi virtual box disk before uploading it to my openstack testbed. I can only load GUI when I compile with ‘user’ build variant. :/ then again I get no debug functions. 

Best regards,
Chathura


Chathura Sarathchandra Magurawalage

unread,
Apr 5, 2014, 1:24:50 PM4/5/14
to andro...@googlegroups.com
Hello all,

I have created a project for this on sourceforge, in which you can download Android ubuntu image in qcow2 format. Virtual machines can be created using this image on openstack like any other OS image running on  openstack. Keypairs are automatically fetched in the boot up. 

How ever this image is not perfect. No GUI yet! any contributions are welcome. Please contact me if interested. 


Best regards,
Chathura
Reply all
Reply to author
Forward
0 new messages