How do I remove grub entries?

I’ve noticed for some time that I have way too many entries in my grub menu - about six from the previous version (31) and one from 30, and then three from 32. It’s not a big problem, because the system boots with the latest kernel, but I don’t know where to look to remove them.

I know grub.cfg is being generated each time a new kernel is installed/updated, but it should be limited to three versions, only that grub is showing SEVEN versions.

Here’s a photo I took: boot menu

And here are some things I checked:

[rama@rama ~]$ grep limit /etc/dnf/dnf.conf
installonly_limit=3
[rama@rama ~]$ rpm -qa kernel\* | sort -V
kernel-5.6.6-200.fc31.x86_64
kernel-5.6.6-300.fc32.x86_64
kernel-core-5.6.6-200.fc31.x86_64
kernel-core-5.6.6-300.fc32.x86_64
kernel-devel-5.6.6-200.fc31.x86_64
kernel-devel-5.6.6-300.fc32.x86_64
kernel-headers-5.6.6-300.fc32.x86_64
kernel-modules-5.6.6-200.fc31.x86_64
kernel-modules-5.6.6-300.fc32.x86_64
kernel-modules-extra-5.6.6-200.fc31.x86_64
kernel-modules-extra-5.6.6-300.fc32.x86_64
kernel-tools-5.6.6-300.fc32.x86_64
kernel-tools-libs-5.6.6-300.fc32.x86_64

How do I remove the extra entries left from older fedora versions?

according to your output of rpm -qa the limit of 3 isn’t reached (count the core packages)
accourding to your photo I guess there are leftovers under

/boot/loader/entries

you need to manual delete them (but be careful !).
the same goes for your rescue entries [1]. something like:

sudo rm -rfv /boot/*rescue*

afterwards you need to run

[ -d /sys/firmware/efi/efivars ] && sudo grub2-mkconfig -o /boot/efi/EFI/fedora/grub.cfg || sudo grub2-mkconfig -o /boot/grub2/grub.cfg

the lasting [2] cleanage is done via

sudo dnf remove kernel-core-5.6.6-200.fc31.x86_64 kernel-devel-5.6.6-200.fc31.x86_64

hint:
the kernel-core also removes (=> dependences)

  • kernel-*.f31 and
  • kernel-modules*.f31 and I guess
  • kernel-modules-extra*.f31 [1]
  • but not kernel-devel

[1]
I don 't have and need them.

[2]
NOT exact.
the question “why your boot menue looks like it looks (filleded up with aged entries)” isn’t complete cleared

2 Likes

This was it! Thanks a lot!

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.