Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[SOLVED]Kernel loads all modules.
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Installing Gentoo
View previous topic :: View next topic  
Author Message
weelkin
n00b
n00b


Joined: 13 Dec 2011
Posts: 7

PostPosted: Tue Dec 13, 2011 11:18 pm    Post subject: [SOLVED]Kernel loads all modules. Reply with quote

Hi there,

i just started installing gentoo and discovered something strange (at least for me as a gentoo newbee). I used genkernel to build my kernel. I managed to set up an encrypted root, but now when booting up, a huge amount of kernel modules is loaded. Most of them are not needed. In total there are 177 modules loaded. Is this behaviour normal? Afaik the kernel should probe for the hardware and just load modules for which it finds hardware.

Thanks in advance,


weelkin


Last edited by weelkin on Wed Dec 14, 2011 10:12 pm; edited 1 time in total
Back to top
View user's profile Send private message
ultraincognito
Guru
Guru


Joined: 03 Jun 2011
Posts: 346
Location: Ukraine

PostPosted: Wed Dec 14, 2011 7:13 am    Post subject: Reply with quote

If all works good then there isn't nothing bad. Modules aren't very weighty for RAM.
But you really going to to understand and to improve your Gentoo system then do next:
Firstly, look at /usr/share/genkernel/YOUR_ARCH/modules_load.
Secondly, if do want more. Learning configure the kernel! On begin you can switch on the many options in the kernel. It gives more chance that the kernel would load fine. And gradually exclude the excess modules.
Back to top
View user's profile Send private message
weelkin
n00b
n00b


Joined: 13 Dec 2011
Posts: 7

PostPosted: Wed Dec 14, 2011 11:54 am    Post subject: Reply with quote

Thanks for the answer,

will the initram kernel load all the modules listed in this file? Regardless of there is hardware for this modules or not? How does it work then with other distributions like .e.g Arch linux? In my arch installation only the needed modules are loaded, although i haven't touched the kernel.


Thanks in advance,

weelkin
Back to top
View user's profile Send private message
krinn
Watchman
Watchman


Joined: 02 May 2003
Posts: 7470

PostPosted: Wed Dec 14, 2011 5:26 pm    Post subject: Reply with quote

Yes, it's bad that a module is load when not need, you're wasting ressource.
I'm not familiar with genkernel, but if i need to build the most generic kernel i could, then i would built everything as module, but certainly not load all of them thru autoload !

Check the file ultraincognito spoke about, and clean that file from the mess if genkernel put every module in it into the initram.

And for others distributions, and for gentoo too, you don't have to load all modules in initram to make a kernel working, only the ones that are need to boot, mostly hdd controller drivers, next to that, leaving udev do the work for the hardware that remain so you'll only have module that will be in fact real use.

Still without knowing if genkernel do that (load all modules in the initram file), gentoo is about choices, and you have to do yours, but sometimes a dev make one for you, if you don't agree with it, change it.
Even that choice seem a bit rude at first, it could be seen as a good default choice to do, as it will make sure it will boot, at a prize of a bloat system.
I think genkernel is there for people that never really handle a kernel, and genkernel is trying its best to make a valid bootable kernel, and not a top optimize kernel.

Look at the excellent linux sea for more help with kernel and module : http://swift.siphos.be/linux_sea/
Back to top
View user's profile Send private message
ultraincognito
Guru
Guru


Joined: 03 Jun 2011
Posts: 346
Location: Ukraine

PostPosted: Wed Dec 14, 2011 5:32 pm    Post subject: Reply with quote

weelkin wrote:
will the initram kernel load all the modules listed in this file? Regardless of there is hardware for this modules or not?

Yes, it will.
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54300
Location: 56N 3W

PostPosted: Wed Dec 14, 2011 8:03 pm    Post subject: Reply with quote

weelkin,

Roll your own kernel starting with one of Pappys Seeds
Post problems in Pappys support thread.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
weelkin
n00b
n00b


Joined: 13 Dec 2011
Posts: 7

PostPosted: Wed Dec 14, 2011 10:06 pm    Post subject: Reply with quote

Thanks for all the answers,


i found the answer in the arch-linux wiki :) https://wiki.archlinux.org/index.php/Mkinitcpio#Overview

Arch is including udev in the initramfs to avoid loading unecessary modules. I will look into "dracut" to build a similiar initramfs with udev as a failsave and a initramfs
with just the modules included which my laptop needs.
I'll do the same with my kernel, just in case i have to change the hardware of my system.


Regards,

weelkin
Back to top
View user's profile Send private message
cach0rr0
Bodhisattva
Bodhisattva


Joined: 13 Nov 2008
Posts: 4123
Location: Houston, Republic of Texas

PostPosted: Wed Dec 14, 2011 10:40 pm    Post subject: Reply with quote

