39

I'm following this tutorial to get my card reader working: http://ubuntuforums.org/showthread.php?t=636867

However I'm unable unload my sdhci module:

sudo modprobe -rv sdhci mmc_core mmc_block
modprobe: FATAL: Module sdhci is in use.

How should I proceed?

Andreas Hartmann
  • 2,613
  • 7
  • 29
  • 47

2 Answers2

35

First, find out, which other modules use the module sdhci:

lsmod | grep sdhci

You will get a list like this:

module size used_by

Try unloading these modules (used_by) before or together with the module you want to unload:

sudo modprobe -r <module found from lsmod> <module you want to remove>

If you want to prevent the module from loading on the next boot, add it to the blacklist:

echo -e "sdhci\n" | sudo tee -a /etc/modprobe.d/blacklist.conf
s3lph
  • 14,314
  • 11
  • 59
  • 82
  • 3
    I tried this but didn't have any luck: http://askubuntu.com/questions/724052/unload-saa7164-module-for-hauppauge-2250-and-stop-tvheadend-to-suspend-ubuntu-1 – guttermonk Jan 22 '16 at 02:23
  • 18
    What if I get "used by 1" but it does not says which one? – Alejo Dev Jun 02 '20 at 15:20
  • 2
    @AlejoDev the same for me. I get 'used by' value just 3. – Chan Kim Aug 18 '21 at 05:38
  • 4
    A line sdhci in /etc/modprobe.d/blacklist.conf will not work. The line should be blacklist sdhci in etc/modprobe.d/blacklist.conf – qwertz Jun 07 '22 at 15:22
5

Another place to look at is "lsof" apart from unloading the dependent modules.

# lsof | grep < relevant str to module >

This should list the files that are opened via the module. Try killing those processes that opened the files and check the module reference count is getting reduced through the "lsmod" command.

Vicky
  • 151
  • 1
  • 3
  • Great info! I had Nvidia drivers failing to run CUDA programs and typically sudo modprobe -r nvidia_uvm && sudo modprobe nvidia_uvm is the correct solution but this time got FATAL: Module nvidia_uvm is in use even though lsmod didn't list any users. However, sudo lsof | grep uvm did show that I had nvtop running which had file /dev/nvidia-uvm open which was the cause. After closing nvtop and doing the modprobe commands, the CUDA programs started to work again without a reboot. – Mikko Rantalainen Feb 23 '24 at 11:45