[aklug] Re: Grokking modprobe.conf

From: Kevin Miller <atftb2@alaska.net>
Date: Fri Feb 25 2011 - 10:54:30 AKST

On 02/25/2011 09:42 AM, Arthur Corliss wrote:
> On Fri, 25 Feb 2011, Kevin Miller wrote:
>
>> I was reading the modprobe.conf man page and came across this, which I'm
>> not sure I quite understand:
>>
>> [CODE]
>> install modulename command...
>> This command instructs modprobe to run your command instead of
>> inserting the module in the kernel as normal. The command can be any
>> shell command: this allows you to do any kind of complex processing you
>> might wish. For example, if the module "fred" works better with the
>> module "barney" already installed (but it doesn't depend on it, so
>> modprobe won't automatically load it), you could say
>> "install fred /sbin/modprobe barney; /sbin/modprobe --ignore-install
>> fred",
>> which would do what you wanted. Note the --ignore-install, which stops
>> the second modprobe from running the same install command again. See
>> also remove below.
>> [/CODE]
>>
>> How does one parse the install line? Is it saying to install fred, then
>> barney? If so, why does it have to specify modprobe for barney but not
>> fred?
>
> The format breaks down like this:
>
> {rule} {module} {action/options}
>
> In this case you're making an install rule for fred which executes two shell
> commands. Modprobe.conf isn't a script, it's a list of rules which apply to
> specific modules, and is consulted each time modprobe is called.

Sorry for being dense but I'm still not getting it. In the breakdown
above, what's the rule part, what's the module and what are the actions?

Is the rule called fred? Which is also a module?

Would the shell commands be:
   1: modprobe barney
   2: modprobe --ignore-install fred

If so, if we left #2 off why would we have a loop?

>> The second half of the command with the --ignore-install confuses me.
>> What do they mean by "second modprobe"? Are they referring to the call
>> to modprobe just before barney? Why would that re-call fred?
>
> The --ignore-install rule makes it skip the install rule for fred. If you
> didn't do this you'd end up in an infinite recursive loop. You only want
> this rule executed for the *first* install request for fred to make sure
> barney is preloaded.

That's where I'm confused. How many times does modprobe run? And when?
  Obviously at least once at boot up. And I can see it might when some
event happens such as sticking a thumb drive or camera into the USB
port. But if

There's lots of modules referenced in modprobe.conf, so why don't they
all need an --ignore-install afterwards? I presume that when modprobe
runs it sees that my NIC is already up, so doesn't try to load the
driver again. Why does that not happen with fred?

Thanks...

...Kevin

-- 
Kevin Miller
Juneau, Alaska
http://www.alaska.net/~atftb
In a recent poll, seven out of ten hard drives preferred Linux.
---------
To unsubscribe, send email to <aklug-request@aklug.org>
with 'unsubscribe' in the message body.
Received on Fri Feb 25 10:54:51 2011

This archive was generated by hypermail 2.1.8 : Fri Feb 25 2011 - 10:54:51 AKST