Android_x86 - How to set up dual boot with Mint in 5 mins.

Write tutorials for Linux Mint here
More tutorials on https://github.com/orgs/linuxmint/discu ... /tutorials and (archive) on https://community.linuxmint.com/tutorial
Forum rules
Don't add support questions to tutorials; start your own topic in the appropriate sub-forum instead. Before you post read forum rules
Locked
User avatar
smurphos
Level 18
Level 18
Posts: 8501
Joined: Fri Sep 05, 2014 12:18 am
Location: Irish Brit in Portugal
Contact:

Android_x86 - How to set up dual boot with Mint in 5 mins.

Post by smurphos »

Android-x86 is a project to port Android to desktop machines. It's a reasonably mature project which I've used on and off for several years installed via the method outlined in this tutorial.

Current releases based on Android 8.1 ship with Play Store access built in and a Desktop Friendly Taskbar launcher for the home screen.

It comes as a regular iso file which can be burned to a USB and installed like any other Linux distro on it's own, in multi-boot scenarios or in virtual-box. It's performance in virtual-box isn't great though.

It's also amenable to a quick and easy manual install for multi-boot that doesn't necessarily require separate partitions and has less risk of inadvertently breaking existing installed OS's. This tutorial outlines the manual install method.

Step 1 - Download the ISO

Download the current ISO from https://www.android-x86.org/download.html

For this tutorial I used the most recent stable 64bit release android-x86_64-8.1-r2.iso

Step 2 - Choose and create the install directory

You can use any location you like as long as it's not encrypted. You could install in your home folder, somewhere else in Mint file system, or on a separate partition. A fresh install takes up about 2GB of space in total. You''ll probably want at least 6GB available to allow for Android app installs.

For this tutorial I'll be installing into a dedicated directory added to Mint's root file system.

In a terminal create the directory to hold the installation. As I'm using the root partition I'll need to use sudo at this point, and then take ownership of the directory once created.

Code: Select all

sudo mkdir /android-x86
Take ownership of the new directory

Code: Select all

sudo chown $USER:$USER /android-x86
Make a data directory

Code: Select all

mkdir /android-x86/data
Step 3 - Extract the system, kernel, ramdisk and initrd images from the ISO

In your File Manager navigate back to the downloaded Android-x86 ISO, right click on it and open it with Archive Manager.

In Archive Manager select the 4 files as in the screenshot below before clicking extract.

Image

In the folder selection dialog navigate to the /android-x86 directory you created earlier and click extract

Image

You should now have the following content in the /android-x86 directory

Image

Step 4 - Create a grub menu entry

For this stage of the process you will need to make a note the UUID of the partition that you have used for the installation directory along with the full path of the directory.

To check the UUID open a terminal and run

Code: Select all

lsblk -o NAME,SIZE,TYPE,MOUNTPOINT,UUID
My output is below. From this I can tell my root partition where I have created the /android-x86 directory has a UUID of d3abb04b-9d93-4004-a247-eff8481481d3

Code: Select all

steve@steve-Inspiron-5580:~$ lsblk -o NAME,SIZE,TYPE,MOUNTPOINT,UUID
NAME          SIZE TYPE MOUNTPOINT             UUID
sda         931.5G disk                        
└─sda1      931.5G part /mnt/backup_drive      7f5c52d4-a3ee-44b1-bbbe-230bdb1e6d13
nvme0n1     238.5G disk                        
├─nvme0n1p1   512M part /boot/efi              0C7C-3863
├─nvme0n1p2  29.8G part /                      d3abb04b-9d93-4004-a247-eff8481481d3
├─nvme0n1p3  59.6G part /home                  464812ce-bfe2-4aae-8e50-66fc77f13bc2
├─nvme0n1p4  29.8G part                        0dd54e55-0107-41e5-9c73-6dff95358456
└─nvme0n1p6 118.8G part /mnt/virtualbox_images 398e2ad0-3f28-414f-a71e-ea46c9b8a3a0
Next open /etc/grub.d/40_custom in a text editor.

In a terminal run

Code: Select all

