Testing which modules are unloaded with modprobe

15,179

Solution 1

To unload modules you can use these 2 commands, lsmod and rmmod. lsmod will list what modules are loaded, while rmmod will remove a given module from the Kernel, assuming it was dynamically built so that it can/could be dynamically loaded.

$ sudo lsmod | head -5
Module                  Size  Used by
bluetooth              89276  0 
cpufreq_powersave       1154  0 
tcp_lp                  2111  0 
aesni_intel            12131  1 

To remove a module simply do this:

$ sudo rmmod bluetooth

To reload it:

$ modprobe bluetooth

I have to agree with @Patrick though, there isn't really anything that this will do, sounds like someone doesn't quite understand the function/role the modules play and what loading/unloading them even means.

My Wireless Modules

I will say that I've had issues with my WiFi drivers and have had to unload them and reload them from time to time, so perhaps this is what someone meant and it got misinterpreted?

These are my WiFi drivers that I once every 1-2 months have to to unload them:

$ lsmod | grep iw
iwlagn                209751  0 
iwlcore               195714  1 iwlagn
mac80211              229095  2 iwlagn,iwlcore
cfg80211              134981  3 iwlagn,iwlcore,mac80211

I'm on Fedora 14 with a Thinkpad T410.

What driver is hardware X using?

You can use the tool lshw as one of the other answers provides as an example. You can also use the tool hwinfo to find out this info too:

$ hwinfo | less
...
...
63: None 00.0: 1070a WLAN
  [Created at net.124]
  Unique ID: XXX.QXn1l67XXXX
  Parent ID: XXX.OmvKrXXXXXX
  SysFS ID: /class/net/wlan0
  SysFS Device Link: /devices/pci0000:00/0000:00:1c.1/0000:03:00.0
  Hardware Class: network interface
  Model: "WLAN network interface"
  Driver: "iwlagn"
  Driver Modules: "iwlagn"
  Device File: wlan0
  HW Address: 45:12:12:32:7a:02
  Link detected: yes
  Config Status: cfg=new, avail=yes, need=no, active=unknown
  Attached to: #35 (WLAN controller)

So in my case my WiFi adapter is using the module, iwlagn. hwinfo is another package that you may need to install. The package name is, you guessed it, hwinfo. So check with your distro's package management software to see if you have it available as well.

Solution 2

To see which driver is currently handling your card you can run lshw -c network you might find something like

   *-network
        description: Wireless interface
        product: Centrino Wireless-N 2230
        vendor: Intel Corporation
        ...
        capabilities: bus_master cap_list ethernet physical wireless
        configuration: broadcast=yes driver=iwlwifi bla=bla...
        resources: irq:45 memory:f2d00000-f2d01fff

If the driver=iwlwifi lists a driver you didn't intend to be used, you can try unloading/blacklisting it and load your desired driver.

Share:
15,179
aldorado
Author by

aldorado

Updated on September 18, 2022

Comments

  • aldorado
    aldorado over 1 year

    I'm currently searching for the right driver for my Broadcom BCM4313 network/wifi device.

    At first no network was recognized at all, now I managed to connect, but the connection is really slow. I read that it can be helpful to unload some driver modules with modprobe since they can disturb each other. To find the right driver I'm thinking of trying to unload all of them and then activate each one alone.

    Is there a possibility to find out which modules are activated and is there a command to unload all wifi modules at once?

    Any other hints concerning my troubleshooting are welcome as well.

    Edit:

    To prevent misunderstanding: From the comments I assume that screening the modules is not a good way to find the right driver. I was still looking for a way to find the active modules to get a deeper understanding of which module is active and ergo doing something and which is not.

    • phemmer
      phemmer over 10 years
      I don't know where you heard that from, but either they're playing a joke on you, or they're extremely misinformed.
    • aldorado
      aldorado over 10 years
      Ok maybe I misunderstood something. I guess that was what I figured from all of the different possible drivers that one could or could not use. The question is still relevant and I found part of a solution. After I found out how to see which module was loaded and which wasn't it greatly helped my understanding of the problem. I will edit the question to prevent misunderstandings.
  • aldorado
    aldorado over 10 years
    Thank you, the lsmod option helped me to see if a certain module plays any role in my problem. I found a solution for my wifi problem, too. I had to install a different driver the wl driver. link
  • slm
    slm over 10 years
    @aldorado - awesome. Glad you resolved your issue, hopefully this info was helpful in getting a better understanding of Kernel modules in general. There is also the command modinfo which you can use to find out more info about a particular named module. modinfo iwlagn, for eg.
  • slm
    slm over 10 years
    lshw may not be installed, you'll have to install it using your distro's package management software, apt-get or yum.
  • phemmer
    phemmer over 10 years
    There's also lspci -k which is a bit more common in my experience.