On Wed, 25 Dec 2013 17:33:04 +0100 Ralf Jung <p...@ralfj.de> wrote:
> Dear maintainer,
> 
> adding the attached systemd unit fixes restoring the hdparm
> configuration when systemd is used. I'd appreciate if you could add this
> (or a similar solution) to the package.

This proposed patch doesn't work as-is, due to a misunderstanding how
targets work:

After=suspend.target
After=hibernate.target
After=hybrid-sleep.target

This doesn't guarantee that the service is run on resume.
Those targets are activated on suspend/hibernate, so there is a race and
you might actually run /usr/lib/pm-utils/power.d/95hdparm-apm *before*
the system is suspended. You'd have to order this service after the
*service* which does the actual suspend.


Even though upstream recommends against shipping a snippet in
/lib/systemd/system-sleep/ and considers them hacks, I actually think
this is the cleanest/simplest solution here

$ cat /lib/systemd/system-sleep/hdparm

#!/bin/sh

case $1 in
  post)
    /usr/lib/pm-utils/power.d/95hdparm-apm resume
    ;;
esac




[1] man systemd-sleep
-- 
Why is it that all of the instruments seeking intelligent life in the
universe are pointed away from Earth?

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to