Re: Whole lot of dir's in /lib/modules - can I delete them?

Michael <[email protected]> Sun, 26 Apr 2026 17:10:33 +0100
Newsgroups gmane.linux.gentoo.user
Message-ID <5070256.GXAFRqVoOG@rogueboard>
On Sunday, 26 April 2026 16:52:30 British Summer Time 
[email protected] wrote:
> Dear all,
> Whilst doing a world update I happened to see that the nvidia driver
> was doing something in the dir "/lib/modules/7.0.1-gentoo-dist" - I am
> currently on 7.0.1. I thought "Just out of interest, I wonder what's
> in there". I went there and saw dirs:
> 
> 6.11.10-gentoo-dist
[snip ...]

> 6.19.9-gentoo-dist
> 7.0.1-gentoo-dist
> 
> All of these dir's take up approx 51GB of space. As I am on kernel
> 7.0.1, do I need all of these dir's? Can I basically do a "rm -r 6*"
> and blow them all away, except the current?
> 
> Any thoughts/enlightenment greatly appreciated,
> 
> 		Andrew

Whenever you build a kernel with various options built as modules [M], 
as opposed to building them in-kernel [*], the compiled modules are 
stored under /lib/modules/.

You can find all available modules of your current kernel with:

find /lib/modules/$(uname -r) -type f -name '*.ko*'

If you have cleared out old kernel images and initramfs files from your 
/efi/ or /boot/, then you have no use for their old module files hanging 
around in your /lib/modules/ and you can safely delete them manually to 
recover disk space.
signature.asc (application/pgp-signature, 870 B)
-----BEGIN PGP SIGNATURE-----

iQJPBAABCAA5FiEEXqhvaVh2ERicA8Ceseqq9sKVZxkFAmnuOPkbFIAAAAAABAAO
bWFudTIsMi41KzEuMTIsMiwyAAoJELHqqvbClWcZbOcQAIhbY/fnG89A02iybX8w
ZTfzvzLZUsnUXTdcBqcHe2lYEFYMqhbBz7rvg4y5/zDhNVj9YT5h9LnL0Roqq8Xe
BgROvTAxG/LWW6ViDUpXAcaUxXCDNgJ+VW9cvR6leZHLtXbGmeWp0hYI+L1mJ3hL
epmkkAS0DriSfmm2YONAVYPN/rJPRzllrAwgzIkeCifL0ITmZBdlEL6VBLdhmvkY
o9mbSTiQnPtDQWkf5HafUgwsm7v8vQ3nqsnntMvDOy6pkGhCixNM2uP9rEYGbcag
wUSiqhCKnDQ+T4q77fYK8xuoSlNoax4i6ho+lwkOnRpLIoI/vHdMrITkpxduAgx4
DSFXL2SsJ04Bo9Y+7NlEEVlq/OheOz5f+slLqR5vstaZSk9FR+7bB4X+xUYJY+Ck
fCs0ohukMbvTpmH2vhsAzE9IZeo8ZClffhExSAZB5QGjf/j0hIMPfYuYFUXFcl1R
BSC1JSuyo6hcXpvrB2LV6BH52oIv1132OmtFBSpGwui0DJ98+UilDWqrd0mR6AZt
DXSood5O8j5rVsmsHphuFpqx1aMf4kRNNrzfKTdGQcuNXH30p5taklGT/ZJFQ41h
IgkX/oEuq8hWLKhEM18UmWnGL/ANtlJGVIEquW7+uJ2EqZSFpEFAwAFq/Z30KbHt
5sRUmoVZ2Cqk7kpftIO6Cl5q
=od1R
-----END PGP SIGNATURE-----