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?

  • 2
    You did not do anything wrong. Grub only installs to ESP - efi system partition on sda. And you have to manually copy /EFI/ubuntu to flash drive and copy again to /EFI/Boot and rename either shimx64.efi or grubx64.efi to bootx64.efi. External drives in UEFI mode only boot from /EFI/Boot/bootx64.efi (on PCs, not sure about Mac). And copy of grub in /EFI/ubuntu expects rest of grub files to be in /EFI/ubuntu so copy in /EFI/Boot needs the/EFI/ubuntu to work. Similar bug (was for OEM) bugs.launchpad.net/ubuntu/+source/grub2/+bug/1414124 – oldfred Feb 23 '17 at 16:27
  • @oldfred Thanks, that was most helpful. If you want to post that as an answer (since "grub only installs to ESP" answers my main question!) then I'll accept it. I'm going to add an answer with some extra notes anyway, since I've got it working now thanks to your note about needing EFI/ubuntu as well as EFI/Boot. – Tom Seddon Feb 23 '17 at 17:24
  • 1
    You also probably need to edit fstab with efi mount of flash drive rather than that of ESP on sda. I have both left 3 line grub in /EFI/ubuntu and changed to one line configfile with my PC, again there may be differences with a Mac? – oldfred Feb 23 '17 at 18:18
  • Yes, you're quite right, I have /dev/sda1 mounted as /boot/efi. It's mounted by GUID in /etc/fstab so that looks like it ought to be an easy fix. – Tom Seddon Feb 23 '17 at 18:59

(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.)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.