[maverick] HD spins down all the time on AC

Bug #606706 reported by Christian Schürer-Waldheim
78
This bug affects 13 people
Affects Status Importance Assigned to Milestone
pm-utils (Ubuntu)
Fix Released
High
Martin Pitt
Maverick
Fix Released
High
Martin Pitt

Bug Description

Binary package hint: pm-utils

Today pm-utils got updated from 1.3.0-2 to 1.4.1-1. Since then, the hard drive spins down all the time. For instance while reading a web page in firefox, I can hear the hard drive spin down and up several times a minute - even being on mains power supply. The load cycle increased by more than 20 within 2-3 minutes.

Tags: regression
Revision history for this message
Christian Schürer-Waldheim (quincunx) wrote :

Martin and Michael, I subscribed you to this bug report because you made the recent changes in pm-utils.

[quote]
    Current hooks when switching to battery:
    - [hal-cd-polling] Disable HAL's polling of CD drives for automounting
      them. Note that this HAL functionality is already obsolete in Debian's
      current GNOME, but still being used in current KDE and XFCE desktops.
    - [harddrive] More aggressive harddrive spindown times

[/quote]

The changelog is saying that a more aggressive harddrive spindown is set when on battery, but could it be that this option is also active when on mains power? Because another thing I notices since pm-utils was updated is that my CD drive spins up from time to time even there is no CD ROM in it, which could be caused by the disabled cd polling.

Revision history for this message
Christian Schürer-Waldheim (quincunx) wrote :

Monitoring /var/log/pm-powersave.log while removing and connecting the power supply, I get this:

[quote]
Running hook /usr/lib/pm-utils/power.d/harddrive true:
Enabling power management for /dev/sda...Done.
[/quote]

So even the laptop is connected to mains power again, the hooks are run as being on battery only.

Running "sudo /usr/lib/pm-utils/power.d/harddrive false" seems to help - load cycle stopped to increase.

Revision history for this message
Michael Biebl (mbiebl) wrote :

I can confirm the behaviour, when on battery. The hard disk spin downs are much too aggressive. Imho we also need to evaluate if the power saving justify this hook after all. One compromise could be, to install the harddrive hook but disable it by default.

I can't confirm the problem though, when on mains power. Could you send the output of
on_ac_power && echo yes || echo no
when on ac and battery?

Revision history for this message
Christian Schürer-Waldheim (quincunx) wrote :

The output of "on_ac_power && echo yes || echo no" is as expected: yes while on ac and no while on battery.

Nevertheless, the aggressive hard disk spin down is always active - no matter I'm on ac or not. Only disabling it manually helps.

I have a Dell Latitude D620, if this is of any help.

How can I find out why the settings do not work while being on ac?

Revision history for this message
Martin Pitt (pitti) wrote :

Interesting, so you still get "Running hook /usr/lib/pm-utils/power.d/harddrive true" after you connect AC? Can you confirm that "upower --dump" says "on battery" while it's really on AC?

Revision history for this message
Martin Pitt (pitti) wrote :

upower itself does not use the on_ac_power script. But what would be interesting to see is the output of "sh -ex /usr/bin/on_ac_power" while your system is on AC.

summary: - Regression: HD spins down all the time after upgrade of pm-utils
+ [maverick] HD spins down all the time on AC
Revision history for this message
Martin Pitt (pitti) wrote :

I'm going to devote this report to the part of running the battery mode scripts on AC power.

Changed in pm-utils (Ubuntu):
assignee: nobody → Martin Pitt (pitti)
status: New → Incomplete
Revision history for this message
Christian Schürer-Waldheim (quincunx) wrote :

upower was not installed on my system (kubuntu), but it does not report that the system is on battery.

The output of "sh -ex /usr/bin/on_ac_power" is:

+ set -e
+ OFF_LINE_P=no
+ [ -d /sys/class/power_supply/ ]
+ test -d /sys/class/power_supply/AC
+ test -r /sys/class/power_supply/AC/type
+ cat /sys/class/power_supply/AC/type
+ type=Mains
+ test xMains = xMains
+ [ -r /sys/class/power_supply/AC/online ]
+ cat /sys/class/power_supply/AC/online
+ online=1
+ [ 1 = 1 ]
+ exit 0

