Re: [gentoo-user] Execute udev rule before net.* scripts

2014-08-26 Thread Grant
 SUBSYSTEM==net, KERNEL==enp3s0u1, NAME=net0

 enp3s0u1 isn't a kernel name; it's an ID_NET_NAME_PATH attribute.

 That's what came to my mind too, that's why I instructed him away from it.

 Yeah, I saw your email after I sent mine.

 I now have to figure out why you're recommending a 80 prefix when I
 thought that a 80 prefix is necessary in order AFAIK to override
 /lib/udev/rules.d/80-net-setup-link.rules.

 I tried 75- instead of 85- this morning before leaving for work and
 the interfaces were renamed properly so I'm clearly wrong...


I'm not totally sure that this answers your question, but:

Because the rules are triggered before the default one (rules are
triggered in alphanumerical order, so 70 comes before 80) the names
provided in the rule file will be used instead of the default ones.
The number granted to the file should be between 76 and 79 (the
environment variables are defined by a rule start starts with 75 and
the fallback naming is done in a rule numbered 80).

https://www.gentoo.org/doc/en/handbook/handbook-amd64.xml?part=4chap=2#doc_chap4

- Grant



Re: [gentoo-user] Execute udev rule before net.* scripts

2014-08-26 Thread Tom H
On Tue, Aug 26, 2014 at 8:43 AM, Grant emailgr...@gmail.com wrote:

 SUBSYSTEM==net, KERNEL==enp3s0u1, NAME=net0

 enp3s0u1 isn't a kernel name; it's an ID_NET_NAME_PATH attribute.

 That's what came to my mind too, that's why I instructed him away from it.

 Yeah, I saw your email after I sent mine.

 I now have to figure out why you're recommending a 80 prefix when I
 thought that a 80 prefix is necessary in order AFAIK to override
 /lib/udev/rules.d/80-net-setup-link.rules.

 I tried 75- instead of 85- this morning before leaving for work and
 the interfaces were renamed properly so I'm clearly wrong...

 I'm not totally sure that this answers your question, but:

 Because the rules are triggered before the default one (rules are
 triggered in alphanumerical order, so 70 comes before 80) the names
 provided in the rule file will be used instead of the default ones.
 The number granted to the file should be between 76 and 79 (the
 environment variables are defined by a rule start starts with 75 and
 the fallback naming is done in a rule numbered 80).

 https://www.gentoo.org/doc/en/handbook/handbook-amd64.xml?part=4chap=2#doc_chap4

Thanks, it does. fallback naming explains it because I thought that
80- provided override naming. But I'd still like to know more
precisely.

I looked at 75-net-description.rules and 80-net-setup-link.rules last
night and decided to look up the source of net_id, path_id,
net_setup_link this weekend because I was too tired...

Thanks again.



Re: [gentoo-user] Execute udev rule before net.* scripts

2014-08-25 Thread Tom H
On Sun, Aug 24, 2014 at 1:05 PM, Samuli Suominen ssuomi...@gentoo.org wrote:
 On 24/08/14 20:05, Tom H wrote:
 On Sun, Aug 24, 2014 at 8:59 AM, Grant emailgr...@gmail.com wrote:

 SUBSYSTEM==net, KERNEL==enp3s0u1, NAME=net0

 enp3s0u1 isn't a kernel name; it's an ID_NET_NAME_PATH attribute.

 That's what came to my mind too, that's why I instructed him away from it.

Yeah, I saw your email after I sent mine.

I now have to figure out why you're recommending a 80 prefix when I
thought that a 80 prefix is necessary in order AFAIK to override
/lib/udev/rules.d/80-net-setup-link.rules.

I tried 75- instead of 85- this morning before leaving for work and
the interfaces were renamed properly so I'm clearly wrong...



[gentoo-user] Execute udev rule before net.* scripts

2014-08-24 Thread Grant
I'm trying to define names for my USB network interfaces keyed on the
interface location instead of the interface MAC address.  This udev
rule renames one of them:

SUBSYSTEM==net, KERNEL==enp3s0u1, NAME=net0

But it doesn't work automatically at boot, I have to execute 'udevadm
trigger --action=add'.  How can I execute that before the net.*
scripts at boot?

- Grant



Re: [gentoo-user] Execute udev rule before net.* scripts

2014-08-24 Thread Samuli Suominen

On 24/08/14 15:59, Grant wrote:
 I'm trying to define names for my USB network interfaces keyed on the
 interface location instead of the interface MAC address.  This udev
 rule renames one of them:

 SUBSYSTEM==net, KERNEL==enp3s0u1, NAME=net0

 But it doesn't work automatically at boot, I have to execute 'udevadm
 trigger --action=add'.  How can I execute that before the net.*
 scripts at boot?

 - Grant


I'm not 100% convinced that's the right syntax to use. See,

https://www.gentoo.org/doc/en/handbook/handbook-amd64.xml?part=4chap=2#doc_chap4


Using your Own Names

Code Listing 4.2: Setting the lan0 name for the current eth0 interface

# vim /etc/udev/rules.d/76-net-name-use-custom.rules
# Second one uses ID_NET_NAME_PATH information, and 76- number to be between
# 75-net-*.rules and 80-net-*.rules
SUBSYSTEM==net, ACTION==add, ENV{ID_NET_NAME_PATH}==enp3s0u1, NAME=net0






Re: [gentoo-user] Execute udev rule before net.* scripts

2014-08-24 Thread Grant
 I'm trying to define names for my USB network interfaces keyed on the
 interface location instead of the interface MAC address.  This udev
 rule renames one of them:

 SUBSYSTEM==net, KERNEL==enp3s0u1, NAME=net0

 But it doesn't work automatically at boot, I have to execute 'udevadm
 trigger --action=add'.  How can I execute that before the net.*
 scripts at boot?

 - Grant


 I'm not 100% convinced that's the right syntax to use. See,

 https://www.gentoo.org/doc/en/handbook/handbook-amd64.xml?part=4chap=2#doc_chap4


 Using your Own Names

 Code Listing 4.2: Setting the lan0 name for the current eth0 interface

 # vim /etc/udev/rules.d/76-net-name-use-custom.rules
 # Second one uses ID_NET_NAME_PATH information, and 76- number to be between
 # 75-net-*.rules and 80-net-*.rules
 SUBSYSTEM==net, ACTION==add, ENV{ID_NET_NAME_PATH}==enp3s0u1, 
 NAME=net0


Works perfectly!  Thank you Samuli!

- Grant



Re: [gentoo-user] Execute udev rule before net.* scripts

2014-08-24 Thread Tom H
On Sun, Aug 24, 2014 at 8:59 AM, Grant emailgr...@gmail.com wrote:

 I'm trying to define names for my USB network interfaces keyed on the
 interface location instead of the interface MAC address. This udev
 rule renames one of them:

 SUBSYSTEM==net, KERNEL==enp3s0u1, NAME=net0

 But it doesn't work automatically at boot, I have to execute 'udevadm
 trigger --action=add'. How can I execute that before the net.*
 scripts at boot?

enp3s0u1 isn't a kernel name; it's an ID_NET_NAME_PATH attribute.

I use the following on my laptop:

$ cat /etc/udev/rules.d/85-net-name.rules
SUBSYSTEM==net, ACTION==add, KERNEL==eth*,
ATTR{address}==28:D2:44:0E:2F:53, NAME=wire
SUBSYSTEM==net, ACTION==add, KERNEL==wlan*,
ATTR{address}==68:17:29:4B:26:5C, NAME=wifi

The rule that used to create 70-persistent-net.rules added
DRIVERS==?*
ATTR{dev_id}==0x0
ATTR{type}==1
but udev doen't seem to need them.



Re: [gentoo-user] Execute udev rule before net.* scripts

2014-08-24 Thread Samuli Suominen

On 24/08/14 20:05, Tom H wrote:
 On Sun, Aug 24, 2014 at 8:59 AM, Grant emailgr...@gmail.com wrote:
 I'm trying to define names for my USB network interfaces keyed on the
 interface location instead of the interface MAC address. This udev
 rule renames one of them:

 SUBSYSTEM==net, KERNEL==enp3s0u1, NAME=net0

 But it doesn't work automatically at boot, I have to execute 'udevadm
 trigger --action=add'. How can I execute that before the net.*
 scripts at boot?
 enp3s0u1 isn't a kernel name; it's an ID_NET_NAME_PATH attribute.

That's what came to my mind too, that's why I instructed him away from it.

- Samuli