public inbox for gentoo-user@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-user] Listing kernel modules
@ 2020-05-02 13:19 Peter Humphrey
  2020-05-02 13:29 ` Consus
  2020-05-02 13:40 ` Jack
  0 siblings, 2 replies; 5+ messages in thread
From: Peter Humphrey @ 2020-05-02 13:19 UTC (permalink / raw
  To: gentoo-user

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.





^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [gentoo-user] Listing kernel modules
  2020-05-02 13:19 [gentoo-user] Listing kernel modules Peter Humphrey
@ 2020-05-02 13:29 ` Consus
  2020-05-02 13:32   ` Consus
  2020-05-02 13:40 ` Jack
  1 sibling, 1 reply; 5+ messages in thread
From: Consus @ 2020-05-02 13:29 UTC (permalink / raw
  To: gentoo-user

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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [gentoo-user] Listing kernel modules
  2020-05-02 13:29 ` Consus
@ 2020-05-02 13:32   ` Consus
  2020-05-02 16:49     ` Peter Humphrey
  0 siblings, 1 reply; 5+ messages in thread
From: Consus @ 2020-05-02 13:32 UTC (permalink / raw
  To: gentoo-user

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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [gentoo-user] Listing kernel modules
  2020-05-02 13:19 [gentoo-user] Listing kernel modules Peter Humphrey
  2020-05-02 13:29 ` Consus
@ 2020-05-02 13:40 ` Jack
  1 sibling, 0 replies; 5+ messages in thread
From: Jack @ 2020-05-02 13:40 UTC (permalink / raw
  To: gentoo-user

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.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [gentoo-user] Listing kernel modules
  2020-05-02 13:32   ` Consus
@ 2020-05-02 16:49     ` Peter Humphrey
  0 siblings, 0 replies; 5+ messages in thread
From: Peter Humphrey @ 2020-05-02 16:49 UTC (permalink / raw
  To: gentoo-user

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.





^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-05-02 16:49 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-05-02 13:19 [gentoo-user] Listing kernel modules Peter Humphrey
2020-05-02 13:29 ` Consus
2020-05-02 13:32   ` Consus
2020-05-02 16:49     ` Peter Humphrey
2020-05-02 13:40 ` Jack

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox