13

Since I updated Windows to 8.1 my Grub menu disappeared. I ran Ubuntu using Live USB, I used Boot-Repair but something went wrong. If I click on Reccomended repair I get this error:

GPT detected. Please create a BIOS-Boot partition (>1MB, unformatted filesystem, bios_grub flag). This can be performed via tools such as Gparted. Then try again. Alternatively, you can retry after activating the [Separate /boot/efi partition:] option.

So I tried to set my sda9 (I think that it's the Ubuntu system partition, since it's ext4) with the bios_grub flag and then to run Boot-Repair again. It didn't work.

I don't know what to do. My Grub was working fine (using UEFI) before I updated Windows.

I removed the bios_grub flag. Then I used fsck and it didn't find any error. So I tried again with Boot-Repair but it always gives me the "GPT detected" error. My boot is on UEFI mode, Secure Boot is "off".

When I boot my PC with SecureBoot OFF, I can reach the GRUB menu. But it's empty (the only voice is "System Setup").

I mounted my Ubuntu system disk:

sudo mount /dev/sda9 /mnt

and the other things:

sudo mount --bind /dev /mnt/dev
sudo mount --bind /proc /mnt/proc
sudo mount --bind /sys /mnt/sys

I logged on the system with chroot:

sudo chroot /mnt

I re-installed grub:

grub-install /dev/sda
update-grub2

But it still doesn't work.

Braiam
  • 67,791
  • 32
  • 179
  • 269
  • For future readers, this answer fixed it for me (boot the actual partition and then run grub-install): http://askubuntu.com/questions/546582/surface-pro-3-no-grub-menu/604238#604238 – CornSmith Dec 14 '16 at 04:02

2 Answers2

11

First, the bios_grub flag in parted or GParted is a way to identify a BIOS Boot Partition. GRUB 2 uses this partition to hold part of its boot code when the computer boots in BIOS mode. It's normally about 1MiB in size, although it can be smaller in some cases. Most importantly, if Boot Repair re-ran the GRUB installer after you set the bios_grub flag on your Linux root (/) partition, you may have trashed that partition. Thus, before you do anything else, I recommend you:

  1. Remove the bios_grub flag from your Linux root (/) partition.
  2. Test your Linux root (/) partition with fsck (or equivalent functionality in GParted or other GUI tools). If the partition has errors, fix them or restore your system from a backup. Only once you're sure that you can mount the partition and use it normally should you proceed.

Second, you had this problem because you booted your emergency disc in BIOS/CSM/legacy mode rather than in EFI mode. You need to learn how to control your computer's boot mode. You can usually do this via a boot manager that's accessed by hitting Esc or a function key early in the boot process (before GRUB appears); but there's no standardization on how to access this boot manager or what options it provides. Thus, you may need to experiment to figure this out.

Third, if you can figure out how to boot your live CD in EFI mode, Boot Repair should fix the problem. Alternatively, you should be able to use a CD-R or USB flash drive version of my rEFInd boot manager to get Linux booted. Once Linux is up and running, you should be able to use efibootmgr to restore GRUB as the default boot loader, but the details depend on how it's configured now. Briefly, you must use the -o option to efibootmgr to set GRUB's entry as the first one. This question and answers cover the issue from a different angle. Instead of restoring GRUB, you could consider installing rEFInd to your hard disk, too.


EDIT: Try using my rEFInd boot manager: Use the USB flash drive or CD-R image to create a suitable medium and boot from that. This should give you an option for Windows and at least one option for Linux. If you can boot both Windows and Linux, install the Debian package of rEFInd in Linux. This should switch the computer to use rEFInd by default, and you should be able to boot everything normally.

Rod Smith
  • 44,284
  • 7
  • 63
  • 105
  • I removed the bios_grub flag. Then I used fsck and it didn't find any error. So I tried again with Boot-Repair but it always give me the "GPT detected" error. My boot is on UEFI mode, Secure Boot is "off". If I put Secure Boot "on" it gives me a security policy error. How can I solve the GPT error? – Kurt Bourbaki Oct 21 '13 at 06:27
  • P.S. When I boot my PC with SecureBoot OFF, I can reach the GRUB menu. But it's empty (the only voice is "System Setup"). – Kurt Bourbaki Oct 21 '13 at 06:32
  • Please try using rEFInd, as suggested in my edit. – Rod Smith Oct 21 '13 at 17:34
  • I used rEFInd, but the result is the same. It shows me an interface with 3 choices; when I choose Windows or Ubuntu it keeps bringing me back to the GRUB menu, as if the system were rebooting. It's like if the system couldn't find the right files for the boot (I'm trying to guess). In fact, even if I choose Ubuntu or Windows from the system boot, it keeps bringing me to the GRUB menu. – Kurt Bourbaki Oct 21 '13 at 19:40
  • 1
    Boot Repair will sometimes replace the Windows boot loader with another copy of GRUB, backing up the original to another file. In the Boot Repair Advanced menu there's an option to restore such backups, so you could try running that and then using rEFInd. It's also possible that the original has been lost, in which case restoring it from a backup or using a Windows recovery disk may be necessary. If rEFInd is bringing GRUB up when you select a vmlinuz* option, then something is very wrong with your system. What brand computer/motherboard do you have? – Rod Smith Oct 22 '13 at 18:05
  • I've got a Dell Inspiron 15r. Unfortunately I had to format and reinstall Ubuntu since I had the urge to keep working on a academic project. I tried to restore old backups, but it didn't get me anywhere. Plus, I didn't have a Windows backup disk (Dell doesn't always supply it with new laptops and I didn't succeed with windows8 backup service). But I thank you for your kind answers as well, and I'll set yours as the right answer :) – Kurt Bourbaki Oct 23 '13 at 07:55
  • FWIW, this program was the only tool/procedure which solved the trashing of the Grub menu after a Windows 10 upgrade. Boot-repair didn’t work because it wanted a new partition and GParted wouldn’t create one Instead of sda1, sdb, my devices were named (cryptically) nvme0np1, p2 p3 etc. Trying to mount them after opening a live-CD linux session threw the “can’t find /etc/fstab” error. The next error was “cannot find EFI” partition and trying to mount the existing Linux filesystem from the live-cd failed. This program restored access to Windows and Linux both where everything else failed. – user26732 Jan 07 '21 at 12:14
6

You can handle this issue as follows:

  1. Start Gparted.

  2. Identify the boot partition. Mine is the first 16.00MiB on my system disk.

  3. Delete the partition (you will not want to delete the wrong partition and lost all the data on it! Stop if you don't know what you are doing!).

  4. Create a new partition (do not format it to any filesystem), apply the settings.

  5. Flags the new partition as bios_grub using Manage Flags option.

Now, try boot-repair again.

ThunderBird
  • 1,955
yang
  • 161