How to unload a kernel module which is in use?

I'm following this tutorial to get my card reader working:

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?

4

2 Answers

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
4

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.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like