in most linux distros it is possible to generate /etc/modprobe.d/blacklist.conf which prevents listed kernel modules from being loaded at boot time and thus not having to resort to the drastic measure of removing the module entirely.
I believe rmmod --force will allow to remove a module even if it appears to be in use (assuming the kernel supports that). Whether this is a good idea is a different question. From man rmmod:
-f, --force
This option can be extremely dangerous: it has no effect unless CONFIG_MODULE_FORCE_UNLOAD was set when the kernel was compiled. With this option,
you can remove modules which are being used, or which are not designed to be removed, or have been marked as unsafe (see lsmod(8)).
Also I do not know whether openwrt offers rmmod at all.
why is it more often than not that a question is being responded to with "why you want it" and basically questioning the legitimacy of a use case?
I did not start this thread to discuss of why I wish to unload a kernel module and potentially derail the thread into such. Appreciate if this stays on topic instead.
Because often people ask about a specific "how" because they believe this "how" to be necessary to solve their real problem. Often enough, the real problem has solutions that do not require to solve the specific "how". Been there, witnessed that from both sides. Also on the internet nobody needs to answer anything so a person asking questions should be friendly towards all responders, even if unhelpful, they are spending their time on your problem, at least acknowledge that. (That does not mean that you need to agree, but IMHO calls to "stay on topic" are not merited, as you can simply ignore answers you deem unhelpful; if an answer is rude, that is a different issue meriting calling it out)
There is no mentioning of a "problem" and I do not comprehend why this lingual characteristic is being introduced/utilized/argued by either of you? It is a straightforward question which has been exhaustively responded to - making it clear what can and what cannot be done.
Commonly in Linux it is possible to unload a kernel module that is in use. And the discovery from the thread is that such is not possible in OpenWrt.
There is no root cause at all - the reason of why I want to unload a kernel module does not pertain to solving the question of this topic at all. On that perspective we might be discontent though.
However, rest assured I would have started a thread in a different manner if I wanted to solve a problem with a particular kernel module.
Not sure what you are getting exited about and unnecessary heating the thread with such statements? Your telling of what one should do or not could be easily mistaken as patronizing. And I am afraid that is not the first time such mannerism is on display.
Look, you do not want to believe that is possible, despite
that is fine. It works on my Linux boxes.
It is says
that is clear enough to me for potential ill effects. But those ill effects were never the point of the question and discussing it does not pertain in solving the question either.
You made me look for a way that I can never see your posts in future. I just want to erase this happening from my memory actually. I had a good day until tried to help you.
You already have all the answers to your question. So you probably don't need mine anyway. I am retracting them. So that you know, I won't respond anymore also.
Yes, this is part of the issue, people in this forum are quite happy to help solve problems, so if you have a problem come forward. If however you have no acute problem, why waste everybody's time?
Most folks here know, that OpenWrt being a linux distribution tailored to low-end devices does not offer everything big Linux distributions offer, so enumerating all differences seems moot unless such a difference causes real problems ;), but then it helps if the problem is stated along with the difference that makes solutions for "normal" linux distributions inapplicable for OpenWrt.
Because I am happy tp spend some time helping with a problem, but not with non-problems
The why is missing, someone less conscious of the dangers of removing a piece of kernel code where other parts of the same kernel might still hold references to than you, might get wrong ideas about when calling rmmod --force my_module is reasonable. (I admit that modprobe -r seems less dangerous in that it tries to also remove the reference holding modules, but that is subtle).
So, problems can be posted but questions for clarifications should not then? Posting a question does not mean that there is problem, not sure why a question equals a problem.
Maybe I should have labelled it more clearly as RFC instead to avoid this being mistaken as a problem. Well, lesson learned - be specific with the topic.
Look, I am not the forum admin, just a user voicing my own opinion, so I try not to talk about can and shall, but rather could and should. IMHO asking a specific question is fine, but even better if accompanied by a description of why the question is relevant. If you have no problem, maybe do not ask a question in the first place?
Sure, that certainly helps, (except all answers are comments even the off-topic ones ). But this is an open forum, as long as the tone stays friendly you can post almost every question, it is just that people will be better to help if they understand the scope of the question better.
I think I answered your question, but I also think you did not understand my answer.
If a module is in use (notice I said "in use" and not "loaded"), you have to stop using it (notice I said "stop using" instead of "prevent it from being loaded") before unloading it.
If the module provides support for a specific filesystem, unmount all devices using that filesystem first. If the module provides basic support for USB, unload all USB-related modules first.