Howto: Clean the grub boot menu
I’ve been running Various distros of Ubuntu linux for several years and have accumulated a long list of out of date kernels that I no longer use, this is not a problem except that I now want to add an extra boot option and don’t want disappearing to the end of the list, or having to search within the list for it.
Before starting this howto, please read it all and make sure you understand what is going on, I cannot be held responsible for anything bad that happens and there is a big chance of you breaking something if you do it wrong.
1. Backup the existing grub menu.
sudo cp /boot/grub/menu.lst /boot/grub/menu.lst-backup
2. Remove the old kernels and their supporting files.
Files starting with vmlinuz- are kernel files, there will also be files starting with abi-, initrd.img-, config- and System.map- for each kernel as well. My /boot folder, where kernels are stored for booting, had kernels dating from 2.6.12.
WARNING: Do not delete your current kernel or your computer will definitely not work.
Find out your current kernel version.
uname -r
My current kernel is 2.6.17 so I removed the ones lower than that.
sudo rm /boot/*2.6.12* /boot/*2.6.15*
3. Update grub’s menu.lst
sudo update-grub