LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   How to install a universal grub2 to a usb having android x86 lineageos ? (https://www.linuxquestions.org/questions/linux-newbie-8/how-to-install-a-universal-grub2-to-a-usb-having-android-x86-lineageos-4175623109/)

irajeevankumar 02-05-2018 04:50 AM

How to install a universal grub2 to a usb having android x86 lineageos ?
 
1 Attachment(s)
Help a newbie please...Sorry for my Botched English though...


I have installed a latest android_X86 #LineageOS to a USB Drive. I tried Android Live for a while and decided to INSTALL the OS on another PENDRIVE[Lineage-USB] because i want to use android portably.

While installing i did chose the option install GRUB2 to the drive but when i reboot the system at the end of installtion, my pc cant able to boot it. I did a small search and found a live system called SuperGrub2 which is basically a universal Grub capable of booting whatever operating system installed on any connected device.And i've installed the latter on an other usb[SUPERGRUB2-USB].

SUPERGRUB2-USB boots the Lineage-USB successfully on every devices i have and runs like a charm. Its quite ok for a while using two pendrives simultaneously to boot a single OS but later it seems just WIERD. So now all i need is a Similar Grub setup for my Lineage-USB so that i can boot it from any available pc/laptop/sbc etc.


FYI:
# Attached Screeshot of SuperGrub2 Menu showing installed bootable Android Os.

# Lineage-USB is in EXT4 file system | GPT | created using Gparted on a linux host

# GRUB folder does present on that Lineage-USB after andoid_x86 installation. That folder has only one file called "grub.cfg".
The list of command inside that grub.cfg file are as follows:-

set timeout=10


menuentry "Android-x86 14.1-rc1" {
search --set=root --file /cm-x86-14.1-rc1/kernel
linux /cm-x86-14.1-rc1/kernel quiet root=/dev/ram0 androidboot.selinux=permissive buildvariant=userdebug
initrd /cm-x86-14.1-rc1/initrd.img
}
menuentry "Android-x86 14.1-rc1 (DEBUG mode)" {
search --set=root --file /cm-x86-14.1-rc1/kernel
linux /cm-x86-14.1-rc1/kernel root=/dev/ram0 androidboot.selinux=permissive buildvariant=userdebug DEBUG=2
initrd /cm-x86-14.1-rc1/initrd.img
}

I dont know why grub did'nt shows up when i boot the Lineage-USB. Help me..

yancek 02-05-2018 07:18 AM

Quote:

While installing i did chose the option install GRUB2 to the drive but when i reboot the system at the end of installtion, my pc cant able to boot it.
What does 'can't boot' mean? You will need to be more specific as to exactly what happens when you try.
When you installed Grub to the pendrive, did you get an option to install to the MBR or the partition on which Android was?
If so, which did you select?
If it is GPT, did you create a BIOS boot partition as part of the install or are you doing an EFI boot?
You indicate there is no Grub folder but that you have a grub.cfg file, where (in what folder) is it?

irajeevankumar 02-05-2018 07:59 AM

Quote:

Originally Posted by yancek (Post 5815982)
What does 'can't boot' mean? You will need to be more specific as to exactly what happens when you try.

After installing i tried to boot from USB black screen with a Dash just blinks and bios goes to my host PC's bootloader.

Quote:

Originally Posted by yancek (Post 5815982)
When you installed Grub to the pendrive, did you get an option to install to the MBR or the partition on which Android was?
If so, which did you select?

No i didnt got any option to choose where to intall grub. But im sure that by default its been installed in my android partition itself


Quote:

Originally Posted by yancek (Post 5815982)
If it is GPT, did you create a BIOS boot partition as part of the install or are you doing an EFI boot? You indicate there is no Grub folder but that you have a grub.cfg file, where (in what folder) is it?

No i didnt create any seperate BIOS boot Partition. I tried EFI boot.EXT4 is the only partition i created. Grub folder is in android partition itself inside boot folder and thats where grub.cfg file is.



Quote:

Thank you for replying to my post.
What should i do ?
#Do i need to change partition table from GPT to MBR.
#If we need to stick with GPT do i need to create a separate partition for bios boot. If so what file system should i use to create bios boot partiition.
#Then... will the installer automaticaly identifies where to install grub


yancek 02-05-2018 05:06 PM

Quote:

No i didnt got any option to choose where to intall grub. But im sure that by default its been installed in my android partition itself
Then you would need to put an entry in the host systems boot menu. If you have an older Legacy system, you have boot code in the MBR which points to the boot menu and from there you make a selection of the OS. If you have an EFI system, you need an EFI entry. If you are using GOT partitioning, you need either a BIOS boot partition or an EFI partition with an EFI entry for your Android. If you want to use Android portable on different computers, you will need boot code in the MBR or a separate EFI partition. I don't have any familiarity with Android so have no idea how it would work.

irajeevankumar 02-06-2018 05:59 AM

Quote:

Originally Posted by yancek (Post 5816197)
If you want to use Android portable on different computers, you will need boot code in the MBR or a separate EFI partition. I don't have any familiarity with Android so have no idea how it would work.

I just created a separate VFat partition and flagged that as a Boot and then i reinstalled android again on Ext4 and installer's Grub EFI installs itself on that VFAT partition.

IT WORKS !!!

But i can use the USB only on a UEFI system. As you've mentioned earlier i need the same boot code in MBR to make the USB work in different computers .how to do that ? Any Ideas.

yancek 02-06-2018 06:59 AM

I've never tried this but you might try installing Grub to the MBR of the pendrive pointing to the /boot/grub directory or wherever the grub.cfg file is. No idea if this will work.

irajeevankumar 02-06-2018 07:13 AM

Thank you but how can i do that?


All times are GMT -5. The time now is 11:07 AM.