Skip to contentSkip to conversation

Proble using udev to rename ethernet interfaces

DISCUSSION Thomas Koeller 3 participants 4 messages Dec 31, 2005

lore
Share & tools
lore
#0 lore raw

Hi,

when trying to set up udev rules to assign names to my ethernet interfaces, I ran into severe problems. There are two ethernet cards (of identical type) in my computer, and I wrote the following rule to name the interfaces:

# Network interface setup

# Ethernet interfaces
SUBSYSTEM="net", KERNEL="eth[0-9]", SYSFS{address}="00:e0:29:48:fe:4d", NAME="eth_lan", RUN="start_lan" SUBSYSTEM="net", KERNEL="eth[0-9]", SYSFS{address}="00:04:e2:08:dc:44", NAME="eth_dsl", RUN="/sbin/modprobe pppoe"

The results I get by using these rules are that sometimes the rules take effect, and sometimes they don't. That is to say that if I cycle through loading/unloading my ethernet driver modulemultiple times, the network interfaces may either be assigned the names defined by the rules, or the kernel names 'eth0' and 'eth1', in an apparently random fashion.

In particular, I observed the following cases:

1. First rule takes effect, second one does not
-----------------------------------------------

Dec 31 03:19:23 sarkovy udevd[248]: udev_done: seq 495, pid [1933] exit with 0, 0 seconds old
Dec 31 03:19:23 sarkovy udevd-event[1935]: udev_rules_get_name: rule applied, 'eth0' becomes 'eth_lan'
Dec 31 03:19:23 sarkovy udevd[248]: udev_event_run: seq 497 forked, pid [1937], 'add' 'net', 0 seconds old
Dec 31 03:19:23 sarkovy udevd-event[1937]: udev_rules_get_name: no node name set, will use kernel name 'eth1'
Dec 31 03:19:23 sarkovy udevd-event[1935]: udev_rules_get_name: reset run list
Dec 31 03:19:23 sarkovy udevd-event[1937]: udev_event_run: seq 497 finished
Dec 31 03:19:23 sarkovy udevd-event[1935]: rename_net_if: changing net interface name from 'eth0' to 'eth_lan'
Dec 31 03:19:23 sarkovy udevd[248]: udev_done: seq 497, pid [1937] exit with 0, 0 seconds old
Dec 31 03:19:23 sarkovy udevd-event[1935]: udev_add_device: renamed netif to 'eth_lan'
Dec 31 03:19:23 sarkovy udevd-event[1935]: run_program: 'start_lan' 'net'
Dec 31 03:19:23 sarkovy udevd-event[1935]: run_program: '/lib/udev/start_lan' returned with status 0
Dec 31 03:19:23 sarkovy udevd-event[1935]: udev_event_run: seq 496 finished
Dec 31 03:19:23 sarkovy udevd[248]: udev_done: seq 496, pid [1935] exit with 0, 0 seconds old

2. Both rules are ignored
-------------------------

Dec 31 03:20:18 sarkovy udevd[248]: udev_event_run: seq 523 forked, pid [2183], 'add' 'net', 0 seconds old
Dec 31 03:20:18 sarkovy udevd-event[2183]: udev_rules_get_name: no node name set, will use kernel name 'eth0'
Dec 31 03:20:18 sarkovy udevd-event[2183]: udev_event_run: seq 523 finished
Dec 31 03:20:18 sarkovy udevd[248]: udev_done: seq 523, pid [2183] exit with 0, 0 seconds old
Dec 31 03:20:18 sarkovy udevd[248]: udev_event_run: seq 524 forked, pid [2185], 'add' 'net', 0 seconds old
Dec 31 03:20:18 sarkovy udevd-event[2185]: udev_rules_get_name: no node name set, will use kernel name 'eth1'
Dec 31 03:20:18 sarkovy udevd-event[2185]: udev_event_run: seq 524 finished
Dec 31 03:20:18 sarkovy udevd[248]: udev_done: seq 524, pid [2185] exit with 0, 0 seconds old
Dec 31 03:20:21 sarkovy udevd[248]: udev_event_run: seq 525 forked, pid [2190], 'add' 'module', 0 seconds old
Dec 31 03:20:21 sarkovy udevd-event[2190]: udev_event_run: seq 525 finished
Dec 31 03:20:21 sarkovy udevd[248]: udev_done: seq 525, pid [2190] exit with 0, 0 seconds old

If, however, I execute 'udevstart' after loading the driver, both rules always take effect. I am completely puzzled by this nondeterministic behavior, can anyone help?

Thomas

Signature · 13 lines
Thomas Koeller
thomas at koeller dot dyndns dot org


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_idv37&alloc_id865&op=click
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
#1 lore raw

I should have mentioned that I am using udev-079.

thomas

Signature · 13 lines
Thomas Koeller
thomas at koeller dot dyndns dot org


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_idv37&alloc_id865&op=click
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
#2 lore raw
In reply to Thomas Koeller
Quoted 5 lines · Thomas Koeller

Hi,

when trying to set up udev rules to assign names to my ethernet interfaces, I ran into severe problems. There are two ethernet cards (of identical type) in my computer, and I wrote the following rule to name the interfaces:

Try adding:
ACTION="add", SUBSYSTEM="net", WAIT_FOR_SYSFS="address"

Your distro should include this until this patch hits the kernel:
http://www.kernel.org/git/?p=linux/kernel/git/gregkh/patches.git;a=blob;hb=HEAD;f=driver/net-swich-device-attribute-creation-to-default-attrs.patch

Kay

-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_idv37&alloc_id865&op=click
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

#3 lore raw
In reply to Thomas Koeller
Quoted 2 lines · Thomas Koeller

The results I get by using these rules are that sometimes the rules take effect, and sometimes they don't. That is to say that if I cycle through loading/unloading

Use this before the other rules:

ACTION="add", SUBSYSTEM="net", WAIT_FOR_SYSFS="address"

Signature · 13 lines
ciao,
Marco


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_idv37&alloc_id865&op=click
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel