2

I installed Lubuntu on a flash drive as you would an HD (not live/squashfs). But whenever I boot it I get a grub rescue prompt.

It says it can't find /boot/grub/i386-pc/normal.mod which explains the rescue prompt. However, it's installed for x86_64. The folder for that arch is there with all the modules. When I did grub-install I targeted it to x86_64. When I try to explicitly insmod it it says wrong arch elf magic. So it is definitely looking for i386 and in the right place, but why and how do I fix it?

My question is different than the suggested duplicates because there is no Windows installation on the flash drive, which must be machine-independent. Also, the solutions provided in either do not help - even boot-repair doesn't fix it.

Dessa Simpson
  • 687
  • 7
  • 19

1 Answers1

2

I found the solution. It was booting in Legacy mode because it failed to boot in UEFI. The EFI partition contained EFI/Boot and EFI/ubuntu. It was looking for two files, grubx64.efi and MokManager.efi, in /EFI/Boot, but they were in ubuntu, so I did cp EFI/ubuntu/*.efi EFI/Boot and that fixed it! To clarify, the root problem was that the installer put the boot files in a location that is only suitable for fixed drives, and the solution was to cp -r the files to the correct location.

Dessa Simpson
  • 687
  • 7
  • 19
  • 1
    That's the correct observation UEFI booting from external media is only supported from \EFI\Boot, I wrote about it here: http://askubuntu.com/q/559007/40581 – LiveWireBT Dec 31 '15 at 21:56
  • Question: Why does Ubuntu install it to EFI/ubuntu if it doesn't always work and in what cases does it work? – Dessa Simpson Jan 02 '16 at 05:50
  • 1
    As far as I understand the UEFI spec, which I recommend to look up yourself, the way Ubuntu does it is considered expected behavior from a UEFI computer: boot the first bootloader entry in the boot catalog. \EFI\Boot was initially only for removable media, but was later added for internal drives as a fallback if the catalog has no valid entries. Example: Asus motherboard firmware updates deleted the entire catalog. You can find these issues where manufacturers weren't considerate enough about users wanting to install something else than Windows. I filed a bug, but it didn't get much attention. – LiveWireBT Jan 03 '16 at 19:11
  • Alright. Why is it that that doesn't work for removable drives? – Dessa Simpson Jan 03 '16 at 20:38
  • 1
    The boot catalog is stored in the platform (on the mainboard) and each operating system is responsible for registering it's bootloader in the catalog (basically telling the firmware where the file is and a corresponding name to display , this is done on Linux with efibootmgr). In case of removable media, if you use the storage device on another computer this information is not available and would not make much sense (you could still add it though). – LiveWireBT Jan 03 '16 at 23:00
  • Ah, I see. I've never liked that method because I like things to be hardware-independent, but I understand. Thanks! – Dessa Simpson Jan 04 '16 at 20:47