[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: disk usage for /usr/lib on bullseye

On Fri, May 05, 2023 at 02:35:08PM +0000, Bonno Bloksma wrote:
> 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.

"apt autoremove" will remove (not purge) packages that meet various
criteria, which can be defined in /etc/apt/apt.conf.d/ configuration
files.  The intent is to have it do something sensible for the ordinary
user.  Among other things, it removes all but the two most recent
kernels, and it removes packages that no longer have anything depending
on them, and which are also not marked as manually installed.

"apt purge", as we've experimentally determined, seems to do nothing.

"apt clean" removes all of the cached *.deb files in /var/cache/apt/archives.
You may not HAVE any such files, if you've been using "apt" exclusively
(as opposed to "apt-get", which leaves the files behind).

> I am now cleaning some by hand. Running kernel -22 and having -21 as backup kernel I did:
> xxxxx:/usr/lib/modules# rm -rd 5.10.0-16-amd64/
> xxxxx:/usr/lib/modules# rm -rd 5.10.0-17-amd64/
> xxxxx:/usr/lib/modules# rm -rd 5.10.0-18-amd64/

One imagines that if you simply purged all of the kernel packages that
had been autoremoved, this would clean up 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.

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.

Reply to: