Skip to content

Commit

Permalink
mxgrub: Always install GRUB in MBR
Browse files Browse the repository at this point in the history
Contradicting the documentation, that `i386-pc` is the default target,
on UEFI systems it is not.

    $ sudo grub-install --boot-directory=/boot /dev/nvme0n1
    Installing for x86_64-efi platform.
    grub-install: error: cannot find EFI directory.

So, pass `--target=i386-pc` to install GRUB in the MBR.

    $ sudo grub-install --target=i386-pc --boot-directory=/boot /dev/nvme0n1
    Installing for i386-pc platform.
    Installation finished. No error reported.
  • Loading branch information
pmenzel committed Sep 3, 2018
1 parent 5d71961 commit bc4ef58
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions mxgrub/mxgrub
Original file line number Diff line number Diff line change
Expand Up @@ -313,18 +313,18 @@ sub cmd_install {
if (is_efi) {
sys 'mount','-L','ESP','/boot/efi' and exit 1;
if (-d '/boot/efi/EFI/grub/grubx64.efi') {
print "GRUB is already installed.\n";
print "GRUB for UEFI is already installed.\n";
}
else {
sys 'grub-install','--target=x86_64-efi',$root_disk and exit 1;
}
sys 'umount','/boot/efi' and exit 1;
}

if ($mbr_type ne 'GRUB') {
sys 'grub-install','--target=i386-pc',$root_disk and exit 1;
} else {
if ($mbr_type ne 'GRUB') {
sys 'grub-install',$root_disk and exit 1;
} else {
print "GRUB is already installed.\n";
}
print "GRUB is already installed in MBR.\n";
}

if ($label eq 'default') {
Expand Down

0 comments on commit bc4ef58

Please sign in to comment.