How to remove a kernel from ubuntu? [duplicate]

If compiled and installed via make install, you will need to manually remove the following entries:

/boot/vmlinuz*KERNEL-VERSION*
/boot/initrd*KERNEL-VERSION*
/boot/System-map*KERNEL-VERSION*
/boot/config-*KERNEL-VERSION*
/lib/modules/*KERNEL-VERSION*/
/var/lib/initramfs/*KERNEL-VERSION*/

Then update the grub configuration:

sudo update-grub2

If compiled via the debian method, you can see the installed kernel with the following:

dpkg --list | grep kernel-image

And then uninstall the desired kernel package with apt-get:

sudo apt-get remove kernel-image-your-kernel-image

Thanks to jarno's question here I worked out a way of implementing Mudit Kapil's answer that requires very little typing and catches any extra bits lying around

Since all that is needed to remove the kernel is to delete all its files & directories, and all those files and directories will have the kernel release string in their paths, we can use locate to find all the files with the kernel release string and delete them to remove the kernel.

(First check uname -r to find the name of the currently running kernel & be sure not to delete it)

Say you want to remove a kernel called 4.4.6-my-kernel. You can find all its existing files & directories (without listing the files in all the named directories) with locate -b -e 4.4.6-my-kernel. Appending rm -r to this with xargs allows you to delete the files too. I add -p to make xargs display targets and ask for confirmation before executing

locate -b -e 4.4.6-my-kernel | xargs -p sudo rm -r

then type y to execute rm -r on the targets shown. It will complain that files that are not directories don't exist because you're trying to delete them recursively (-r) but that's OK, they will still be removed along with the directories and their contents. When done, just run

sudo update-grub

et voila.