LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   'rmmod -a' : what does it do? (https://www.linuxquestions.org/questions/linux-newbie-8/rmmod-a-what-does-it-do-906709/)

stf92 10-06-2011 05:04 AM

'rmmod -a' : what does it do?
 
Hi: In my system, the rmmod manual says:

Code:

SYNOPSIS
      rmmod [-f]  [-w]  [-s]  [-v]  [modulename]

And in /etc, I have:
Code:

semoi@darkstar:/etc/cron.hourly$ cat kmod
#!/bin/sh
/sbin/rmmod -as
semoi@darkstar:/etc/cron.hourly$

The manual does not say what rmmod does when it is invoked without an argument. And the -a option is undocumented. Can somebody supply missing information? Thanks in advance.

dive 10-06-2011 05:13 AM

Looking at the source it removes all unused modules:

Code:

    /* Parse command line. */
    n = getopt32(argv, "wfas"); // -s ignored
    argv += optind;
 
    if (n & 1)  // --wait                       
        flags &= ~O_NONBLOCK;                   
    if (n & 2)  // --force
        flags |= O_TRUNC;
    if (n & 4) {
        /* Unload _all_ unused modules via NULL delete_module() call */
        if (bb_delete_module(NULL, flags) != 0 && errno != EFAULT)
            bb_perror_msg_and_die("rmmod");
        return EXIT_SUCCESS;
    }


stf92 10-06-2011 06:35 AM

Thanks very much. Then in my system, every unused module is unloaded say at 6am, at 7am, at 8am and so on. However, if I do lsmod, I see all ALSA modules are loaded. These are loaded at boot time, but afterwards no other module or program uses them. I will exit the GUI and stay out of it for an hour and see what happens.

dive 10-06-2011 01:54 PM

I'm curious where that kmod script came from. I don't have it on my 13.37 boxes.

stf92 10-06-2011 08:09 PM

It gets installed in /etc/cron.hourly every time I install slackware 12.0. It's in the module-init-tools package (module-init-tools-3.2.2-i486-3.tgz), belonging to the A series.
Code:

PACKAGE LOCATION: /var/log/mount/slackware/a/module-init-tools-3.2.2-i486-3.tgz
PACKAGE DESCRIPTION:
module-init-tools: module-init-tools (kernel module utilities)
module-init-tools:
module-init-tools: Utilities to load and unload kernel modules.  These are used
on Linux
module-init-tools: to load extra drivers or other features into the running kern
el.
module-init-tools:
module-init-tools:
module-init-tools:
module-init-tools:
module-init-tools:
module-init-tools:
module-init-tools:
FILE LIST:
./
bin/
etc/
etc/cron.hourly/
etc/cron.hourly/kmod
etc/modprobe.conf.new
...................


dive 10-07-2011 07:36 PM

It seems to have been removed at some point then.

stf92 10-08-2011 03:10 AM

After boot, I have 20 sound modules loaded. Do you know some easy way to unload them all?


All times are GMT -5. The time now is 04:52 AM.