You are not logged in.

#1 2013-04-04 22:51:09

chord
Member
Registered: 2012-11-07
Posts: 121

lsmod output: why so many modules loaded?

I've done system update and run lsmod to look what modules are loaded. I wondering why so many modules loaded - 60?

[root@arch archer]# lsmod
Module                  Size  Used by
des_generic            16203  0 
ecb                     2105  0 
md4                     3529  0 
sha256_generic         10197  1 
md5                     2345  2 
hmac                    2953  2 
nls_utf8                1352  2 
cifs                  340876  3 
fscache                44984  1 cifs
snd_hda_codec_hdmi     27848  4 
snd_hda_codec_realtek    62745  1 
snd_hda_intel          34194  4 
snd_hda_codec         102453  3 snd_hda_codec_realtek,snd_hda_codec_hdmi,snd_hda_intel
nvidia               9122517  38 
snd_hwdep               6428  1 snd_hda_codec
i2c_i801               11077  0 
snd_pcm                78146  3 snd_hda_codec_hdmi,snd_hda_codec,snd_hda_intel
acpi_cpufreq           10630  1 
mperf                   1267  1 acpi_cpufreq
coretemp                6198  0 
kvm                   392222  0 
crc32c_intel           14313  0 
ghash_clmulni_intel     4597  0 
r8169                  57619  0 
iTCO_wdt                5447  0 
pcspkr                  1995  0 
iTCO_vendor_support     1929  1 iTCO_wdt
processor              27431  1 acpi_cpufreq
shpchp                 25905  0 
snd_page_alloc          7426  2 snd_pcm,snd_hda_intel
cryptd                  8741  1 ghash_clmulni_intel
gpio_ich                4608  0 
pci_hotplug            23116  1 shpchp
evdev                  10136  6 
mei                    59991  0 
i2c_core               23171  2 i2c_i801,nvidia
lpc_ich                11601  0 
mii                     4091  1 r8169
snd_timer              18934  1 snd_pcm
snd                    60156  15 snd_hda_codec_realtek,snd_hwdep,snd_timer,snd_hda_codec_hdmi,snd_pcm,snd_hda_codec,snd_hda_intel
button                  4701  0 
soundcore               5442  1 snd
microcode              14465  0 
ext4                  478338  1 
crc16                   1359  1 ext4
jbd2                   78013  1 ext4
mbcache                 6026  1 ext4
hid_a4tech              2212  0 
usbhid                 41357  0 
hid                    87118  2 hid_a4tech,usbhid
sd_mod                 31258  2 
ahci                   22160  1 
libahci                20906  1 ahci
libata                168683  2 ahci,libahci
ehci_pci                4120  0 
xhci_hcd               89405  0 
scsi_mod              130797  2 libata,sd_mod
ehci_hcd               47467  1 ehci_pci
usbcore               175029  4 ehci_hcd,ehci_pci,usbhid,xhci_hcd
usb_common               954  1 usbcore

For comparison my Gentoo (running without initramfs) loading 15 modules only.  Is it because of using initramfs on Arch or something else? Or may be it is default configuration that could be reduced? If yes, what is the best way to do it: just add unneccessary modules to blacklist or reconfigure and rebuild kernel?

Any suggestions?

Offline

#2 2013-04-05 01:00:29

hadrons123
Member
From: chennai
Registered: 2011-10-07
Posts: 1,249

Re: lsmod output: why so many modules loaded?

just add unnecessary modules to blacklist or reconfigure and rebuild kernel?

Yes.

Offline

#3 2013-04-05 01:27:19

chord
Member
Registered: 2012-11-07
Posts: 121

Re: lsmod output: why so many modules loaded?

hadrons123 wrote:

just add unnecessary modules to blacklist or reconfigure and rebuild kernel?

Yes.

which one? roll blacklist or rebuild?

Offline

#4 2013-04-05 01:46:26

hadrons123
Member
From: chennai
Registered: 2011-10-07
Posts: 1,249

Re: lsmod output: why so many modules loaded?

Find the modules that your PC will need and compile the kernel with only those modules. This thread helped me.
https://bbs.archlinux.org/viewtopic.php?id=142666

Offline

#5 2013-04-05 02:05:52

chord
Member
Registered: 2012-11-07
Posts: 121

Re: lsmod output: why so many modules loaded?

thanks for link.
If I will rebuild kernel, could I use my gentoo's kernel config that was built without initramfs? Do not want to configure once more.

Offline

#6 2013-04-05 02:32:39

hadrons123
Member
From: chennai
Registered: 2011-10-07
Posts: 1,249

Re: lsmod output: why so many modules loaded?

I hope so. I never tried gentoo though.

Offline

#7 2013-04-05 03:14:19

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 20,612

Re: lsmod output: why so many modules loaded?

On Gentoo, you compile your own kernel and often target it at your machine.  You build in the modules that are critical to the operation of the system, and only make loadable modules of the ones you might not want at start up; for example, all of the USB things you might want sometimes, but not at every boot.

