* Udev sometimes forgets to RUN a program when renaming network
@ 2007-01-05 12:30 Alexander E. Patrakov
2007-01-05 12:50 ` Andrey Borzenkov
0 siblings, 1 reply; 2+ messages in thread
From: Alexander E. Patrakov @ 2007-01-05 12:30 UTC (permalink / raw)
To: linux-hotplug
To Marco d'Itri: this testcase may explain at least a fraction of Debian bug
#403706 (because in Debian ifup is run, essentially, from udev rules),
that's why the CC. Udev version is 0.100-2.3. Also reproducible with 0.103-1.
To repeat the steps below, you need a Debian Etch installation CD, and
VMware Server. QEMU may be able to reproduce this too, but it is untested.
1) Create a virtual machine with two network cards. The first of them should
look into a custom empty virtual network (e.g., /dev/vmnet2 - the intention
is to simulate a useless network card looking into nowhere). The other card
should use host-only or NAT networking (the intention is that it gets its IP
address via DHCP).
2) Install Debian Etch into this virtual machine from the CD. Select eth1 as
the primary network interface. Do not update the system, because this would
trigger the update-initramfs script and break the testcase! (the testcase
relies on the fact that udev not in initramfs has to swap the two network
interfaces at step 6)
This installation procedure creates the following files:
/etc/network/interfaces:
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
allow-hotplug eth1
iface eth1 inet dhcp
/etc/udev/rules.d/z25_persistent-net.rules:
# This file was automatically generated by the /lib/udev/write_net_rules
# program, probably run by the persistent-net-generator.rules rules file.
#
# You can modify it, as long as you keep each rule on a single line.
# PCI device 0x1022:0x2000 (pcnet32)
SUBSYSTEM="net", DRIVERS="?*", ATTRS{address}="00:0c:29:d8:39:6e",
NAME="eth1"
# PCI device 0x1022:0x2000 (pcnet32)
SUBSYSTEM="net", DRIVERS="?*", ATTRS{address}="00:0c:29:d8:39:64",
NAME="eth0"
3) Create the file /etc/udev/rules.d/z49_debug.rules with the following
contents:
SUBSYSTEM="net", ACTION="add", RUN+="/bin/sh -c 'echo FOUND NETWORK
INTERFACE %k >/dev/console'"
4) Reboot the system, watch how it prints that it found eth1, eth0 and lo.
So far so good. Note that the renaming rules above are not really triggered,
because these two network cards are PCI cards served by the same module.
5) Now edit /etc/network/interfaces so that it mentions eth0 instead of
eth1, and edit /etc/udev/rules.d/z25_persistent-net.rules by swapping eth0
and eth1 (so that 00:0c:29:d8:39:6e becomes eth0 and 00:0c:29:d8:39:64
becomes eth1). The intention is, as you may have guessed, is to swap the
names, so that the used card becomes eth0, and the useless one is eth1. The
consequence is that the renaming rules become essential.
6) Reboot. This time it prints the message:
udevd-event[2669]: rename_netif: error changing net interface name
eth1_rename to eth0: No such device
(but "ifconfig -a" shows that the 00:0c:29:d8:39:6e card does become eth0)
Then it prints a message that it found eth1 and lo, and no message about
eth0. And of course, the network is not up, because udev forgot to run
net.agent for the new eth0. Bug!
While it took us some special preparations to trigger this bug with two
identical network cards, I guess that this will happen by itself with 50%
probability if the network cards are not identical, due to random module
loading order.
7) This time, repeat step (5), using names "used" and "unused" for the two
interfaces, reboot and watch how udev finds the "used", "unused" and "lo"
interfaces.
--
Alexander E. Patrakov
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CIDÞVDEV
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: Udev sometimes forgets to RUN a program when renaming network
2007-01-05 12:30 Udev sometimes forgets to RUN a program when renaming network Alexander E. Patrakov
@ 2007-01-05 12:50 ` Andrey Borzenkov
0 siblings, 0 replies; 2+ messages in thread
From: Andrey Borzenkov @ 2007-01-05 12:50 UTC (permalink / raw)
To: linux-hotplug
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Friday 05 January 2007 15:30, Alexander E. Patrakov wrote:
[...]
>
> 5) Now edit /etc/network/interfaces so that it mentions eth0 instead of
> eth1, and edit /etc/udev/rules.d/z25_persistent-net.rules by swapping eth0
> and eth1 (so that 00:0c:29:d8:39:6e becomes eth0 and 00:0c:29:d8:39:64
> becomes eth1). The intention is, as you may have guessed, is to swap the
> names, so that the used card becomes eth0, and the useless one is eth1. The
> consequence is that the renaming rules become essential.
>
> 6) Reboot. This time it prints the message:
>
> udevd-event[2669]: rename_netif: error changing net interface name
> eth1_rename to eth0: No such device
>
> (but "ifconfig -a" shows that the 00:0c:29:d8:39:6e card does become eth0)
>
I confirm this for Mandriva cooker with udev 103 and kernel 2.6.20-rc3. The
two interfaces are eth0 (PCI e100 normally unused) and eth1 (built-in PCMCIA
wireless, primary interface). Effectively the latter is found first by
coldplugging then the former is loaded by network startup script. The
interface eth1 gets renamed and comes up just fine; I have not tried eth0.
Both have DHCP.
> Then it prints a message that it found eth1 and lo, and no message about
> eth0. And of course, the network is not up, because udev forgot to run
> net.agent for the new eth0. Bug!
>
Looks like it; I should have 2 dhclient while I have just one for eth1:
{pts/1}% pgrep -l dh
3491 dhclient
{pts/1}% ps wwwfp 3491
PID TTY STAT TIME COMMAND
3491 ? Ss 0:00
dhclient -1 -q -lf /var/lib/dhcp/dhclient-eth1.leases -pf /var/run/dhclient-eth1.pid -cf /etc/dhclient-eth1.conf
eth1
As far as I can tell, the bug happens under 2.6.20; I have not seen it under
2.6.19 or earlier.
I did not get around to debugging this yet.
- -andrey
> While it took us some special preparations to trigger this bug with two
> identical network cards, I guess that this will happen by itself with 50%
> probability if the network cards are not identical, due to random module
> loading order.
>
> 7) This time, repeat step (5), using names "used" and "unused" for the two
> interfaces, reboot and watch how udev finds the "used", "unused" and "lo"
> interfaces.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (GNU/Linux)
iD8DBQFFnkmgR6LMutpd94wRAmzlAJkBZLkAygg7UENvqYiWsvkGRyim2ACgh4MO
w8+ZnjwTFo4o9k34pATybmo=THa9
-----END PGP SIGNATURE-----
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CIDÞVDEV
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2007-01-05 12:50 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-01-05 12:30 Udev sometimes forgets to RUN a program when renaming network Alexander E. Patrakov
2007-01-05 12:50 ` Andrey Borzenkov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).