I generally recommend keeping at least two kernels for each Linux distribution. This is especially true when installing a new one; occasionally a new bug creeps in, or a filesystem error occurs, which causes a new kernel to not work. In such cases, having an older kernel around as a backup can greatly simplify recovery.
That said, you can limit the number of kernels on an Ubuntu system by doing:
sudo apt-get autoremove
This command will remove packages that were pulled in automatically by packages you've since removed. It will also remove all but two or three kernels, at least in most cases. (Sometimes it seems to leave more, but I'm not sure why.) It's possible to remove more kernels by using dpkg
, but that's a little more tedious. You can simply use rm
to delete kernels in /boot
, but that creates package/filesystem inconsistencies, which are generally best avoided. (Such issues won't cause your system to blow up, but they might cause warnings when adding or deleting packages in the future.)
FWIW, I'm rEFInd's developer, and a feature that I've been wanting to add for a while is one to "fold" multiple kernels in a single directory into one icon on the rEFInd menu. Such a feature would not address the problem of having too many kernels installed (and it can be a problem if you've got a separate /boot
partition), but it will help de-clutter the rEFInd menu. I hope to add this feature soon, but I can't make any promises about precisely when that will happen.
They can't test every single hardware setup and every set of programs with each possible configuration. New kernels are sometimes buggy. – gronostaj – 2015-07-15T15:51:58.447