All of lore.kernel.org
 help / color / mirror / Atom feed
* how to suppress write_net_rules (prevent alteration of my net rules)
@ 2011-01-19 16:58 John Lumby
  2011-01-19 17:24 ` Kay Sievers
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: John Lumby @ 2011-01-19 16:58 UTC (permalink / raw)
  To: linux-hotplug


Is there any supported way of telling udev never to create, append or alter my /etc/udev/rules.d/70-persistent-net.rules ?
It appears that by default a script called /lib/udev/write_net_rules will always do so,
although I can't find this documented anywhere other than inside the  /etc/udev/rules.d/70-persistent-net.rules.

The reason I want to prevent this is that I have one special requirement:
  that any net interface that is named eth0 by the kernel must never be renamed.
(This is for ensuring that running root over nfs works without hiccup).
I can specify this restriction in my /etc/udev/rules.d/60-net.rules by 
 SUBSYSTEM="net", ....  , KERNEL!="eth0", NAME="eth[n]"
which works   --   but then along comes /lib/udev/write_net_rules and creates or appends 
/etc/udev/rules.d/70-persistent-net.rules with conflicting specifications.

So I want to stop it from doing that.    The only way I have found is to edit this script
and change the string "/etc/udev/rules.d/70-persistent-net.rule" to "/tmp/70-persistent-net.rules"
but I suppose that change gets wiped out whenever I upgrade the software.

Is there any properly supported way of specifying this?

John Lumby
 		 	   		  

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: how to suppress write_net_rules (prevent alteration of my net rules)
  2011-01-19 16:58 how to suppress write_net_rules (prevent alteration of my net rules) John Lumby
@ 2011-01-19 17:24 ` Kay Sievers
  2011-01-19 18:31 ` Andrey Borzenkov
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Kay Sievers @ 2011-01-19 17:24 UTC (permalink / raw)
  To: linux-hotplug

On Wed, Jan 19, 2011 at 17:58, John Lumby <johnlumby@hotmail.com> wrote:
>
> Is there any supported way of telling udev never to create, append or alter my /etc/udev/rules.d/70-persistent-net.rules ?
> It appears that by default a script called /lib/udev/write_net_rules will always do so,
> although I can't find this documented anywhere other than inside the  /etc/udev/rules.d/70-persistent-net.rules.
>
> The reason I want to prevent this is that I have one special requirement:
>   that any net interface that is named eth0 by the kernel must never be renamed.
> (This is for ensuring that running root over nfs works without hiccup).
> I can specify this restriction in my /etc/udev/rules.d/60-net.rules by
>  SUBSYSTEM="net", ....  , KERNEL!="eth0", NAME="eth[n]"
> which works   --   but then along comes /lib/udev/write_net_rules and creates or appends
> /etc/udev/rules.d/70-persistent-net.rules with conflicting specifications.
>
> So I want to stop it from doing that.    The only way I have found is to edit this script
> and change the string "/etc/udev/rules.d/70-persistent-net.rule" to "/tmp/70-persistent-net.rules"
> but I suppose that change gets wiped out whenever I upgrade the software.
>
> Is there any properly supported way of specifying this?

Rules in /etc over-rule rules in /lib with the same name.

echo "# disable net-generator rules in /lib/udev" > \
  /etc/udev/rules.d/75-persistent-net-generator.rules

Kay

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: how to suppress write_net_rules (prevent alteration of my net rules)
  2011-01-19 16:58 how to suppress write_net_rules (prevent alteration of my net rules) John Lumby
  2011-01-19 17:24 ` Kay Sievers
