There are certain important steps that one must follow in order to get Android-x86 working properly in a Virtualbox VM. Common issues are like Android is not booting into graphics mode and you are stuck in a command prompt OR Android setup not getting completed OR apps are silently crashing upon starting and so on. This post gives solutions to most of them. I had a hard time to install Android-6 in a Virtualbox VM – but once I got it working, I found it very stable and the system performance is also very good.
Some of the information given here is collected from various sources in Internet and some are my own experiements and experiences.
First steps
These are straightforward.
- Download Android-x86 ISO from here. It comes in both a 32-bit (x86) and a 64-bit(x86_64) variant. I used 64 bit variant of Android version 6 (Marshmallow). It worked very well for me.
- Create a new VM with the following specifications:
- Operating system type: Linux
- Operating system version: Linux 2.6/3.x/4.x (64-bit)
- Memory size: 1024 MB or more (I used 2048)
- Hard disk: When you’re asked for hard disk settings, select “Create a virtual hard disk now” and opt for a “Dynamically allocated” hard disk file. Set the hard disk size to 4-8 GB. I used 8GB.
- Power on the VM by double-clicking on it. You’ll be asked to add an ISO file to boot from. Here, you can select the Android-x86 ISO file you’ve downloaded. If this option doesn’t show up for you, hit F12 when the virtual machine starts to boot. Then, you can right click on the CD icon in the status bar to add an ISO file. Then, press the key shown on screen to boot from CD. (In our case, the key is “c”).
- When the VM boots up, select the installation option with the up/down arrows and press Enter to continue.
- Select the “Create/Modify Partitions” option. Then, select “No” to skip using GPT.You’ll be taken to a text-based partition editing tool. Use the left/right arrow keys to select the “New” option, and hit Enter. Then, choose the “Primary” option and hit enter. You’ll be asked for the size of the partition. The default is fine, so hit Enter again. Since we’ll be installing an OS to the partition, we have to mark it as bootable. Select the “Bootable” option and hit Enter.
- Select the “Write” option to save your changes. You’ll have to type in “yes” to confirm. Finally, you can quit the partition editor using “Quit”.
- Now, you have to select the partition where Android-x86 should be installed. The default is fine, so you can press Enter.
- Select the “ext4” filesystem, and select “Yes” to format the disk.
- Select “Yes” to install the GRUB bootloader. Then, select “No” to skip installing the EFI version of GRUB as we won’t need it.
- Then, select “Yes” to install the
/systempartition as read-write. This is very useful for trying out root-based apps. - It will take a few minutes for the installation to complete. When it’s done, right click the CD icon in the status bar and select “Remove disk from virtual drive”. Then, select “Reboot” and press Enter. If you don’t do this, you’ll end up booting from the ISO again, instead of the hard disk. (If you’ve already booted into the ISO again, simply press Right Ctrl + R to force a reboot.)
When the reboot completes, Android should ask you for the initial setup, just like a regular smartphone or tablet. If not, you will be dumped to a shell with a command prompt and nothing happens after it. If this happens to you, read on:
If Android logo is not showing up and you ended up in a command prompt:
Then you will have to edit one of the grub configuration files to specify the display details. For this, follows the steps below:
- Reboot
- Boot in debug mode (usually the second option in boot menu)
- When booting stops (for me it just hangs there with flashing cursor and without any prompt) enter
mount -o remount,rw /mnt - Enter
cd /mnt/grub - Enter
vi menu.lst - Press Shift+a
- Right under the first boot entry find the line starting with
kernel initrd=/in(your line might look different; it depends on Android version; in general just find the line that starts withkernel) - At the end of the line type
vga=ask nomodeset xforcevesa - press ESC then
:wq– these commands will save the file and quit vi - enter
cd / - enter
umount /mnt - enter
reboot -f
After rebooting, you will now be presented with a list of resolutions from which you will have to select. Please note that for best results you must choose something like 1024 x 768 x 32 (which is a VISA mod numbered as “344” in my system). If you make wrong selection here, Android may still boot, but when you try to launch apps, they will silently crash and terminate. If you get it right, then upon further reboots, you can simply press Enter when it asks for the resolution you can repeat the whole process and replace the “ask” with the mode number that worked for you.
That should get you back to normal Android configuration on first boot just like any tablet.
If certain apps forces your “tablet” screen to change orientation on desktop!
The next hurdle is the screen orientation issues with apps that try to force phone orientations to portrait mode (typical example: Kindle). When such apps are run, your beautiful Android “tablet” that sits on your desktop in landscape mode will be rotated 90- degree to left and will become practically impossible to use. If this happens to you, and the display settings in the “Settings” app does not help you, do the following:
- Press ALT+F1 that gives you a command prompt.
- Type the command:
vm size 768x1024The numbers changes as per your command, but this will make sure the screen goes back to portrait mode. you only have to do this once. Android seems to remember this setting across reboots.
Well, that is all! Please post a comment if you run into any other issues. 🙂