weelkin wrote:
Thanks for all the answers,


i found the answer in the arch-linux wiki :) https://wiki.archlinux.org/index.php/Mkinitcpio#Overview

Arch is including udev in the initramfs to avoid loading unecessary modules. I will look into "dracut" to build a similiar initramfs with udev as a failsave and a initramfs
with just the modules included which my laptop needs.
I'll do the same with my kernel, just in case i have to change the hardware of my system.


Regards,

weelkin


overkill. you dont need to bother with dracut; making a simple initramfs is not as painful as you might think

http://whitehathouston.com/documentation/gentoo/initramfs_howto.htm

use that in conjunction with one of pappy's seeds. Build dmcrypt, your HDD controller, devtmpfs, and your foot filesystem, as in-kernel options. Then make a small simple initramfs that handles the process of unlocking your encrypted volume, mounting it at root, then firing off /sbin/init

you dont need udev in your initramfs. devtmpfs can easily do what you need there, and it's in-kernel (you have to include devtmpfs support in your kernel, mind you). if you go that route, one line in 'init'

Code:

mount -t devtmpfs none /dev


replaces the entire need for having udev in your initramfs.
_________________
Lost configuring your system?
dump lspci -n here | see Pappy's guide | Link Stash
Back to top
View user's profile Send private message
weelkin
n00b
n00b


Joined: 13 Dec 2011
Posts: 7

PostPosted: Thu Dec 15, 2011 12:33 am    Post subject: Reply with quote

Thanks for the link this howto is awsome :) I learned alot.
If i don't want to built some modules into the kernel, i'd have to copy the module files into the initramfs and them manully insmod them, right?


Regards,

welkin
Back to top
View user's profile Send private message
cach0rr0
Bodhisattva
Bodhisattva


Joined: 13 Nov 2008
Posts: 4123
Location: Houston, Republic of Texas

PostPosted: Thu Dec 15, 2011 1:03 am    Post subject: Reply with quote

weelkin wrote:
Thanks for the link this howto is awsome :) I learned alot.
If i don't want to built some modules into the kernel, i'd have to copy the module files into the initramfs and them manully insmod them, right?


Regards,

welkin


yip, that's correct, and youd need to do so before you mount the devtmpfs
_________________
Lost configuring your system?
dump lspci -n here | see Pappy's guide | Link Stash
Back to top
View user's profile Send private message
MACHINE
Tux's lil' helper
Tux's lil' helper


Joined: 30 Mar 2004
Posts: 141
Location: Earth

PostPosted: Sat Dec 17, 2011 1:37 am    Post subject: Reply with quote

i got the same issue. i made a minimalist-style kernel/modules, but when system rebooted, i found a lot of unneeded modules loaded. i don't want to try auto-probe stuffs either, but want thing KISS - just my specified modules. any hints?
_________________
Hi, Gentoo men!!
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54300
Location: 56N 3W

PostPosted: Sat Dec 17, 2011 1:15 pm    Post subject: Reply with quote

MACHINE,

If you want lean and mean you need to understand what the modules do and why you would want them or not.
That means don't start with genkernel. You can use genkernel to do the build and install if doing it yourself makes you nervous but you must configure the kernel yourself.

There are a few rules of thumb to help:-
Code:
Anything you neet to get booted must be built in <*>
Anthing you will never need should be < >
Anything you use occasionally can be <M>
Anything that needs firmware should be <M> so the firmware can go in /lib/firmware

If you don't know what an option does and the help doesn't help - leave the default setting

Examples are, to get booded your need your root filesystem, your hdd chip set driver, SCSI Disk support and the correct partition table option.
Never need examples, ISA sound hardware AMD anything on and Intel CPU (or vice versa)
Maybes include loop support, so you can mount *ISO files, Packet writing support, USB storage (unless you want to boot from it)
Firmware needing devices include USB wireless devices.

If you are still reading but your eyes have glazed over, Pappys Seeds will give you a helping hand.
Its a lean mean kernel .config to get you started but without hardware support. Get the seed, then follow the instructaions to find out what hardware support you need and how to add it.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
MACHINE
Tux's lil' helper
Tux's lil' helper


Joined: 30 Mar 2004
Posts: 141
Location: Earth

PostPosted: Sun Dec 18, 2011 1:00 am    Post subject: Reply with quote

i understood and i was following the rules of thumb. the issue is, as i said, genkernel disregarded my kernel configuration, and built modules i never need. anyway, thx for your suggestion.
_________________
Hi, Gentoo men!!
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54300
Location: 56N 3W

PostPosted: Sun Dec 18, 2011 7:50 pm    Post subject: Reply with quote

MACHINE,

You can tell genkernel yo use your .config file rather than its defualt one. Try genkernel --help or man genkernel for the exact incatation.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Installing Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum