0

I have a full Ubuntu install on a USB that I keep on my keyring so I can have a portable, personal computer. However I cant boot from it on UEFI machines, even if secure boot is turned off. Is there any way to make it UEFI compatible?

Harvs
  • 143
  • Possible duplicate of http://askubuntu.com/q/559007/40581 ? Does it answer your question? Edit: for secure boot and an alternative to shim, you can use preloader with hashtool http://askubuntu.com/q/594747/40581 – LiveWireBT Dec 21 '15 at 21:02

1 Answers1

0

I haven't tested this but it should work. First, you have to prepare the USB drive:

  1. Install and launch GParted on the running OS from the USB.
  2. Shrink a partition to make a 200 - 400 MB space at the end (or the beginning, but not in the middle of the drive). Make a new primary partition in that space and format it as FAT32.
  3. Put the esp flag on it using GParted.
  4. Mount it using terminal.

To make it EFI bootable:

  1. Install package grub-efi-amd64-bin.
  2. Run sudo grub-install --target=x86_64-efi /dev/sdaX where X is the number of the FAT32 ESP partition you created earlier.
  3. Run sudo update-grub. It should detect and add Ubuntu to the boot menu.
  4. Check the ESP partition. You should find a file at /efi/ubuntu/grubx64.efi. Copy and rename this file in a boot folder so that you get /efi/boot/bootx64.efi.
  5. Shut down, plug USB in UEFI computer and boot.

Disclaimer: it should work. I haven't tested it personally.

Cornelius
  • 9,483
  • 4
  • 40
  • 62
  • 1
    That should work; however, there's a risk that an EFI-mode GRUB will interfere with a BIOS-mode GRUB because both may look for the same configuration file but require slightly different contents to work. For this reason, I recommend using a different EFI-mode boot loader than the BIOS-mode boot loader. That is, use GRUB 2 for BIOS and ELILO, SYSLINUX, or the kernel stub loader with rEFInd for EFI; or use LILO or GRUB Legacy for BIOS and GRUB 2 or any of the others I've just specified for EFI. – Rod Smith Dec 22 '15 at 13:58