Ubuntu: Remove/Uninstall old kernel images

To clean up your Ubuntu system it could reasonable to remove old kernels from time to time. For example, if you use a separate /boot partition which have in most cases only some 100MBs space a lot of the kernel images could result in no free disk space.

To list all kernels that are installed in the system use the following command

# dpkg --get-selections | grep linux-image

The output looks like this

linux-image-3.2.0-24-generic-pae                install
linux-image-3.2.0-25-generic-pae                install
linux-image-3.2.0-26-generic-pae                install
linux-image-generic-pae                         install

To find out what kernel the system is currently using us

# uname -r

To remove on of the old kernels us (DON’T remove the “linux-image-generic” package!)

# sudo aptitude purge [KERNEL-TO-REMOVE]

It is recommended to keep at least one old kernel version installed as backup in case of you have any problems with your current kernel.


Leave a Reply

Your email address will not be published. Required fields are marked *