Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 257156

Summary: sys-power/pm-utils: include hook for restarting hdparm when resuming
Product: Gentoo Linux Reporter: Pacho Ramos <pacho>
Component: Current packagesAssignee: Freedesktop bugs <freedesktop-bugs>
Severity: enhancement CC: alexanderyt, wonko
Priority: High Keywords: PMASKED
Version: unspecified   
Hardware: All   
OS: Linux   
Package list:
Runtime testing required: ---
Attachments: hdparm.ebuild.diff

Description Pacho Ramos gentoo-dev 2009-01-31 23:18:22 UTC

I would want to get attached hook supplied by hdparm for letting pm-suspend/pm-hibernate to restart hdparm service when resuming. 

Currently, I am manually running it with a ugly script for getting desired Advanced Power Management at resume time as BIOS modifies it when booting and resuming.

I need to run hdparm -B 254 on my laptop because I am affected by "Load Cycle Count" issue (you can read more about this issue in ). Then, I use provided hdparm init.d service for running it. 

Anyway, the trivial hook I attach will simply restarts /etc/init.d/hdparm, then, other users can use it for other options like, for example, enable dma on devices that disable it by default (like some old CD readers) or other options that hdparm allows to modify.

I suggest to make this hook provided by hdparm ebuild instead of pm-utils one because this is the policy that pm-utils upstream suggests in its README.distributions file in its sources tarball:
Note for distro maintainers:

When writing sleep hooks, please consider adding any needed hooks to the package
that requires the hooks, rather than pm-utils.  

Also, I have also discussed this with pm-utils upstream in their mailling list and they have also suggested me to send to hdparm upstream or to my distribution.

The attached ebuild.diff will simply install the file in /usr/$(get_libdir)/pm-utils/sleep.d. I don't add any USE flag because, in the past, I saw that using USE flags for simply installing or not a single file is not recommended (I saw it in a bug related with a logrotate file)

I also have called it "50hdparm" because this is one of the numbers pm-utils suggests for this kind if stuff (look it at pm/HOWTO.hooks in pm-utils tarball):
50 - 74: service-handling hooks. 
If you need to stop or start a service, you should have a hook in this range.

Thanks a lot

Reproducible: Always
Comment 1 Pacho Ramos gentoo-dev 2009-01-31 23:18:37 UTC
Created attachment 180487 [details, diff]
Comment 2 Pacho Ramos gentoo-dev 2009-01-31 23:19:02 UTC
Created attachment 180489 [details]
Comment 3 Gilles Dartiguelongue gentoo-dev 2009-01-31 23:27:41 UTC
please remember that more hooks == more time spent in suspend/resume phases so make sure this is not enabled if hdparm is not in the current runlevel.
Comment 4 Pacho Ramos gentoo-dev 2009-02-01 15:32:26 UTC
(In reply to comment #3)
> please remember that more hooks == more time spent in suspend/resume phases so
> make sure this is not enabled if hdparm is not in the current runlevel.

Anyway, hdparm won't be started by pm-utils if wasn't started when suspend/hibernate started 
Comment 5 Pacho Ramos gentoo-dev 2009-07-18 09:56:20 UTC
I am using this since months in two different laptops and works without problems on two laptops (that are affected by "load cycle count" issue) suspending/hibernating with pm-utils and tuxonice :-)

Comment 6 Tomáš Chvátal (RETIRED) gentoo-dev 2010-04-13 08:25:04 UTC
1) that 50-hdparm has borked whitespace
2) see how ntp is done in pm-utils, same way should be hdparm done most likely
Comment 7 Pacho Ramos gentoo-dev 2010-06-16 09:24:36 UTC
Created attachment 235555 [details]

How is it done in ntp?

Comment 8 SpanKY gentoo-dev 2010-10-07 01:52:20 UTC
seems like it'd be better to include this with pm-utils

see also Bug 334393
Comment 9 Gilles Dartiguelongue gentoo-dev 2010-10-07 06:40:09 UTC
@thomas: pm-utils upstream ships the ntp hook, not hdparm, that's why this package was moved to hdparm maintainers.
Comment 10 Gilles Dartiguelongue gentoo-dev 2010-11-14 16:25:34 UTC
*** Bug 334393 has been marked as a duplicate of this bug. ***
Comment 11 Gilles Dartiguelongue gentoo-dev 2010-11-14 16:31:11 UTC
As I said in the duplicate bug report, at the time the ticket was opened, there was no hdparm management at all but now that there is, I think the ebuild should enable/disable the script and depend on hdparm as appropriate. Of course this means there will be no hooks and no service restart since there is no reason to do that anymore.

Thoughts ?
Comment 12 Gilles Dartiguelongue gentoo-dev 2010-11-17 09:54:50 UTC
*** Bug 345849 has been marked as a duplicate of this bug. ***
Comment 13 Larry the Git Cow gentoo-dev 2021-02-21 10:57:05 UTC
The bug has been closed via the following commit(s):

commit f146bb7e14ac3405429772d4adfef555f7810c20
Author:     Jakov Smolic <>
AuthorDate: 2021-02-21 10:56:16 +0000
Commit:     David Seifert <>
CommitDate: 2021-02-21 10:56:16 +0000

    sys-power/pm-utils: Remove last-rited pkg
    Signed-off-by: Jakov Smolic <>
    Signed-off-by: David Seifert <>

 profiles/arch/amd64/package.use.mask               |  4 -
 profiles/arch/base/package.use.mask                |  4 -
 profiles/arch/hppa/use.mask                        |  4 -
 profiles/arch/x86/package.use.mask                 |  4 -
 sys-power/pm-utils/Manifest                        |  1 -
 .../pm-utils/files/1.4.1-bluetooth-sync.patch      | 43 ----------
 .../pm-utils/files/1.4.1-disable-sata-alpm.patch   | 24 ------
 sys-power/pm-utils/files/1.4.1-echo-n.patch        | 51 ------------
 sys-power/pm-utils/files/1.4.1-fix-alpm-typo.patch | 29 -------
 .../1.4.1-fix-intel-audio-powersave-hook.patch     | 40 ---------
 .../pm-utils/files/1.4.1-ignore-led-failure.patch  | 14 ----
 .../files/1.4.1-inhibit-on-right-status.patch      | 20 -----
 .../pm-utils/files/1.4.1-logging-append.patch      | 17 ----
 .../pm-utils/files/1.4.1-run-hook-logging.patch    | 17 ----
 .../pm-utils/files/1.4.1-suspend-hybrid.patch      | 36 ---------
 .../files/1.4.1-uswsusp-hibernate-mode.patch       | 19 -----
 .../files/1.4.1-xfs_buffer_arguments.patch         | 31 -------
 sys-power/pm-utils/files/pm-utils.logrotate        |  8 --
 sys-power/pm-utils/files/power.d/pci_devices       | 61 --------------
 sys-power/pm-utils/files/power.d/usb_bluetooth     | 45 -----------
 sys-power/pm-utils/files/sleep.d/50unload_alx      | 18 -----
 sys-power/pm-utils/metadata.xml                    | 10 ---
 sys-power/pm-utils/pm-utils-1.4.1-r7.ebuild        | 94 ----------------------
 23 files changed, 594 deletions(-)