Ubuntu – Did Ubuntu 16.04.2 install the loader on Macbook Pro hard drive despite being told to put it on USB hard drive

bootgrub2macbook prouefi

Macbook Pro 12,1 with OS X 10.11.6; installing using Ubuntu 16.04.2-desktop-amd64.iso

Trying to install Ubuntu 16 to a USB hard drive, for use with my Macbook Pro, which I have set up with Boot Camp and Windows 10. So I put the installer on a USB stick, booted using it, and set stuff up in the partition manager as per this photo.

Me quite clearly telling the stupid computer to put a boot loader on /dev/sdd1

(Why am I adding an EFI partition? Because it had already gone wrong once, and I thought I'd try again, this time taking photos, and wondered whether maybe adding an EFI partition to the USB hard drive would help it decide to do the right thing. Anyway, I'm the one asking the questions here.)

Note device selected for boot loader installation.

I clicked Install Now.

Stupid computer failing to mention that it's about to copy stuff onto /dev/sda1

That all seemed in order, so I clicked Continue and let it install. And what ended up happening was that the boot loader was installed on /dev/sda1, and /dev/sdd1 was left blank.

This made a bit of a mess:

  1. Switch on with USB hard drive connected: Ubuntu boot menu appears, with an option for Ubuntu and an option for Windows 10 (which works). No sign of OS X

  2. Switch on with USB hard drive disconnected: grub text console. I don't know how to use this, because when I typed help I got several pages of output that immediately scrolled away and I decided life was too short

  3. Switch on while holding Alt: standard Apple boot menu appears, allowing selection of OS X and Windows as before. But even when USB hard drive is connected, there's no sign of Ubuntu

It's fairly easy to remove the loader (mount EFI partition and remove the ubuntu folder there), so now I'm back where I was.

But I'm still a bit confused. What, if anything, did I do wrong? Why did the loader end up on /dev/sda1 rather than /dev/sdd1?

Best Answer

(This doesn't answer my direct question, but making it work proved more annoying than I expected so I thought I'd post some notes.)

In the end I seem to have got it working to my satisfaction. Armed with the ubuntu folder that the installer had added to my Macbook's EFI partition, my USB hard drive with an empty EFI partition, and @oldfred's comments, I filled the USB hard drive's EFI partition as follows:

  1. make folder in root of empty EFI partition called EFI
  2. copy ubuntu folder (that the installer added) into the new EFI folder
  3. make folder in EFI called Boot
  4. move EFI/ubuntu/grubx64.efi and EFI/ubuntu/MokManager.efi into EFI/Boot
  5. move EFI/ubuntu/shimx64.efi into Boot, and rename it to BOOTx64.EFI
  6. Edit EFI/ubuntu/grub.cfg, find the search.fs_uuid line, and remove the device specifier from the end (so it reads just search.fs_uuid <<GUID>> root).

My USB disk then appears in the Apple boot menu when it's connected. And when selected, it brings up the usual boot menu, and I can select Ubuntu and off it goes.

As a final step, once up and running, I edited /etc/fstab to mount the USB disk's EFI partition, rather than the MBP's.

(I don't know whether step 6 is vital, and I don't know whether these file names are case-sensitive. This took numerous reboots and I don't fancy doing much more additional experimentation.)

Related Question