Nevertheless, the harddrive spins down as soon as the system is idle for one second or so. And I've noticed this behavior on my desktop computer now too (both running maverick with kubuntu, latest updates as of now installed).

The logfile now says

Running hook /usr/lib/pm-utils/power.d/harddrive false:
Disabling hard drive power management for /dev/sda...Done.

/usr/lib/pm-utils/power.d/harddrive false: success.

when I connect the AC power, but still the HD spins down too often, even after a reboot while having the computer on main power.

Revision history for this message
Martin Pitt (pitti) wrote :

Hm, I'm confused now. In comment 2 you said "So even the laptop is connected to mains power again, the hooks are run as being on battery only.", and in comment 8 it's correct now. What changed in between? So is this actually an issue, or is the remaining problem that it shuts down fast also when the hook is called on AC mode?

For AC mode I get

   hdparm -W 1 -S 0 -B 254 -M 0 /dev/sda

and for powersave (battery) mode

  hdparm -W 0 -S 6 -B 1 -M 254 -F /dev/sda

These actually work very well for me, but apparently not for you then. Can you confirm that running the first hdparm command through sudo still causes very short hard disk spindown times for you?

Revision history for this message
Christian Schürer-Waldheim (quincunx) wrote :

Yes, I noticed the different output too and could reproduce the behaviour.

If I unplug the power cord after a fresh boot, wait until all pm-utils scripts are run and plug the cord in again, then I get the output as in comment 2 (scripts are run as being on battery). But if I quickly unplug and plug the power cord while the pm-utils scripts are still called, then it the scripts are run as in comment 8 - as long as I do the quickly unplugging and plugging.

But beside this problem of running the scripts with proper arguments when being on main power again, the wrong initial values are set on boot time already - on both computers I've tested it with (laptop and desktop).

*) On the laptop (a Dell Latitude D620 with a PATA harddrive), the initial APM_level (hdparm -B) is set to 1 - which is obviously too aggressive.

*) On the desktop computer (HP Pavilion with two SATA harddrives), there is no APM_level set (as it is not supported on these devices), but the write cache is disabled and the option "Device-initiated interface power management" is not set. The harddrives will spin down within some minutes as soon as the system is idle. Running the /usr/lib/pm-utils/power.d/harddrive hook manually, the write cache and "Device-initiated interface power management" are set again.

Changed in pm-utils (Ubuntu):
status: Incomplete → New
Revision history for this message
Christian Schürer-Waldheim (quincunx) wrote :

Correction regarding the desktop computer: initial value of "Device-initiated interface power management" is enabled and disabled when the harddrive-hook is run manually.

I've downgraded pm-utils to the version in lucid (1.3.0-1ubuntu1) on both computers and everything is as it used to be before the update:

*) On the laptop, the initial APM_level is set to 254 while on main power and to 128 when running on battery.

*) On the workstation, the write cache is enabled and "Device-initiated interface power management" is disabled.

Revision history for this message
Søren Holm (sgh) wrote :

As of today it is still a problem.....

Revision history for this message
Christian Schürer-Waldheim (quincunx) wrote :

Soren, you could confirm this bug and provide some details about your hardware, so that the developers have more information to work on.

Revision history for this message
Søren Holm (sgh) wrote :

Yeah ..... but as of today, and yesterday, it has not been a problem. Two days ago the solution was to disable power-saving manually. BUT I powered on my system in a strange manner august 3rd. I placed the laptop in the docking-station and turned it on. But the power supply to the docking station was off during bootup and I first noticed it after the laptop was booted.

I will try to recreate tomorrow when I get back to the office.

Revision history for this message
Søren Holm (sgh) wrote :

Two thing can be said.

1. In general the harddisk spins down to often in powersave-mode.
2. The log contains logging of the call to /usr/*/*/.... /harddisk

