Attempting to dual boot

I’m attempting to dual-boot Raspbian on eMMC and Ubuntu on SD. I have booted successfully from both on their own. As mentioned here, I ran update-grub while booted into Raspbian on the eMMC. It successfully ran os-prober and found Ubuntu on the SD card. After rebooting, uboot throws an error if the eMMC is connected.

Found EFI removable media binary efi/boot/bootaa64.efi
872448 bytes read in 21 ms (39.6 MiB/s)
Booting /efi\boot\bootaa64.efi
No EFI system partition
Failed to persist EFI variables
“Synchronous Abort” …

It appears that modifying grub has corrupted it somehow. Interrupting uboot and running run bootcmd_mmc1 does work, but is there a way to use grub to dual-boot both grub bootable OSs?

1 Like

It appears that installing a new version of Grub, as mentioned in that other thread, was breaking the existing one. I opened the image and manually copied the old grub files into the EFI folder to fix it. Updating grub entries was not the problem.

However I still cannot get os-prober to reliably find the OS’s on the SD Card. Nor can I get grub itself to even access the other storage mediums. (something to do with how uboot passes hardware control to grub maybe.)

The ridiculous workaround I’ve found for this is to create a grub entry I labeled “Boot SD Card” which simply executes the exit command. This causes grub to quit and makes uboot think that emmc booting failed and to try the next option on the list. This works to boot OS’s not using grub (like CoreELEC and Android) so long as grub is installed on the eMMC. I imagine it would work for SD Card users (or eMMC users) trying to dual boot with a USB device.

  1. make sure OS on eMMC uses grub (Raspbian, Ubuntu, etc.)
  2. sudo nano /etc/grub.d/40_custom
  3. add the following to the bottom of that file

menuentry “Boot SD Card” {

  1. sudo update-grub

That’s it. Dual boot with anything on the SD Card including swapping cards on the fly for testing without having to add grub entries for each new OS. The other option is to stop uboot and enter run bootcmd_mmc1 each time you want to boot into the SD Card instead.

  1. I like your solution. It’s a lot easier to catch grub than uboot. My eMMC might come out of the drawer now.
  2. As a sugar-maker, I like your avatar.

I really wish that there were a better (in SPI?) bootloader to opt-pick a boot device or at least define a boot priority. I would much rather it prefer to boot from USB first, then uSD, then LASTly the eMMC. I assume that since this board lacks SPI flash that this is likely impossible without including this within the bootloader on each boot device?

You can control this via the boot.ini on the first partition of your boot device.

boot_targets=usb mmc1 mmc0
1 Like

Doesn’t that still require an eMMC or uSD card to then boot from USB?