Code Yarns ‍👨‍💻
Tech BlogPersonal Blog

How to remove old Linux kernels

📅 2015-Feb-25 ⬩ ✍️ Ashwin Nanjappa ⬩ 🏷️ kernel, linux, ubuntu tweak ⬩ 📚 Archive

20150225_kernel

Ubuntu updates Linux kernels almost every month. If you regularly update Ubuntu, you will end up with a lot of old Linux kernels.

A Linux kernel in Ubuntu is installed as four packages. They are listed here for kernel 3.13.0-43: linux-headers-3.13.0-43, linux-headers-3.13.0-43-generic, linux-image-3.13.0-43-generic and linux-image-extra-3.13.0-43-generic.

You can of course look up the latest kernel version using uname -r and then proceed to remove all the rest of the Linux kernel packages manually.

A great alternative is to use the purge-old-kernels tool. This removes all but the latest 2 kernels. Strangely, it is shipped along with the Byobu package, so you will need to install that to use it:

$ sudo apt install byobu
$ sudo purge-old-kernels

Another alternative that I like is to use Ubuntu Tweak tool. It can be installed easily, as described here.

In Ubuntu Tweak, go to Janitor -> System -> Old Kernel and you will be presented with all the Linux kernel packages on your system. The current kernel will not be included here, for obvious reasons. You can now pick and choose and select what you want to remove easily from here.

Tried with: Ubuntu Tweak 0.8.7 and Ubuntu 14.04


© 2023 Ashwin Nanjappa • All writing under CC BY-SA license • 🐘 Mastodon📧 Email