xed admin:///etc/grub.d/40_custom
At the bottom of the file add the following code block replacing %UUID% with the actual UUID of the partition containing the /android-x86 directory and %DIRECTORY% with the full path to the /android-x86 directory.

Code: Select all

menuentry 'Android-x86' --class android-x86 {
    insmod part_gpt
    set root='%UUID%'
    set DIR=%DIRECTORY%
    search --file --no-floppy --set=root $DIR/system.sfs
    linux $DIR/kernel root=/dev/ram0 androidboot.selinux=permissive quiet DATA=
    initrd $DIR/initrd.img
}
On my machine this entry looks like this

Code: Select all

menuentry 'Android-x86' --class android-x86 {
    insmod part_gpt
    set root='d3abb04b-9d93-4004-a247-eff8481481d3'
    set DIR=/android-x86
    search --file --no-floppy --set=root $DIR/system.sfs
    linux $DIR/kernel root=/dev/ram0 androidboot.selinux=permissive quiet DATA=
    initrd $DIR/initrd.img
}
Save the file and close the text editor.

Open a terminal and run

Code: Select all

sudo update-grub
Step 5 - Reboot and test!

Reboot, access grub and select the Android-x86 menu entry. You should shortly be booted into Android. Have fun.
Last edited by xenopeek on Mon Aug 30, 2021 2:25 am, edited 2 times in total.
Reason: locked; support questions go in the support forums, not on tutorials
For custom Nemo actions, useful scripts for the Cinnamon desktop, and Cinnamox themes visit my Github pages.
User avatar
smurphos
Level 18
Level 18
Posts: 8501
Joined: Fri Sep 05, 2014 12:18 am
Location: Irish Brit in Portugal
Contact:

Re: Android_x86 - How to set up dual boot with Mint in 5 mins.

Post by smurphos »

Hints and Tips for Android-X86

Having installed and booted Android-X86 here are a few tips.

1 - Take care with external drives!

Android installed by this method will not be able to interact with the file-system of the partition/disk it it installed on - all of it's user data is stored in the data directory created during the installation. However Android will detect and automount any external discs connected to your machine - e.g USB disks, SD cards etc.

On first boot Android will ask how you want to use these discs. One of the options will be to format and incorporate into Android's internal storage. If you have data on the disc don't do this! The safe option is to select the option to use the external disc for transferring media. Personally I tend to eject them from the notification area just after boot.

2 - Application Compatibility

In Settings be sure to visit Android-x86 options and enable 'Native Bridge'. Without this set many Android apps and games will crash when you attempt to run them.

Image
For custom Nemo actions, useful scripts for the Cinnamon desktop, and Cinnamox themes visit my Github pages.
cain2log

Re: Android_x86 - How to set up dual boot with Mint in 5 mins.

Post by cain2log »

Hi, smurphos,

Followed your instructions faithfully, only using /home/android-86 in my case. I managed to get Android-x86 to appear on the grub boot menu, but entering it only returns the following:

error: no such device: /home/android-86/system.sfs. [The file does exist in the stated path.]
error: disk '%UUID%' not found. [I am sure I copy/pasted my /home UUID correctly.]
error: you need to load the kernel first.

Press any key to continue..._

What am I to do?

I am a complete noob, just two weeks into testing my way into Linux Mint. I am not even sure if I am here violating the rule about adding support questions to tutorials, but I don't know where or how else to post my query to your tutorial. If I can get Android to dual boot with Linux Mint as you teach, you'd make me a very happy man.

cain
User avatar
trytip
Level 14
Level 14
Posts: 5371
Joined: Tue Jul 05, 2016 1:20 pm

Re: Android_x86 - How to set up dual boot with Mint in 5 mins.

Post by trytip »

i'm itching to install something different on new ryzen tablet was thinking about phoenixOS or androidx86 and have never been able to add it correctly to the grub menu. i was able to boot it using the Super Grub2 Disk but then i realized i need an OS that has ROOT enabled

@smurphos, before i try this which i will dual boot with win10 is there a way to access ROOT in this installation so i can add my hosts file? i stayed away from android simply for the fact that i do not have root access
Image
User avatar
smurphos
Level 18
Level 18
Posts: 8501
Joined: Fri Sep 05, 2014 12:18 am
Location: Irish Brit in Portugal
Contact:

