How To Install convert MBR Legacy booting GRUB to EFI from a non-EFI Linux Environment Ubuntu Mint Debian

1.) Create your EFI/ESP Partition

If you happen to have some free space on the drive already then this is easy, just create a new partition of at least 100M.

The nice thing about the EFI spec is that it must just be in the first 2.2TB of space so for most users, it means you can simply resize the last partition (downsize it by 100M) and then add an EFI partition at the end.

For example if you had this partition scheme:

/dev/sda1 = /

/dev/sda2 = swap

You could just downsize your swap partition or whatever the last partition is and then create a new partitiion as EFI/FAT32 at the end.  UEFI will still find and boot it even if it is not the first partition.

You could use gparted to achieve the above or from any other LiveCD like Ubuntu/Mint you could boot and manipulate the partition table as you need.

Format your EFI/ESP partition

Replace the xx with your info eg. if you had /dev/sda3 as your EFI partition then use mkfs.vfat /dev/sda3

mkfs.vfat /dev/sdxx

2.) chroot into your target root partition

How to properly chroot

3.) Install grub-efi first otherwise the target x86_64-efi won't exist and you won't be able to install the EFI boot loader.

apt install grub-efi

4.) Mount your ESP in /boot/efi

Remember the EFI boot loader calls for a partition type of vfat/fat32 and it can be at any location (eg. I have booted from ESP as partition#3).

mkdir -p /boot/efi

mount /dev/sda1 /boot/efi

5.) Install GRUB EFI like this:

Note that some platforms/devices/computers/laptops/servers will not boot if you don't use the --bootloader-id option and if you don't use the --no-uefi-secure-boot

Change /dev/sdx to your drive


If you are using secureboot do this:

grub-install --target=x86_64-efi /dev/sdx
Installing for x86_64-efi platform.
grub-install: warning: EFI variables are not supported on this system..
Installation finished. No error reported.

If you are not using secureboot do this:

grub-install --target=x86_64-efi /dev/sdx --no-uefi-secure-boot  --bootloader-id realtechtalk

Errors GRUB EFI won't boot or show at all or disappears from efibootmgr

The whole issue is that the grub efi binaries are hard coded to find the files in /EFI/debian for Debian for example or for Ubuntu it is /EFI/ubuntu.  If you use any bootloader-id other than those things won't work unless they exist.

To have a custom bootloader-id you need the hardcoded/default -bootloader-id in EFI/ and then you can install your customer one.  In essence --bootloader-id is broken as users have complained of for years.

This is usually caused by the issues mentioned in #4, especially installing without --bootloader-id  a lot of implementations of EFI will not boot if you don't set the --bootloader-id.

If you use a bootloader-id other than the default for the grub built for your OS eg. debian, ubuntu it will probably not work unless you use --no-uefi-secure-boot

 

 

 


Tags:

install, grub, efi, linux, ubuntu, mint, debian, _, loader, apt, chroot, partition, mount, esp, vfat, eg, booted, mkdir, dev, sda, sdx, installing, platform, variables, supported, installation, reported,

Latest Articles

  • docker / kubernetes breaks Proxmox QEMU KVM Bridge VMs
  • How To Change Storage Location in Docker.io
  • RTL8812BU and RTL8822BU Linux Driver Ubuntu Setup Archer T3U Plus
  • Kazam video blank/high size and not working when recording solution
  • Cisco UC CME How To Enable Licensed Features
  • from pip._internal.cli.main import main File "/usr/local/lib/python3.5/dist-packages/pip/_internal/cli/main.py", line 60 sys.stderr.write(f"ERROR: {exc}") from pip._internal.cli.main import main File "/usr/local/lib/python3.5/dist-packag
  • ModuleNotFoundError: No module named 'pip._internal' solution python
  • grub blank screen how to manually boot kernel and initrd Linux Ubuntu Debian Centos won't boot solution
  • Cisco Switch / Router How To Restore Factory Default Settings
  • Cisco 2900 3900 Router Password Reset How To Reset Enable Password
  • How To Install convert MBR Legacy booting GRUB to EFI from a non-EFI Linux Environment Ubuntu Mint Debian
  • Translating "cisco" ...domain server (255.255.255.255) Cisco Router/Switch Solution
  • Error opening tftp://10.0.2.2/network-confg (Permission denied) - How To Fix Cisco Router Switch Error Solution Console
  • GRUB error: invalid arch-independent ELF magic. Solution How To Fix Linux Centos Ubuntu Mint
  • How to find out which package a file belongs to in Debian Mint Ubuntu Linux
  • Centos 7 not mounting /etc/fstab partitions
  • CentOS 7 / 8 cannot boot with with mdadm RAID array solution
  • How To Add Default Gateway in Linux using the ip route command routing
  • Error: Failed to download metadata for repo 'appstream': Cannot prepare internal mirrorlist: No URLs in mirrorlist Solution for Centos8 yum package install error
  • md mdadm array inactive how to start and activate the RAID array