2

Intro: I was using Windows 10 and I installed Ubuntu 18.04 in a Dual Boot, which worked quite well, until I decided to uninstall Ubuntu and just keep Windows 10. That uninstall didn't go as expected, and I lost access to the Windows 10 Boot Manager.

Later I reinstalled both Ubuntu and Windows 10, but GRUB shows multiple entries in its boot menu which I don't want. Below is a screen photo of my GRUB boot menu.

GRUB

What I have tried so far:

  1. Fixed the Grub using Boot Repair.

  2. Had gone though various similar questions on askubuntu and other forums but I didn't understand what exactly to do and what boot entry to remove. I am a beginner with Ubuntu and any help will be highly appreciated.

Here is the Boot Repair Log: https://paste.ubuntu.com/p/pwJxxJjYzZ/ and here is my boot info: https://paste.ubuntu.com/p/CkCRhn7S8s/

Boot manager drives:

enter image description here

Here is the text output:

BootCurrent: 0018
Timeout: 2 seconds
BootOrder: 0018,0019,0005,0006,0007,0008,0009,0004
Boot0000* IDER BOOT CDROM   PciRoot(0x0)/Pci(0x16,0x2)/Ata(0,1,0)
Boot0001* IDER BOOT Floppy  PciRoot(0x0)/Pci(0x16,0x2)/Ata(0,0,0)
Boot0002* ATA HDD   VenMsg(bc7838d2-0f82-4d60-8316-c068ee79d25b,91af625956449f41a7b91f4f892ab0f6)
Boot0003* ATAPI CD  VenMsg(bc7838d2-0f82-4d60-8316-c068ee79d25b,aea2090adfde214e8b3a5e471856a354)
Boot0004* PCI LAN   VenMsg(bc7838d2-0f82-4d60-8316-c068ee79d25b,78a84aaf2b2afc4ea79cf5cc8f3d3803)
Boot0005* USB CD    VenMsg(bc7838d2-0f82-4d60-8316-c068ee79d25b,86701296aa5a7848b66cd49dd3ba6a55)
Boot0006* USB FDD   VenMsg(bc7838d2-0f82-4d60-8316-c068ee79d25b,6ff015a28830b543a8b8641009461e49)
Boot0007* NVMe0 VenMsg(bc7838d2-0f82-4d60-8316-c068ee79d25b,001c199932d94c4eae9aa0b6e98eb8a400)
Boot0008* ATA HDD0  VenMsg(bc7838d2-0f82-4d60-8316-c068ee79d25b,91af625956449f41a7b91f4f892ab0f600)
Boot0009* USB HDD   VenMsg(bc7838d2-0f82-4d60-8316-c068ee79d25b,33e821aaaf33bc4789bd419f88c50803)
Boot000A  Setup FvFile(721c8b66-426c-4e86-8e99-3457c46ab0b9)
Boot000B  Boot Menu FvFile(126a762d-5758-4fca-8531-201a7f57f850)
Boot000C  Diagnostic Splash Screen  FvFile(a7d8d9a6-6ab0-4aeb-ad9d-163e59a7a380)
Boot000D  Lenovo Diagnostics    FvFile(3f7e615b-0d45-4f80-88dc-26b234958560)
Boot000E  Startup Interrupt Menu    FvFile(f46ee6f4-4785-43a3-923d-7f786c3c8479)
Boot000F  Rescue and Recovery   FvFile(665d3f60-ad3e-4cad-8e26-db46eee9f1b5)
Boot0010  MEBx Hot Key  FvFile(ac6fd56a-3d41-4efd-a1b9-870293811a28)
Boot0011  Startup Interrupt Menu    FvFile(f46ee6f4-4785-43a3-923d-7f786c3c8479)
Boot0012  Rescue and Recovery   FvFile(665d3f60-ad3e-4cad-8e26-db46eee9f1b5)
Boot0013  MEBx Hot Key  FvFile(ac6fd56a-3d41-4efd-a1b9-870293811a28)
Boot0014* IDER BOOT CDROM   PciRoot(0x0)/Pci(0x16,0x2)/Ata(0,1,0)
Boot0015* IDER BOOT Floppy  PciRoot(0x0)/Pci(0x16,0x2)/Ata(0,0,0)
Boot0016* ATA HDD   VenMsg(bc7838d2-0f82-4d60-8316-c068ee79d25b,91af625956449f41a7b91f4f892ab0f6)
Boot0017* ATAPI CD  VenMsg(bc7838d2-0f82-4d60-8316-c068ee79d25b,aea2090adfde214e8b3a5e471856a354)
Boot0018* ubuntu    HD(1,GPT,961a0049-1bbe-4587-8dda-2d37421f1e6b,0x800,0x76800)/File(\EFI\ubuntu\shimx64.efi)
Boot0019* Windows Boot Manager  HD(1,GPT,961a0049-1bbe-4587-8dda-2d37421f1e6b,0x800,0x76800)/File(\EFI\Microsoft\Boot\bootmgfw.efi)WINDOWS.........x...B.C.D.O.B.J.E.C.T.=.{.9.d.e.a.8.6.2.c.-.5.c.d.d.-.4.e.7.0.-.a.c.c.1.-.f.3.2.b.3.4.4.d.4.7.9.5.}...o................

What I want:

I only to keep two boot entries if possible (or Native Ubuntu and Windows Entries noting extra): Ubuntu Windows Boot Manager (on /dev/sda1/)

Note: I have UEFI and Safe Boot Enabled which my BIOS doesn't allow to disable.

karel
  • 114,770
Sheryl
  • 33
  • @user68186 Sorry for the trouble. I will update the question with efibootmgr output! – Sheryl Mar 04 '20 at 17:31
  • 1
    In addition to UEFI boot entries and housecleaning some of those as per user68186's link above, Boot-Repair adds a 25_custom with additional entries. You can edit or remove 25_custom. To get just the two entries, you just about have to turn off most of grub and add your own entries to 40_custom. https://askubuntu.com/questions/778663/what-is-the-difference-between-windows-uefi-bootmgfw-efi-and-windows-uefi-bkpboo & https://help.ubuntu.com/community/Grub2/CustomMenus Backup grub.cfg & turn off os-prober. Add your Windows entry from grub.cfg to 40_custom. – oldfred Mar 04 '20 at 18:54
  • @user68186 and oldfred Thanks for your answers. However, I can't relate the entries which I see on booting (there are 9 in list) with the output of 'sudo efibootmgr' (there are 20+). So, how to I know which one is Windows UEFI bootmgfw.efi and relate it to the command output same goes for the other EFI entries which I don't need. I don't recognize them before I execute the remove command (sudo efibootmgr -b entry -B). – Sheryl Mar 05 '20 at 02:47
  • @user68186 Thanks for your reply! The first one *Ubuntu is default and Ubuntu is booting from there... I want to keep it. Second Entry Windows UEFi bootmgfw.efi and seventh entry Windows Boot Manager (on /dev/sda1/) are booting into same Windows Install and both are working. I want to keep one only from them... Either will be fine. So on GRUB I just want to keep two one for Ubuntu and one for Windows. – Sheryl Mar 06 '20 at 10:36
  • @user68186 Here: https://paste.ubuntu.com/p/N3SBFHKjk9/ is the output of list command. Too lengthy for the comment box to accommodate! – Sheryl Mar 08 '20 at 17:59
  • 1
    @user68186 Sorry I was stuck at a different location from past a few weeks and didn't get time to check this. I will work on it when things around get normal and let you know... Appreciate your help! – Sheryl Jun 03 '20 at 11:21
  • @user68186 Thanks for your help and that detailed explanation... It was helpful answer indeed. You are a star :) – Sheryl Jul 21 '20 at 19:09
  • You are welcome. I am glad I could help. – user68186 Jul 21 '20 at 19:11

1 Answers1

1

Backup! Backup!! Backup!!!

I have not done this, and what I am going to suggest is dangerous. Having a recovery plan is essential.

