LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Debian (http://www.linuxquestions.org/questions/debian-26/)
-   -   Automatic removal of kernel headers package when kernel packages are removed (http://www.linuxquestions.org/questions/debian-26/automatic-removal-of-kernel-headers-package-when-kernel-packages-are-removed-693440/)

bgoodr 12-28-2008 10:21 AM

Automatic removal of kernel headers package when kernel packages are removed
 
As a follow-on to something Telemachos said in another post:

Quote:

Originally Posted by Telemachos (Post 3388803)
You can see what kernels you have installed - to check if you have a virtual kernel and to clean up - by running this command:
Code:

aptitude search ~ilinux-image
If you've been installing kernel-headers along with the kernels (say to build modules for graphics or wireless), you should remove those when you remove the corresponding kernel. The command to search for those is parallel:
Code:

aptitude search ~ilinux-headers
Hope this helps.

I would have thought that removing a given kernel package would trigger the removal of the older kernel headers. Can someone confirm that is, or is not, the behavior? I ask this because it seemed to me that the older kernel header packages were indeed removed when I removed some older kernel packages. For example, the linux kernels I have installed are:

Code:

dpkg-query --show --showformat='${Package}\n' linux-image-\*
linux-image-2.6
linux-image-2.6-amd64
linux-image-2.6.18-5-amd64
linux-image-2.6.18-6-amd64
linux-image-2.6.25-2-amd64
linux-image-2.6.26-1-amd64

Also, the linux-headers packages I have installed are:

Code:

dpkg-query --show --showformat='${Package}\n' linux-headers\*
linux-headers
linux-headers-2.6
linux-headers-2.6.25-2-amd64
linux-headers-2.6.25-2-common
linux-headers-2.6.26-1-amd64
linux-headers-2.6.26-1-common

So, when I get around to removing the linux-image-2.6.25-2-amd64 package like this:

Code:

apt-get remove linux-image-2.6.25-2-amd64
I would expect apt-get to automatically also remove linux-headers-2.6.25-2-amd64 and linux-headers-2.6.25-2-common. Is that what will happen, or do I need to explicitly state all three packages on the apt-get remove command?

Thanks,
bgoodr

the trooper 12-28-2008 12:19 PM

You will need to specify apt to remove the kernel headers as well.
Also for removing files,i tend to use the purge option rather than remove.
I would do it like this:

Code:

aptitude purge linux-image-2.6.25-2-amd64 linux-headers-2.6.25-2-amd64
This will remove all the files you want.
However if you use apt-get insteadof aptitude you will need to specify all dependencies you want to remove.

Code:

apt-get --purge remove linux-image-2.6.25-2-amd64 linux-headers-2.6.25-2-amd64  linux-headers-2.6.25-2-common
This is why i prefer to use aptitude instead of apt-get,because i find aptitude does a better job of removing dependencies.
Please note that this just my opinion,i am not trying to start an apt-get vs aptitude flame war.Use whichever works best for you.;)

Regards.
The trooper.

Telemachos 12-28-2008 12:51 PM

Just to follow up on one other thing from the other thread. The first two linux-image packages (copied below) are not kernels: they're the virtual/dummy packages I talked about in my previous thread. If you don't want kernels to automatically update, remove them.
Code:

linux-image-2.6
linux-image-2.6-amd64


bgoodr 12-30-2008 09:14 PM

Thanks to the both of you for your help!

bgoodr


All times are GMT -5. The time now is 12:03 PM.