Getting rid of Ubuntu old core versions in Grub

The reason for this post is hilarious. In my life time I installed and over installed Ubuntu for period of times, but every time I had to ask my buddy or Google about removing annoying old Ubuntu core versions from Grub configs and from /boot directory. Well, now I will describe those two simple steps for those who have same problem as I did.

First Step: Remove old core files

Actually the order of those steps doesn't change anything, but logicaly I see it like this.

NB! I have to confess I didn't remove those files I just moved them to another place where I have more free space, but it's for you to deside what to do with them.

  • Open your /boot directory. There you will see all those core files.

  • Next I just moved old versions to other directory. Last time I had those versions: 2.6.32-21, 2.6.32-22, 2.6.32-23, 2.6.32-24. My current and I think newest version is 2.6.32-24. For safety purposes I leave to last versions: *23, *24.

  • If you wish to store those old versions create some folder. I would recommend $USER directory. (Optional)

  • If you chose step above, then do the following (in my case it was):
    sudo mv /boot/*2.6.32-21* /home/$USER/dir/
    If you want to delete those files, then do following:
    sudo rm -f /boot/*2.6.32-21*

Second Step: Edit grub.cfg (or menu.lst)

  • Since I have grub.cfg I will describe how to edit it. Open /boot/grub/grub.cfg from terminal gksudo gedit /boot/grub/grub.cfg.

  • Between this line
    ### BEGIN /etc/grub.d/10_linux ###
    and this
    ### END /etc/grub.d/10_linux ###
    you will find all those versions you see in "Grub Loader".

  • Find the versions you deleted or moved and delete those lines or comment them ###.

Conclusion

As you could see those steps where easy as "a b c". Still if you have any questions ask them in comments or @netjunky.