Find the answer to your Linux question:
Results 1 to 4 of 4
Hi My system is RHEL 5.7x64 on BL 490c G6. I was trying to remove the driver module bnx2x using the following command: modprobe -r bnx2x and then checking: lsmod ...
  1. #1
    Just Joined!
    Join Date
    Mar 2008
    Posts
    6

    Can't remove a module using modprobe

    Hi

    My system is RHEL 5.7x64 on BL 490c G6. I was trying to remove the driver module bnx2x using the following command:

    modprobe -r bnx2x

    and then checking:

    lsmod | grep bnx2x.

    But the output shown is:

    bnx2x 638593 0
    mdio 38465 1 bnx2x
    8021q 57937 2 bnx2x, cxgb3

    Seemingly the modules are not unloaded. The similar problem occurs if I use rmmod instead. As a cross check I checked another server with RHEL 5.7x64 with igb driver and it worked without a problem (lsmod was not showing the driver after igb was removed using modprobe).

    What could be the problem with this? Any help would be much appreciated.

    Thanks

  2. #2
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
    Posts
    8,974
    Well, that module has dependencies in that mdio and 8021q both use it. I don't think it will let you remove that without removing the dependent modules as well. If you read the man page for rmmod, you would see this:
    Code:
           -w --wait
                  Normally, rmmod will refuse to unload modules which are in use. With this option, rmmod will isolate the
                  module, and wait until the module is no longer used. Nothing new will be able to  use  the  module,  but
                  it’s  up to you to make sure the current users eventually finish with it.  See lsmod(8)) for information
                  on usage counts.
    Also, here is the man page from modprobe's -r option:
    Code:
           -r --remove
                  This option causes modprobe to remove rather than insert a module. If the modules it depends on are also
                  unused, modprobe will try to remove them too. Unlike insertion, more than one module can be specified on
                  the command line (it does not make sense to specify module parameters when removing modules).
    
                  There is usually no reason to remove modules, but some buggy modules require it.  Your  kernel  may  not
                  support removal of modules.
    So, why do you want to remove this module? I suspect it is in use, so unless you use the -force option it won't let you do that.
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

  3. #3
    Just Joined!
    Join Date
    Mar 2008
    Posts
    6
    Thanks for the reply. Initially I thought similarly to - that 8021q is using the module but when I tried to remove 8021q using modprobe it says that module is in use by bnx2x. I tried to uninstall forcefully by using "-f" with rmmod but it didn't help.

    The reason for removing the module is that I have newer driver so I want to remove the existing one and install the new driver.

    I tried to do a different thing: I tried to remove it from automatically loading by

    chkconfig --rem 8021q off

    and the restarting so that I can gracefully remove bnx2x without any dependency. But chkconfig reports some error.

    So this is the sticky situation I am in right now.

    Quote Originally Posted by Rubberman View Post
    Well, that module has dependencies in that mdio and 8021q both use it. I don't think it will let you remove that without removing the dependent modules as well. If you read the man page for rmmod, you would see this:
    Code:
           -w --wait
                  Normally, rmmod will refuse to unload modules which are in use. With this option, rmmod will isolate the
                  module, and wait until the module is no longer used. Nothing new will be able to  use  the  module,  but
                  it’s  up to you to make sure the current users eventually finish with it.  See lsmod(8)) for information
                  on usage counts.
    Also, here is the man page from modprobe's -r option:
    Code:
           -r --remove
                  This option causes modprobe to remove rather than insert a module. If the modules it depends on are also
                  unused, modprobe will try to remove them too. Unlike insertion, more than one module can be specified on
                  the command line (it does not make sense to specify module parameters when removing modules).
    
                  There is usually no reason to remove modules, but some buggy modules require it.  Your  kernel  may  not
                  support removal of modules.
    So, why do you want to remove this module? I suspect it is in use, so unless you use the -force option it won't let you do that.

  4. #4
    Linux Guru
    Join Date
    May 2011
    Posts
    1,843
    Quote Originally Posted by amishera View Post
    Thanks for the reply. Initially I thought similarly to - that 8021q is using the module but when I tried to remove 8021q using modprobe it says that module is in use by bnx2x. I tried to uninstall forcefully by using "-f" with rmmod but it didn't help.

    The reason for removing the module is that I have newer driver so I want to remove the existing one and install the new driver.

    I tried to do a different thing: I tried to remove it from automatically loading by

    chkconfig --rem 8021q off

    and the restarting so that I can gracefully remove bnx2x without any dependency. But chkconfig reports some error.

    So this is the sticky situation I am in right now.
    Note: chkconfig only works with initscripts that reside in /etc/init.d/ and have been configured to work with chkconfig.

    Does the newer module have a different name than the older module? If they are the same, you could just find the module in your modules directory, back up the original one, and rename the new one, e.g.:

    first find the file:
    Code:
    find /lib/modules/$(uname -r)/|grep bnx2x.ko
    mine is here:
    /lib/modules/2.6.38.6-26.rc1.fc15.i686.PAE/kernel/drivers/net/bnx2x/
    so I'd then do:
    Code:
    cd /lib/modules/2.6.38.6-26.rc1.fc15.i686.PAE/kernel/drivers/net/bnx2x/
    mv bnx2x.ko bnx2x.ko.bak
    cp /path/to/your/bnx2x.ko bnx2x.ko
    <Edit>
    you'd then want to run depmod, e.g.:
    Code:
    depmod -a
    </Edit>

    If your module is of a different name, then blacklist the "bnx2x.ko" module. Add the following lines:

    Code:
    # prevent bnx2x.ko from loading
    blacklist bnx2x
    in the file /etc/modprobe.d/blacklist.conf, then reboot.
    Last edited by atreyu; 01-15-2012 at 04:42 PM. Reason: depmod

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...