pm-utils has laptop-tools script which conflicts with laptop-mode-tools

Bug #239419 reported by Alexey Borzenkov
10
Affects Status Importance Assigned to Milestone
pm-utils (Ubuntu)
Fix Released
Undecided
Unassigned

Bug Description

pm-utils has power.d/laptop-tools script, which unconditionally sets /proc/sys/vm/laptop_mode along with various other /proc/sys/vm settings. The problem is that if you install laptop-mode, enable and configure it with your own settings, those settings are overwritten by the script upon reboot (and come back only if you manually unplug and plug your laptop back or do /etc/init.d/laptop-mode start).

The attached patch fixes the problem by disabling the script in case laptop mode is enabled.

Revision history for this message
Alexey Borzenkov (snaury) wrote :
Revision history for this message
pelm (pelle-ekh) wrote :

Hi!
Adding the lines from the patch to /usr/lib/pm-utils/power.d/laptop-tools, but that's not working. On reboot the script overwrites the settings, and must unplug and plug in the power for the laptop mode to be enabled. Is it something else that i'm missing on this?

Regard
pelm

Revision history for this message
Alexey Borzenkov (snaury) wrote :

Hmm. That's strange. I've just reinstalled ubuntu, added these lines:

if [ -f "/etc/default/acpi-support" ] ; then
 . /etc/default/acpi-support
 if [ x$ENABLE_LAPTOP_MODE = xtrue ] ; then
  echo "Laptop mode enabled, laptop-tools has nothing to do"
  exit 0
 fi
fi

and it worked for me (cat /proc/sys/vm/laptop_mode shows 2).

Are you sure you have ENABLE_LAPTOP_MODE=true in /etc/default/acpi-support?

Also don't forget to replace original laptop_mode_enable and laptop_mode_disable in /etc/acpi/power.sh with this:

function laptop_mode_enable {
    $LAPTOP_MODE auto
}

function laptop_mode_disable {
    $LAPTOP_MODE auto
}

The original is disabling laptop-mode in 5 seconds after you plug in to AC. :-/

Revision history for this message
ceg (ceg) wrote :

Disk-idleing (aka "laptop-mode") and power states are quite separate things.
https://wiki.ubuntu.com/PowerManagement

Since ubuntu by default ships with laptop-mode-tools (thus disabled) which handles all the things associated with disk-idleing,

(like mount options, hdparm options, low battery exceptions, disk-idleing on AC when on the road, etc.)

just remove the "laptop-tools" script from pm-tools.

Package laptop-mode-tools needs to put scripts in that place if pm-tools are chosen to handle power states. #244844

Revision history for this message
Alexey Borzenkov (snaury) wrote :

Actually, you are quite right. Currently, all that /etc/acpi/power.sh 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 problems people already should experience all 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.

Revision history for this message
ceg (ceg) wrote :

This pm-utils bug is not a duplicate of the laptop-mode-tools bug #244844.

This bug is about pm-utils provocing a conflict.

The other is about adapting laptop-mode-tools to the pm-utils / acpi-support hooks.

Revision history for this message
ceg (ceg) wrote :
Revision history for this message
vussvillem (vussvillem) wrote :

I just wanted to confirm that I was also affected by the problem and the patch together with instructions in wiki article (https://wiki.ubuntu.com/PowerManagement#head-ab94c99627b86e9fbb29a09d3316178269c3e764) that ceg has cited, fixed the problem in Ubuntu 8.04.

I also want to underline the importance of activating laptop-mode tools nice and easily in Ubuntu - to me, laptop-mode-tools was the only thing why I gave Linux a try because it makes such a great heat reduction on my Dell D600 with well-known heat issue.

Revision history for this message
ceg (ceg) wrote :

pm-utils no longer ships on laptop-mode script

Changed in pm-utils (Ubuntu):
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.