Ubuntu power management nonsense

Posted in GNU-Linux, English by andrea on November 26th, 2007

One thing that Ubuntu has left half finished is power management. It goes a long way supporting standby, hibernation, laptop buttons and switches out of the box, but leaves many important features hard to configure.

Currently at least two different systems coexist in a Ubuntu installation: laptop-mode-tools and acpi-support. Out of both we have powernowd and gnome-power-manager which only take care of a particular aspect.
Laptop-mode-tools are an old hack used to instruct the kernel to let hard drives spin down by caching writes. This little script has grown big and now can manage most of a system power management, including starting and stopping services, and cpu frequency. You may think it’s good, but it’s not: the configuration is ugly and it just tries to do too much. Have a look under /etc/laptop-mode/ and /etc/power/ to get an idea of this.

Acpi-support is one big Ubuntu-specific attempt to effective power management. It’s a collection of scripts to be run by acpid upon verification of many events, like the AC adapter being plugged or a wireless switch turned on. This package is what makes Ubuntu good on laptops, but it is still an incomplete system, even tough much more modern than laptop-mode-tools.
Configurations files and scripts for acpi-support are in /etc/acpi/ and /etc/default/acpi-support.

Hard drives power management currently done by both with strange results. Also both systems react to power related events and so need a special explicit activation upon boot to check the initial status.

Powernowd is the backend used to scale processor speed and has no notion of battery charge. It just enables the ondemand cpu frequency scaling governor on most platforms.

Gnome-power-manager is instead the gnome component that keeps track of battery status and screen power saving, being the “user” part of power management while the rest is the “system” part. It integrates with HAL, instead of acpid.

As you see there are too many programs doing small bits of a bigger job. In my opinion a possible way out is this one:

  1. reduce laptop-mode-tools functionality to bare minimum necessary to manage kernel parameters and mount options. Don’t let it choose if it should run based on battery or anything else, make it totally controlled by apcid and acpi-support scripts. Laptop mode configuration should be all about advanced parameters most user won’t touch.
  2. merge powernowd functionality with acpi-support.
  3. better support for starting and stopping services in acpi-support, using start and stop arguments, so that it is easier to have some services run on ac only.
  4. refactor configuration files to have all options relevant to powernowd, standby/hibernation, hard drive in different files of the same folder. These should be well commented and easy to manage.
  5. expand gnome-power-manager, making it run user configured scripts on power-related events. Also add some tool capable of setting system-wide preferences like: hard drive timeouts, processor speeds.
  6. we probably don’t need both acpid and HAL, so acpid could be reworked to use HAL as a backend or something else could be used to trigger the scripts from acpi-support.

Steps 1 to 3 should be pretty quick, step 4 may need to touch a few packages, step 5 and 6 would take a while, but the result would be a solid foundation to further integration with power saving tools or defining power profiles.

5 Responses to 'Ubuntu power management nonsense'

Subscribe to comments with RSS or TrackBack to 'Ubuntu power management nonsense'.

  1. paul reiber said,

    on November 26th, 2007 at 10:34 pm

    I recommend deciding on a common infrastructure for these tools to use to coordinate amongst themselves.

    Something like rta lib might fit the need quite nicely.

    Wish I could find the rta lib source url for you alll… Sorry about that…

    The linux appliance design book by no starch press shows how to make really solid daemon solutions using this new infrastructure.

    Itd be awesome to see a concerted effort to pull these various standalone tools together into a comprehensive platform management solution, and rta lib could very well help along those lines.

    Hope this helps!
    -Paul Reiber
    president, silicon valley linux users group
    http://svlug.org

  2. Andy said,

    on November 26th, 2007 at 10:45 pm

    I believe Ubuntu community or Linux community should consider power management as one of the big topics because we are talking about energy efficiency these days and Linux has done excellent jobs on controlling various computer hardware and kernel is just fantastic. So if there is a small group of experts who concentrate on developing power management modules in kernel, it will be Christmas everyday!

  3. andrea said,

    on November 26th, 2007 at 11:05 pm

    I think the best interprocess communication solution would be to use dbus, as it is already by HAL and gnome-power-manager.

  4. ex-parrot said,

    on July 30th, 2008 at 1:31 pm

    The UNIX philosophy has always been small tools that do a single thing and do it well, I don’t see a problem with applying this approach to power management. The more Ubuntu deviates from this philosophy, the further it deviates from the things that make Linux great.

  5. Joel Koltner said,

    on November 2nd, 2008 at 11:35 pm

    ex-parrot,

    The problem is that right now those small tolls *don’t* do a “single thing” well — they all tend to (partially) fight with each other. :-(

Leave a Reply