Re: Android_x86 - How to set up dual boot with Mint in 5 mins.

Post by smurphos »

trytip wrote: Sat Feb 15, 2020 11:31 am @smurphos, before i try this which i will dual boot with win10 is there a way to access ROOT in this installation so i can add my hosts file? i stayed away from android simply for the fact that i do not have root access
It ships with root access - configurable in Developer options.
For custom Nemo actions, useful scripts for the Cinnamon desktop, and Cinnamox themes visit my Github pages.
User avatar
smurphos
Level 18
Level 18
Posts: 8501
Joined: Fri Sep 05, 2014 12:18 am
Location: Irish Brit in Portugal
Contact:

Re: Android_x86 - How to set up dual boot with Mint in 5 mins.

Post by smurphos »

cain2log wrote: Sat Feb 15, 2020 9:56 am Hi, smurphos,

Followed your instructions faithfully, only using /home/android-86 in my case. I managed to get Android-x86 to appear on the grub boot menu, but entering it only returns the following:

error: no such device: /home/android-86/system.sfs. [The file does exist in the stated path.]
error: disk '%UUID%' not found. [I am sure I copy/pasted my /home UUID correctly.]
error: you need to load the kernel first.
Hi,

Lets check a few things - all are commands to be run in terminal. Please report the output (highlight the output in the terminal > right click and copy and then paste into your reply)

UEFI or BIOS

Code: Select all

dmesg | grep "EFI v"
Double-check the location of your android folder

Code: Select all

sudo find /home -type d -iname android*86
And it's contents

Code: Select all

ls $(sudo find /home -type d -iname android*86)
Double check your UUIDs

Code: Select all

lsblk -o NAME,SIZE,TYPE,MOUNTPOINT,UUID
Double check your grub entry

Code: Select all

 cat /etc/grub.d/40_custom
For custom Nemo actions, useful scripts for the Cinnamon desktop, and Cinnamox themes visit my Github pages.
User avatar
AndyMH
Level 21
Level 21
Posts: 13575
Joined: Fri Mar 04, 2016 5:23 pm
Location: Wiltshire

Re: Android_x86 - How to set up dual boot with Mint in 5 mins.

Post by AndyMH »

Maybe a stupid question - wouldn't it be easier to install as a VM in virtualbox?
Thinkcentre M720Q - LM21.3 cinnamon, 4 x T430 - LM21.3 cinnamon, Homebrew desktop i5-8400+GTX1080 Cinnamon 19.0
User avatar
trytip
Level 14
Level 14
Posts: 5371
Joined: Tue Jul 05, 2016 1:20 pm

Re: Android_x86 - How to set up dual boot with Mint in 5 mins.

Post by trytip »

AndyMH wrote: Sun Feb 16, 2020 7:30 am Maybe a stupid question - wouldn't it be easier to install as a VM in virtualbox?
It's performance in virtual-box isn't great though :mrgreen: but what's the point of having virtualbox emulator which is not true hardware. i can barely play a NES (nintendo emulator) with my ryzen5 12GB RAM and NVME drive because of cpu and gpu not being optimized for this application.
virtualbox is good for tasting things, but if you want a feast and be satisfied, you need real hardware.
Last edited by trytip on Mon Feb 17, 2020 11:33 pm, edited 1 time in total.
Image
User avatar
smurphos
Level 18
Level 18
Posts: 8501
Joined: Fri Sep 05, 2014 12:18 am
Location: Irish Brit in Portugal
Contact:

Re: Android_x86 - How to set up dual boot with Mint in 5 mins.

Post by smurphos »

The problem with VBox is no Guest Additions exist for the Android variant of the kernel and thus there is no 3D acceleration, and thus it runs like a lame duck.
For custom Nemo actions, useful scripts for the Cinnamon desktop, and Cinnamox themes visit my Github pages.
cain2log

Re: Android_x86 - How to set up dual boot with Mint in 5 mins.

Post by cain2log »

Hi,

Lets check a few things - all are commands to be run in terminal. Please report the output (highlight the output in the terminal > right click and copy and then paste into your reply)
Thanks for your reply. Here's the output:

