[Bug 1248012] Re: Resuming after suspend, wrong settings from /etc/hdparm.conf are applied

Brian Murray brian at ubuntu.com
Fri Nov 15 21:56:26 UTC 2013


Thanks for the patch, Ivan!  I've uploaded it to Trusty the development
release of Ubuntu.  It'd be great if you could forward it to debian,
since they would also benefit from the patch.

** Changed in: hdparm (Ubuntu)
       Status: Triaged => In Progress

** Changed in: hdparm (Ubuntu)
     Assignee: (unassigned) => Brian Murray (brian-murray)

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to hdparm in Ubuntu.
https://bugs.launchpad.net/bugs/1248012

Title:
  Resuming after suspend, wrong settings from /etc/hdparm.conf are
  applied

Status in “hdparm” package in Ubuntu:
  In Progress

Bug description:
  I have a new installation of Ubuntu 13.10 amd64 with hdparm 9.43-1ubuntu2.
  I have 3 harddisks and I want 1 and only 1 of these disks to spindown after a minute on inactivity.

  My /etc/hdparm.conf looks like this:

  *************************************************
  /dev/disk/by-id/ata-Maxtor_6Y080L0_Y29Q6WSC {
  	spindown_time = 12
  }
  *************************************************

  Resuming after a suspend, in pm-suspend.log I found:

  *************************************************
  Running hook /usr/lib/pm-utils/sleep.d/95hdparm-apm resume suspend:

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

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

  /dev/sda:
   setting standby to 12 (1 minutes)

  /dev/sdb:
   setting standby to 12 (1 minutes)

  /usr/lib/pm-utils/sleep.d/95hdparm-apm resume suspend: success.
  ***************************************************

  Notice that /dev/disk/by-id/ata-Maxtor_6Y080L0_Y29Q6WSC was a link to /dev/sda.
  After a reboot, /dev/disk/by-id/ata-Maxtor_6Y080L0_Y29Q6WSC was a link to /dev/sdc and in pm-suspend.log I found:

  ***************************************************
  Running hook /usr/lib/pm-utils/sleep.d/95hdparm-apm resume suspend:

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

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

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

  /dev/sdc:
   setting standby to 12 (1 minutes)
  /usr/lib/pm-utils/sleep.d/95hdparm-apm resume suspend: success.
  ***************************************************

  So in the 1st instance the spindown  setting was applied also to a second disk ( the 3rd disk does not support AdvancedPM so it doesn't appear in the log and, BTW, this is another bug now reported in bug #1225169 ). In the 2nd instance, -B254 was applied a second time to /dev/sda.
  IMHO, the problem lies in the variable apm_opt used in /usr/lib/pm-utils/power.d/95hdparm-apm both in resume_hdparm_apm() and resume_hdparm_spindown(). This variable is not initialized at the beginning of each "for" cycle. So when resume_hdparm_apm() is called apm_opt gets the first -B parameter found in /etc/hdparm.conf (or the default -B254) and it is not changed till another -B option is found. Then resume_hdparm_spindown() is called but apm_opt does not change till an -S value is found and so on. 
  So a possible solution is to initialize apm_opt at the beginning of each "for" cycle: a patch is attached.

  Now in pm-suspend.log I correctly find:
  ***************************************************
  Running hook /usr/lib/pm-utils/sleep.d/95hdparm-apm resume suspend:

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

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

  /dev/sdc:
   setting standby to 12 (1 minutes)
  /usr/lib/pm-utils/sleep.d/95hdparm-apm resume suspend: success.
  ***************************************************

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/hdparm/+bug/1248012/+subscriptions



More information about the foundations-bugs mailing list