Hi Greg,

>> Just created a snapshot of my servers and then did:
>> apt autoremove
>> apt purge
>> apt clean
>> and I still have a working system so it will not just get rid of all 
>> installed packages. :-) But... I still also have all those folders in 
>> /usr/lib/modules

> It seems like you're just trying random commands without understanding what 
> they do.
Oh, I pretty much understood what they would do. ;-) Which is why I had no 
problem trying them just to see if they indeed did what I expected. And also to 
prove to all the others nothing earth shattering would happen. :-)

> "apt autoremove" will remove (not purge) packages
[....]
Thanks for the better explanation, that is what I understood as well.

> One imagines that if you simply purged all of the kernel packages that had 
> been autoremoved, this would clean up the modules. 
Yes, that would seem to be prudent but I also do not understand why the modules 
would be left behind? As far as I understand they are the module part of the 
kernel. Without the kernel they are useless. Why not treat them as part of the 
kernel. When I remove the kernel, remove the modules.

> But I'm not 100% sure about that.  If you've got modules that were built by 
> dkms for example, I don't know whether those would be removed.
As I use the apt and (apt-get) exclusively for package management I would like 
them to clean up what I do not need when I tell it to clean it up.

> It would be nice to know whether you had to do this "rm -r" because the "dpkg 
> --purge linux-image-5.10.0-16-amd64" failed to remove the modules, or whether 
> you simply did not KNOW to try the dpkg --purge first.

Look here:
------<Quote>---------------------
xxxxxx:~# cd /usr/lib/modules
xxxxxx:/usr/lib/modules# ll
total 56
drwxr-xr-x 2 root root 4096 Apr 19  2022 5.10.0-10-amd64
drwxr-xr-x 2 root root 4096 Apr 19  2022 5.10.0-11-amd64
drwxr-xr-x 2 root root 4096 Jun 17  2022 5.10.0-12-amd64
drwxr-xr-x 2 root root 4096 Jul 29  2022 5.10.0-13-amd64
drwxr-xr-x 2 root root 4096 Dec 12 07:40 5.10.0-15-amd64
drwxr-xr-x 2 root root 4096 Dec 12 07:40 5.10.0-16-amd64
drwxr-xr-x 3 root root 4096 Sep 17  2022 5.10.0-18-amd64
drwxr-xr-x 3 root root 4096 Nov  2  2022 5.10.0-19-amd64
drwxr-xr-x 3 root root 4096 Jan  3 16:51 5.10.0-20-amd64
drwxr-xr-x 3 root root 4096 Mar  3 09:40 5.10.0-21-amd64
drwxr-xr-x 3 root root 4096 Apr 29 13:18 5.10.0-22-amd64
drwxr-xr-x 2 root root 4096 Dec 13  2021 5.10.0-7-amd64
drwxr-xr-x 2 root root 4096 Jan 24  2022 5.10.0-8-amd64
drwxr-xr-x 2 root root 4096 Mar 11  2022 5.10.0-9-amd64
xxxxxx:/usr/lib/modules# dpkg --purge linux-image-5.10.0-7-amd64
(Reading database ... 57231 files and directories currently installed.)
Purging configuration files for linux-image-5.10.0-7-amd64 (5.10.40-1) ...
xxxxxx:/usr/lib/modules# ll
total 52
drwxr-xr-x 2 root root 4096 Apr 19  2022 5.10.0-10-amd64
drwxr-xr-x 2 root root 4096 Apr 19  2022 5.10.0-11-amd64
drwxr-xr-x 2 root root 4096 Jun 17  2022 5.10.0-12-amd64
drwxr-xr-x 2 root root 4096 Jul 29  2022 5.10.0-13-amd64
drwxr-xr-x 2 root root 4096 Dec 12 07:40 5.10.0-15-amd64
drwxr-xr-x 2 root root 4096 Dec 12 07:40 5.10.0-16-amd64
drwxr-xr-x 3 root root 4096 Sep 17  2022 5.10.0-18-amd64
drwxr-xr-x 3 root root 4096 Nov  2  2022 5.10.0-19-amd64
drwxr-xr-x 3 root root 4096 Jan  3 16:51 5.10.0-20-amd64
drwxr-xr-x 3 root root 4096 Mar  3 09:40 5.10.0-21-amd64
drwxr-xr-x 3 root root 4096 Apr 29 13:18 5.10.0-22-amd64
drwxr-xr-x 2 root root 4096 Jan 24  2022 5.10.0-8-amd64
drwxr-xr-x 2 root root 4096 Mar 11  2022 5.10.0-9-amd64
xxxxxx:/usr/lib/modules#

------<Quote>---------------------

So it seems using the dpkg --purge against the removed kernel version is the 
proper way(?) to get rid of the kernels.

But I still think this should be part of the apt autoremove for kernels. 
I understand there are circumstances where not al modules assigned to a kernel 
version are part of the kernel. But... would they be of any use when that 
kernel version is no longer installed?

Bonno Bloksma

Reply via email to