Opened 14 years ago

Closed 14 years ago

Last modified 14 years ago

#2527 closed task (fixed)

Udev rule audit

Reported by: Bryan Kadzban Owned by: Matthew Burgess
Priority: low Milestone: 6.6
Component: Book Version: SVN
Severity: minor Keywords:
Cc:

Description

As of Udev-149, several rules in 55-lfs.rules are either no longer supported, or no longer needed. The list I know of (from #2525):

  • create_floppy_devices is now correct upstream; the override we have is no longer required
  • /dev/hd* rules are now gone. Looks like this is benign for our config -- users that need it might complain, but we don't need to change anything yet.
  • OPTIONS+="ignore_device" is no longer supported, so we should kill the NAME=="card*" and NAME=="dm-*" rules. Not sure what effect this removal has on DRM, but it's good for device-mapper, as long as you use a new-enough version, and build its udev integration.

Also, we need to re-audit our rules and ensure we aren't duplicating upstream stuff again. (I suspect the ALSA rules may not be needed, since I've heard several comments on linux-hotplug about never using NAME="xxx", ever. Either the kernel is now providing the correct name, or the comments I heard are wrong. :-) )

(Marking as minor-severity/low-priority since the current book is reported to boot, at least.)

Change History (8)

comment:1 by Matthew Burgess, 14 years ago

From my testing I don't think any of the audio rules are required. My limited box here shows /dev/snd/{control*,pcm*,timer} devices owned by 'audio' without any rules in 55-lfs.rules.

Bryan, I suspect there's some sysfs magic going on to tell udev what the default group should be for those devices? If so, I can grep the kernel sources to check whether the other rules we have that simply set the group can be removed too. If they can, and with the other observations of yours above, that only leaves us with the rtc rules in 55-lfs.rules, which is probably too much for an entire tarball and could probably be addressed in the book text or even in BLFS.

comment:2 by Matthew Burgess, 14 years ago

Ha, silly me. There's a default rule in /lib/udev/rules.d/50-udev-default.rules that sets all SUBSYSTEM="sound" devices to be owned by group "audio". Therefore all of our sound rules can go.

comment:3 by Matthew Burgess, 14 years ago

OK, final update for now:

1) All rules in 55-lfs.rules that set the GROUP can safely be dropped, aside from the ISDN ones. I don't have any ISDN devices to test this on, but I note that 40-gentoo.rules contain similar rules to ours. I wonder why they've not been merged to the default Udev ruleset; are they really the right thing to do? 2) I think we want to keep the RTC rules around so that the clock is set early on 3) I can't see anything that duplicates our symlink from "/dev/input/mice" to "/dev/mouse". Is this still required by anything?

comment:4 by Matthew Burgess, 14 years ago

I really must learn to hit 'Preview' more often!

  1. All rules in 55-lfs.rules that set the GROUP can safely be dropped, aside from the ISDN ones. I don't have any ISDN devices to test this on, but I note that 40-gentoo.rules contain similar rules to ours. I wonder why they've not been merged to the default Udev ruleset; are they really the right thing to do?
  2. I think we want to keep the RTC rules around so that the clock is set early on
  3. I can't see anything that duplicates our symlink from "/dev/input/mice" to "/dev/mouse". Is this still required by anything?

comment:5 by Bryan Kadzban, 14 years ago

My limited box here shows /dev/snd/{control*,pcm*,timer} devices owned by 'audio' without any rules in 55-lfs.rules.

While the 'audio' group is interesting (and you found the reason why), the /dev/snd/* naming is what I was thinking we didn't need to set anymore. (Which was why I started talking about never setting NAME.) If it works without rules, the kernel must be sending the snd!controlC0 name now, or something like that...

Ah. That's not how it works anymore, but it's close. Looking in /sys/class/sound/controlC0/uevent shows "DEVNAME=snd/controlC0" (along with MAJOR and MINOR); these can't be set from userspace, and must be coming from the kernel somewhere. (Though I can't see where. Oh well.) udev must use DEVNAME by default.

All rules in 55-lfs.rules that set the GROUP can safely be dropped, aside from the ISDN ones.

What about 61-cdrom.rules? Looks like the replacement will work fine with SCSI (and libata, I think) CD drives, but probably not plain old IDE. It depends on the "type" attribute in sysfs, which I believe is only valid with SCSI. Doesn't look like there's anything else, but I'm not sure since I moved to libata quite a while ago; I can't test plain-old-IDE anymore...

(Debian seems to do what we have today in 61-cdrom.rules, FWIW: use ENV{ID_CDROM} instead of SYSFS{type}.)

Although given the number of people not using libata, this is probably not used enough to worry; let's just remove it and see if anyone complains. :-)

I don't have any ISDN devices to test this on, but I note that 40-gentoo.rules contain similar rules to ours. I wonder why they've not been merged to the default Udev ruleset; are they really the right thing to do?

I don't remember for sure what happened last time this one came up on linux-hotplug; I think it only got as far as unifying the capi* devices. And I don't know if /dev/ippp* or /dev/isdn* or /dev/dcbri* devices are even created anymore; it's possible that all of this was yanked out to be replaced by something different...

Hmm, looks like at least ippp* devices are used by some kind of pppd; you'd want this if you run pppd as non-root (and it still uses those).

I think we want to keep the RTC rules around so that the clock is set early on

Yes.

I can't see anything that duplicates our symlink from "/dev/input/mice" to "/dev/mouse". Is this still required by anything?

No idea...

I *think* /dev/input/mice became the widely-accepted default around the time people moved to kernel 2.6, where (...I *think*!) PS/2 mice moved to the generic input subsystem, and to one of the /dev/input/mouseX nodes, as well. So the /dev/mouse generic symlink that people used to configure which mouse would be used by X/gpm is no longer required; /dev/input/mice is always "all mice".

Er, except serial mice. Hmm. OTOH, if you have a serial mouse, you'll have to change the rules to be able to use /dev/mouse anyway -- as-is, a USB mouse will blow away any manual /dev/mouse symlink to /dev/ttyS* that the admin made.

...

All things considered, it's probably safe to kill it.

One more comment:

create_floppy_devices is now correct upstream; the override we have is no longer required

This is no longer true in udev-150. Should be fixed in -151.

comment:6 by Matthew Burgess, 14 years ago

Owner: changed from lfs-book@… to Matthew Burgess
Status: newassigned

The create_floppy_devices mode can be changed pretty easily using a sed on upstream's rule file, so I'll remove our rule too.

comment:7 by Matthew Burgess, 14 years ago

Resolution: fixed
Status: assignedclosed

Bryan, this is fixed (I think) in r9165. If you wouldn't mind giving it a quick review please and ensure I didn't mess things up, I'd appreciate it. Thanks!

comment:8 by Bryan Kadzban, 14 years ago

The diff looked fine. :-)

I had sort of intended the docs to be a full documentation of all the rules, not just the ones we install. But if we can yank the last couple rules, that's probably fine; we'll just kill all of the docs as well. And it's a lot of work keeping up with the upstream changes in these docs; I haven't had bandwidth to do that. Well, either way.

(Hmm. We can probably kill the contrib/debian/* files, as well, now that this method for CD symlinks is upstream in udev, and has been for a while.)

Note: See TracTickets for help on using tickets.