@ 2011-01-19 18:31 ` Andrey Borzenkov
  2011-01-19 18:37 ` how to suppress write_net_rules (prevent alteration of my net Marco d'Itri
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Andrey Borzenkov @ 2011-01-19 18:31 UTC (permalink / raw)
  To: linux-hotplug

On Wed, Jan 19, 2011 at 7:58 PM, John Lumby <johnlumby@hotmail.com> wrote:
>
> Is there any supported way of telling udev never to create, append or alter my /etc/udev/rules.d/70-persistent-net.rules ?
> It appears that by default a script called /lib/udev/write_net_rules will always do so,
> although I can't find this documented anywhere other than inside the  /etc/udev/rules.d/70-persistent-net.rules.
>
> The reason I want to prevent this is that I have one special requirement:
>   that any net interface that is named eth0 by the kernel must never be renamed.
> (This is for ensuring that running root over nfs works without hiccup).
> I can specify this restriction in my /etc/udev/rules.d/60-net.rules by
>  SUBSYSTEM="net", ....  , KERNEL!="eth0", NAME="eth[n]"
> which works   --   but then along comes /lib/udev/write_net_rules and creates or appends
> /etc/udev/rules.d/70-persistent-net.rules with conflicting specifications.
>
> So I want to stop it from doing that.    The only way I have found is to edit this script
> and change the string "/etc/udev/rules.d/70-persistent-net.rule" to "/tmp/70-persistent-net.rules"
> but I suppose that change gets wiped out whenever I upgrade the software.
>
> Is there any properly supported way of specifying this?
>

/lib/udev/rules.d/75-persistent-net-generator.rules should not call
write_net_rules if NAME is already set, so

KERNEL="eth0", NAME="eth0"

may do the trick.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: how to suppress write_net_rules (prevent alteration of my net
  2011-01-19 16:58 how to suppress write_net_rules (prevent alteration of my net rules) John Lumby
  2011-01-19 17:24 ` Kay Sievers
  2011-01-19 18:31 ` Andrey Borzenkov
@ 2011-01-19 18:37 ` Marco d'Itri
  2011-01-19 20:03 ` John Lumby
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Marco d'Itri @ 2011-01-19 18:37 UTC (permalink / raw)
  To: linux-hotplug

On Jan 19, Andrey Borzenkov <arvidjaar@gmail.com> wrote:

> /lib/udev/rules.d/75-persistent-net-generator.rules should not call
> write_net_rules if NAME is already set, so
> 
> KERNEL="eth0", NAME="eth0"
This is how it should work indeed.

-- 
ciao,
Marco

^ permalink raw reply	[flat|nested] 7+ messages in thread

* RE: how to suppress write_net_rules (prevent alteration of my net
  2011-01-19 16:58 how to suppress write_net_rules (prevent alteration of my net rules) John Lumby
                   ` (2 preceding siblings ...)
  2011-01-19 18:37 ` how to suppress write_net_rules (prevent alteration of my net Marco d'Itri
@ 2011-01-19 20:03 ` John Lumby
  2011-01-20 18:50 ` how to suppress write_net_rules (prevent alteration of my net rules) Andrey Borzenkov
  2011-01-25 19:25 ` John Lumby
  5 siblings, 0 replies; 7+ messages in thread
From: John Lumby @ 2011-01-19 20:03 UTC (permalink / raw)
  To: linux-hotplug


Thanks everyone for the quick response.    Useful education for me but, as far as I can tell,
neither of those approaches quite achieves what I'm looking for.

I should explain a bit more about my root-over-nfs setup.    To simplify,  I have two computers,   C1 and C2,
and each machine has two ethernet NICs with MAC addresses   M1a,  M1b,   and M2a , M2b  respectively.
C1  has M1a and M1b

C2  has M2a and M2b

On each machine there is a linux installation which might run on either machine,
either locally or by mounting root over nfs from the other.

I would ideally like a single content for each of my systems' 60-net.rules,  naming all 4 NICs,
and assigning a unique eth[n] name to each one but *only* if the kernel did not already name it eth0
(which is what the kernel does if told to configure a network interface itself for nfs-mount purposes)
In other words,  I want all 4 interfaces to have a consistent name except when in use for mounting root over nfs.

So I would have content looking like


# mobo 8168
SUBSYSTEM="net", ACTION="add", ATTR{address}="[M1a]", ... KERNEL!="eth0", NAME="eth1"

# PCI via-rhine
SUBSYSTEM="net", ACTION="add", ATTR{address}="[M1b]", ... KERNEL!="eth0", NAME="eth2"

# mobo yukon2
SUBSYSTEM="net", ACTION="add", ATTR{address}="[M2a]",  ... KERNEL!="eth0", NAME="eth3"

#  e1000
SUBSYSTEM="net", ACTION="add", ATTR{address}="[M2b]",  ... KERNEL!="eth0", NAME="eth4"

And that's what I've done and,  in the absence of write_net_rules ,  it works.

Now  if I may ask questions about your specific suggestions:

Kay Sievers wrote:
> 
> Rules in /etc over-rule rules in /lib with the same name.
> 
> echo "# disable net-generator rules in /lib/udev" > \
>   /etc/udev/rules.d/75-persistent-net-generator.rules
>
That looks perfect  -  except  ...    I already have a  /etc/udev/rules.d/75-persistent-net-generator.rules
and at the top it says:
# do not edit this file, it will be overwritten on update

Is that true?     If so  -  although I can see this would work,   I'm no better off than editing the /lib/udev/write_net_rules am I?

Andrey Borzenkov  wrote:
>
> /lib/udev/rules.d/75-persistent-net-generator.rules should not call
> write_net_rules if NAME is already set, so
>
> KERNEL="eth0", NAME="eth0"
>

I think I see how this would prevent the renaming but how can I achieve the renaming I *do* want?
It seems to me that adding KERNEL="eth0", NAME="eth0" would prevent udev from doing anything when
KERNEL!="eth0",  wouldn't it?   I didn't try it but that's my reading of the man page  -
there is no syntax for parenthesising conditions e.g.

( KERNEL="eth0", NAME="eth0" ) || (  KERNEL!="eth0", NAME="eth1" )
is there?

I have one more question  -   is there any master user-specified profile or config file associated with udev?
Something which orchestrates all the other parts?


Cheers,   John

>
> --
> ciao,
> Marco
> --
> To unsubscribe from this list: send the line "unsubscribe linux-hotplug" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
 		 	   		  

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: how to suppress write_net_rules (prevent alteration of my net rules)
  2011-01-19 16:58 how to suppress write_net_rules (prevent alteration of my net rules) John Lumby
                   ` (3 preceding siblings ...)
  2011-01-19 20:03 ` John Lumby
@ 2011-01-20 18:50 ` Andrey Borzenkov
  2011-01-25 19:25 ` John Lumby
  5 siblings, 0 replies; 7+ messages in thread
From: Andrey Borzenkov @ 2011-01-20 18:50 UTC (permalink / raw)
  To: linux-hotplug

On Wed, Jan 19, 2011 at 11:03 PM, John Lumby <johnlumby@hotmail.com> wrote:
>> Rules in /etc over-rule rules in /lib with the same name.
>>
>> echo "# disable net-generator rules in /lib/udev" > \
>>   /etc/udev/rules.d/75-persistent-net-generator.rules
>>
> That looks perfect  -  except  ...    I already have a  /etc/udev/rules.d/75-persistent-net-generator.rules
> and at the top it says:
> # do not edit this file, it will be overwritten on update
>
> Is that true?     If so  -  although I can see this would work,   I'm no better off than editing the /lib/udev/write_net_rules am I?
>

Either you have really old udev version or your distribution installs
standard rules under /etc instead of under /lib. In both cases you
probably need to ask your distro about it.

> Andrey Borzenkov  wrote:
>>
>> /lib/udev/rules.d/75-persistent-net-generator.rules should not call
>> write_net_rules if NAME is already set, so
>>
>> KERNEL="eth0", NAME="eth0"
>>
>
> I think I see how this would prevent the renaming but how can I achieve the renaming I *do* want?
> It seems to me that adding KERNEL="eth0", NAME="eth0" would prevent udev from doing anything when
> KERNEL!="eth0",  wouldn't it?

No, it won't.

>  I didn't try it but that's my reading of the man page  -
> there is no syntax for parenthesising conditions e.g.
>
> ( KERNEL="eth0", NAME="eth0" ) || (  KERNEL!="eth0", NAME="eth1" )
> is there?
>

Just continue to use the same rules for KERNEL != "eth0" as you use now.

> I have one more question  -   is there any master user-specified profile or config file associated with udev?
> Something which orchestrates all the other parts?

Current udev reads /etc/udev/rules.d, /lib/udev/rules.d and one more
directory under /dev for rules generated when root was still
read-only. This is hardcoded.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* how to suppress write_net_rules (prevent alteration of my net rules)
  2011-01-19 16:58 how to suppress write_net_rules (prevent alteration of my net rules) John Lumby
                   ` (4 preceding siblings ...)
  2011-01-20 18:50 ` how to suppress write_net_rules (prevent alteration of my net rules) Andrey Borzenkov
@ 2011-01-25 19:25 ` John Lumby
  5 siblings, 0 replies; 7+ messages in thread
From: John Lumby @ 2011-01-25 19:25 UTC (permalink / raw)
  To: linux-hotplug


Thanks Andrey :

On Thu, 20 Jan 2011 at 21:50:29 Andrey Borzenkov  wrote:
>
> Either you have really old udev version or your distribution installs
> standard rules under /etc instead of under /lib. In both cases you
> probably need to ask your distro about it.
>

It is current version but my distro is many times upgraded from the original old one and that file must have remained behind or been restored.     I've now saved it and replaced by Kay's comment-line.

> > Andrey Borzenkov  wrote:
>
> No, it won't.
>
> Just continue to use the same rules for KERNEL != "eth0" as you use now.
>

Ah -   now I get it  -  add that as an extra rule at the start of the rules to catch the case of which ever device is currently eth0  (if any).  Ok   -   thanks.

John
 		 	   		  

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2011-01-25 19:25 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-19 16:58 how to suppress write_net_rules (prevent alteration of my net rules) John Lumby
2011-01-19 17:24 ` Kay Sievers
2011-01-19 18:31 ` Andrey Borzenkov
2011-01-19 18:37 ` how to suppress write_net_rules (prevent alteration of my net Marco d'Itri
2011-01-19 20:03 ` John Lumby
2011-01-20 18:50 ` how to suppress write_net_rules (prevent alteration of my net rules) Andrey Borzenkov
2011-01-25 19:25 ` John Lumby

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.