Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.


Yes, 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
share|improve this question
add comment

2 Answers

up vote 1 down vote accepted

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
share|improve this answer
    
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 Aug 14 '09 at 17:57
    
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 Aug 14 '09 at 20:00
    
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) –  Avery Payne Aug 14 '09 at 22:34
    
anyways, glad to help. –  Avery Payne Aug 14 '09 at 22:35
add comment

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...

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.