First, make a disk image of the EFI partition, so that if things go south you can restore the EFI partition and get back to where you started from. There are many ways to make a disk image file. Here is one:

  1. Boot from a Ubuntu Live USB and use the "Try Ubuntu without installing..." option.
  2. Open the "Disks" utility.
  3. Select the internal drive from the left panel.
  4. Select the EFI partition from the main window.
  5. Make sure it is not mounted.
  6. Select "create Disk Image..." from the hamburger menu ≡ on top right corner.
  7. Make sure the destination partition/disk has sufficient space. Select the folder where you want to keep the image file.
  8. click Start Creating button and wait for a long time.

If something goes wrong you should be able to restore the partition from this image.

Understand

Understand the relationship between the output of sudo efibootmgr and the Grub boot menu. Let us focus on the first part of the output:

BootCurrent: 0018
Timeout: 2 seconds
BootOrder: 0018,0019,0005,0006,0007,0008,0009,0004

and the Grub Menu screenshot:

enter image description here

The first line of the sudo efibootmgr tells us the default boot and this corresponds to the first line of the Grub Menu *Ubuntu. The * in the Grub menu indicates that this is selected by default.

From this, we learnt that 0018 in the sudo efibootmgr output corresponds to the *Ubuntu in the Grub menu.

We will ignore the second line of sudo efibootmgr. The third line tells us the boot order of 8 entries in the Grub menu:

0018 -> *Ubunu

0019 -> Windows UEFI bootmgfw.efi

0005 -> EFI/BOOT/bkpbootx64.efi

0006 -> EFI/BOOT/fbx64.efi

0007 -> EFI/ubuntu/fwupx64.efi

0008 -> EFI/ubuntu/mmx64.efi

0009 -> Windows Boot Manager (on /devsda1)

0004 -> System Setup

Now that we understand the relationship between the efibootmgr output and the Grub menu, we can form a strategy to delete the entries in the efibootmgr we don't need.

Based on your question we only need 0018, and 0019. The rest can be deleted.

See Explaination of my "efibootmgr -v" output for more.

Delete! Delete!! Delete!!

This is the most difficult and dangerous part.

You will want to delete the entries 0005, 0006, 0007, 0008, 0009, and 0004. You may also want to delete other boot entries that do not appear in the Grub Menu, but that may result in unexpected behavior and I don't recommend it.

If you want to live dangerously and be reckless you may want to delete the inactive boot entries, that do not have a star * next to them such as:

Boot000A  Setup FvFile(721c8b66-426c-4e86-8e99-3457c46ab0b9)

But these entries do not appear in the Grub menu, so you don't need to delete them for what you want.

Start with 0005 Use the command:

sudo efibootmgr -b 5 -B

Based on the mapping between efibootmgr output and Grub menu, we know this boot entry correspond to a file in the /boot/efi partition, specifically /boot/efi/EFI/BOOT/bkpbootx64.efi. So we can delete this file as well, with the following command:

sudo rm /boot/efi/EFI/BOOT/bkpbootx64.efi

Verify! Verify!! Verify!!!

Warning the boot entries in efibootmgr may have changed after deleting the 0005 boot entry. Run the command:

sudo efibootmgr --verbose

to verify the boot entry numbers have not changed. If they have changed follow the procedure described above to find the mapping between efibootmgr output and Grub menu. Reboot the computer and take a new picture of the Grub menu to be sure.

This is also a good time to verify the Grub menu still works as expected and you can still boot Windows and Ubuntu.

If Grub still shows EFI/BOOT/bkpbootx64.efi in the menu, you will have to run:

sudo update-grub

to make the changes in the Grub.

Repeat for the other boot entries

Once you have verified that everything works as expected, do it again for the next Grub entry and the corresponding boot entry in efibootmgr output

Final thoughts:I have not tested this solution and there is always a chance that you delete the wrong entry or the wrong file by mistake. If that happens, I hope you can restore the partition from the image file you have created.

Hope this helps

user68186
  • 33,360
  • 1
    Thanks for that detailed answer... I appreciate that. I am a bit scared :) But I will give it a try and get back. – Sheryl Mar 12 '20 at 12:24
  • It was helpful... Thanks for writing that detailed response... I really appreciate that help! – Sheryl Jul 21 '20 at 19:08