On distributions such as Arch, there is the need to have a kernel that is compatible with countless permutations of processors, video cards, network cards, bridges, USB hubs, disk controllers, LPC buses, etc,,,  The kernel needs to be able to pick the parts it needs dynamically.


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
The shortest way to ruin a country is to give power to demagogues.— Dionysius of Halicarnassus
---
How to Ask Questions the Smart Way

Offline

#8 2013-04-05 09:14:11

chord
Member
Registered: 2012-11-07
Posts: 121

Re: lsmod output: why so many modules loaded?

Thanks for explanation. I followed the link above and I think localmodconfig should be a good start point. Going to try it.

Offline

#9 2013-04-05 09:32:19

tomk
Forum Fellow
From: Ireland
Registered: 2004-07-21
Posts: 9,839

Re: lsmod output: why so many modules loaded?

What are your concerns about the number of loaded modules?

Offline

#10 2013-04-05 10:08:48

chord
Member
Registered: 2012-11-07
Posts: 121

Re: lsmod output: why so many modules loaded?

tomk wrote:

What are your concerns about the number of loaded modules?

The first reason: I am minimalist and I dislike to have things, that I do not need. Otherwise I would have used some bloated distro like OpenSUSE or Fedora.
The second reason: I want to shred my kernel. Just for fun. lol

Offline

#11 2013-04-05 11:11:39

Gusar
Member
Registered: 2009-08-25
Posts: 3,607

Re: lsmod output: why so many modules loaded?

chord wrote:

I am minimalist and I dislike to have things, that I do not need.

But you do need that stuff. That's why it got loaded. If you compile your own kernel, it'll still be loaded. It'll just be part of the kernel itself, instead of a module. "Out of sight, out of mind" is a powerful thing, innit? smile

Your second reason is much more valid - nothing wrong with hacking for the sake of hacking. There are weirder hobbies out there smile.

Offline

#12 2013-04-05 13:20:57

chord
Member
Registered: 2012-11-07
Posts: 121

Re: lsmod output: why so many modules loaded?

I've built new kernel right now and booted into the CLI. CLI seems as working good. But I can't access my kde. Tried to run startkde but got an error: '$DISPLAY is not set or cannot connect to X server'. Should I rebuild nvidia? If yes, will the old kernel be able to work with rebuilt nvidia driver?

Offline

#13 2013-04-05 14:38:17

anonymous_user
Member
Registered: 2009-08-28
Posts: 3,059

Re: lsmod output: why so many modules loaded?

You can have multiple nvidia packages (just give them unique names), one for each kernel iirc.

Offline

#14 2013-04-05 14:56:42

chord
Member
Registered: 2012-11-07
Posts: 121

Re: lsmod output: why so many modules loaded?

Hmm, when I building a kernel, I can give him a name  in config, but how can I rename nvidia driver?

Offline

#15 2013-04-05 14:57:51

anonymous_user
Member
Registered: 2009-08-28
Posts: 3,059

Re: lsmod output: why so many modules loaded?

You make a PKGBUILD for the new nvidia driver. Check out the numerous nvidia- packages in AUR to see what I mean.

Offline

#16 2013-04-05 15:32:32

chord
Member
Registered: 2012-11-07
Posts: 121

Re: lsmod output: why so many modules loaded?

OK, thanks, I've read PKGBUILD from AUR nvidia-all. I assuming makepkg should detect all the kernels and build separate driver for every found kernel.
So I going to ruin my system lol

P.S.
Failed.

==> Making package: nvidia-all 313.26-2
==> Checking runtime dependencies...
==> Installing missing dependencies...
error: target not found: nvidia-utils=313.26
==> ERROR: 'pacman' failed to install missing dependencies.

when trying to install nvidia-utils=313.26 pacman says that 313.30 already installed and asks for reinstall. Should I allow to reinstall/downgrade nvidia-utils?

Added:
I didn't did downgrade nvidia, just edited PKGBUILD: changed version to current release version number and built it by 'makepkg -si'. Not errors was reported. But can't start kde anyway. 'modprobe nvidia' says: FATAL: module nvidia not found. Where this module was installed?

Last edited by chord (2013-04-05 18:07:06)

Offline

#17 2013-04-06 01:54:51

hadrons123
Member
From: chennai
Registered: 2011-10-07
Posts: 1,249

Re: lsmod output: why so many modules loaded?

What error your xorg.o.log say?

Offline

#18 2013-04-06 11:28:09

chord
Member
Registered: 2012-11-07
Posts: 121

Re: lsmod output: why so many modules loaded?

No problem with xorg. Something wrong in custom kernel modules tree or aub/abs PKGBUILD.  May be both are wrong. Not sure.
After aur I tried abs - way with the same problem. NVidia module not found. But module was built, I can found them and load with insmod /full/path/to/module. I realized that nodprobe looking for module in a wrong directory. Did some research and saw that default kernel has a bit different modules directories structure than custom kernel. I tried to organize custom kernel's modules tree like a default kernel tree, but this doesnt helped.
So I removed all the aur/abs crap and installed nvidia module in old good nvidia way:

