PDA

View Full Version : Boot-repair hangs when reinstalling grub



hksiu1004
December 2nd, 2020, 11:46 AM
I installed ubuntu alongside with windows. But grub seems to have broken after a hardware repair. I tried using boot-repair on a live-usb to reinstall grub, but it hangs when trying to install grub on the ubuntu partition. This is the BootInfo summary generated by Boot-Repair:

https://paste.ubuntu.com/p/bHjQMnZP24/

I am an absolute beginner. What should I do now to repair grub? Thank you so much!!

yancek
December 2nd, 2020, 03:00 PM
Boot repair shows you have windows boot code in the MBR of the drive, is that correct?
Partitions 3-6 show windows 8 and line 95 shows windows 10.
Partition 5 is vfat which could be an EFI partition. Beginning at line 102, boot repair shows a number of EFI boot entries but there is no entry for ubuntu.
Line 142 shows a GPT drive which would need an EFI setup for windows to boot. It appears you may have installed Ubuntu in Legacy/CSM/
Try the suggestions in boot repair, lines 370 and 376.

oldfred
December 2nd, 2020, 05:00 PM
Your system seems very confused.
A bios_boot or bios_grub partition is normally 1 or 2MB unformatted.
An ESP is normally FAT32 and much larger, 100 to 500MB typically.


nvme0n1p1: _______________
File system: BIOS Boot partition
Boot sector type: Windows 8/2012: FAT32
nvme0n1p1 2048 534527 532480 260M BIOS boot

Boot0000* Windows Boot Manager HD(1,GPT,88f8333e-d550-4d76-b6da-fddeb9489fed,0x800,0x82000)/File(\EFI\Microsoft\Boot\bootmgfw.efi)
nvme0n1p1 vfat 7429-C392 88f8333e-d550-4d76-b6da-fddeb9489fed SYSTEM EFI system partition


Your nvme0n1p1 cannot be both an unformatted bios_grub and an ESP - efi system partition FAT32 formatted.
Since larger, looks like it really should be the ESP.
But if you installed grub in BIOS mode, the write of grub2's core.img into the 'unformatted' bios-grub partition may just overwrite good data? If it did not work then your ESP may still be ok.

Change nvme0n1p1 back to the ESP. Use gparted to change to esp & boot flags. You do not want to reformat if you can avoid it. If it gets reformatted you have to reinstall Windows boot files using your Windows repair disk.

Then from Boot-Repair in UEFI boot mode you should be able to install grub, default options may no be best, use advanced mode.

Note sure why Boot-Repair thinks you have a legacy/BIOS install of Windows? Windows has to be UEFI boot if on gpt drive.

hksiu1004
December 2nd, 2020, 11:50 PM
Thanks, Oldfred.

After clearing the flag on my nvme0n1p1, I ran boot-repair again, and I got this error message this time:


Please create a ESP partition (FAT32, 100MB~250MB, start of the disk, boot flag). This can be performed via tools such as Gparted. Then try again.

But I believe my nvme0n1p1 is already a ESP partition (the label on Gparted reads: "EFI system partition"). Here is the BootInfo summary this time: https://paste.ubuntu.com/p/9MmFs8HT23/

Which sub-options should I use in advanced mode? Using it still gave me the error message above. Thanks!

oldfred
December 3rd, 2020, 12:10 AM
The ESP needs the esp and seems to usually also have boot flag.
It must be FAT32 formatted. It is not showing as ESP, but in line 199 as Microsoft basic data which a FAT32 partition without flag would be shown as.

If after you add flag it says it wants a full reinstall of grub then you can run that.
Otherwise in advanced options, chose your install and total reinstall of grub. Besure to boot in UEFI mode, so it repairs in UEFI boot mode.
UEFI options should be a bit different:
https://sourceforge.net/p/boot-repair/home/Home/

hksiu1004
December 3rd, 2020, 12:38 AM
Thanks so much, oldfred. After adding a esp flag to that FAT32 partition, boot-repair works. Now I get back the boot menu.

ubfan1
December 3rd, 2020, 01:04 AM
4.5G is an awfully small root.