LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 10-20-2004, 11:43 AM   #1
Levitate
Member
 
Registered: Aug 2004
Posts: 63

Rep: Reputation: 15
Automatically unloading modules?


Hey, I'm wondering if there's a way to get certain modules that are loaded up when something starts (for example, XFree) to unload when that application or whatever is terminated.

For example...when I start XFree, I know that the radeon module is loaded to handle the graphics, etc etc. however if I shut down XFree, the radeon module stays there even though I don't need it anymore. Or if I put in my USB memory stick and use it, and then unmount it and take it out...the modules needed for the USB stick remain loaded and don't go away unless I unload them myself.

Is there a way to make these unneeded modules unload automatically? It seems like Kmod is supposed to do something like that, but I have no idea how to get it to work and haven't been able to find any information on it...I know it's enabled in the kernel but I don't see it doing anything on its own and I don't know how to configure it, or whatever you have to do. Any suggestions or pointers to somewhere that could help me?

I'm running Debian Sarge with the 2.6.7 kernel

thanks
 
Old 10-20-2004, 12:51 PM   #2
MasterC
LQ Guru
 
Registered: Mar 2002
Location: Salt Lake City, UT - USA
Distribution: Gentoo ; LFS ; Kubuntu ; CentOS ; Raspbian
Posts: 12,613

Rep: Reputation: 69
Why would you be concerned about the loaded module anyway?

I would think something like hotplug would indeed do what it is you are talking about, at least for the memory stick portion, but the radeon, well the hardware is still going to be attached, so I can't imagine it would take care of that as well. However, I would think that depending on how you call X and stop X you might be able to attach a string to rmmod the radeon module during the kill. You could probably also write a small script to check if X is running using something like ps, and when it returns a 1 meaning X is no longer running, it can then unload the module. But that's a bit in depth for something so trivial, IMHO.

Cool
 
Old 10-20-2004, 02:07 PM   #3
Levitate
Member
 
Registered: Aug 2004
Posts: 63

Original Poster
Rep: Reputation: 15
hot plug loads up the modules when i need them for something like the USB stick, but they don't go away later

anyways, more loaded modules = less availible RAM, unless i'm completely missing something...
 
Old 10-20-2004, 02:43 PM   #4
MasterC
LQ Guru
 
Registered: Mar 2002
Location: Salt Lake City, UT - USA
Distribution: Gentoo ; LFS ; Kubuntu ; CentOS ; Raspbian
Posts: 12,613

Rep: Reputation: 69
I guess if RAM is hard to come by, sure. I'm not sure that the modules load up RAM, but if they do, and that is a concern for you (they are tiny, but if your RAM is as well, then...) then unloading them sounds good to me

When you unplug the stick, does hotplug recognize it (in the logs)? With hotplug running, when I remove my PCMCIA Wireless card, the modules are then removed that keep it running, but maybe that's the workings of pcmcia and not necessarily USB.

kmod should/does remove un-necessary modules, but I believe that's only at a certain interval, maybe every 10 minutes or so?

I'm sure 2.6.7 is mature enough to have the capability of doing that. My 2.4.x running Gentoo does, but again, I'm not sure of the process that unloads the module, kmod or hotplug or possibly something else...



http://www.tldp.org/HOWTO/Module-HOW....html#MEMALLOC
There's a bit of more info on modules than I ever wanted to know

Anyway, I think the script is probably the way to go, however, I'm not a script writer so I'm not sure quite how to go about it.

Cool
 
Old 10-20-2004, 02:52 PM   #5
Levitate
Member
 
Registered: Aug 2004
Posts: 63

Original Poster
Rep: Reputation: 15
thanks, just somethin about building up more and more uneeded modules as i do things that kinda irks me....but i dunno if it's a big deal, that's just me....

is kmod kind of an automatic thing or do you have to configure it? that's what i can't really figure out...i know i enabled support for automatic module loading when i recompiled my kernel and all

but thanks for the help at any rate

actually I have one unrelated question, if i can hijack my own thread for a second...

when you're copying files at the command line, how do you do it if the file you're copying has spaces in it? for example, i have some documents from my windows PC that i wanted to move over to my linux pc via my USB key. the name of the document has spaces in it...using normal copying commands i wasn't able to get it to work (though maybe i just needed to play with it more) is there some trick i'm missing?
 
Old 10-21-2004, 04:32 AM   #6
MasterC
LQ Guru
 
Registered: Mar 2002
Location: Salt Lake City, UT - USA
Distribution: Gentoo ; LFS ; Kubuntu ; CentOS ; Raspbian
Posts: 12,613

Rep: Reputation: 69
You can use quotes around the spaced filename:
cp "My Cool Huge File that I wrote.doc" /home/documents
OR, you can TAB TAB TAB to get the autocomplete to do it the more correct way:
cp My\ Cool\ Huge\ File\ that\ I\ wrote.doc
Hit tab after typing My in the directory where the file is located.

I just, as in 30 seconds ago, configured a 2.6.9 kernel, and in the modules section, there is an option for module unloading, and it may be the answer you are looking for, it's worth a shot anyway.

Cool
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
how to load modules automatically kulmis Linux - Newbie 4 08-08-2005 09:59 AM
cant loading modules automatically kira Linux - Software 6 04-14-2005 12:57 AM
how do i get modules to load automatically behmjose Linux - General 2 04-13-2004 08:32 PM
unloading modules Xris718 Linux - General 8 03-30-2004 03:30 PM
modules.conf - Cannot get modules to load automatically gundelgauk Linux - General 1 12-27-2003 11:27 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

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

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration