How to install archlinux EFI grub with MBR (msdos) partation table?

2.2k Views Asked by At

As we know, EFI boot is not limited to GPT partition table, and MBR is ok.

I've a legacy disk with msdos partition table, and I'd like to reinstall it into archlinux.

In wiki:

https://wiki.archlinux.org/index.php/GRUB#UEFI_systems

it also said that GPT is not necessary.

GPT is not strictly necessary, but it is highly recommended and is the only method currently supported in this article.

What is the way to install grub EFI boot to my hard drive with MBR partition table? Thx.

1

There are 1 best solutions below

7
On

Assuming:

  • /dev/sda1 is your efi partition
  • /dev/sda2 is your root partition (containing /boot too)
  • Your linux kernel file is /boot/vmlinuz-linux
  • Your initrd file is /boot/initrd.img

Burn a live usb of ubuntu 16.04 with amd64 architecture, boot on it and paste these commands:

sudo os-prober
efibootmgr

Install os-prober or efibootmgr if it isn't installed yet:

sudo apt-get install os-prober
sudo apt-get install efibootmgr

Grub in efi mode is probably not installed, install it too

sudo apt-get install grub-efi-amd64-signed

Then, install grub:

sudo mount -t ext4 /dev/sda2 /mnt
sudo mount -t vfat /dev/sda1 /mnt/boot/efi
grub-install --target=x86_64-efi --efi-directory=/mnt/boot/efi --boot-directory=/mnt/boot --bootloader-id=grub

Don't try to use grub-mkconfig, it will not work. Instead, boot from your newly grub bootloader, you will have a grub shell, paste these commands:

set root=(hd0,2)
linux /boot/vmlinuz-linux root=/dev/sda2
initrd /boot/initrd.img
boot

After that, you should be on linux, mount your efi partition (to /boot/efi !) if it's not already, install grub/os-prober/efibootmgr, and run these:

sudo os-prober
grub-install --target=x86_64-efi --efi-directory=/boot/efi --boot-directory=/boot --bootloader-id=grub
grub-mkconfig -o /boot/grub/grub.cfg

Reboot, and grub is back and working