How to handle grub on multi-boot systems?

Bo Berglund bo.berglund at gmail.com
Wed Oct 20 08:12:29 UTC 2021


I have installed Ubuntu 20.04 on a Lenovo PC, which had Windows 10 from the
factory.
I shrunk the Windows partition (from Windows) so it does not use up all of the
disk and gives room for Ubuntu. But I kept it in place so I can use Windows if
needed.

Then I installed Ubuntu 20.04 using a live USB made with Balena Etcher.
This created a dual boot Ubuntu installation again using all of the free
space...
And it also fixed the boot by putting a grub menu in the boot sequence where I
can select from a few entries with Ubuntu being default.

Next I booted to GParted Live and fixed the disk by shrinking the way too big
Ubuntu partition down to 30 GB.
I also copied another Ubuntu 18.04 server partition and its home partition to
the free space on the disk.

When I rebooted next I did see Ubuntu 20.04 on the boot menu and also Windows
but no  Ubuntu 18.

I started the Ubuntu 20.04 system and then I did this
sudo apt update
sudo apt full-upgrade
which I normally do.

In this case the end message was interesting:

...
Processing triggers for linux-image-5.11.0-38-generic (5.11.0-38.42~20.04.1) ...
/etc/kernel/postinst.d/initramfs-tools:
update-initramfs: Generating /boot/initrd.img-5.11.0-38-generic
/etc/kernel/postinst.d/zz-update-grub:
Sourcing file `/etc/default/grub'
Sourcing file `/etc/default/grub.d/init-select.cfg'
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-5.11.0-38-generic
Found initrd image: /boot/initrd.img-5.11.0-38-generic
Found linux image: /boot/vmlinuz-5.11.0-27-generic
Found initrd image: /boot/initrd.img-5.11.0-27-generic
Found Windows Boot Manager on /dev/nvme0n1p1@/EFI/Microsoft/Boot/bootmgfw.efi
Found Ubuntu 18.04.6 LTS (18.04) on /dev/nvme0n1p6
Found Ubuntu 18.04.6 LTS (18.04) on /dev/sda1
Adding boot menu entry for UEFI Firmware Settings

Notice how there is an update to the grub done!

So I rebooted to check this out and this is how the boot menu looked now:

*Ubuntu
Advanced options for Ubuntu
Windows Boot Manager (on /dev/nvme0n1p6)
Ubuntu 18.04.6 LTS (18.04) (on /dev/nvme0n1p6)
Advanced options for Ubuntu 18.04.6 LTS (18.04) (on /dev/nvme0n1p6)
Ubuntu 18.04.6 LTS (18.04) (on /dev/sda1)
Advanced options for Ubuntu 18.04.6 LTS (18.04) (on /dev/sda1)
UEFI Firmware Settings

As you can see it added the copied Ubuntu 18 as a boot entry (which is good).
But it also entered the same entry but from the USB attached backup drive I had
uysed when copying the old sustem over, but had not removed from the USB
connector...

QUESTIONS:
----------
1) How do I make the extraneous grub entry go away from the boot menu?

2) And how can I set which operating system is the default and listed on top?

3) How do I make the grub managed by one Ubuntu and not all of them?

I tried googling as usual but got to widely varying suggestions...


-- 
Bo Berglund
Developer in Sweden





More information about the ubuntu-users mailing list