6

I'm trying to programatically stomp on bluetooth on RHEL5.

I've got the service stopped -- no problem. Also no problem on rpm -e for the associated bluetooth packages, bluez-*.

ps -aef | grep -v grep | egrep -c '(sdpd|hcid)'

returns zero , so I know the daemons are gone.

For some reason, I just can't get the modules to unload. modprobe -rv keeps saying they're in use.

Dependencies look like this:

bluetooth -> bnep
          -> l2cap 
                 -> rfcomm
                 -> hidp
          -> rfcomm
          -> hidp

But, even starting at the top so that dependencies are simple, modprobe -rv bluetooth returns FATAL: Module bluetooth is in use.

So, how do I find out what processes are using this module? It doesn't seem to be in /proc/modules, or lsof.

Command lsof still shows something hooked.

# lsmod | egrep '(bnep|hidp|rfcomm|l2cap|bluetooth)'
bnep                   82241  0 
hidp                   83521  0 
rfcomm                104809  0 
l2cap                  89281  5 bnep,hidp,rfcomm
bluetooth             118597  4 bnep,hidp,rfcomm,l2cap

2 Answers 2

4

When you do an lsmod, what is the reference count for the bluetooth module? Also,

lsmod | grep "bluetooth"

just to make sure there aren't other dependencies that may have been missed.


Eject modules in the following order:

rmmod bnep
rmmod hidp
rmmod rfcomm
rmmod l2cap

Then try

rmmod bluetooth
lsmod
4
  • Something's got it hooked, but I have no idea how to know what. That's not very Unix-y. I don't know the answer, but I do expect the system to expose it somewhere. # lsmod | egrep '(bnep|hidp|rfcomm|l2cap|bluetooth)' bnep 82241 0 hidp 83521 0 rfcomm 104809 0 l2cap 89281 5 bnep,hidp,rfcomm bluetooth 118597 4 bnep,hidp,rfcomm,l2cap
    – pboin
    Commented Aug 14, 2009 at 17:57
  • 1
    Huh? That worked. I had been using "modprobe -r" instead of "lmmod", per the lmmod man page. It says, "Most users will want to use mod-probe(8) instead, with the -r option." I don't know why one worked and the other didn't. Thank you for taking the time to help me out...
    – pboin
    Commented Aug 14, 2009 at 20:00
  • 1
    rmmod was always meant to remove a module. modprobe's original function was to attempt to determine if a module was needed, and then load it if so (from the 2.0 days) Commented Aug 14, 2009 at 22:34
  • anyways, glad to help. Commented Aug 14, 2009 at 22:35
2

What about disabling the module in /etc/modprobe.conf or blacking listing under /etc/modprobe.d/blacklist and then just rebooting?

Does something map to a /dev device and you could use lsof on that?

I think you have already tried the normal options...

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .