acpi-support should let laptop-mode-tools run properly

Bug #250938 reported by Alexey Borzenkov on 2008-07-22
Affects Status Importance Assigned to Milestone
acpi-support (Ubuntu)

Bug Description

Binary package hint: acpi-support

Copying bug #250935 in part:

Currently acpi-support is running laptop-mode incorrectly. First of all it executes laptop-mode with start and stop commands directly, which interferes with settings users have in /etc/laptop-mode/laptop-mode.conf. Secondly, immediately after that it applies hard-coded power management and spindown time values, which interfere with the same settings specified in /etc/laptop-mode/laptop-mode.conf.

Please keep in mind, that acpi-support applies these settings only when laptop-mode is enabled, so it is natural for laptop-mode to handle these settings by itself, which it is better at, that is. To do this I propose these steps:

1) Change default laptop-mode settings to match those of acpi-support: this way users without custom configs won't notice any difference.
2) Since pm-utils is handling power states and hibernate/thaw/sleep/resume add pm-utils hooks to handle laptop-mode reloading
3) Change acpi-support not to interfere with laptop-mode, since now it is handled by pm-utils

The attached debdiff does step 3. This change will simplify acpi-support and finally let laptop-mode-tools work properly without users' having to do custom changes.

Related branches

Alexey Borzenkov (snaury) wrote :

good work thanks

Tormod Volden (tormodvolden) wrote :

This seems to make a lot of sense. But what if laptop_mode is not enabled (which is default), will there be no spindown time set at all? I agree it doesn't belong here anyway, it's not an ACPI thing.

Alexey Borzenkov (snaury) wrote :

If laptop-mode is not enabled (by default) then nothing changes. Currently, without laptop-mode enabled there is not spindown time as well.

Alexey Borzenkov (snaury) wrote :

It's interesting to know that current acpi-support in Debian unstable (1.109-5) has this comment in /etc/default/acpi-support:

# Note: to enable "laptop mode" (to spin down your hard drive for longer
# periods of time), install the laptop-mode-tools package and configure
# it in /etc/laptop-mode/laptop-mode.conf.
# (Note to upgraders: earlier versions of the acpi-support package contained
# an option to enable/disable laptop mode. This option has never actually
# worked, and for that reason it has been removed.)

Changed in acpi-support:
status: New → Confirmed
Tormod Volden (tormodvolden) wrote :

> Currently, without laptop-mode enabled there is not spindown time as well.

I think I can confirm this, yes. I have ENABLE_LAPTOP_MODE=false in /etc/default/acpi-support.

However, I am now trying out the debdiff3 in bug #255446 (includes your patch from bug #250935), and with this version the hard disk spins down nevertheless. (This is more a comment to those two bugs than this one though)

Tormod Volden (tormodvolden) wrote :

I found out why: there wasn't any space around the "=" in the check in the hooks (in patch for bug #250935). [ xtrue=xfalse] yields true.

ceg (ceg) wrote :

I'd like to say thank you.
For providing patches to the laptop-mode related things in ubuntu.
It was good to see your work apear.

Launchpad Janitor (janitor) wrote :

This bug was fixed in the package acpi-support - 0.110

acpi-support (0.110) intrepid; urgency=low

  * Let laptop-mode-tools run properly (closes LP: #250938)
    - remove laptop-mode invocations, should be handled by pm-utils
    - acpi-support: remove SPINDOWN_TIME, should be controlled by laptop-mode

 -- Alexey Borzenkov <email address hidden> Tue, 22 Jul 2008 23:59:07 +0400

Changed in acpi-support:
status: Confirmed → Fix Released
Dana Goyette (danagoyette) wrote :

Hmm, laptop-mode-tools still doesn't work properly.... the logic to control laptop-mode from ACPI-support has been removed, but the logic within the laptop-mode-tools package itself has not been fixed.
Note the following line in the changelog: "- usr/sbin/laptop_mode: Do not parse arguments, ignore "force" and let start/stop mean enable/disable."

laptop-mode-tools (1.45-1ubuntu1) intrepid; urgency=low

  [ Tormod Volden ]
  * Merge from debian unstable (LP: #255446), remaining changes:
    - etc/init.d/laptop-mode: Check if laptop mode is disabled in
      /etc/default/laptop-mode (that's the file laptop_mode looks into, too,
      but it incorrectly evaluates the ENABLE_LAPTOP_MODE setting) as well
      as in /etc/default/acpi-support.
    - usr/sbin/laptop_mode: Do not parse arguments, ignore "force" and
      let start/stop mean enable/disable.
    - /usr/sbin/laptop_mode: Do not read $ACTIVATE_WITH_POSSIBLE_DATA_LOSS
      from /var/run/laptop-mode-state to see if state has changed.
    - debian/rules: Do not ship acpi/apm scripts (we handle that ourselves)
    - debian/laptop-mode-tools.preinst: Remove any old acpi/apm scripts
    - debian/laptop-mode-tools.postinst: Create /etc/default/laptop-mode
      (with ENABLE_LAPTOP_MODE=false) if the file does not exist yet and we
      are on ppc.
    - Also accept "stop" as second argument since the init script
      calls laptop_mode with "init stop"

  [ Alexey Borzenkov ]
  * Change default settings to match acpi-support (LP: #250935)
    - etc/laptop-mode/laptop-mode.conf: change default spindown time and
      power management modes
  * Add pm-utils hooks to ensure laptop-mode is running as expected after
    power change or thaw/resume
    - power.d/laptop-mode: runs laptop-mode on power change
    - sleep.d/96laptop-mode: runs laptop-mode on thaw/resume

 -- Tormod Volden <email address hidden> Wed, 06 Aug 2008 20:06:08 +0200

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