Editing Grub Boot Menu

Ubuntu Support Template

Ubuntu Version: 22.04 LTS / Workstation
Desktop Environment (if applicable): GNOME

Problem Description: In all the years of using multi-boot setups I’ve never needed to edit grub until now. I have a new (old stock) laptop that came with Windows 10, and I first of all reduced this to a minimum installation. I then set about installing Ubuntu (vanilla, Workstation) as my prime OS, and two Ubuntu flavours. So far, so good, every thing was fine. Then I set up Fedora Workstation, which also booted fine. But, suddenly, my two Ubuntu flavours had turned into one, with one completely disappeared but its boot entries and partition assigned to the remaining flavour.

Also, Ubuntu Workstation now won’t update properly any more, especially the kernel updates. All told, I now want to remove all boot entries from Grub except the Windows Bootmanager one, as I have to preserve Windows because there’s no media and the activation code is built into the system. However, after getting the Grub manual and doing extensive searches on the topic here, while I got the basics of the job, backing up Grub first of course, going through the following commands in Terminal -

“sudo cp /boot/grub/grub.cfg /boot/grub/grub.cfg.bak”
“cd /etc/grub.d/”
“ls”
“sudo nano 30_os-prober”

And then I got a long list of texts that frankly were complete gobbledeegook to me, that in no way identified the boot menu entries, except for one paragraph with a fleeting reference to Windows Bootmanager.

End result, I’m stuck as to what to do or how. I include a copy of my Grub Boot Menu here -

GRUB V.2.12 (Menu)

Fedora Linux (6.16.10-200.fc42.x86_64) 42 (Workstation Edition)
Fedora Linux (6.16.7-200.fc42.x86_64) 42 (Workstation Edition)
Fedora Linux (6.16.3-200.fc42.x86_64) 42 (Workstation Edition)
Fedora Linux (0-Rescue-2d981b965f0545809faf485fe6290023) 42 (Workstation Ed.)
Ubuntu (on /dev/sda10)
Ubuntu, with Linux 5.15.0-143-generic (on /dev/sda10)
Ubuntu, with Linux 5.15.0-143-generic (Recovery Mode) (on /dev/sda10)
Ubuntu, with Linux 5.15.0-25-generic (on /dev/sda10)
Ubuntu, with Linux 5.15.0-25-generic (Recovery Mode) (on /dev/sda10)
Windows Boot Manager (on /dev/sda2)
Ubuntu (on /dev/sda8)
Ubuntu, with Linux 6.8.0-60-generic (on /dev/sda8)

(Fedora is on /dev/sda12)
Surely there must be a better/simpler way of getting rid of all the entries except the one for Windows Bootmanager.

Any help would be greatly appreciated, so that I can set about re-installing my Linux systems. This time perhaps best to start with Fedora. Nothing ever happened like this before, Fedora used to install just fine without interfering with anything. Upgrading it always went fine. With this troubled installation, it even insisted on making itself the default boot option!

Anyway, MTIA.

According to the entries, you have only one disc, designated /dev/sda

This is then split into partitions, one will be the EFI partition then a Microsoft reserved and then an NTFS Windows 10 partition.

You have then put various flavours of linux on the remaining space.

OK. Every flavour of an o/s have designers who believe theirs is the best thing since sliced bread and will attempt to take over the boot process in preference to any other. This is where things get interesting, there are some o/s’s that will write to the nand memory in your machine and rewrite the EFI entries to suit themselves.

Before doing anything else, go into your bios and see what is listed in the boot order. You will see that one o/s has re-ordered the boot order, and placed itself on the top. Just re-order it in the way in which you require, the first o/s you will want is probably the workstation one which is sda10

Grub is now managed by fedora, at boot select Ubuntu and do:
sudo grub-install and sudo update-grub and see if changes

Thanks for the reply. Yes, indeed the last one to be installed put itself as the default boot, and that’s Fedora Workstation on /dev/sda12. (It’s also created it’s own 1GB /boot partition ahead of sda12 as /dev/sda7. Not what I want at all. I wanted Ubuntu Workstation on /dev/sda8 as the default boot. Anyway, all mute points really as the 5 ‘Ubuntu’ (Mate) entries on /dev/sda10 are invalid due to having merged with menu entries that originally addressed /dev/sda9 Ubuntu Unity. So all those 5 sda10 menu entries had to go anyway, and I might as well re-install Ubuntu Workstation and Fedora Workstation as well, so I’d want a “clean slate” Grub Boot Menu with just the Windows bootmanager entry left. So there is no way around having to edit Grub somehow.

My advice would be to zap everything except windows and start again. If I were you I would just install one other, the workstation one which is what you seem to be most involved.
I would boot from an ubuntu stick, then use gparted to examine the partition layout. You will find an EFI an ms reserved an NTFS and an ms recovery partitions DO NOT REMOVE ANY OF THEM!!!

Just zap the rest.

Go into your bios and delete the linux entries in the boot menu.

Check windows works.

Then install workstation on a cleanish machine.

2 Likes

Thanks for that @corradoventu. That makes sense, Fedora having taken over Grub! I’ll try that. Still, it’s all going to have to come off of the Grub menu, apart from Windows Bootmanager entry. Then I can do a clean re-install of all the Linux OSs, installing them in reverse order and with the data partitions moved between them. So still need a way to edit the Grub Menu cleanly, somehow.

You don’t need to modify Grub menu, if you reinstall or format a partition doing update-grub grub will recognize the new situation.
I constantly install/reinstall new OS and never touch Grub, I only use grub-install and update-grub.

corrado@corrado-n3-rr-1101:~$ sudo lsblk -o NAME,LABEL,SIZE,FSTYPE -e7
NAME         LABEL         SIZE FSTYPE
sda                      465.8G 
├─sda1                     256M vfat
├─sda2                       8G swap
├─sda3       sharea         32G ext4
├─sda4       a4-debian      32G ext4
├─sda5       a5-lub-1109    32G ext4       <  Lubuntu
├─sda6       a6-xub-1109    32G ext4       < Xubuntu
└─sda7       datia       329.5G ext4
sdb                      465.8G 
├─sdb1       shareb         32G ext4
├─sdb2       b2-fedora43    32G ext4
└─sdb3       datib       401.8G ext4
sr0                       1024M 
nvme0n1                  465.8G 
├─nvme0n1p1                512M vfat
├─nvme0n1p2  n2-noble       40G ext4
├─nvme0n1p3  n3-rr-1101     40G ext4     < Ubuntu Resolute from ISO 1101
├─nvme0n1p4  n4-rr-1101     40G ext4     < Ubuntu Resolute from ISO 1101
├─nvme0n1p5  n5-questing    40G ext4
├─nvme0n1p6  n6-rr-1022     40G ext4     < Ubuntu Resolute from ISO 1022
├─nvme0n1p7  n7-rr-1024     40G ext4     < Ubuntu Resolute from ISO 1024
├─nvme0n1p8  n8-plucky      40G ext4
└─nvme0n1p10 dati        185.3G ext4
corrado@corrado-n3-rr-1101:~$
1 Like

Thank you for your reply, @vidtek99 . Zapping everything except Windows and starting again is the whole idea. Actually, there is another (small) Windows partition also, Windows RE Tools on /dev/sda1. Yes, I’ll leave those alone. /dev/sda2 is the EFI System Partition, presumably also to be left alone.

After getting rid of all that, presumably sudo update-grub should then clean up the Grub Boot Menu?

Thanks again @corradoventu - that’ll simplify things! :smile:

You also should keep in mind that each linux distribution has its own way of handling the bootloader setup … i.e. on Ubuntu you should never edit something like grub.cfg directly since all grub handling is done by scripts that the upgrade-grub command executes …

The update-grub command in turn is used by any packages that require changes to the bootloader setup (some app that needs a special kernel cmdline entry might call it as well as updates of the kernel package themselves etc) …

At the same time fedora might have a completely different mechanism to deal with this config but will have to update its own grub entries similarly to Ubuntu when it comes to newer kernels or changes to the kernel cmdline …

… so you end up with two systems battling over the sovereignty of grub and who owns it essentially … Ubuntu might deal with settings differently from fedora here …

2 Likes

Yes, every new install will impose itself as primary on the boot EFI menu.
As others have said you don’t need to touch the grub menu, each new o/s will overwrite the previous one installed. I personally think having four different o/s on one device is a recipe for things to go horribly wrong. As a suggestion, external devices with large capacities are relatively cheap, if it were me, I would restrict the main drive in your machine to a max of two o/s’s. I would then buy a couple of large (500gb or so) usb sticks and install any other systems on them. You can then choose via the machine’s efi menu at switch-on choose which o/s to boot via a key combination (usually f8 or f2 on most bios’s).

1 Like

@ogra - Thank you very much for your reply.

Yes, I’m well aware that grub.cfg should never be attempted to be edited directly. Hence I followed the instructions in the Grub Manual, as per my OP. (Never had any problem like this in all the years of multi-booting on a couple of machines, and everything’s still fine there.)

Yes, Fedora must have completely changed their Anaconda installer I’d guess as I never had a problem with it before. The thing is, I have a 4TB SATA SSSD so don’t really have any need for a separate drive - I could add a2nd internal one, or a USB one, but that would be wasting a lot of space on the 4TB drive! (I keep most of my data on a USB drive, just keeping a couple of partitions with a sub-set of my data on the primary drive.

Anyway, I think I’ll try the clean-up suggested by previous replies, and all being well then try re-installing, perhaps starting with Fedora and working my way up to my Prime OS, Ubuntu Workstation. Perhaps it’ll work. If not, I can always clean up again and perhaps put Fedora on a separate drive or stick.

Anyway, thanks for the detailed explanations. Yes, it looks like Ubuntu and Fedora deal with grub settings quite differently now. And if they end up battling over the sovereignty of Grub etc., in the end there’s no doubt here who’s going to be left out. :smiley:

@vidtek99 - Thanks again for this reply.

Oh, I have 5 OSs on one device in another machine with never a problem. :slight_smile: But I’ll consider a separate drive (either as 2nd internal - no problem fitting in DVD bay, or a USB one) for Fedora if I can’t get it to play ball with Ubuntu if necessary, and if that still gives problems then Fedora will have to go live on some sort of live system stick for this laptop. Alternatively, perhaps run it in a VM. Got plenty of space on the primary disk and will have other VMs anyway. It’s just, it’s never quite the same as running on metal.

In my PC on 3 different disk i have some Ubuntu of various versions, Xubuntu, Lubuntu Debian and Fedora.
All *buntu uses the same entry in /boot/efi/EFI while debian and fedora have separate entries:

corrado@corrado-n3-rr-1101:~$ ls /boot/efi/EFI
BOOT  Debian  fedora  ubuntu

I know what you mean, a VM doesn’t cut it for me either, stuff that runs perfectly on a VM usually fails on bare metal for any number of obscure reasons.

You do like to live dangerously. I would recommend QT-fsarchiver to you.

Just set windows to be the default and ignore the rest. Just rename the os_prober file to a lower number than the Linux one (with leading zero if needed)

Ah, yeah, the problem there is probably that Ubuntu flavours just ID as Ubuntu.

Funnily enough, I also have Debian on another machine. :slight_smile: Useful to keep up with the upstream. Also, I use TAILS sticks when I’m away.

Yeah, and occasionally, rarely really, I’ve also encountered the reverse, something running perfectly on bare metal failing in a VM. Weird, but it is what it is.

Been meaning to look into qt-fsarchiver but haven’t had time really so far. Well, what’s life without a bit of danger? :wink:

Based on what you have posted above, your Fedora install appears to be an LVM install with a separate /boot partition and when you installed it, it probably set itself to first boot priority in the BIOS. EFI installs don’t overwrite EFI entries (except Ubuntu and derivatives) they just put themselves first in boot order but not all do this.

If you mount and look at your EFI partition, you should see a number of directories there, on your system at least Boot, Microsoft, ubuntu and fedora and the EFI files for each system are in their respective directories. You can see the priority in EFI from your Linux system with: sudo efibootmgr command. As pointed out above, if you install Ubuntu or one of its major derivatives and then install another Ubuntu, it will overwrite the files on the EFI partition in the ubuntu directory. The information in your first post shows 2 entries for some Ubuntu on sda and sda10. Maybe you could post more details on the actual problem of being unable to update your Ubuntu Workstation, is that and actual Ubuntu or a derivative and which release version? You might get the boot repair software and run it but only if you use the Create BootInfo Summary option and then review the output. Or you could post the link here as it will give a lot of information on your speciific hardware.

https://help.ubuntu.com/community/Boot-Repair

Yes, all Ubuntu flavours just ID as Ubuntu but this is NOT a problem.
All my *buntu 26.04 are listed as “Ubuntu Resolute Raccoon (development branch) (26.04)”
also for Lubuntu and Xubuntu but at reboot i can select the one i want.

corrado@corrado-n3-rr-1101:~$ sudo update-grub
[sudo: authenticate] Password:
Sourcing file /etc/default/grub' Sourcing file /etc/default/grub.d/kdump-tools.cfg’
Generating grub configuration file …
Found background image: puffin-n3.png
Found linux image: /boot/vmlinuz-6.17.0-5-generic
Found initrd image: /boot/initrd.img-6.17.0-5-generic
Found memtest86+ 64bit EFI image: /boot/memtest86+x64.efi
Found memtest86+ 32bit EFI image: /boot/memtest86+ia32.efi
Found memtest86+ 64bit image: /boot/memtest86+x64.bin
Found memtest86+ 32bit image: /boot/memtest86+ia32.bin
Warning: os-prober will be executed to detect other bootable partitions.
Its output will be used to detect bootable binaries on them and create new boot entries.
Found Ubuntu 24.04.3 LTS (24.04) on /dev/nvme0n1p2
Found Ubuntu Resolute Raccoon (development branch) (26.04) on /dev/nvme0n1p4
Found Ubuntu 25.10 (25.10) on /dev/nvme0n1p5
Found Ubuntu Resolute Raccoon (development branch) (26.04) on /dev/nvme0n1p6
Found Ubuntu Resolute Raccoon (development branch) (26.04) on /dev/nvme0n1p7
Found Ubuntu 25.04 (25.04) on /dev/nvme0n1p8
Found Debian GNU/Linux forky/sid on /dev/sda4
Found Ubuntu Resolute Raccoon (development branch) (26.04) on /dev/sda5
Found Ubuntu Resolute Raccoon (development branch) (26.04) on /dev/sda6
Found Fedora Linux 43 (Workstation Edition) on /dev/sdb2
Adding boot menu entry for UEFI Firmware Settings …
Found grml-rescueboot ISO image: /home/corrado/Downloads//lubuntu-1109.iso
Found grml-rescueboot ISO image: /home/corrado/Downloads//xubuntu-1109.iso
done