agila@agilamint:~$ dmesg | grep "EFI v"
agila@agilamint:~$ sudo find /home -type d -iname android*86
[sudo] password for agila:
/home/android-x86
agila@agilamint:~$ ls $(sudo find /home -type d -iname android*86)
data initrd.img kernel ramdisk.img system.sfs
agila@agilamint:~$ lsblk -o NAME,SIZE,TYPE,MOUNTPOINT,UUID
NAME SIZE TYPE MOUNTPOINT UUID
loop0 91.3M loop /snap/core/8592
loop1 89.1M loop /snap/core/8268
sda 931.5G disk
├─sda1 350M part 64AC0BEEAC0BB996
├─sda2 558.6G part D2CAF1B4CAF194C7
├─sda3 1K part
├─sda4 186.3G part F0FAFD07FAFCCB3C
├─sda5 82.8G part A87CBA4F7CBA1850
├─sda6 19.1G part / c605dd38-55be-481b-989b-76552e43b007
├─sda7 4.8G part [SWAP] e6432d18-204e-43c0-9474-d961e0487d40
└─sda8 79.7G part /home 1be1e135-2aa1-49fc-b185-1f99dcc80d1c
sr0 1024M rom
agila@agilamint:~$ cat /etc/grub.d/40_custom
#!/bin/sh
exec tail -n +3 $0
# This file provides an easy way to add custom menu entries. Simply type the
# menu entries you want to add after this comment. Be careful not to change
# the 'exec tail' line above.

######################################################################
menuentry 'Android-x86' --class android-x86 {
insmod part_gpt
set root='1be1e135-2aa1-49fc-b185-1f99dcc80d1c'
set DIR=/home/android-x86
search --file --no-floppy --set=root $DIR/system.sfs
linux $DIR/kernel root=/dev/ram0 androidboot.selinux=permissive quiet DATA=
initrd $DIR/initrd.img
}
agila@agilamint:~$

BTW, I'm not sure if this is relevant, but I am running Win10 and Linux Mint 19.3 in a dual boot. Successfully adding Android would make my system triple boot.
cain2log

Re: Android_x86 - How to set up dual boot with Mint in 5 mins.

Post by cain2log »

AndyMH wrote: Sun Feb 16, 2020 7:30 am Maybe a stupid question - wouldn't it be easier to install as a VM in virtualbox?
smurphos wrote: Mon Feb 17, 2020 1:06 pm The problem with VBox is no Guest Additions exist for the Android variant of the kernel and thus there is no 3D acceleration, and thus it runs like a lame duck.
I've tried Android in Vbox, from version 5.1 to 8.1 r3, trying without success to get Guest Additions to work. This is why i am eager to make smurphos's method to work.
User avatar
smurphos
Level 18
Level 18
Posts: 8501
Joined: Fri Sep 05, 2014 12:18 am
Location: Irish Brit in Portugal
Contact:

Re: Android_x86 - How to set up dual boot with Mint in 5 mins.

Post by smurphos »

cain2log wrote: Tue Feb 18, 2020 8:55 am ######################################################################
menuentry 'Android-x86' --class android-x86 {
insmod part_gpt
set root='1be1e135-2aa1-49fc-b185-1f99dcc80d1c'
set DIR=/home/android-x86
search --file --no-floppy --set=root $DIR/system.sfs
linux $DIR/kernel root=/dev/ram0 androidboot.selinux=permissive quiet DATA=
initrd $DIR/initrd.img
}
agila@agilamint:~$

BTW, I'm not sure if this is relevant, but I am running Win10 and Linux Mint 19.3 in a dual boot. Successfully adding Android would make my system triple boot.
Thanks,

So the partition it's on is mounted as /home, so it's full path as far as that partition is concerned should be just /android-x86

Try this in /etc/grub.d/40_custom and run sudo update-grub after the edit. The output of the latter may be helpful if it doesn't work.

Code: Select all

menuentry 'Android-x86' --class android-x86 {
    insmod part_gpt
    set root='1be1e135-2aa1-49fc-b185-1f99dcc80d1c'
    set DIR=/android-x86
    search --file --no-floppy --set=root $DIR/system.sfs
    linux $DIR/kernel root=/dev/ram0 androidboot.selinux=permissive quiet DATA=
    initrd $DIR/initrd.img
}
If that doesn't work it may be a GPT vs MBR issue. In that case I'll need to do some research. the output of sudo update-grub may be helpful.
For custom Nemo actions, useful scripts for the Cinnamon desktop, and Cinnamox themes visit my Github pages.
cain2log

Re: Android_x86 - How to set up dual boot with Mint in 5 mins.

Post by cain2log »

smurphos wrote: Wed Feb 19, 2020 3:19 am So the partition it's on is mounted as /home, so it's full path as far as that partition is concerned should be just /android-x86
Yaaaay!!! Android is now in triple boot with Win10 and Linux Mint 19.3 on my laptop, and Android is running superfast compared to when it was in Vbox.

It was just as you said, the correct path of the partition was the point. And we can rule out the BIOS boot as culprit. Thanks for the lesson.

External drives and USB drives are also working perfectly, without my having to do anything more. Now, I'll go on exploring, especially on how to access Linux files from Android and vice versa (and Windows 10, too, although I am now just about to ditch Windows altogether)--or can you share the magic for this as well?

Many thanks.
sa38332

Re: Android_x86 - How to set up dual boot with Mint in 5 mins.

Post by sa38332 »

Hi, I have the exact same problem as cain2log but I have made sure that 'android-x86' is in the /android-x86 directory. What should I do?
loopingrocks

Re: Android_x86 - How to set up dual boot with Mint in 5 mins.

Post by loopingrocks »

There's also the solution of using the EFI loader.

Basically, the steps are:
-make a USB stick from the ISO
-boot from USB stick
-select installation
-install on a ext4 partition (if you're using / or /home or any already used partition DO NOT format!)
-install EFI GRUB2 (this step will add an android directory in your EFI partition)
-reboot and go back to linux

in grub add a custom entry (similar to your windows boot entry if you have one) that points to the Android EFI loader.
Here's an example from my grub custom configuration

insmod part_gpt
insmod fat
set root='hd0,gpt2'
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt2 --hint-efi=hd0,gpt2 --hint-baremetal=ahci0,gpt2 2AA0-D23F
else
search --no-floppy --fs-uuid --set=root 2AA0-D23F
fi
chainloader /EFI/Android/grubx64.efi
AydonB

Re: Android_x86 - How to set up dual boot with Mint in 5 mins.

Post by AydonB »

It took me a day or two to find your post, which means I was obviously looking in all the wrong places. I followed the instructions, edited the /etc/grub.d/40_custom command to suit my laptop, and now have both Android-x86 and PhoenixOS booting along side my Linux Mint installation. Thank you so much smurphos!
microangelo

Re: Android_x86 - How to set up dual boot with Mint in 5 mins.

Post by microangelo »

EDIT:
It seems thats more a Problem of Linux Mint or GRUB in general.
I found out that the Menu Entry is there just the Start-Menue isn't displayed.



Hello @smurphos!

First, thanks very much for your detailed instructions!

BUT ...
I'm running into an issue with that, cause I am not a very experienced user; Yes I know and learned many things about Linux in the past few years, and im not afraid to use the CLI, but in many things I still need some kind of step-by-step-advise.

Trying to follow your instructions for this, but have a own partition for the android system on my netbook which is mounted as '/android-x86'.
I use Linux Mint 19.3 (all recent updates) and Android-X86 X64 9.0-r2 for it.

Now I have the problem that there is now Start-Menu/GRUB-Menu shown at startup.

I followed this code:

Code: Select all

menuentry 'Android-x86' --class android-x86 {
    insmod part_gpt
    set root='<UUID>'
    set DIR=/android-x86
    search --file --no-floppy --set=root $DIR/system.sfs
    linux $DIR/kernel root=/dev/ram0 androidboot.selinux=permissive quiet DATA=
    initrd $DIR/initrd.img
}
Maybe you find some time to help me with that.
If you need more Information please do tell/ask.

regards
Juergen
Locked

Return to “Tutorials”