Adapt laptop-mode-tools invocation to ubuntu's acpi-support / pm-tools packages

Bug #244844 reported by ceg on 2008-07-02
This bug affects 1 person
Affects Status Importance Assigned to Milestone
laptop-mode-tools (Ubuntu)

Bug Description

Binary package hint: laptop-mode-tools

Adaption would would mean to include scripts that call "/usr/bin/laptop_mode auto" in in /etc/acpi/ac.d, battery.d, resume.d and start.d.

It is suggested to acpi-support to stop calling laptop-mode-tools and hdparm directly (in non-config files).
bug #244831, bug #244832, bug #244833, bug #244836

(Beware: resume.d, and start.d may be obsoleted by some pm-tools directory)
bug #244839, bug #205005

(Adapt the approach from the original laptop-mode-tools debian package to current ubuntu acpi-support)

laptop_mode may need the options "auto force" when called on resume events. (To reapply hdparm settings even though AC state has not changed.)

(The current laptop-mode disk-idleing approach seems to be a left-over from before the ubuntu-laptop-mode package was droped for laptop-mode-tools.)

Alexey Borzenkov (snaury) wrote :

A copy of my comment

Actually, you are quite right. Currently, all that /etc/acpi/ and /usr/lib/pm-utils/power.d/laptop-tools do is perfectly replicable with identical settings in /etc/laptop-mode/laptop-mode.conf (*_HD_POWERMGMT, *_HD_IDLE_TIMEOUT_SECONDS, *_RATIO in /etc/laptop-mode/laptop-mode.conf, and ENABLE_LAPTOP_MODE=true in /etc/default/acpi-support). Even the argument that laptop-mode is freezing some computers is no longer valid, because /proc/sys/vm/laptop_mode is hard-coded to 2 on battery power, and you will get the same functionality as long as ENABLE_LAPTOP_MODE_ON_AC=0 (which is default). So if there are still problems people already should have been experiencing that.

Also, /usr/sbin/laptop_mode already has all that state code commented out, so it doesn't need any force argument, WAS_ACTIVE is always 0 with the version shipped in Ubuntu, so it always reapplies its parameters.

Changed in laptop-mode-tools:
status: New → Confirmed
Alexey Borzenkov (snaury) wrote :

Ok, patch for pm-utils here. As far as I understood power.d is called on battery/ac change and sleep.d is called on sleep/resume and the like. My patch stops pm-utils from interfering with laptop-mode-tools and reloads laptop-mode on ac/battery and suspend/resume.

The package with this change is uploaded to

Alexey Borzenkov (snaury) wrote :

Ok, patch for acpi-support here. Since power states seem to be primarily controlled with pm-utils and my previous patch has necessary modifications we can remove laptop-mode calling code here and let pm-utils do its job. Also, we set ENABLE_LAPTOP_MODE=true by default, to that everything will have potential of running the same way as before.

The package with this change is uploaded to

Alexey Borzenkov (snaury) wrote :

Now at this stage all that's left is changing defaults in laptop-mode-tools to sane values. I'm not providing a patch for this, because I might be too biased on the matter of correct values (i.e. I think the values that are currently used in hardy are bad and I'm using different values).

ceg, if you can, please advertise my patches to developers. I'm currently basically no one in Ubuntu community and don't know the right people to talk to. So I will be pleased if this blanket bug of yours will finally become the turning point.

description: updated
ceg (ceg) wrote :

This bug report is inteded to document the adaption of laptop-mode-tools.

Wouldn't the patch to pm-tools be the matter of a pm-tools bugreport?

Though this bugreports may be linked with current pm-tools package interfering with package laptop-mode-tools, I do think this bug needs to be separate from pm-tools bugs (they are not duplicates).

Alexey Borzenkov (snaury) wrote :

Ok, tell me where (to which bug numbers) my patches belong? The problem is that we have three packages at play here and patching one doesn't make sense without the other. I'm a little lost with so many bug reports, bug #59695 where this all originated is rather long (and I'm sure it's hard to track for developers too) and I don't want to create even more bug reports just for my patches.

ceg (ceg) on 2008-07-06
description: updated
ceg (ceg) wrote :

I don't know.

I believe in letting pm-utils manage power state changes (if that is the tool of choice) and letting acpi-support taking care of button, battery and ac events etc.

A disk idleing tool like laptop-mode-tools can be hooked into these appropriately, when its packaged with scripts that go into the right directories.

ceg (ceg) wrote :

There is now an overview about the related bugs in the wiki.

kakado (dadomonte) wrote :

Thank you Alexey!!!!
I am using your patch to acpi and pm-utils and everything is working great even after a suspend/resume.
Now I am focus in change the laptop-mode.conf to better settings.

Alexey Borzenkov (snaury) wrote :

Hello, just to inform you here, I now filed bug #250935 and bug #250938 that are intended for intrepid (and actually fix the issue better than my previous patches). I really hope they could land before intrepid freezes... -_-

yoda42 (yoda42) wrote :

I am still running Gutsy 7.10 on a Dell 1525n, and would like to know what to set where to have an optimal configuration for a machine sitting at home on AC power, as well as if it is mobile on battery. Every so often at home I hear the disk drive make an alarming click sound, which I believe to be the heads parking as described above (S.M.A.R.T. reports everything is okay). The wiki, etc. only seem to describe post-Gutsy scenarios.


Ritesh Raj Sarraf (rrs) wrote :

I'm not sure who is the active maintainer for laptop-mode-tools in Ubuntu but are there any plans of updating the version in Ubuntu to the latest from upstream ?

Steve Langasek (vorlon) wrote :

This appears to be fixed in recent versions of Ubuntu: all power management hooks are handled by pm-utils, and laptop-mode-tools integrates with pm-utils. Marking as fixed.

Changed in laptop-mode-tools (Ubuntu):
status: Confirmed → Fix Released
ceg (ceg) wrote :

Hi Steve,

thank you for working on this. I have checked the integration in 9.10. My observation is:

* laptop-mode-tools ships with scripts under /etc/power/*. Is this location still valid in some way or are scripts supposed
    to be installed under /etc/pm/* now (as /etc/ scripts to override /usr/lib/pm-tools/* ?

* In order to remove the ENABLE_LAPTOP_MODE setting from /etc/default/acpi-support (LP: #244838)
   (if we really do not want to have laptop-mode enabled by default *on battery* like in debian):
   Either laptop-mode-tools should allways ship with the /etc/default/laptop_mode (not only on powerpc)
   or default ENABLE_LAPTOP_MODE_ON_BATTERY to "no" in /etc/laptop-mode/laptop-mode.conf
   (if enabling laptop-mode on battery by default is ok, this point is obsolete and ENABLE_LAPTOP_MODE=false
   can be removed from /etc/default/acpi-support right away.)

* May the script /usr/lib/pm-utils/power.d/laptop-mode better be named with a number too? Like 96laptop-mode,
    to make sure it is called after 95hdaparm-apm.

Please set to fixed if those points are allready handled in lucid.

Changed in laptop-mode-tools (Ubuntu):
status: Fix Released → New
ceg (ceg) wrote :

According to
the kernel's laptop_mode has been hardcoded to be enabled on battery all the time anyway.

So it should be fine to just remove checking ENABLE_LAPTOP_MODE
in /etc/default/acpi-support from /etc/init.d/laptop-mode, /usr/lib/pm-utils/sleep.d/96laptop-mode and /usr/lib/pm-utils/power.d/laptop-mode. And to remove that stanza from the /etc/default/acpi-support file.

Steve Langasek (vorlon) wrote :

/etc/power/ appears to be a configuration directory for the pbbuttonsd daemon, which is powerpc-specific; these scripts are certainly unrelated to pm-utils integration, and I have no intention of touching this given that I'm not in a position to test changes regarding pbbuttonsd integration.

> May the script /usr/lib/pm-utils/power.d/laptop-mode better be named with a number too? Like 96laptop-mode,
> to make sure it is called after 95hdparm-apm.

Letters already sort after numbers.

As for whether laptop-mode-tools should be enabled by default, there is already a separate bug open for this issue, so that's not a reason to keep this bug report open (and is scope creep wrt the original request in any case).

> According to
> the kernel's laptop_mode has been hardcoded to be enabled on battery all the time anyway.

I'm not sure what the basis for this claim was, but it's definitely wrong.

$ cat /proc/sys/vm/laptop_mode

Steve Langasek (vorlon) on 2009-12-02
Changed in laptop-mode-tools (Ubuntu):
status: New → Fix Released
ceg (ceg) wrote :

Thanks, for getting back and finding out about /etc/power.

I'm sure we want to give a good impression of tidy, easily understandable and functional ubuntu packages for acpi, powermanagment and disk idleing (laptop-mode) support unlike with the bugload unfortunately introduced before.

-> Because letters sort after numbers it is not possible to adequately sort a script like "anacon" behind it using numbers. Bug #491831

-> /etc/power is now also a separate Bug #491804

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Duplicates of this bug

Other bug subscribers