Score:0

How to clean up duplicate entries in GRUB?

nr flag

I want to clean up the entries in GRUB on Ubuntu 22.04 since there are a lot of duplicates:

Here's a screenshot of the GRUB menu:

photo of screen showing GRUB menu

Everything seems to be listed twice.

I already ran apt-get autoremove --purge, but there was nothing to remove. Here's the output of update-grub2:

Sourcing file `/etc/default/grub'
Sourcing file `/etc/default/grub.d/init-select.cfg'
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-5.15.0-71-generic
Found initrd image: /boot/initrd.img-5.15.0-71-generic
Found linux image: /boot/vmlinuz-5.4.0-147-generic
Found initrd image: /boot/initrd.img-5.4.0-147-generic
Found linux image: /boot/vmlinuz-3.5.0-54-generic
Found initrd image: /boot/initrd.img-3.5.0-54-generic
Found linux image: /boot/vmlinuz-3.5.0-23-generic
Found initrd image: /boot/initrd.img-3.5.0-23-generic
Found linux image: /boot/vmlinuz-5.15.0-71-generic
Found initrd image: /boot/initrd.img-5.15.0-71-generic
Found linux image: /boot/vmlinuz-5.4.0-147-generic
Found initrd image: /boot/initrd.img-5.4.0-147-generic
Found linux image: /boot/vmlinuz-3.5.0-54-generic
Found initrd image: /boot/initrd.img-3.5.0-54-generic
Found linux image: /boot/vmlinuz-3.5.0-23-generic
Found initrd image: /boot/initrd.img-3.5.0-23-generic
Found memtest86+ image: /boot/memtest86+.elf
Found memtest86+ image: /boot/memtest86+.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 Windows 10 on /dev/sda1
Found Windows 10 on /dev/sda1
Found linux image: /boot/vmlinuz-5.15.0-71-generic
Found initrd image: /boot/initrd.img-5.15.0-71-generic
Found linux image: /boot/vmlinuz-5.4.0-147-generic
Found initrd image: /boot/initrd.img-5.4.0-147-generic
Found linux image: /boot/vmlinuz-3.5.0-54-generic
Found initrd image: /boot/initrd.img-3.5.0-54-generic
Found linux image: /boot/vmlinuz-3.5.0-23-generic
Found initrd image: /boot/initrd.img-3.5.0-23-generic
Found Windows 10 on /dev/sda1
Found linux image: /boot/vmlinuz-5.15.0-71-generic
Found initrd image: /boot/initrd.img-5.15.0-71-generic
Found linux image: /boot/vmlinuz-5.4.0-147-generic
Found initrd image: /boot/initrd.img-5.4.0-147-generic
Found linux image: /boot/vmlinuz-3.5.0-54-generic
Found initrd image: /boot/initrd.img-3.5.0-54-generic
Found linux image: /boot/vmlinuz-3.5.0-23-generic
Found initrd image: /boot/initrd.img-3.5.0-23-generic
Found memtest86+ image: /boot/memtest86+.elf
Found memtest86+ image: /boot/memtest86+.bin
Found linux image: /boot/vmlinuz-5.15.0-71-generic
Found initrd image: /boot/initrd.img-5.15.0-71-generic
Found linux image: /boot/vmlinuz-5.4.0-147-generic
Found initrd image: /boot/initrd.img-5.4.0-147-generic
Found linux image: /boot/vmlinuz-3.5.0-54-generic
Found initrd image: /boot/initrd.img-3.5.0-54-generic
Found linux image: /boot/vmlinuz-3.5.0-23-generic
Found initrd image: /boot/initrd.img-3.5.0-23-generic
done

And here is a list of of /etc/grub.d/:

-rwxr-xr-x 1 root root 10627 Dez  2 16:20 00_header
-rwxr-xr-x 1 root root  6260 Dez  2 16:18 05_debian_theme
-rwxr-xr-x 1 root root  1408 Mär  7  2020 06_linux_proxy
-rwxr-xr-x 1 root root 18683 Dez  2 16:18 10_linux
-rwxr-xr-x 1 root root 43031 Dez  2 16:18 10_linux_zfs
-rwxr-xr-x 1 root root 14180 Dez  2 16:18 20_linux_xen
-rwxr-xr-x 1 root root  2924 Feb  6  2022 20_memtest86+
-rwxr-xr-x 1 root root 13369 Dez  2 16:18 30_os-prober
-rwxr-xr-x 1 root root   188 Mär  7  2020 30_os-prober_proxy
-rwxr-xr-x 1 root root  1372 Dez  2 16:18 30_uefi-firmware
-rwxr-xr-x 1 root root  1448 Mär  7  2020 31_linux_proxy
-rwxr-xr-x 1 root root   188 Mär  7  2020 32_os-prober_proxy
-rwxr-xr-x 1 root root  1448 Mär  7  2020 33_linux_proxy
-rwxr-xr-x 1 root root 11298 Nov 11  2019 34_linux_xen
-rwxr-xr-x 1 root root   700 Jul  3  2022 35_fwupd
-rwxr-xr-x 1 root root  1992 Mär 12  2014 35_memtest86+
-rwxr-xr-x 1 root root  1418 Mär 22  2019 36_uefi-firmware
-rwxr-xr-x 1 root root   214 Jan 22  2013 40_custom
-rwxr-xr-x 1 root root   215 Dez  2 16:18 41_custom
-rwxr-xr-x 1 root root  1448 Mär  7  2020 42_linux_proxy
drwxr-xr-x 4 root root  4096 Okt  3  2014 backup
drwxr-xr-x 2 root root  4096 Okt  3  2014 bin
drwxr-xr-x 2 root root  4096 Mär  7  2020 proxifiedScripts
-rw-r--r-- 1 root root   483 Jan 22  2013 README

Can someone tell me where these duplicates come from and how I get rid of them?

Nmath avatar
ng flag
How did you originally install all of these multiple kernel versions? You've got several versions of kernel 3.5, kernel 5.4, and kernel 5.15. This is not normal and shouldn't exist unless you did something. Can you describe what that was?
Jakob avatar
nr flag
I've recently updated from 18.04 to 20.04 to 22.04, before tthat he grub menu was nice and tidy. I can't remeber anything else that could have caused this mess.
oldfred avatar
cn flag
You have duplicate scripts. At some point you installed Grub-Customizer or files with proxy in the name. Normally a total reinstall of grub erases script partition, but upgrade must have assumed it was over writing default grub files & left proxy files creating duplicates. I would just erase /etc/grub.d & totally reinstall grub. Make sure you have working live installer as once erased, you will not be able to reboot until grub re-installed. If you have edited 40_custom, be sure to save backup.
I sit in a Tesla and translated this thread with Ai:

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.