(Originally posted on SuperUser here, but posted here due to lack of responses.)

I have Android installed on sda3, and it boots fine when loaded from Grub with the following commands:

set root='(hd0,3)'
search --no-floppy --fs-uuid --set=root 977083a6-5762-4064-b860-39429b9e0cf8
linux /kernel root=UUID=977083a6-5762-4064-b860-39429b9e0cf8 
initrd /initrd.img

I have tried to load it in KVM using the following:

#Mount the Android partition as read-only so KVM can read its kernel and initrd
sudo mkdir /media/android
sudo mount -o ro /dev/sda3 /media/android

#Command to start the vm
sudo kvm -kernel /media/android/kernel -initrd /media/android/initrd.img /dev/sda3

In both circumstances a command line environment appears and configures loads of options quickly, but when booting from Grub the Android operating system proper then appears, whilst when trying to boot it as a vm using KVM it simply loads into a terminal interface. Are there any options I need to add to the KVM command to get this working properly (perhaps using the -append parameter)

(p.s. unsure if I should be posting this on SuperUser or Unix & Linux)

Using Ubuntu 14.10 with an Intel i5-4690K.

I have tried adding the option -append root=/dev/sda, to no avail. Some of the initialisation process is still visible and includes lines like:

sd 0:0:0:0: [sda] Write Protect is off
sd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
sd 0:0:0:0: Attached scsi generic sy0 type 0
sda: unknown partition table
sd 0:0:0:0: [sda] Attached SCSI disk
Detecting Android-x86... found at /dev/sda

When I try to use operations like "mkdir" from the cli, I get told mkdir failed, Read-only file system.

Update 2:
I managed to get it to run in VirtualBox on Windows installed on a separate hard drive by using a raw disk image of the entire physical hard drive Android is installed on (the same one my Ubuntu partition is on). Trying to create a raw disk image of just the Android partition, in both Windows and Ubuntu, creates a VM that doesn't boot (even when using a custom GRUB 2 ISO that disincludes the inaccessible partitions). When I run fdisk -l in Ubuntu, I get a warning that "Partition 3 [where Android is installed] is not aligned to logical sector boundary" (or something like that). Could that be the root cause?

The Android partition has no data or apps on it other than what was installed by default, so I will try deleting the partition and re-installing it and report back here.

  • Would love to know how this went post Update 2. – slowpoison Nov 20 '14 at 13:18

It sounds to me like it's unable to mount the rootfs and the terminal interface you see is the init program giving up and just running a shell. You probably need to add a root= kernel parameter like you have in your grub config (note that the device may show up differently) probably something like -append root=/dev/sda (note that the partition shows up like an MBR less disk and so it's not sda3).

You can also try mounting it manually from the cli you get, if you don't see the device in /dev/ or can't mount it then it's probably because [host] linux isn't letting qemu access the raw partition because it's either already mounted or qemu isn't running as root.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.