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 |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
10-20-2004, 11:43 AM
|
#1
|
Member
Registered: Aug 2004
Posts: 63
Rep:
|
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
|
|
|
10-20-2004, 12:51 PM
|
#2
|
LQ Guru
Registered: Mar 2002
Location: Salt Lake City, UT - USA
Distribution: Gentoo ; LFS ; Kubuntu ; CentOS ; Raspbian
Posts: 12,613
Rep:
|
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
|
|
|
10-20-2004, 02:07 PM
|
#3
|
Member
Registered: Aug 2004
Posts: 63
Original Poster
Rep:
|
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...
|
|
|
10-20-2004, 02:43 PM
|
#4
|
LQ Guru
Registered: Mar 2002
Location: Salt Lake City, UT - USA
Distribution: Gentoo ; LFS ; Kubuntu ; CentOS ; Raspbian
Posts: 12,613
Rep:
|
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
|
|
|
10-20-2004, 02:52 PM
|
#5
|
Member
Registered: Aug 2004
Posts: 63
Original Poster
Rep:
|
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?
|
|
|
10-21-2004, 04:32 AM
|
#6
|
LQ Guru
Registered: Mar 2002
Location: Salt Lake City, UT - USA
Distribution: Gentoo ; LFS ; Kubuntu ; CentOS ; Raspbian
Posts: 12,613
Rep:
|
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
|
|
|
All times are GMT -5. The time now is 05:12 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|