PDA

View Full Version : [SOLVED] Grub2-Install Failed



pingwu
10th November 2017, 07:21 PM
System: Fedora 26 (x2)

Machine: AMD FX 8350 + RX 480

Issue: After grub-booted into the second (previously installed) Fedora system, I tried to use the following steps to reinstall grub into this system, but failed:


dnf install grub2-efi grub2-efi-modules shim

grub2-mkconfig -o /boot/efi/EFI/fedora/grub.cfg

grub2-install /dev/sda


https://fedoraproject.org/wiki/GRUB_2

Return said no error. But I am now unable to boot.

Have to boot into a Ubuntu system on the same machine.

dswaner
10th November 2017, 10:23 PM
https://forums.fedoraforum.org/showthread.php?t=312443 might be helpful (especially comment #5).

amiga
10th November 2017, 10:38 PM
There is one incorrect and unnecessary step for a UEFI system


grub2-install /dev/sda

This is only for legacy BIOS or CSM mode where you are installing grub2 to the MBR of /dev/sda. You don't do this at all for an EFI system. This command is what broke your grub installation.

For UEFI systems with Fedora:

https://fedoraproject.org/wiki/GRUB_2#Updating_GRUB_2_configuration_on_UEFI_syste ms

On this page there is a large warning in bold.


grub2-install shouldn't be used on EFI systems. The grub2-efi package installs a prebaked grubx64.efi on the EFI System partition, which looks for grub.cfg on the ESP in /EFI/fedora/ whereas the grub2-install command creates a custom grubx64.efi, deletes the original installed one, and looks for grub.cfg in /boot/grub2/.

When you ran grub2-install /dev/sda you likely overwrote your previous bootloader as described above. You will have to reinstall the grub packages.

pingwu
11th November 2017, 05:49 AM
For UEFI systems with Fedora:

https://fedoraproject.org/wiki/GRUB_2#Updating_GRUB_2_configuration_on_UEFI_syste ms

On this page there is a large warning in bold.

Actually I was trying the quoted url (stated in my original post). Admitted that this is not the best written tutorial, at least for me.:D

(I knew this article specifically warned against using grub2-install on my UEFI system, but when everything I tried failed, I am willing to try anything.)

Still struggling. Any further help will be greatly appreciated. Thanks again.

pingwu
11th November 2017, 09:14 AM
It turned out that I need to edit the secure boot option.

Everything is good now. I can boot directly into the previously installed Fedora.

Summary:

1. Boot into Fedora, run two commands:


dnf irenstall grub2-efi grub2-efi-modules shim

grub2-mkconfig -o /boot/efi/EFI/fedora/grub.cfg

(The second command may not be necessary, but won't hurt).

2. Reboot; Go to BIOS SETUP -> Advanced -> Boot -> Secure Boot -> Change from "Windows" to "Other OS"

(Other machines may have different setup.)