Removing old kernel entries in Grub [duplicate]
Open up a terminal (Ctrl+Alt+T).
Type
uname -r
. This will show you the kernel you're using currently, so you don't want to remove this.Run the following command:
dpkg --list | grep linux-image
. This will show the all the kernels that are installed.Note down the names of all the kernels which you want to remove.
To remove the kernels, run:
sudo apt-get purge linux-image-x.x.x.x-xyz
(replace the kernel name with an appropriate one).Update the GRUB:
sudo update-grub2
And, you're done.
Bonus: here's a little one-liner to do all that automatically:
sudo apt-get purge $( dpkg --list | grep -P -o "linux-image-\d\S+" | grep -v $(uname -r | grep -P -o ".+\d") )
I found what this problem was.
The issue was that, when I upgraded Ubuntu, by installing through a liveUSB instead of doing a normal upgrade, it left behind the old kernel files in the /boot folder.
Now that I have upgraded in the same way from 12.10 to 13.04, I encountered the same situation.
The solution is to manually delete all the files related to the old kernels in the /boot folder and run sudo update-grub
. The extra entries vanished.