[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: overriding udev rules

On Tue, Aug 20, 2013 at 09:58:43PM +0200, Thomas Goirand wrote:

> I'd be happy to find a correct and clean way to do this, because I also
> need to do it, and it seems to be a fairly common use case. I currently
> only delete the 75-persistent-net-generator.rules file (which I know is
> the wrong way to do it as it wont survive upgrades, though I currently
> don't know how to do it cleanly, so I have fallen back to that).
> It would be really nice to have a switch somewhere in /etc for this.
> Maybe upstream could work that out, so that we don't have to hack and
> hack again? I'm sure I'm not the only one to think that dpkg-divert
> over-engineering something that should be fixed upstream.

The least ugly thing we came up with was:

$ cat /lib/udev/rules.d/60-${our_package}.rules
# Avoid udev persistent names (see
# /lib/udev/rules.d/75-persistent-net-generator.rules )
ACTION=="add", SUBSYSTEM=="net", KERNEL=="eth*",        NAME="$kernel"

You can make that rule more specific to only disable it for specific
cards. It works because of:

$ grep -B1 -w NAME /lib/udev/rules.d/75-persistent-net-generator.rules | head -n2
# ignore the interface if a name has already been set
NAME=="?*",                             GOTO="persistent_net_generator_end"

Tzafrir Cohen         | tzafrir@jabber.org | VIM is
http://tzafrir.org.il |                    | a Mutt's
tzafrir@cohens.org.il |                    |  best
tzafrir@debian.org    |                    | friend

Reply to: