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

Re: removing modules

On 2021-07-03 at 12:50, mick crane wrote:

> I did think that modules are for the kernel to interact with
> hardware. There is for example "dell_smm_hwmon" followed "0" which
> you'd think was to be used by software for monitoring the PC
> hardware.
> I never used anything like that and wondered if there was some
> software that was installed that needed that module but I never used
> so it is "0" but if I used it it would change to "1".

No - the "0" means that there is nothing else which the kernel currently
knows A: is running and B: would fail if that module were not loaded.

The most likely reason for it to be installed is because you have
hardware which is capable of being managed by that module, and won't
work without that module. If you don't need to use the hardware, you
don't need the module and can probably safely remove it - but it's hard
to know which hardware components the various software you're running
may or may not be making use of.

> I looked because "apt upgrade" failed to install things in /boot
> because no room left. I deleted the oldest kernel stuff of the 3
> there and "apt upgrade" worked.

I hope you removed them by uninstalling their kernel packages, not by
just deleting the files from under /boot directly.

> I was thinking then to remove the unwanted modules to make the
> kernels smaller.

Kernel modules aren't actually stored inside the kernel on-disk. They're
normally found in a kernel-specific subdirectory underneath
/lib/modules/; the subdirectory name is the string which the kernel in
question would print if you ran the command 'uname -r'.

That said, if you have an initrd or initramfs stored under /boot, some
of the modules will probably be included in that. This isn't strictly
part of the kernel, but it does take up space on /boot, so it'd be
relevant to your considerations.

> There is for example a few filesystem modules like msdos which would
> be needed if I wanted to mount an msdos filesystem. Seem to remember
> "insmod" a module if and when needed.

Typically, for modules like that, they will be loaded on demand. They
don't generally get loaded during the boot process unless one of the
filesystems which the boot process needs is of that type, so they will
not always be included in the initrd / initramfs; as a result, leaving
them out will not necessarily reduce the space those files consume.

> If remove modules from kernel are the gone or are they still on disk
> and could be put back ?

If you remove them by 'modprobe -r' or 'rmmod', you mean? Yes - all that
does is tell the kernel to unload the module; it's loaded on demand from
the disk (by 'modprobe', 'insmod', or similar), from that location
underneath /lib/modules/, every time you boot and do something that
needs it.

   The Wanderer

The reasonable man adapts himself to the world; the unreasonable one
persists in trying to adapt the world to himself. Therefore all
progress depends on the unreasonable man.         -- George Bernard Shaw

Attachment: signature.asc
Description: OpenPGP digital signature

Reply to: