0

I know that when you run localmodconfig, only the loaded modules are copied to the new configuration file and that is my problem.
For example, the sound card goes to sleep after about 30 seconds and so the module for the sound card gets unloaded and is not copied to the new config file, but there are also other modules that are unloaded and not teaken over to the new config file.

How can I transfer all needed modules into the config?
I've already tried the following:
Exported the output of lsmod to a file (mylsmod)

lsmod > /tmp/mylsmod

and executed it with the command

make LSMOD=/tmp/mylsmod localmodconfig

However, modules are still missing, because when running lsmod not all modules are loaded. I've run lsmod several times and each time I get a different result (lines in the file), sometimes it is 144 lines and another time 119 lines.

lsmod output screenshot

How do I get lsmod to include the unloaded modules in the file?

1 Answer 1

1

For example, the sound card goes to sleep after about 30 seconds and so the module for the sound card gets unloaded

It doesn't. Module unloading is not automatic on Linux – once something was loaded, it stays loaded until reboot, regardless of removing the physical device.

(More to that, the sound card's driver module is what puts the sound card to sleep and wakes it up in the first place. And an asleep sound card is still online – if it going to sleep meant the card disappeared entirely, that would mean your programs would have no way to interact with it. Thus even devices in power saving mode still need the driver modules to be loaded.)

The only time modules get removed is if you have something explicitly run rmmod or modprobe -r for some reason, or of course if you reboot.

How do I get lsmod to include the unloaded modules in the file?

You don't, it doesn't know what modules have been unloaded previously. A module either is loaded or isn't; there is no "has previously been loaded" state, and the reason for that is in the 1st part of the answer.

3
  • My sound card is the "Studio Evolution SE6X" when I run lsmod it is sometimes present in the config and other times not. Why?
    – Teso
    Commented Jun 9, 2021 at 14:04
  • According to the Linux kernel configuration file, modules can be unloaded -> Enable loadable module support (MODULES [=y]) -> Module unloading (MODULE_UNLOAD [=y]) -> Forced module unloading (MODULE_FORCE_UNLOAD [=n]).
    – Teso
    Commented Jun 9, 2021 at 14:23
  • Yeah, if you run rmmod. Not on their own. Commented Jun 9, 2021 at 14:26

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .