old kernel references are "stuck" in /etc/grub2.cfg and /etc/grub2-efi.cfg
After my last upgrade to F28 I noticed there are multiple kernel menu options listed on the grub boot loader that are no longer installed. I'm guessing these are leftovers from old Fedora major releases that aren't cleaned up after system upgrades (dnf system-upgrade
)
Here are the kernels that I have actually installed:
$ rpm -q kernel
kernel-4.17.2-200.fc28.x86_64
kernel-4.17.3-200.fc28.x86_64
kernel-4.17.4-200.fc28.x86_64
However, here I can see the kernels listed in /etc/grub2.cfg and /etc/grub2-efi.cfg:
$ sudo grep Fedora /etc/grub2.cfg | ruby -e 'STDIN.readlines.each do |l| puts l.match(/Fedora\s[^\)]+\)/) end'
Fedora (4.17.4-200.fc28.x86_64)
Fedora (4.17.3-200.fc28.x86_64)
Fedora (4.17.2-200.fc28.x86_64)
Fedora (4.16.9-300.fc28.x86_64)
Fedora (4.16.7-100.fc26.x86_64)
Fedora (4.14.16-200.fc26.x86_64)
09:54:55 [erick@lenobot:~]
$ sudo grep Fedora /etc/grub2-efi.cfg | ruby -e 'STDIN.readlines.each do |l| puts l.match(/Fedora\s[^\)]+\)/) end'
Fedora (4.17.4-200.fc28.x86_64)
Fedora (4.17.3-200.fc28.x86_64)
Fedora (4.17.2-200.fc28.x86_64)
Fedora (4.16.9-300.fc28.x86_64)
Fedora (4.16.7-100.fc26.x86_64)
Fedora (4.14.16-200.fc26.x86_64)
Fedora (0-rescue-2df438ba327a49f7ad5fd2367ebe5581)
Fedora (4.11.7-200.fc25.x86_64)
Looking in /boot I see these kernels (which matches the output of rpm -q kernel
):
$ ls /boot/ | grep '^vm'
vmlinuz-0-rescue-2df438ba327a49f7ad5fd2367ebe5581
vmlinuz-4.17.2-200.fc28.x86_64
vmlinuz-4.17.3-200.fc28.x86_64
vmlinuz-4.17.4-200.fc28.x86_64
I'm aware that grub2.cfg is generated from the scripts inside of /etc/grub.d/*, but being someone who changes grub configs only when necessary with a healthy fear/respect for fucking up my boot loader, how do I go about cleaning up these old references to the 4.16.x, 4.14.x, and 4.11.x kernels?
My system is the same way. Should we do something manually to fix this?