Ubuntu Grub/EFI won't boot - I really need help

6,780

Oldfred is on the right track. To elaborate and provide further advice:

  • Somewhere along the line, you inappropriately changed the partition type code on /dev/sda1 from that for an EFI System Partition (ESP) to that for a BIOS Boot Partition. The former is required to boot a computer in EFI mode, whereas the latter is used by GRUB in BIOS mode to boot from a GPT disk. Making this change by itself would not have caused problems, but combining it with other mistakes (like installing a BIOS-mode copy of GRUB) could be -- and seems to have been -- disastrous. To correct this problem, you must do two things:
    • Change the "bios_grub flag" to a "boot flag" with parted or GParted; or change the type code from EF02 to EF00 in gdisk, cgdisk, or sgdisk. (These two program families have different ways of identifying type code information.) If you fail to make this change, you're likely to run into further problems in the future.
    • You must also create a new FAT32 filesystem on the partition. GParted provides a GUI tool for doing this; or you can type sudo mkdosfs -F 32 -n ESP /dev/sda1 to do it from an Ubuntu Terminal.
  • Windows boots in EFI mode from GPT disks. Thus, in your case you do not want to go anywhere near BIOS-mode booting, even for Ubuntu. Unfortunately, many tutorials recommend enabling the EFI's Compatibility Support Module (CSM) when installing Ubuntu as a routine matter. This is a Bad Idea, for reasons I elaborate on here. It appears that you enabled your CSM (aka "legacy boot support" or some similar term), which in turn resulted (along with the type code change) in GRUB damaging your ESP. You should go back into your firmware setup utility and disable the CSM! It will do you no good and could lead you down a path to further trouble in the future.
  • You must re-install your Windows boot loader to make it bootable again. You should ask on a Windows forum about doing this.
  • You must re-install an EFI-mode boot loader for Linux to make it bootable again. Boot Repair should be able to do this; or you could use my rEFInd, as Scott Stensland has suggested.
  • Completely re-installing both OSes is another option, although it's not really necessary. Also, that path could easily lead you into yet more trouble if you don't first address the fundamental problem of the CSM (or fully understand how to control your boot mode, which is a tricky subject).
Share:
6,780

Related videos on Youtube

Nathan Prestwood
Author by

Nathan Prestwood

Updated on September 18, 2022

Comments

  • Nathan Prestwood
    Nathan Prestwood over 1 year

    I really need help, guys. I`m very desperate. I had a EFI partition with multiboot (Win10, Ubuntu, Kali) and then I wanted to reset my boot for some reason and formated it. Then everything went south. I've looked up every website, everything about this and nothing works. I'll tell you what I know:

    • My partition table is GPT (I don't know what it means but...)

    • I tried to reinstall grub in every way and it didn't work

    • sda1 was where grub or efi was (I'll print fsdisk later)

    • When I go to my computer's bios menu I don't see any hd options

    • I'm using Ubuntu Gnome 15.10 liveCD and all my files and partitions are still here

    That's all I know. I also tried using boot-repair and it didn't work. It gave me this, though: http://paste.ubuntu.com/14154768/

    And this is fdisk -l

    Disk /dev/sda: 931.5 GiB, 1000204886016 bytes, 1953525168 sectors
    Units: sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 4096 bytes
    I/O size (minimum/optimal): 4096 bytes / 4096 bytes
    Disklabel type: gpt
    Disk identifier: 469F8C92-03DC-43CC-A5F3-810410000919
    
    Device          Start        End    Sectors   Size Type
    /dev/sda1        2048     532479     530432   259M BIOS boot
    /dev/sda2      532480     794623     262144   128M Microsoft reserved
    /dev/sda3      794624 1393434623 1392640000 664.1G Microsoft basic data
    /dev/sda4  1393434624 1394356223     921600   450M Windows recovery environment
    /dev/sda5  1394356224 1492013055   97656832  46.6G Linux filesystem
    /dev/sda6  1492013056 1523263487   31250432  14.9G Linux swap
    /dev/sda7  1523263488 1887262719  363999232 173.6G Linux filesystem
    /dev/sda8  1887262720 1953523711   66260992  31.6G Linux filesystem
    
    
    Disk /dev/sdb: 3.7 GiB, 3926949888 bytes, 7669824 sectors
    Units: sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disklabel type: gpt
    Disk identifier: 786BCBC6-FF1A-47D4-9240-D446AB032537
    
    Device     Start     End Sectors  Size Type
    /dev/sdb1   2048 7669790 7667743  3.7G Microsoft basic data
    

    Please, help me.

    EDIT 1: I also tried reinstalling ubuntu. I have a separate home partition so it was easy and it worked again but without windows and then trying to get windows back grub stopped working too.

    • albertoefg
      albertoefg over 8 years
      i know is not a tecnical solution but i would try to install another distro along the corruent OS's that once helped me
    • albertoefg
      albertoefg over 8 years
      then you can access a live dvd or live usb, and use grup repair, in advanced options you can choose to change grub to boot from an older OS , and then erase the new distro with gparted.
    • Nathan Prestwood
      Nathan Prestwood over 8 years
      I tried a lot of things but nothing worked, could you be more specific? Then I'd tell you if I'd already tried.
    • Nathan Prestwood
      Nathan Prestwood over 8 years
      But I don't think it'll show windows anyway, cause I did erase my ubuntu partition and installed it again. I think I need to restore windows boot files somehow.
    • Daniel
      Daniel over 8 years
      Then you need to run Windows Startup Repair from the Windows Install DVD.
    • Scott Stensland
      Scott Stensland over 8 years
      I have seen good results from using this boot tool : rEFInd .... google on dual boot ubuntu windows rEFInd
    • Nathan Prestwood
      Nathan Prestwood over 8 years
      Thank you all for the answers. I'll back up my data and reinstall everything from the beginning. Windows then Ubuntu. At least now I know: NEVER format a EFI partition. hahaha'
    • oldfred
      oldfred over 8 years
      You reinstalled in BIOS boot mode as you replaced the ESP - efi system partition with a bios_grub partition for BIOS boot. But a bios_grub partition is normally only 1 or 2 MB. You can format the sda1 as FAT32 with the boot flag to make it the ESP. Then reinstall grub in UEFI mode, not BIOS mode. Easiest with Boot-Repair. Not sure what all the Windows UEFI/efi boot files are. Only boot in UEFI mode: help.ubuntu.com/community/Boot-Repair