LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   How to remove module from kernel without recompile? (https://www.linuxquestions.org/questions/linux-software-2/how-to-remove-module-from-kernel-without-recompile-95277/)

Stoic 09-21-2003 05:54 PM

How to remove module from kernel without recompile?
 
Hi,

I'd like to know whether it is possible to remove a module from the kernel without having to recompile the kernel? I know this seems kind of contradictionary, but may be there is a way?

Just to be clear, I do not mean to remove a module with modprobe -r.

Here is my actual problem (you may skip this, as it is quite long and boring :p). I had installed Mandrake 9.1 with the Lirc application as a module. Somehow I did not get it working (automatically) with my remote control (from Pinnacle Systems). That is, it assigned directory /dev/lirc -> serial. But I'd wanted it to be lirc->ttyS0.

I might have achieved this by manually fiddling with it, but I wanted to solve it differently.

I'd thought I just download Lirc from the lirc website and reconfigure it myself (actually I did succeed in this somehow the last time before I screwed up my previous (Mandrake) Linux installation :D).

When I configure Lirc it says that "Your hardware does not require a kernel module.". After this I make and make install and all the other stuff that is mentioned in many Lirc How-To's.

But when I run modprobe lirc_serial it probably tries to load the mandrake pre-installed one which then results in errors (cannot remember what the errors were exactly now).

I decided to remove the lirc-mdk through "Remove Software" after having uninstalled the original Lirc (through make uninstall). The Mandrake "Remove Software" did remove some lirc stuff but not the modules that reside in /lib/modules/2.4.21-0.13mdk/kernel/3rdparty/!?

So I removed the lirc folder therein manually, did a depmode -a (thought this would have actually tricked other applications in thinking that the module did not exist anymore :tisk: :newbie: :D) and recompiled Lirc. However, Lirc did not install any modules at the place I had just removed. It probably still thinks that I have those modules (doh?) ?!.

So to make the long story short, I think I need to reconfigure the module dependencies such that the kernel is actually not using the Lirc module, and such that Lirc will think it needs to compile and install the driver (module) itself.

As mentioned in the beginning, is this possible without having to go through the "hassle" of recompiling the kernel? May be just by performing make modules after a make config?

Thanks for any replies,
Stoic :study:

nhs 09-21-2003 06:02 PM

You shouldn't need to recompile your kernel. Try completely deleting the Lirc source code directory and untarring again as it may be cacheing the results of your initial config. This should reset everything and allow you to compile without problem (hopefully).

Stoic 09-22-2003 02:40 AM

Quote:

Originally posted by nhs
You shouldn't need to recompile your kernel. Try completely deleting the Lirc source code directory and untarring again as it may be cacheing the results of your initial config. This should reset everything and allow you to compile without problem (hopefully).
Thanks. I'll try that tonight when I get home.

Stoic 09-22-2003 06:03 PM

Unfortunately after make uninstall, make distclean, and then removing the whole lirc-0.6.6 folder and untarring the lirc-0.6.6 package did not solve my issue.

Thus, after I ./setup.sh, configure for my remote control, configure, it still says "Your hardware does not require a kernel module.". Why it says this I do not understand. So I went on anyway with make and (as su) make install, chmod 666 /dev/lircd. Then when I modprobe lirc_serial it says modprobe: Can't locate module lirc_serial, which is logical as the driver is not in /lib/modules.

So there is something telling Lirc not to make this driver as it is unnecessary according to that something (most likely some kernel config file).

To ask my question again. Is it possible to remove a module from the kernel without recompiling the kernel? :D

Stoic

Stoic 09-22-2003 06:55 PM

Btw there is still something hanging around in relation to lirc (even after make uninstall and previous Mandrake 'Remove Software'). It is in /lib/dev-state/lirc.

ls -l gets me this:
Code:

crw-rw-rw-    1 root    root      61,  0 Sep 21 22:54 serial
lrwxrwxrwx    1 root    root            5 Sep 21 23:00 ttyS0 -> ttyS0

I remember from the Mandrake Lirc install that lirc was assigned to serial. The original lirc package assigned lirc to ttyS0.

Will it do any harm if I remove /lib/dev-state/lirc?

mikeon 09-23-2003 09:55 AM

Hi Stoic,
I've just been going through the same thing as you. I'm trying to get lirc to transmit signals through a 'homebrew' TX on the serial port.
Briefly, I had three days of problems, finally I uninstalled lirc, removed the mandrake lirc_serial.o.gz file and rpms and tried again to compile the source.
I found that everytime I rebooted, somthing was creating /dev/lirc & /dev/lircd even if I deleted these before booting. I eventually deleted the file you identified /lib/dev-state/lirc*
also, an entry in /etc/makedev (i think that's it, I'm not at the linux pc now).
I also had to manually remove Mserial module (part of win4lin) before doing modprobe lirc_serial.
Finally, I manually (for now) start /usr/local/sbin/lircd
It all seems to work now for me!
HTH
M.

Stoic 09-23-2003 10:16 AM

Quote:

Originally posted by mikeon
Hi Stoic,
I've just been going through the same thing as you. I'm trying to get lirc to transmit signals through a 'homebrew' TX on the serial port.
Briefly, I had three days of problems, finally I uninstalled lirc, removed the mandrake lirc_serial.o.gz file and rpms and tried again to compile the source.
I found that everytime I rebooted, somthing was creating /dev/lirc & /dev/lircd even if I deleted these before booting. I eventually deleted the file you identified /lib/dev-state/lirc*
also, an entry in /etc/makedev (i think that's it, I'm not at the linux pc now).
I also had to manually remove Mserial module (part of win4lin) before doing modprobe lirc_serial.
Finally, I manually (for now) start /usr/local/sbin/lircd
It all seems to work now for me!
HTH
M.

Great! So let us get this straight:
  • You uninstalled the lirc-mdk package (through, e.g., "Remove Software")
  • You uninstalled lirc (make uninstall, may be even delete the lirc-0.6.6 folder and 're-untarring' it)
  • You removed the lirc module(s) found in /lib/modules ... /lirc
  • You removed folder /lib/dev-state/lirc and some other system folder that contained stuff related to lirc
  • You installed lirc-0.6.6 through ./setup.sh, etc.
  • You could get modprobe lirc_serial working now (?)
  • You could start /dev/lircd
  • You could start irw, which actually outputted things on the terminal when you pressed buttons on your device (?)
I'll try this at home :D

Thanks,
Stoic

Stoic 09-23-2003 10:22 AM

Quote:

Originally posted by mikeon
Hi Stoic,
<snip />
I also had to manually remove Mserial module (part of win4lin) before doing modprobe lirc_serial.
<snip />

How do I know if I have this module installed and how do I remove it if I have it? Will it, e.g., show up in lsmod?

mikeon 09-23-2003 11:48 AM

Quote:

Great! So let us get this straight:


1 * You uninstalled the lirc-mdk package (through, e.g., "Remove Software")
2 * You uninstalled lirc (make uninstall, may be even delete the lirc-0.6.6 folder and 're-untarring' it)
3 * You removed the lirc module(s) found in /lib/modules ... /lirc
4 * You removed folder /lib/dev-state/lirc and some other system folder that contained stuff related to lirc
5 * You installed lirc-0.6.6 through ./setup.sh, etc.
6 * You could get modprobe lirc_serial working now (?)
7 * You could start /dev/lircd
8 * You could start irw, which actually outputted things on the terminal when you pressed buttons on your device (?)
1. yes!
2. yes, make uninstall, but kept the untared stuff.
3. I deleted lirc_serial.so.gz but I forget where it was. I'd delete anything that mentions lirc that is not part of the tar package.
4. Yes, this was the main problem. I think this signals during bootup to recreate these devices if they don't exist. In my case this was a 'serial' device when I really needed to create with mknod /dev/lirc c 61 0
4a. I also removed a line in the file /etc/makedev.d/mandrake that mentioned lirc. No bad side effects yet..
5. exactly.
6. yes, after deleteing as per step 3.
7. I type /usr/local/sbin/lircd to start, this way I'm sure it's the freshly compiled version.
8. I've only tried rc and irrecord. Both work now. Just tried irw and that also works!

Don't worry about Mserial if you didn't install Win4Lin (commercial package not installed by default).
These steps worked for me but I think no two people have exactly the same setup, but this should help you get further.
Good luck!
M.

Stoic 09-23-2003 05:56 PM

I seem to be out of luck here :cry:. After having done all of the above I still don't get Lirc to build a lirc_serial driver :mad:. So my last option is to recompile the kernel :rolleyes:.

Stoic 09-23-2003 06:17 PM

Ah finally! I did not have to modprobe lirc_serial for some reason (maybe cause I have it in my kernel instead of as a module? can't remember). Anyway, I got it working!

Stoic :newbie:


All times are GMT -5. The time now is 05:50 AM.