Discussion:
Force module not to load
Teemu Nikkilä
2007-02-11 22:17:40 UTC
Permalink
Hi,

usb_storage is giving me troubles under 10.1 so I'd like to prevent the system
from loading the module completely since I don't need it. How do I accomplish
this?

-Teemu
Carl Hartung
2007-02-11 22:46:11 UTC
Permalink
Post by Teemu Nikkilä
usb_storage is giving me troubles under 10.1 so I'd like to prevent the
system from loading the module completely since I don't need it. How do I
accomplish this?
Hi Teemu,

I've got a file here (10.2) called 'modules.unsupported'
under /lib/modules/2.6.18.2-34-default/

It looks to me like it's just one big module blacklist (last seven lines from
Post by Teemu Nikkilä
blacklist affs
blacklist adfs
blacklist jfs
blacklist efs
blacklist bfs
blacklist kafs
blacklist 9p
For the mailing list, since I don't know myself: Is this is the new method for
blacklisting troublesome modules?

regards,

Carl
Joe Morris (NTM)
2007-02-11 23:09:37 UTC
Permalink
Post by Carl Hartung
Post by Teemu Nikkilä
usb_storage is giving me troubles under 10.1 so I'd like to prevent the
system from loading the module completely since I don't need it. How do I
accomplish this?
I've got a file here (10.2) called 'modules.unsupported'
under /lib/modules/2.6.18.2-34-default/
It looks to me like it's just one big module blacklist (last seven lines from
Post by Teemu Nikkilä
blacklist affs
blacklist adfs
For the mailing list, since I don't know myself: Is this is the new method for
blacklisting troublesome modules?
I believe it is /etc/modprobe.d/blacklist.
--
Joe Morris
Registered Linux user 231871 running openSUSE 10.2 x86_64
Anders Johansson
2007-02-11 23:12:12 UTC
Permalink
Post by Teemu Nikkilä
Hi,
usb_storage is giving me troubles under 10.1 so I'd like to prevent the
system from loading the module completely since I don't need it. How do I
accomplish this?
Edit /etc/modprobe.conf.local and add the line

install usb_storage /bin/true

It sounds backwards, but it will prevent use_storage from loading
Carl Hartung
2007-02-11 23:21:24 UTC
Permalink
Post by Joe Morris (NTM)
I believe it is /etc/modprobe.d/blacklist.
Thanks, Joe, I haven't dealt with that issue for so long I'd forgotten where
it was.

Carl
Carl Hartung
2007-02-11 23:22:38 UTC
Permalink
Post by Anders Johansson
Edit /etc/modprobe.conf.local and add the line
install usb_storage /bin/true
It sounds backwards, but it will prevent use_storage from loading
Hi Anders,

Is this because doing so 'reserves' the module for user space?

Carl
Anders Johansson
2007-02-11 23:26:54 UTC
Permalink
Post by Carl Hartung
Post by Anders Johansson
Edit /etc/modprobe.conf.local and add the line
install usb_storage /bin/true
It sounds backwards, but it will prevent use_storage from loading
Hi Anders,
Is this because doing so 'reserves' the module for user space?
Hm, not sure what you mean by that.

The "install" directive tells modprobe what to do when loading the module. If
you don't have an "install", it will simply go ahead and load it. If you have
one, it will run those commands *instead* of loading it.

You could for example use it to run other commands before the module is
loaded, for example

install foo cmd1; cmd2; modprobe --ignore-install foo

this will run the commands cmd1 and cmd2, and then load the module
(the --ignore-install is so there isn't a perpetual loop)

In the case above, with /bin/true, it will simply run /bin/true instead of
loading the module, and nothing else.

/bin/false would sound more logical to a human, but it returns "false" on
exit, so modprobe thinks there was an error, and this would interrupt a boot,
and/or give annoying error messages in the log
Carl Hartung
2007-02-12 00:05:37 UTC
Permalink
Post by Anders Johansson
Post by Carl Hartung
Is this because doing so 'reserves' the module for user space?
Hm, not sure what you mean by that.
It was a spontaneous guess, so there's not much meaning there, anyway ;-)
Post by Anders Johansson
The "install" directive tells modprobe what to do when loading the module.
If you don't have an "install", it will simply go ahead and load it. If you
have one, it will run those commands *instead* of loading it.
*Now* I get it!
Post by Anders Johansson
/bin/false would sound more logical to a human, but it returns "false" on
exit, so modprobe thinks there was an error, and this would interrupt a
boot, and/or give annoying error messages in the log
Thanks for the clarification, Anders.

Carl
Fajar Priyanto
2007-02-12 08:46:22 UTC
Permalink
Post by Anders Johansson
/bin/false would sound more logical to a human, but it returns "false" on
exit, so modprobe thinks there was an error, and this would interrupt a
boot, and/or give annoying error messages in the log
This is what we implement in Finance dept so that users cannot copy data out
of the PC using any USB storage device:

/etc/modprobe.conf:
install usb_storage \
wall "Sorry, no USB storage devices are allowed" \
&& /bin/false

Make sure we reboot the PC before it takes effect, or unload the module
manually: modprobe -r usb_storage

HTH,
--
Fajar Priyanto | Reg'd Linux User #327841 | Linux tutorial
http://linux2.arinet.org
3:46pm up 2:35, 2.6.16.21-0.8-default GNU/Linux
Let's use OpenOffice. http://www.openoffice.org
Teemu Nikkilä
2007-02-12 12:40:37 UTC
Permalink
Post by Fajar Priyanto
install usb_storage \
wall "Sorry, no USB storage devices are allowed" \
&& /bin/false
Make sure we reboot the PC before it takes effect, or unload the module
manually: modprobe -r usb_storage
Thanks to all, I'll test this soon.

-Teemu
Anders Johansson
2007-02-12 18:11:31 UTC
Permalink
Post by Fajar Priyanto
Post by Anders Johansson
/bin/false would sound more logical to a human, but it returns "false"
on exit, so modprobe thinks there was an error, and this would
interrupt a boot, and/or give annoying error messages in the log
This is what we implement in Finance dept so that users cannot copy data
install usb_storage \
wall "Sorry, no USB storage devices are allowed" \
&& /bin/false
But then you'll get error messages. /bin/true gives the same effect but
without error messages

Loading...