The call fails but that is because of some stuff that can not be set. Turning off powersave works in the case.

The case a couple of day ago was that the pm-powersave.log did not contain anything else than the initial lines. I remember that becasuse after reading this bug tried to onplug and plug AC multiple times while "tail -f" the logfile. Bothing happenend. I will be extremely carefull when I experience this bug the next time to check that everything runs. Monitoring udev might be an idea.

Revision history for this message
Søren Holm (sgh) wrote :
Revision history for this message
Daniel Hahler (blueyed) wrote :

I've marked bug 614876 as duplicate, where "laptop mode" gets detected on a desktop system.

However, when it were a laptop system, it should not constantly spin disks down and up so much (by default).

Changed in pm-utils (Ubuntu):
importance: Undecided → Medium
status: New → Triaged
Revision history for this message
Søren Holm (sgh) wrote :

Today I booted up my laptop. It is currently running without a battery. I notices the HD spin down and looked in the log. It had set the system as running without AC - which is false since the battery was out of the machine. When I plugged the battery in the system put itself in AC-mode.

Revision history for this message
Illogic_Gate (illogicgate) wrote :

Ok, as I sit here on my T42 Thinkpad running on battery and a fully up to date version of Maverick Alpha 3 and listen to my hard drive spin up and down so often it rarely actually FINISHES spinning DOWN before spooling back UP, I'm going to chime in and say the settings are way, way, WAY too aggressive.

This MAY be a stupid question, but couldn't we let the user change the spin-down times for ac AND battery instead of(including?) simply providing a yes or no check box to allow spin down in Gnome?

Failing that, what config file/script needs to be edited in maverik in order to tone down the settings manually. I don't want the hdparm settings "solution" as that doesn't stick across reboots. Thanks!

Martin Pitt (pitti)
Changed in pm-utils (Ubuntu Maverick):
importance: Medium → High
Revision history for this message
willyboy666 (fhailywalid) wrote :

on battery mode,my hard drive spins down while i am working on the laptop (everything freeze and i can hear the harddrive going calm) then i have to wait for 10 to 20 second until i hear my harddrive spins up again and the laptop work again(even the hd spining down option in power management is off).

Revision history for this message
Daniel Swarbrick (pressureman) wrote :

It definitely appears as though the "Spin down hard disks when possible" on the "On Battery Power" tab of the power management applet is not being respected. I have the option unchecked, and can observe the following:

daniel@thinkpad:~$ sudo hdparm -B /dev/sda

/dev/sda:
 APM_level = 254

(remove AC)

daniel@thinkpad:~$ sudo hdparm -B /dev/sda

/dev/sda:
 APM_level = 1

If I manually "sudo hdparm -B 254 /dev/sda" after going to battery mode, then the hard disk obviously stops the incessant and overly ambitious spinning down.

I'm all for spinning down disks when on battery power, but if I specifically uncheck that option in the power management applet, it should be honoured. Also, when spinning down disks, something a bit more sensible like a 2 or 5 minute idle period would be better (can we have this adjustable maybe?)

Revision history for this message
Chris Thomas (cwt137) wrote :

I am on a daily build of Maverick, 20100916, and it still has this issue. Every chance my computer gets to spin down the hard drive, it does. Every 10 seconds or so, I hear the hard drive spin up. I have a Sony VAIO VGN-NW270F. All this spinning up, puts a lot of extra wear and tear on a drive. I think this is a critical bug because anyone who uses their laptop for a long time will wear out their drive extra quickly.

Revision history for this message
willyboy666 (fhailywalid) wrote :

this bug is killing me,
everything crashes now ,because the harddrive take 20-30 second to start spinning again, even sometime it try to start 2-3 times until it start spinning....

Revision history for this message
Fred (fredrooks) wrote :

I've fixed this bug for myself by modifying the value of the -B parameter of hdparm when running on battery power.

I did this by editing /usr/lib/pm-utils/power.d/harddrive and changing line 14 from DRIVE_POWER_MGMT_BAT="${DRIVE_POWER_MGMT_BAT:-1}" to DRIVE_POWER_MGMT_BAT="${DRIVE_POWER_MGMT_BAT:-128}.

With this setting, my WD2500BEVS does not spin down every thirty seconds or so like it did before, but I will continue experimenting to find the optimal value for my hard drive. Different drives probably need different values.

The variable DRIVE_POWER_MGMT_BAT governs hdparm -B while running off the battery, and DRIVE_POWER_MGMT_AC (line 8) sets the value when connected to the mains.

I think hdparm -B should definitely not be set to 1 by default since it causes severe problems for so many people.

Martin Pitt (pitti)
Changed in pm-utils (Ubuntu Maverick):
status: Triaged → In Progress
milestone: none → ubuntu-10.10
Revision history for this message
Martin Pitt (pitti) wrote :

Could people please test setting DRIVE_POWER_MGMT_BAT to 127 by default? That's the first value which actually does permit spindown. Please change that with

  sudo gedit /usr/lib/pm-utils/power.d/harddrive

(or your favourite editor) and set line 14 to

  DRIVE_POWER_MGMT_BAT="${DRIVE_POWER_MGMT_BAT:-127}

If this doesn't help, I'll modify the maverick version to use 128. This will take away a lot of the power saving, but if it works so poorly for you (i. e. the people affected by this bug), we can't help it.

Thank you!

Revision history for this message
Daniel Swarbrick (pressureman) wrote :

Curiously, my hard disk appears to only support four values, indicating that it possibly ignores most bits of the value. Any value <= 127 comes back as 1.

daniel@thinkpad:~$ sudo hdparm -B 255 /dev/sda

/dev/sda:
 setting Advanced Power Management level to disabled
 APM_level = off

daniel@thinkpad:~$ sudo hdparm -B 254 /dev/sda

/dev/sda:
 setting Advanced Power Management level to 0xfe (254)
 APM_level = 254

daniel@thinkpad:~$ sudo hdparm -B 253 /dev/sda

/dev/sda:
 setting Advanced Power Management level to 0xfd (253)
 APM_level = 128

daniel@thinkpad:~$ sudo hdparm -B 127 /dev/sda

/dev/sda:
 setting Advanced Power Management level to 0x7f (127)
 APM_level = 1

My disk is a Samsung HM251JJ, firmware version 2AA00_00

Revision history for this message
Martin Pitt (pitti) wrote :

I discussed that with Michael Biebl. We already have a hook in the hdparm package which sets it to 128, and if anything below causes too much trouble, let's just disable that particular hook completely. That brings us back to what we had in lucid, and is a safe choice at this point.

Revision history for this message
Martin Pitt (pitti) wrote :

Fixed in Debian packaging trunk.

Changed in pm-utils (Ubuntu Maverick):
status: In Progress → Fix Committed
Revision history for this message
Martin Pitt (pitti) wrote :

Uploaded, waiting for release team member to review.

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package pm-utils - 1.4.1-3

---------------
pm-utils (1.4.1-3) experimental; urgency=low

  * debian/rules: Remove harddrive power hook, this causes excessive hard disk
    spindown on a lot of machines. The hdparm package already ships a less
    aggressive hook (with -B 128 instead of -B 1). (LP: #606706)
  * debian/control: Bump Standards-Version to 3.9.1 (no changes necessary).
  * debian/rules: Use dpkg-vendor instead of lsb_release, and drop lsb-release
    build dependency.
 -- Martin Pitt <email address hidden> Fri, 24 Sep 2010 08:44:00 +0200

Changed in pm-utils (Ubuntu Maverick):
status: Fix Committed → Fix Released
Revision history for this message
Fred (fredrooks) wrote :

I've been playing with the values of hdparm -B and hdparm -S for a while now, but I haven't been able to achieve an acceptable frequency of spindowns with any combination of settings. My WD2500BEVS and many other hdds out there don't behave as they should, so I'm glad that a safe choice has been made.

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

Duplicates of this bug

Other bug subscribers

Remote bug watches

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