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

Michael <[email protected]> Sun, 26 Apr 2026 20:35:06 +0100
Newsgroups gmane.linux.gentoo.user
Message-ID <2411862.ElGaqSPkdT@rogueboard>
On Sunday, 26 April 2026 18:10:10 British Summer Time 
[email protected] wrote:
> On 4/27/26 12:10 AM, Michael wrote:
> > On Sunday, 26 April 2026 16:52:30 British Summer Time
> > 
> > [email protected] wrote:
> >> Dear all,
> 
> [snip]
> 
> >> 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.
> 
> Thanks Michael, that's what I though. I've been using the prebuilt
> kernel, "-bin" for a while hence a whole lot of modules but have to
> get back to my own build which usually has stuff all built-in. And
> yes, I have been deleting stuff in /efi/EFI/Gentoo but didn't think
> of /lib/modules.
> 
> 	Thanks,
> 		Andrew

I tend to keep two or three previous kernels and their modules on my 
system at a time, just in case something goes wrong with the current 
kernel release.  I must admit I only had to revert to previous kernels 
rarely, because of bugs or a corrupt fs, so this is not a regular 
occurrence.  With disk space being relatively cheap it doesn't hurt to 
keep a the last couple of kernels and their modules, just in case.
signature.asc (application/pgp-signature, 870 B)
-----BEGIN PGP SIGNATURE-----

iQJPBAABCAA5FiEEXqhvaVh2ERicA8Ceseqq9sKVZxkFAmnuaOobFIAAAAAABAAO
bWFudTIsMi41KzEuMTIsMiwyAAoJELHqqvbClWcZvVcQAJl5jj2cwz0lRmRl1g/t
EXI3uccBJNJkdkaDidYF6PKqzR3XIUjgAP2py381FAjtl2GTh697nRKyqssrn7Cj
u4Px1aG1NeCvfqegaCQANM0H+c9zssk0n046esCBPfCEHc76JZM1uX0GdntMjX0g
pTjDJd+CBDUdkW21zaECXZM4+0ygYczdVCpLp6f+yBXxr0VyZo/A0/Q5oSRFOPzN
ygUvKyYwXyFDLRCba6BiHfSJVN6WKTDJ8xtoayMylC9MAoRN2xhr4wpg7PDqVrqg
eEDwaNrGlu6hsuL814ObLpSjvEyMox4+YMa0WVsg7hFPulEqKqASf/Vm4wnXus5+
ZK7MczTAb0CAnU+ygPLhJGy7iM/d/MORWaTDelXoEDQT07NsVOFhndgmZ4ktQYU1
A8fDwA0r4XoGZpmkEkupIUOdXW/r67Wn7RaWlBgLmlxitcYUzuNVQ8hhdaTDLJdM
smfdMa931t5Hh8BL4ZX1jfzyFx8UgsfDVrJK7SU+Q97mRam741Ake3HJj7moYeAO
XHnZWhh6vlzWo4XDXOsJr01CQf5X0qEJ1WgX/vQgLbg7ARVKSNO8TRIOv1RnTcYG
O4swvu/NiRRWQnejql3naRH3LvjMNrDaXgje8tAt7efz2EHpAJ3GlKdg+n0WCqmO
efkKMateVWdWH4ALIuWGnWiS
=rS/p
-----END PGP SIGNATURE-----