Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 476044 - sys-apps/hdparm: add udev rule for configuring devices on the fly
Summary: sys-apps/hdparm: add udev rule for configuring devices on the fly
Status: CONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal enhancement (vote)
Assignee: Gentoo's Team for Core System packages
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-07-07 07:16 UTC by Pacho Ramos
Modified: 2013-10-16 06:33 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Pacho Ramos gentoo-dev 2013-07-07 07:16:42 UTC
While trying to find a unit file for hdparm to replace init.d script, I found the following:
http://lists.freedesktop.org/archives/systemd-devel/2012-June/005600.html

After reading it, that looks to be pretty reasonable approach as it would also simplify things, making, for example, tweaks to re-run hdparm when resuming from hibernate unneeded and bug 448334 obsolete.

This kind of rule could be suggested to people:
https://wiki.archlinux.org/index.php/Hdparm#Parking_your_hard_drive

Reproducible: Always
Comment 1 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2013-07-07 07:24:27 UTC
udev rules sound reasonable. Anyone tried asking upstream? I'd agree we rather avoid distro-specific inventions if possible.
Comment 2 William Hubbs gentoo-dev 2013-07-07 21:50:50 UTC
Agreed; this should not be done at the distro level.
I vote for closing this resolved/upstream once a bug is opened there.
Comment 3 Pacho Ramos gentoo-dev 2013-07-07 22:09:27 UTC
But we are already doing the "init.d" way downstream. I don't understand why we need to wait for upstream to have a udev rule while not for adding init.d files to run hdparm at boot time :/ (even looking to have drawbacks compared with udev approach)

Anyway, I am not sure if we (or upstream) could provide some generic rule, as we would need a rule inheriting hdparm arguments from some config file and the device to be run on.
Comment 4 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2013-07-07 22:16:58 UTC
I'm not even sure if there can be any kind of 'generic' script with 'generic' config file. The point is that the udev rule itself needs to be matched to the proper device, and then adding proper options is not a problem.

We may actually work on making that simpler/more practical. Either providing information, examples, tools to generate udev rules...
Comment 5 William Hubbs gentoo-dev 2013-07-08 15:45:17 UTC
@mgorny:
True, and if we wrote a tool to generate udev rules, since these rules
would be system specific, I would vote to put them in /etc/udev/rules.d.
Also, this tool could be included upstream.
Comment 6 Samuli Suominen (RETIRED) gentoo-dev 2013-07-09 06:51:19 UTC
(In reply to Michał Górny from comment #1)
> udev rules sound reasonable. Anyone tried asking upstream? I'd agree we
> rather avoid distro-specific inventions if possible.

How about sharing with Debian like we do for multiple other base-system@ pkgs as is.

http://packages.debian.org/sid/hdparm

They install a static one-liner like this:

$ cat /lib/udev/rules.d/85-hdparm.rules:
ACTION=="add", SUBSYSTEM=="block", KERNEL=="[sh]d[a-z]*", RUN+="/etc/init.d/hdparm hotplug"

(CAUTION! Look out for out-of-date udev generators in the hdparm patchset from Debian.)

Debian changelog says:

* Allow udev rule to process large numbers of devices (closes: #675624)

* Install UDEV rule to /lib/udev/rules.d (closes: #563762, #622568) 

* Clean up old rules from /etc/udev in postinst (Remember when I said they had a generator, and they ditched it? -ssuominen)

* Udev rule can also match for sata devices (closes: #471401)
Comment 7 Samuli Suominen (RETIRED) gentoo-dev 2013-07-09 06:56:18 UTC
(In reply to Samuli Suominen from comment #6)
> RUN+="/etc/init.d/hdparm hotplug"

Looks like I completely failed to cover (explain) the script itself in prev. comment :-(
Comment 8 SpanKY gentoo-dev 2013-10-16 06:33:11 UTC
the init.d file isn't going anywhere (not everyone runs udev)

i think we'd have to add a new script for udev & init.d to hit rather than having the udev rule hit the init.d