[gentoo-user] Listing kernel modules
Afternoon all, Is there a straightforward way of listing kernel modules that exist but haven't been loaded? I'm sure I have quite a number that I don't need, and I'd like to remove them from the kernel config. -- Regards, Peter.
Re: [gentoo-user] Listing kernel modules
On Sat, May 02, 2020 at 02:19:18PM +0100, Peter Humphrey wrote: > Afternoon all, > > Is there a straightforward way of listing kernel modules that exist > but haven't been loaded? This will do I guess: # lsmod | awk '{print $1}' > inserted # find /lib/modules/$(uname -r) -name '*.ko' -printf '%f\n' | sed 's/\.ko$//' > present # cat inserted present | sort -u
Re: [gentoo-user] Listing kernel modules
On Sat, May 02, 2020 at 04:29:38PM +0300, Consus wrote: > On Sat, May 02, 2020 at 02:19:18PM +0100, Peter Humphrey wrote: > > Afternoon all, > > > > Is there a straightforward way of listing kernel modules that exist > > but haven't been loaded? > > This will do I guess: > > # lsmod | awk '{print $1}' > inserted > # find /lib/modules/$(uname -r) -name '*.ko' -printf '%f\n' | sed > 's/\.ko$//' > present > # cat inserted present | sort -u Wait, no, replace the last line with: # cat inserted present | sort | uniq -u
Re: [gentoo-user] Listing kernel modules
On 5/2/20 9:19 AM, Peter Humphrey wrote: Afternoon all, Is there a straightforward way of listing kernel modules that exist but haven't been loaded? I'm sure I have quite a number that I don't need, and I'd like to remove them from the kernel config. How about just grepping for them under /lib/modules/version? In my case it would be *.ko.xz. Note that won't tell you about anything built in to the kernal you might want to remove. Otherwise, it's just a slow slog through make xconfig or make menuconfig. I suppose you could also grep through the kernel's .config file (or /proc/sys/config.gz) for "=m". In both cases, you probably still need to search to figure out where in the configuration that gets set.
Re: [gentoo-user] Listing kernel modules
On Saturday, 2 May 2020 14:32:22 BST Consus wrote: > On Sat, May 02, 2020 at 04:29:38PM +0300, Consus wrote: > > On Sat, May 02, 2020 at 02:19:18PM +0100, Peter Humphrey wrote: > > > Afternoon all, > > > > > > Is there a straightforward way of listing kernel modules that exist > > > but haven't been loaded? > > > > This will do I guess: > > # lsmod | awk '{print $1}' > inserted > > # find /lib/modules/$(uname -r) -name '*.ko' -printf '%f\n' | sed > > 's/\.ko$//' > present # cat inserted present | sort -u > > Wait, no, replace the last line with: > > # cat inserted present | sort | uniq -u Very good - thanks. Now I have a 183-line list of module names to go through. :( And of course, the module names differ from the corresponding config options. Still, it does give me some useful pointers to bunches of modules I specified to find out which one I needed. -- Regards, Peter.