Score:1

How to fully remove Ubuntu from UEFI boot menu

jp flag

I recently uninstalled Ubuntu from my dual boot, so I could change some partition stuff, but even after deleting the ubuntu folder from the EFI folder, a blank entry still appeared on the boot menu. I tried to reinstall Ubuntu with my new partition setup, but it gave me an error relating to grub fails to install. I’m not sure why I got this error saying that I deleted it from the system partition. If I try to boot into the new Ubuntu boot entry I get greeted with the grub Bash, rather than a boot menu. Any ideas on how to fix this?

oldfred avatar
cn flag
If doing a new install, you do not have to delete anything. New install will just overwrite all old settings. But you must reinstall in UEFI boot mode. Lets see details, use ppa version with your live installer (2nd option) or any working install, not Boot-Repair ISO: Please copy & paste the pastebin link to the Boot-info summary report ( do not post report), do not run the auto fix till reviewed. https://help.ubuntu.com/community/Boot-Repair What brand/model system? What version of Ubuntu?
DarkBrave_ avatar
jp flag
Ubuntu 21.04, and the pc is a somewhat modified CyberPowerPC.
Score:1
cn flag

Assuming you are using GNU GRUB2

There should be a file named grub.cfg under /boot/grub/ that is generated from the scripts in /etc/grub.d/ and settings from /etc/default/grub on executing the command:

update-grub

You need to login as root to do any of the following.

A quick'n dirty way is to find any occurance of the enties you want to remove.

# find occurrences in /etc/grub.d/ scripts
find /etc/grub.d/ -type f -exec grep -n 'ubuntu' {} +

Then edit the files found by removing those occurrences.

Make sure you remove the right menuentry, I recommend making backups.

After that simply execute:

grub-mkconfig -o /boot/grub/grub.cfg

OR

update-grub
DarkBrave_ avatar
jp flag
How do I configure Grub if I can't access the operating system that is using that grub configuration?
SaleemKhair avatar
cn flag
On which bootloader you are seeing the empty ubuntu menu entry? You can manually change it by accessing the boot partition.
DarkBrave_ avatar
jp flag
When I remove /EFI/ubuntu/ from the System Reserved partition, there is still a blank entry on my UEFI boot menu that I get when I press F12 on startup. When I click on it, the computer just goes back to the boot menu.
SaleemKhair avatar
cn flag
What I mean is that the entry you see is defined in text, in a file, on the boot partition... so you can access it how ever you like....its not enough to just remove the folder, you need to remove the menu entry in that file
SaleemKhair avatar
cn flag
It specifies the name and path of the folder you removed, hence the error message and the fact that it redirect you to the boot menu
Score:0
jp flag

Okay, so after doing a bit of research, I couldn't find a definitive answer to fix these problems, but if you want to reinstall Ubuntu without getting the GRUB2 error I found a way to fix that.

After getting the error, reboot the computer, and enter the Live CD environment. This is because I've had issues unmounting the /target folder, so a reboot is an easy fix.

Then, install the Boot Repair app by using these commands:

sudo add-apt-repository ppa:yannubuntu/boot-repair
sudo apt-get update
sudo apt-get install -y boot-repair

After install it, run the app:

sudo  boot-repair

Make sure to go into advanced options and verify that the GRUB2 and operating system partition locations are correct, or else the app might not work correctly. Follow the instructions in the app until it says you are safe to reboot.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.