Package: udev
Version: 0.103-1
Severity: important
Tags: upstream

Short summary: if udev has to swap names of the two network interfaces, it forgets to process RUN+="..." statements for one of them (including net.agent). This may be, at least partially, responsible for the critical bug #403706.

If you agree, please increase severity on the "breaks ifupdown" basis. A 100% reproducible testcase is below.

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.

-- Package-specific info:
-- /etc/udev/rules.d/:
/etc/udev/rules.d/:
total 12
lrwxrwxrwx 1 root root 20 Jan 5 21:02 020_permissions.rules -> ../permissions.rules
lrwxrwxrwx 1 root root  13 Jan  5 21:02 udev.rules -> ../udev.rules
lrwxrwxrwx 1 root root 25 Jan 5 21:02 z20_persistent-input.rules -> ../persistent-input.rules lrwxrwxrwx 1 root root 19 Jan 5 21:02 z20_persistent.rules -> ../persistent.rules
-rw-r--r-- 1 root root 705 Jan  5 21:27 z25_persistent-cd.rules
-rw-r--r-- 1 root root 458 Jan  5 21:54 z25_persistent-net.rules
lrwxrwxrwx 1 root root 33 Jan 5 21:02 z45_persistent-net-generator.rules -> ../persistent-net-generator.rules
-rw-r--r-- 1 root root  99 Jan  5 21:34 z49_debug.rules
lrwxrwxrwx 1 root root  12 Jan  5 21:02 z50_run.rules -> ../run.rules
lrwxrwxrwx 1 root root  16 Jan  5 21:02 z55_hotplug.rules -> ../hotplug.rules
lrwxrwxrwx 1 root root 29 Jan 5 21:02 z75_cd-aliases-generator.rules -> ../cd-aliases-generator.rules

-- /sys/:
/sys/block/fd0/dev
/sys/block/hdc/dev
/sys/block/loop0/dev
/sys/block/loop1/dev
/sys/block/loop2/dev
/sys/block/loop3/dev
/sys/block/loop4/dev
/sys/block/loop5/dev
/sys/block/loop6/dev
/sys/block/loop7/dev
/sys/block/ram0/dev
/sys/block/ram1/dev
/sys/block/ram10/dev
/sys/block/ram11/dev
/sys/block/ram12/dev
/sys/block/ram13/dev
/sys/block/ram14/dev
/sys/block/ram15/dev
/sys/block/ram2/dev
/sys/block/ram3/dev
/sys/block/ram4/dev
/sys/block/ram5/dev
/sys/block/ram6/dev
/sys/block/ram7/dev
/sys/block/ram8/dev
/sys/block/ram9/dev
/sys/block/sda/dev
/sys/block/sda/sda1/dev
/sys/block/sda/sda2/dev
/sys/block/sda/sda5/dev
/sys/class/input/input0/event0/dev
/sys/class/input/input1/event1/dev
/sys/class/input/input1/mouse0/dev
/sys/class/input/input1/ts0/dev
/sys/class/input/input2/event2/dev
/sys/class/input/mice/dev
/sys/class/misc/agpgart/dev
/sys/class/misc/device-mapper/dev
/sys/class/misc/hpet/dev
/sys/class/misc/psaux/dev
/sys/class/misc/rtc/dev
/sys/class/misc/snapshot/dev

-- Kernel configuration:


-- System Information:
Debian Release: 4.0
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.17-2-686
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968)

Versions of packages udev depends on:
ii  debconf [debconf-2.0]        1.5.8       Debian configuration management
ii  libc6                        2.3.6.ds1-8 GNU C Library: Shared libraries
ii  libselinux1                  1.32-3      SELinux shared libraries
ii  libvolume-id0                0.103-1     libvolume_id shared library
ii  lsb-base                     3.1-22      Linux Standard Base 3.1 init

udev recommends no packages.

-- debconf information excluded

--
Alexander E. Patrakov


--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to