2

Is there any way to unload modules in Ubuntu (e.g., keyboard, USB, graphics etc) to save power? I don't want to use powertop for that, but I want to manually find these modules and unload them.

1

3 Answers 3

1

I don't know of any way to directly monitor power consumption from modules. As far as I know powertop looks for modules that are responsible for lots of wakeups. I don't know how to look for modules that are responsible for lots of wakeups. What I want to suggest is to look for loaded modules you don't need and simply unload them and then check whether that lower power consumption. The following describes how to do that.

Finding modules

Alternative 1

You can list loaded modules with lsmod and combine it with grep to find certain modules. Say, that you're looking for modules that has to do with video because you don't need them. Then you can do

lsmod | grep -i video

On my system this returns

video                  19438  1 i915

If I want to unload any modules that has to do with video I guess I'd unload the module video. But what about the module i915? We can learn about it by doing:

modinfo i915

It tells me that the module i915 is for Intel graphics so it makes sense to unload that module as well if I want to unload everything that has to do with video. Also it might make sense to do

modinfo i915 | grep depends

to see what modules i915 depends on. It might show other candidates for unloading.

Alternative 2

Another way to go is to go through all loaded modules and check whether you need them or not. First do

lsmod

Then you simply run modinfo for every module you want information about. If "module-name" is the name of the module you want to information about you do

modinfo module-name

Unloading modules

To unload a module either do

sudo rmmod module-name

or

sudo modprobe -r module-name
4
  • The question is, "how do I find a specific module?", e.g., I want to remove graphics module from a PC over ssh from another PC.
    – umair
    Aug 10, 2011 at 11:33
  • @umair I've edited my answer to answer that. You might want to clarify your question so that it's completely clear what you're asking for. You might also want to provide an example case.
    – N.N.
    Aug 10, 2011 at 12:11
  • Thanks for your suggestions. Actually I wanna know the power consumption of a PC. I could only measure the overall power consumed by the whole system (with a power meter). I have no way to calculate the power consumption of individual component (e.g., graphics card, processor, HDD etc). I connect to this PC via ssh over another PC. I just want to turn off all the modules (e.g., graphics) to see if they really affect the power consumption. I tried lsmod | grep -i video over ssh, but nothing shows up.
    – umair
    Aug 10, 2011 at 12:34
  • @umair You should edit your question and add that that is what you want to do (the users of this site are knowledgeable but not mind readers). Instead of doing lsmod | grep -i video you can just do lsmod and then do modinfo module-name for every module it returns and decide if that is a module you need. You can check power consumption before and after unloading modules to see if it has any effect.
    – N.N.
    Aug 10, 2011 at 12:37
1

You have two questions, joined at the middle... But each question has a different context.

Yes you can unload modules, possibly saving RAM. But doing so is rarely going to translate into lower power use, and sometimes power use could go up if the thing you unloaded were providing an efficiency boost. Unloading an optimized graphics module could have your system falling back on unaccellerated vides which uses more CPU power, for example.

There is also no guarantee that device without driver commanding it would be in any kind of idle mode. It's job of the driver to put the device into on/sleep/off modes depending on OS situation, and without the driver device might be in any of those three.

If you only connect to this system via ssh, then you can configure the server to not boot into X. Edit innittab in /etc, and set the default run level to 3, and your system will boot and load into the console prompt.

Best thing is use a utility to manage power for you, and set it to max power savings.

You are only going to be able to measure whole system power, either through the OS or at the outlet using a Kill-a-watt device. You may see the overall numbers change with experimentation to your configuration. I am not aware of a method to track power of just a hardware subsystem.

0

You can also use powertop to find the power-save settings you could change:

  • Start powertop.
  • Use TAB to go to the rightmost list that shows each device and its state. It shows >good< or >bad< if the power-save options are on or off.
  • When you change it with space, you see the command it executes at the top.
  • Copy the commands you want and put them in a script separately.

(Not an answer to your question, but you could also put powertop --auto-tune in your startup scripts to set all settings to >good< at once - https://unix.stackexchange.com/questions/156758/reload-a-kernel-module-to-re-vive-a-crashed-device-without-reboot)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .