laptop-mode-tools uses hparm -B 255 instead of 254

Bug #172282 reported by ubuntu_demon
12
Affects Status Importance Assigned to Milestone
laptop-mode-tools (Debian)
Fix Released
Unknown
laptop-mode-tools (Ubuntu)
Fix Released
Undecided
Unassigned

Bug Description

Binary package hint: laptop-mode-tools

regarding /etc/laptop-mode/laptop-mode.conf : LM_AC_HD_POWERMGMT and NOLM_AC_HD_POWERMGMT should default to 254 instead of 255
Using hdparm -B 255 is unpredictable because it's undefined in the ata/sata specs. This is relevant to people who are using CONTROL_HD_POWERMGMT=1

Please sync laptop-mode-tools from Debian to fix this issue. Quoting Bart Samwel, Debian maintainer of laptop-mode-tools, from
https://bugs.launchpad.net/ubuntu/+source/acpi-support/+bug/59695/comments/225 :

[quote=Bart Samwel]
......
......
The only thing that
should change in that area is that the default HD powermgmt settings in
the laptop-mode.conf should be changed to 254 instead of 255, but
that'll happen automatically the next time they sync up with Debian.
......
......
[/quote]

tferero received an email from Bruce Allen. From :
http://www.linuxquestions.org/questions/showthread.php?p=2945630#post2945630

[quote=Bruce Allen]
Hi T-,

I just learned about this buzz from a colleague yesterday.

I don't have any experience with your Samsung drive. I suggest that you
run a sort self-test '-t short' and wait until it completes. The drive
age should then be shown in the self test log. Then experiment with the
different -v and -F options to see how the drive is storing its lifetime.

IMPORTANT INFORMATION BELOW: PLEASE PASS BACK TO THE UBUNTU COMMUNITY

I think that the -B value of 255 is incorrect. You should use 254 for
maximum performance. 255 IS DOCUMENTED AS 'RESERVED' IN THE ATA/SATA
SPECS. THE BEHAVIOR OF -B 255 THUS IS NOT PREDICTABLE AND IT MAY HAVE NO
EFFECT. Also according to the ATA/SATA specs any value greater than or
equal to 128 will 'not permit the device to spin down to save power'. So
128 will reduce power use as much as possible but not permit spin-down.

References:
http://www.t13.org/Documents/UploadedDocuments/docs2007/D1532v1r4b-AT_Attachment_with_Packet_Interface_-_7_Volume_1.pdf
PDF page 273 Document page 253
Table 43 (and the paragraph immediately following it).

So I suggest you try some different -B values such as -B 254 or -B 128.

The hdparm man page says 'values of 255 will disable Advanced Power
Management'. I think this is a mistake in the man page. According to the
ATA/SATA specs referenced above, the value 255 is reserved and has vendor
dependent meaning (or has no effect).

Cheers,
Bruce
[/quote]

Bruce Allen is :
* author of "Monitoring Hard Disks with SMART", Linux Journal, 2004) :
http://www.linuxjournal.com/article/6983
* maintainer of the website http://smartmontools.sourceforge.net/

blackhole54 notified us here about this here :
http://ubuntuforums.org/showpost.php?p=3690862&postcount=15

The bug about hdparm's misleading feedback about -B values :
https://bugs.launchpad.net/ubuntu/+source/hdparm/+bug/172287

description: updated
description: updated
Revision history for this message
Tormod Volden (tormodvolden) wrote : Re: laptop-mode-tools uses hparm -B 255 instead of 254 please sync laptop-mode-tools from Debian to fix this

A merge request has already been filed in bug #164387.

Revision history for this message
Tormod Volden (tormodvolden) wrote :

I will update the changelog in the merge patch to indicate that it closes this bug as well. I submitted the merge almost a week ago, maybe we can kick the sponsoring a little.

Changed in laptop-mode-tools:
status: New → Confirmed
Revision history for this message
ubuntu_demon (ubuntu-demon) wrote :

Thanks.

Changed in laptop-mode-tools:
status: Unknown → Fix Released
Revision history for this message
ubuntu_demon (ubuntu-demon) wrote :

For most drives "sudo hdparm -B 254 /dev/sda" works
For some drives "sudo smartctl -o on /dev/sda" is needed before issueing "sudo hdparm -B 254 /dev/sda"
For some drives "sudo hdparm -B 255 /dev/sda" might be needed

IMHO it would be nice if hdparm would provide a single command which turns down power management for all drives.

see also :
https://bugs.launchpad.net/ubuntu/+source/acpi-support/+bug/59695/comments/286
https://bugs.launchpad.net/ubuntu/+source/hdparm/+bug/172287/comments/1
http://ubuntuforums.org/showpost.php?p=3909494&postcount=552
http://ubuntuforums.org/showpost.php?p=3672087&postcount=18

Revision history for this message
Tormod Volden (tormodvolden) wrote :

laptop-mode-tools (1.35-1ubuntu1) hardy; urgency=low

  * Merge from debian unstable (LP: #164387), 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
      "init" 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.
    - Add 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.
    - debian/laptop-mode-tools.postinst: Include update-rc.d (LP: #127273)
      (Debian generates the .postinst from dh_makeinit)
    - debian/laptop-mode-tools.preinst: remove any old acpi scripts
    - debian/rules: Don't ship acpi scripts (we handle that ourselves)
    - debian/rules: use rm -f to avoid missing-file message
    - debian/control: change maintainer
  * New Ubuntu-only patch:
    - Do not ship apm scripts and remove any old ones
  * Dropped Ubuntu-patches now upstream:
    - Fix error messages when run as non-root (LP: #77560)
  * New upstream changes closing Ubuntu bugs:
    - laptop-mode-tools uses hparm -B 255 instead of 254 (LP: #172282)

laptop-mode-tools (1.35-1) unstable; urgency=low

  * New upstream version 1.35.
  * Listen to more ACPI events for AC adapters. Closes: #448101.
  * Better error messages when laptop_mode status is called by a non-root user.
    Closes: #428162.
  * Clean up temp file from init script, and properly quote messages so that
    they are displayed in full. Closes: #442321, 427292.
  * Set READAHEAD setting correctly on Linux 2.4. Closes: #355492.
  * Set HD power management default values to 254 instead of 255.
    Closes: #451589.
  * Update homepage location in debian/copyright. Closes: #445455.
  * Fix bug in manual page for lm-profiler.conf. Closes: #450431.
  * Don't adjust LCD brightness to the same value as before. Closes: #440115.
  * Modules moved to /usr/share/laptop-mode-tools/modules to improve FHS
    compliance.

 -- Tormod Volden <email address hidden> Wed, 21 Nov 2007 20:42:58 +0100

Changed in laptop-mode-tools:
status: Confirmed → Fix Released
Revision history for this message
Yann (lostec) wrote :

I recently reinstalled my toshiba p100 laptop from Dapper to Hardy... Recently, I also changed my HDD for a WD Scorpio 320Gb.

This configuration was working nicely under dapper, with both original drive (fujitsu 100Gb) and new one I used a few days before reinstall.

Under Hardy, I was surprised to hear a new HDD tick almost every minute, even on AC. smartmon proved I was due to heads parking very often.

Here are the results of my experiences:
Hardy defaults to a -B 128 even on AC. It's nonsense. On some drives (like my WD scorpio), it leads to excessive head parks. On some (my office HP nc6400 Seagate momentus 80Gb for instance), It does not.

So, to have something working with ALL HDD, hdparm sould default to -B 255, which effectively seems to switch off drive power management (with 254, the WD Scorpio still heavily park heads), at least on AC.

On battery, value 128 is also irrelevant as it does not permit spin down to save power! So we have excessive parks without huge spin down power saving!

Proposed fixes (scripts in /etc/acpi/*.d with appropriate hdparm line) work... until you resume from suspend to ram! It seems acpi override script settings after their execution.

This bug lasts since several kernel revisions, even if I discovered it recently. It should really be solved in hurry and considered really critical because a user that will lost his HDD becaus of linux is really not likely to use it again.

Regards.

Revision history for this message
Tormod Volden (tormodvolden) wrote :

Yann, laptop-mode is not enabled by default in Hardy, so normal users won't use it at all. If it is enabled, it will use -B 254 (that's why this bug is closed now).

Revision history for this message
Yann (lostec) wrote :

Tormod,

I'm really not sure who is controlling this: acpi, pm, laptop_mode? Just grep'ed in conf file to try settings. Only one thing is sure: I've found, as others, ugly ways to disable HDD power mgt a startup... but not after a suspend.

So maybe I'm not at the right place, but instead of ugly fixes, I really would like to know where I could change this -B 128 default to be sure I'll not see it again?

Regards

Revision history for this message
chourave (gaston72) wrote :

I posted a comment related to this issue :
https://bugs.launchpad.net/ubuntu/+source/acpi-support/+bug/74394/comments/5

I'm not an expert but I think that the problem is in power.sh : it doesn't make the difference whether or not laptop-mode is installed (and enabled on ac or battery) and overwrite the hdparm settings.

Revision history for this message
ceg (ceg) wrote :

Reopening.

hdparm -B value 254 needs to be reintroduced because the fix to bug #250935 ([intrepid] laptop-mode-tools needs to change its default settings to match acpi-support and add hooks for pm-utils) has migrated the old 255 setting from acpi-support into laptop-mode-tools.

Changed in laptop-mode-tools:
status: Fix Released → Confirmed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package laptop-mode-tools - 1.45-1ubuntu2

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

  * etc/laptop-mode/laptop-mode.conf: Go back to 'hdparm -B 254';
    acpi-support has been fixed to do that now, so let's not have
    laptop-mode-tools undo the effectiveness of that fix in the name of
    consistency with an old version (LP: #172282).

 -- Colin Watson <email address hidden> Wed, 08 Oct 2008 15:05:10 +0100

Changed in laptop-mode-tools:
status: Confirmed → 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.