[Pm-utils] Bug? in pm-powersave

Robby Workman rw at rlworkman.net
Sun Jan 2 22:35:02 PST 2011


Hi Victor and list,

I think I've encountered a bug in pm-powersave, or maybe it's
a bug in how the powersave hooks are processed, or perhaps I'm
just being braindead ;-) but here's a summary:

My laptop drive doesn't like the default DRIVE_POWER_MGMT_BAT
value of "1" - it goes to sleep every 30 seconds and causes
a delay of 1-2 seconds that makes the system feel like it's
crawling along.  

From pm-powersave(8):
  FILES
       /etc/pm/power.d/, /usr/lib/pm-utils/power.d/
           When you run pm-powersave it combines the scripts in 
           these two directories and executes them in sorted order.
           If both directories contain a script with the same name,
           the one in /etc/pm/power.d/ has a higher precedence and 
           only this one will be executed.


Therefore, I grabbed $libdir/pm-utils/power.d/harddrive, placed
a copy at /etc/pm/power.d/harddrive, made sure it retained its
executable permissions, and edited it down to the following:

  #!/bin/sh
  [ -x /sbin/hdparm ] || exit $NA
  DRIVE_WRITE_CACHE_BAT=0
  DRIVE_POWER_MGMT_BAT=128
  # Default devices to operate on
  DRIVE_LIST="/dev/[hs]d[a-z]"

However, when I unplug the AC adapter (or run "pm-powersave true"
manually), the value shown with "hdparm -B /dev/sda" is not 128;
it stays at whatever it was previously.  /var/log/pm-powersave.log
shows this:

  Running hook /etc/pm/power.d/harddrive true:
  
  /etc/pm/power.d/harddrive true: success.

If I remove the /etc/pm/power.d/harddrive file completely, the 
value shown by hdparm afterward is the default value defined in
$libdir/pm-utils/power.d/harddrive, and this is what shows in 
/var/log/pm-powersave.log:

  Running hook /usr/lib64/pm-utils/power.d/harddrive true:
  Enabling power management for /dev/sda...Done.
    
  /usr/lib64/pm-utils/power.d/harddrive true: success.


Am I doing something wrong, or is there a bug here?

-RW


More information about the Pm-utils mailing list