On 2021-07-03 17:29, The Wanderer wrote:
On 2021-07-03 at 12:06, mick crane wrote:

hello,
If I type "lsmod" there is a big list of modules with many followed by a
"0"
which I guess means they are not needed in the kernel ?

That depends what you mean by "needed".

As I understand matters, what that number being nonzero means is that
there's something else the kernel knows about (usually another module)
which won't work if this module isn't loaded. In order to unload this
module, you'll want to unload the other one first.

If the module is zero, that means that the kernel doesn't know of
anything other than that module which won't work unless the module is
present.

That doesn't mean that the module itself isn't needed, however. There
might be some functionality which you need which is provided directly by
that module, rather than by something which the kernel knows about and
considers to be "something else", but which won't work if the module
isn't loaded.

For example, if the driver for your network card is contained in a
module, then even if no other modules depend on that one, unloading the
module would mean your network card would stop functioning. If you need
your network to be functioning, that would mean that you still need the
module, even though there aren't any other modules (etc.) which depends
on it.

Does lsmod know about all installed software and if a module is
needed or does software have to be run first ?

As Reco suggested, you'll have to clarify this. Most of the time,
software does not require loading modules; it's most often hardware that
requires that.

If I don't need them can somebody remind me how I can remove modules
?

The command to run is 'modprobe -r MODULE_NAME'.

You can also do it with 'rmmod MODULE_NAME', but that's not usually the
best way; IIRC, modprobe includes smarts which rmmod doesn't.

Both of those commands need to be run as root in order to work.

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".
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 was thinking then to remove the unwanted modules to make the kernels smaller. 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.

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

mick

--
Key ID    4BFEBB31

Reply via email to