$ dpkg –list | grep linux-image
# dpkg –list | grep linux-headers
ii linux-headers-3.11.0-13 3.11.0-13.20 all Header files related to Linux kernel version 3.11.0
ii linux-headers-3.11.0-13-generic 3.11.0-13.20 i386 Linux kernel headers for version 3.11.0 on 32 bit x86 SMP
ii linux-headers-generic 3.11.0.13.14 i386 Generic Linux kernel headers
ii linux-headers-generic-pae 3.11.0.13.14 i386 Transitional package
rc linux-image-extra-3.8.0-19-generic 3.8.0-19.30 amd64 Linux kernel image for version 3.8.0 on 64 bit x86 SMP
rc linux-image-extra-3.8.0-21-generic 3.8.0-21.32 amd64 Linux kernel image for version 3.8.0 on 64 bit x86 SMP
rc linux-image-extra-3.8.0-22-generic 3.8.0-22.33 amd64 Linux kernel image for version 3.8.0 on 64 bit x86 SMP
Note the “rc” and “ii” in the dpkg output.
rc – package removed, cnfig files remain
ii – package installed
In respect to ‘rc’ .. Removed but Config files remain:
While there is no built in way to remove all of your configuration information from your removed packages you can remove all configuration data from every removed package with the following command.
Code:
dpkg -l | grep ‘^rc’ | awk ‘{print $2}’ | xargs dpkg –purge
After I finished, I ran /usr/sbin/update-grub just to be safe.
I use this script to clear my kernels
#/bin/bash
ls /boot/ | grep vmlinuz | sed ‘s@vmlinuz-@linux-image-@g’ | grep -v `uname -r` > /tmp/kernelList
for I in `cat /tmp/kernelList`
do
aptitude remove $I
done
rm -f /tmp/kernelList
update-grub
Validation steps:
$ ls /boot/ | grep vmlinuz
vmlinuz-3.11.0-13-generic
vmlinuz-3.8.0-33-generic
$ ls /boot/ | grep vmlinuz | sed ‘s@vmlinuz-@linux-image-@g’
linux-image-3.11.0-13-generic
linux-image-3.8.0-33-generic
$ ls /boot/ | grep vmlinuz | sed ‘s@vmlinuz-@linux-image-@g’ | grep -v `uname -r`
linux-image-3.8.0-33-generic
$ uname -r
3.11.0-13-generic