View previous topic :: View next topic |
Author |
Message |
PP133 Apprentice
![Apprentice Apprentice](/images/ranks/rank_rect_2.gif)
Joined: 02 Jun 2005 Posts: 192
|
Posted: Sun Nov 13, 2005 1:07 am Post subject: N00b Module Question |
|
|
Hey guys, I recently got back onto my gentoo machine and I've forgotten EVERYTHING that I learned when I built it.
So among the plethora of questions I have, I chose this one, for now ...How do modules work?
I was reading some of the FAQ posts and read that you can either choose to load something as a module or build it into the kernel and that things that you don't use all that often should be "modularized". How does that work? I mean, let's say that I load something as a module, then do I need to start it up manually or something? For instance, I just rebuilt my kernel to load Samba as a module; will samba start on boot up, still? I'm not sure if I'm asking this the right way. Do you guys perhaps have links to a good module explanations?
Thanks in advance! _________________ -Paul |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
hollywoodb Apprentice
![Apprentice Apprentice](/images/ranks/rank_rect_2.gif)
![](images/avatars/143919169645622e82c2406.png)
Joined: 05 Nov 2003 Posts: 259 Location: MN, U.S.A.
|
Posted: Sun Nov 13, 2005 1:19 am Post subject: |
|
|
the kernel will usually autoload modules when it needs them... there's not much else to it. modprobe, lsmod, and rmmod are tools you'll find useful. also, you can add modules you want loaded on boot to /etc/modules.autoload.d/kernel-2.6 (or kernel-2.4 if you're using a kernel of that series)
in your samba example, if you tell samba to load during the startup process it will load the module for you. to tell samba to load on startup:
Code: | rc-update add samba default |
rc-update and rc-status are your tools for startup scripts,
is pretty self-explanatory |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
thewally l33t
![l33t l33t](/images/ranks/rank_rect_4.gif)
![](images/avatars/772977575436a9e90e35b9.jpg)
Joined: 12 May 2005 Posts: 703 Location: Genova
|
Posted: Sun Nov 13, 2005 1:21 am Post subject: Re: N00b Module Question |
|
|
PP133 wrote: | Hey guys, I recently got back onto my gentoo machine and I've forgotten EVERYTHING that I learned when I built it. |
Welcome back
PP133 wrote: | So among the plethora of questions I have, I chose this one, for now ...How do modules work? |
A quick search on google --> report this link
PP133 wrote: | I was reading some of the FAQ posts and read that you can either choose to load something as a module or build it into the kernel and that things that you don't use all that often should be "modularized". How does that work? I mean, let's say that I load something as a module, then do I need to start it up manually or something? For instance, I just rebuilt my kernel to load Samba as a module; will samba start on boot up, still? I'm not sure if I'm asking this the right way. Do you guys perhaps have links to a good module explanations? |
You can modularize everything isn't necessary on boot.
Then put module name (without extensions - .o or .ko) in your /etc/modules.autoload.d/kernel-2.6 or kernel-2.4 (depend on your kernel version)...
Then: and reboot (or modprobe every single module).
About samba: if you want start a samba server on your computer, smbfs isn't needed: it's needed only for client side (put it in your /etc/modules.autoload.d/kernel-2.x with other modules) .
PP133 wrote: | Thanks in advance! | Your're welcome ![Very Happy :D](images/smiles/icon_biggrin.gif) _________________ Proudly Member of GeCHI |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
dsd Developer
![Developer Developer](/images/ranks/rank-dev.gif)
Joined: 30 Mar 2003 Posts: 2162 Location: nr London
|
Posted: Sun Nov 13, 2005 1:59 am Post subject: |
|
|
hollywoodb wrote: | the kernel will usually autoload modules when it needs them... |
on a modern-style setup (i.e. dynamic /dev), the kernel doesnt autoload modules at all. you'll find that some userspace programs do, for example if you try and mount a FAT partition, and fat support isnt present in the kernel, mount will try and load the vfat module before mounting the filesystem. another example, the iptables application will load modules as they are required too - but on the whole, modules are not loaded automatically.
there are other approaches - for example coldplug, which aggressively loads modules which matches hardware found in your system. this sometimes gives undesired results.
if you are building a kernel manually, i recommend that you avoid modules (unless you have good reason), as it makes things much simpler for yourself. otherwise people run into problems because they dont realise they have to load the modules manually. you also get problems when people forget to rebuild/reinstall old modules when changing the configuration of the main kernel image.
one notable exception is ALSA (see the gentoo alsa guide for more explanation). _________________ http://dev.gentoo.org/~dsd |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
hollywoodb Apprentice
![Apprentice Apprentice](/images/ranks/rank_rect_2.gif)
![](images/avatars/143919169645622e82c2406.png)
Joined: 05 Nov 2003 Posts: 259 Location: MN, U.S.A.
|
Posted: Sun Nov 13, 2005 3:24 am Post subject: |
|
|
dsd:
I understand that the kernel doesn't load the vfat module in anticipation that I'm about to mount a FAT partition I failed to word my response correctly
personally I prefer to compile a large portion of my kernel as modules, for situations in which lsmod helps me solve a problem. recently I had left out an nls option that was preventing mounting of a FAT partition, whereas I could quickly and easily verify that the vfat module was loaded and knew to look elsewhere |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
PP133 Apprentice
![Apprentice Apprentice](/images/ranks/rank_rect_2.gif)
Joined: 02 Jun 2005 Posts: 192
|
Posted: Sun Nov 13, 2005 4:24 am Post subject: Re: N00b Module Question |
|
|
Hey guys, thanks for the replies!
thewally wrote: |
A quick search on google --> report this link
|
Thanks for the link, thewally, I just got it so I haven't had a chance to read it so I'm sorry if the questions I ask now are already covered in that page...
thewally wrote: |
You can modularize everything isn't necessary on boot.
Then put module name (without extensions - .o or .ko) in your /etc/modules.autoload.d/kernel-2.6 or kernel-2.4 (depend on your kernel version)...
Then:
and reboot (or modprobe every single module).
About samba: if you want start a samba server on your computer, smbfs isn't needed: it's needed only for client side (put it in your /etc/modules.autoload.d/kernel-2.x with other modules) .
|
In my case I just use Samba to connect to a Windows share, not as a Samba server. But as I was troubleshooting the error I was getting while trying to connect to a share, someone recommended that I load Samba as a module instead of having it built into the kernel. So I did the and put a 'M' in front of "SMB file system support (to mount Windows shares etc.)", compiled the kernel, rebooted, and it worked. But I never placed the samba module in /etc/modules.autoload.d/kernel-2.6 file and I didn't do a when it booted up. That's why I'm confused...why did it work, haha.
Also, let's say that I went into the menuconfig and took out the M in front of the Samba line, leaving it blank, and instead just placed the word "samba" on the next line of that /etc/modules.autoload.d/kernel-2.6 file, would that load the module? _________________ -Paul |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
PP133 Apprentice
![Apprentice Apprentice](/images/ranks/rank_rect_2.gif)
Joined: 02 Jun 2005 Posts: 192
|
Posted: Sun Nov 13, 2005 4:27 am Post subject: |
|
|
hollywoodb wrote: | in your samba example, if you tell samba to load during the startup process it will load the module for you. to tell samba to load on startup:
Code: | rc-update add samba default |
rc-update and rc-status are your tools for startup scripts,
is pretty self-explanatory |
Ok, so by loading the Samba daemon I also load the module? Is that true for all startup scripts? _________________ -Paul |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
thewally l33t
![l33t l33t](/images/ranks/rank_rect_4.gif)
![](images/avatars/772977575436a9e90e35b9.jpg)
Joined: 12 May 2005 Posts: 703 Location: Genova
|
Posted: Sun Nov 13, 2005 11:34 am Post subject: |
|
|
PP133 wrote: | Ok, so by loading the Samba daemon I also load the module? Is that true for all startup scripts? |
Yes, every command launched by root, who needs modules will load it automatically.
Only user's programs don't (you need to have smbfs module loaded for smb4k or gnome-vfs to browse samba shares). _________________ Proudly Member of GeCHI |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
dsd Developer
![Developer Developer](/images/ranks/rank-dev.gif)
Joined: 30 Mar 2003 Posts: 2162 Location: nr London
|
Posted: Sun Nov 13, 2005 12:38 pm Post subject: |
|
|
Quote: | Also, let's say that I went into the menuconfig and took out the M in front of the Samba line, leaving it blank, and instead just placed the word "samba" on the next line of that /etc/modules.autoload.d/kernel-2.6 file, would that load the module? |
the samba module is called 'smbfs'
if you chose not to build it at all, but added it to the modules.autoload.d file anyway, then you'd see an error every bootup along the lines of:
FATAL: Module smbfs not found.
you can use the "modprobe -l" command to list all modules installed on your system, and where they reside.
PP133 wrote: | Ok, so by loading the Samba daemon I also load the module? |
i expect this isn't true. the samba daemon runs entirely in user-space and does not need any kernel modules. if it was loading the smbfs module as well then that would be a bit bogus (its not needed for the task of starting the samba daemon).
Quote: | Is that true for all startup scripts? |
there are certain startup scripts which are designed specifically to load modules, e.g. alsasound.
on the whole, most applications dont deal with modules automatically, which is why you need to go out of the way and make sure they are loaded yourself.
Quote: | Yes, every command launched by root, who needs modules will load it automatically |
this isn't true as a general rule, but does apply to certain applications (e.g. mount).
if i launch 'alsamixer' as root then it doesnt automatically load my alsa modules. if i try and 'ping' something as root it doesnt try and load my network modules, ....
Quote: | Only user's programs don't (you need to have smbfs module loaded for smb4k or gnome-vfs to browse samba shares). |
and in situations like this, it makes more sense for you to have built smbfs directly into your kernel, then you dont have to worry about the whole module loading thing at all. if you build samba as built-in then the kernel will automatically load it internally when it is needed. _________________ http://dev.gentoo.org/~dsd |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
PP133 Apprentice
![Apprentice Apprentice](/images/ranks/rank_rect_2.gif)
Joined: 02 Jun 2005 Posts: 192
|
Posted: Sun Nov 13, 2005 4:38 pm Post subject: |
|
|
dsd wrote: |
the samba module is called 'smbfs'
if you chose not to build it at all, but added it to the modules.autoload.d file anyway, then you'd see an error every bootup along the lines of:
FATAL: Module smbfs not found.
you can use the "modprobe -l" command to list all modules installed on your system, and where they reside.
|
Well I left the M in front of the Samba line in menuconfig but didn't place it in the modules.autoload.d and when I do a modprobe -l I do see one line Code: | /lib/modules/2.6.11-gentoo-r3/kernel/fs/smbfs/smbfs.ko |
Does this mean that I can bypass inserting the module into the autoload file as long as I set the kernel to load the software as a module?
Thanks. _________________ -Paul |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
dsd Developer
![Developer Developer](/images/ranks/rank-dev.gif)
Joined: 30 Mar 2003 Posts: 2162 Location: nr London
|
Posted: Sun Nov 13, 2005 7:26 pm Post subject: |
|
|
"modprobe -l" lists the modules available *on your system*
if you want a listing of all currently loaded modules, use "lsmod"
if you are mounting samba shares via "mount" then you do not need to autoload the module (see my first reply to this thread) since mount loads it for you on-demand. however, thewally says that other samba apps use the smbfs module (e.g. gnome) and these will not autoload the module for you.
the rule of thumb is that modules are not loaded automatically. there are exceptions to the rule as we've discussed here, but if you insist on building things as modules, then make sure you load them. _________________ http://dev.gentoo.org/~dsd |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
PP133 Apprentice
![Apprentice Apprentice](/images/ranks/rank_rect_2.gif)
Joined: 02 Jun 2005 Posts: 192
|
Posted: Sun Nov 13, 2005 11:45 pm Post subject: |
|
|
Thanks for all the info, guys! _________________ -Paul |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
|
|
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
|
|