Remove Grub2 boot entry?

I installed Leap 15.1 with the gnome desktop on my laptop which had Windows 10 on it. 10 was an “upgrade” from Windows 7 which is no longer on my system. I specifically wanted to have the system dual boot between 10 and Leap 15.1. This is not a UEFI system if that makes a difference.

I have three entries in the Grub2 boot menu:
Leap 15.1
Windows 10
Windows 7

If I select the 7 entry, it fails - which it should since 7 is no longer on the PC. The other two entries work without problems as I wanted.

I have searched around and I have not found anything recent that seems to describe how to delete unwanted or bad Grub2 boot menu entries. The boot screen itself has the edit option, however, it does not appear that I can delete an entry using that menu - and I really don’t know the emacs commands to do so. In the past, it appears that I could have gone into YaST to delete entries, but I have tried that and that method appears to be gone.

What is the preferred procedure to delete unwanted/bad entries from the Grub2 boot menu?

Thanks.

Yast-boot loader should allow removal I believe, but the reason Win7 is there is probably that there are still entries in the EFI boot partition (mounted at /bootEFI in Linux) Also there may be entries still hanging around in the UEFI flash memory, read **man efibootmgr **for detail on viewing adding and removing entries. Once the offending entries are removed in Yast-boot loader make a null edit ie change something and then change it back accept and it should drop the nonexistent OS. Be sure the prob foreign OS box is check. should be by default

You can try running

os-prober

I’m guessing that os-prober will still find Windows 7, and that’s why there is a menu entry.

Your alternatives:

  1. Remove all remnants of Windows 7, so that os-prober no longer finds it;
  2. Stop using os-prober. But then you will also lose the boot entry for Windows 10;
  3. Stop using os-prober, but manually add an entry for Windows 10 (perhaps in “/etc/grub.d/40_custom”);
  4. Learn to live with what you are seeing.

Personally, I would go with the last of those choices – because it is the easiest.

I agree! been there, tried some of that on a ‘converted to WIn10’ Windows 7 laptop. Too much trouble,and then when I did have what I thought was a success. next boot, Grub2 still had Windows 7 in the menu.

Live with what I am seeing? Oh no! That is far too much! lol!

I found the answer after a bit more searching.

What I did is go into the bootloader in YaST2 and get the partition of the Windows 7 entry. For me, it was /dev/sda2

The next thing I did was to open a terminal and run:

blkid

To get the UUID for the Win 7 partition.

The next thing I did was to edit /etc/default/grub and added the line

GRUB_OS_PROBER_SKIP_LIST=“MYUUID@/dev/sda2”

Where I replaced MYUUID with the UUID of the Windows 7 partition from blkid.

Then I ran in a terminal

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

On watching the output, I noted it said something like “Skipping Windows 7 on /dev/sda2 per user request.”

Then I went back into YaST2 bootloader and the Windows 7 entry was gone.

Thanks to these Remove windows 7 entry from grub - Super User and grub2 - update-grub ignoring some options in /etc/default/grub - Ask Ubuntu

Of course, others will have to adjust the parameters according to their system.

Thanks for all the replies.
:slight_smile:

Well thank you. I didn’t know about that.

I currently get two entries for Windows 7 – one for “/dev/sda2” and one for “/dev/sda3”. They both boot the same Windows 7. Maybe I should try that trick.

There is even more wisdom: Simple configuration:cool:

You’re welcome!

According to the grub docs for that parameter, you will need to separate both entries by a space.