sh NVIDIA-Linux-x86_64-313.30-no-compat32.run

Now module placed into appropriate directory and I can boot into KDE.
Here the difference:

[archer@arch ~]$ ls -l /usr/lib/modules/3.8.5-1-ARCH/kernel/drivers/video/
drwxr-xr-x 2 root root  4096 мар 29 22:21 backlight
-rw-r--r-- 1 root root  1518 мар 29 22:21 fb_sys_fops.ko.gz
-rw-r--r-- 1 root root  2186 мар 29 22:21 output.ko.gz
-rw-r--r-- 1 root root  9027 мар 29 22:21 sstfb.ko.gz
-rw-r--r-- 1 root root  2955 мар 29 22:21 syscopyarea.ko.gz
-rw-r--r-- 1 root root  2973 мар 29 22:21 sysfillrect.ko.gz
-rw-r--r-- 1 root root  2186 мар 29 22:21 sysimgblt.ko.gz
-rw-r--r-- 1 root root 13435 мар 29 22:21 udlfb.ko.gz
-rw-r--r-- 1 root root 14557 мар 29 22:21 uvesafb.ko.gz
-rw-r--r-- 1 root root  4067 мар 29 22:21 vfb.ko.gz
-rw-r--r-- 1 root root  8929 мар 29 22:21 vga16fb.ko.gz
-rw-r--r-- 1 root root  5042 мар 29 22:21 vgastate.ko.gz
drwxr-xr-x 2 root root  4096 мар 29 22:21 via
-rw-r--r-- 1 root root  6350 мар 29 22:21 xen-fbfront.ko.gz
[archer@arch ~]$ ls -l /usr/lib/modules/3.8.5-ARCH-CK0/kernel/drivers/video/
-rw-r--r-- 1 root root 12530768 апр  6 03:16 nvidia.ko

Default kernel's module located in /usr/lib/modules/extramodule-3.8-ARCH directory.
AUR/ABS PKGBUILD builds module and puts him into /usr/lib/modules/extramodule-3.8.5-ARCH-CK0 directory. It is a wrong place. Should be /usr/lib/modules/3.8.5-ARCH-CK0/kernel/drivers/video/

So this problem fixed.

Returning to the number of modules.
I started my customization from make localmodconfig point.  It gave me .config file that was noticeable smaller than default .config (88Kb instead of 144Kb). Kernel and initramfs was reduced also. But loaded modules count wasn't reduced. Moreover I got 63 modules loaded (default kernel loads 60). I ran make menuconfig and shreded .config again. A bunch of options was banned. Now I have 51 modules loaded. It is too much.
I'm pretty sure I no need a bunch of loaded modules (des_generic, ecb, md4, hmac, sha256_generic and so on). I not blacklisted them yet, trying to remove them by kernel configuration. I want to build kernel without initramfs (since I have only root partition, no separate /usr or /home or /boot), may be it helps.

Offline

#19 2013-04-06 15:51:06

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 20,612

Re: lsmod output: why so many modules loaded?

As a aside, one of the niceties of a custom kernel is that you can bake in all of the modules you need to boot.  You can set it up such that you do not need an initramfs at all.

You might browse over to http://kernel-seeds.org/.  The guy who runs this is active is famous on the Gentoo forums as pappy_mcfae.  He is their expert on how to configure a kernel. 

Also, see this Gentoo forum thread

Last edited by ewaller (2013-04-06 15:51:28)


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
The shortest way to ruin a country is to give power to demagogues.— Dionysius of Halicarnassus
---
How to Ask Questions the Smart Way

Offline

#20 2013-04-06 15:57:06

hadrons123
Member
From: chennai
Registered: 2011-10-07
Posts: 1,249

Re: lsmod output: why so many modules loaded?

The worst thing about the custom kernel is every week there is a kernel update and I have to compile it again. But compiling is fun only if you have the fastest computer.

Offline

#21 2013-04-06 16:04:03

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 20,612

Re: lsmod output: why so many modules loaded?

hadrons123 wrote:

The worst thing about the custom kernel is every week there is a kernel update and I have to compile it again. But compiling is fun only if you have the fastest computer.

<ewaller wipes a tear from his eye reminiscing about his carefree days on Gentoo.>


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
The shortest way to ruin a country is to give power to demagogues.— Dionysius of Halicarnassus
---
How to Ask Questions the Smart Way

Offline

#22 2013-04-06 17:04:29

chord
Member
Registered: 2012-11-07
Posts: 121

Re: lsmod output: why so many modules loaded?

@ ewaller :
yes, I know about kernel-seeds, but I'm not sure it is applicable to arch kernel, at least right now. Currently I thinking about kernel without initramfs.
@ hadrons123 :
I'm not a fan of every-week updates, so I'm not care about compile time.

Offline

Board footer

Powered by FluxBB