Bug#765577: udev-udeb: Write dupliate entries into 70-persistent-net.rules
Hi all, Petter and Michael, thanks for your work on this! I'm able to reproduce this bug consistently (100% of the time, having run ~40 installations in the past week that exhibit it) with the following steps: 1. PXE boot a jessie netboot image (latest daily build, for example) 2. Add auto=true to the install menu option and run it. 3. Stop the installation (or switch to another TTY) and look at /etc/udev/rules.d/70-persistent-net.rules (in the installer environment, not under /target). The duplicate entry is present already, and will make its way into the target system during installation. The entry always appears for me when I use auto=true. I have not seen it appear without this option, but I haven't tested non-auto installs extensively. It happens even if we temporarily disable d-i preseeding from our DHCP server. On Tue, Oct 21, 2014 at 11:07:51AM +0200, Petter Reinholdtsen wrote: Perhaps it only happen on fairly quick machines? I experience it on a Thinkpad X200 and X300, but not on a 10 year old Latitude D505. :( It's possible that all of the hardware I'm testing on is too fast, but having performed many installs, I'm yet to see this not happen when auto=true is set. I've tested jessie installs on about 20 different systems (mix of ~15 new and old desktops, plus some KVM and VirtualBox guests), and seen this happen reliably on all of them. I wasn't able to narrow down the source of the duplicate entries in the code, despite some attempts at bisecting what I was hoping might be relevent parts of d-i. CCing debian-boot and adding the d-i tag, as I believe there's a good chance it is relevant to this bug. Apologies if that's unnecessary! Thanks and happy Monday, Chris -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Bug#765577: udev-udeb: Write dupliate entries into 70-persistent-net.rules
[Petter Reinholdtsen] It would be nice if /lib/udev/write_net_rules could be changed to log a message to syslog when 70-persistent-net.rules is updated, to be able to figure out when it happen. I in the places I suspect are related to this issue, add similar instrumentation in the hw-detect code. Anyone around to help out with this issue? While waiting for ideas how to find the source of the duplicate entries, I added the following workaround to debian-edu-config, rewriting the 70-persistent-net.rules file to remove duplicate if anyone are present in the pre-pkgsel step. It solve the problem for us for now, but I suspect a generic fix should be added to the code inserting the duplicate entries. diff --git a/share/debian-edu-config/d-i/pre-pkgsel b/share/debian-edu-config/d-i/pre-pkgsel index c298731..34d47a9 100644 --- a/share/debian-edu-config/d-i/pre-pkgsel +++ b/share/debian-edu-config/d-i/pre-pkgsel @@ -209,6 +209,13 @@ EOF echo $MAILNAME /target/etc/mailname fi +# Workaround for bug in d-i/udev, causing duplicate entries in +# /etc/udev/rules.d/70-persistent-net.rules in both d-i and +# /target/. See bug $765577 for the details. +if in-target /usr/share/debian-edu-config/tools/workaround-udev-bug-765577 ; then + error disabled duplicate udev rule (bug #765577) +fi + # Make sure that the interfaces are there for the cfengine run if # network isn't already configured if route | grep -q default ; then diff --git a/share/debian-edu-config/tools/workaround-udev-bug-765577 b/share/debian-edu-config/tools/workar new file mode 100755 index 000..7054c58 --- /dev/null +++ b/share/debian-edu-config/tools/workaround-udev-bug-765577 @@ -0,0 +1,71 @@ +#!/usr/bin/perl +# +# Implement workaround for bug #765577 by removing duplicate entries +# from the persistent network interface name rule before rebooting for +# the first time, to make sure eth0 is present on the machines with +# fixed network setup in /etc/network/interfaces + +use strict; +use warnings; +use Getopt::Std; + +my $bugurl = https://bugs.debian.org/765577;; + +my $rulefile = /etc/udev/rules.d/70-persistent-net.rules; +my $newfile = $rulefile.new; + +my $debug = 0; +my %linecache; +my $modified = 0; +my %opts; + +sub usage { +my $retval = shift; +print EOF; +Usage: $0: [-dn] +Fix + -d enable debugging + -n do not modify $rulefile +EOF + exit($retval) if $retval; +} + +getopts(dn, \%opts) || usage(1); + +open(my $rh, '', $rulefile) || die error: unable to read from $rulefile; +my $wh; +if (!$opts{'n'}) { +open($wh, '', $newfile) || die error: unable to write to $newfile; +} +my $shortline; +while (my $line = $rh) { +$shortline = $line; +$shortline =~ s/, NAME=[^]+//; +print STDERR shortline: '$shortline'\n if $opts{'d'}; +if ($shortline !~ m/^\s*$/ + $shortline =~ m/^SUBSYSTEM=/ + exists $linecache{$shortline}) { +# Seen the same line before, skip it. +print STDERR skipping line\n if $opts{'d'}; +$modified = 1; +if (!$opts{'n'}) { +print $wh # Duplicate entry disabled, workaround for $bugurl\n#$line; +} +next; +} +$linecache{$shortline} = 1; +if (!$opts{'n'}) { +print $wh $line; +} +} +close($rh); +if (!$opts{'n'}) { +close($wh); +if ($modified) { +rename($newfile, $rulefile) || die error: unable to rename $newfile to $rulefile; +} else { +unlink $newfile; +} +} else { +} +exit ! $modified; -- Happy hacking Petter Reinholdtsen -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Bug#765577: udev-udeb: Write dupliate entries into 70-persistent-net.rules
[Petter Reinholdtsen] Could this be related to the fetching and installation of firmware in d-i? It normally cause kernel modules to be reloaded. I did some more testing, and when PXE booting the netboot d-i images, the 70-persistent-net.rules file got the duplicate entries very early. Only the localechooser, console-setup-udeb, ethdetect and netcfg menu items have been selected. The first is added before localechooser show its menu when I do not run the installation on automatic. But installing interactively do not cause the duplicate entries, and I am unable to insert instrumentation without doing things interactively. :( Perhaps it only happen on fairly quick machines? I experience it on a Thinkpad X200 and X300, but not on a 10 year old Latitude D505. :( It would be nice if /lib/udev/write_net_rules could be changed to log a message to syslog when 70-persistent-net.rules is updated, to be able to figure out when it happen. I in the places I suspect are related to this issue, add similar instrumentation in the hw-detect code. -- Happy hacking Petter Reinholdtsen -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Bug#765577: udev-udeb: Write dupliate entries into 70-persistent-net.rules
[Michael Biebl] Could be a race. Maybe hwdetect triggers a uevent for your ethernet device, while /lib/udev/write_net_rules has not finished yet writing 70-persistent-net.rules and udev having picked up the changed 70-persistent-net.rules (via inotify). So instead of applying the generated rule for eth0, it generates a new rule, for eth1. Marco is the expert here though, so maybe he can shed some light on this. Great. I look forward to hearing from him. Could this be related to the fetching and installation of firmware in d-i? It normally cause kernel modules to be reloaded. -- Happy hacking Petter Reinholdtsen -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Bug#765577: udev-udeb: Write dupliate entries into 70-persistent-net.rules
Package: udev-udeb Version: 215-5+b1 Severity: important User: debian-...@lists.debian.org Usertags: debian-edu I ran into this problem when installing a Debian Edu Jessie workstation using PXE on a Lenovo Thinkpad X200. The problem at the end is that users can not log into the workstation because the network interface is not properly configured. This is caused by the network card to show up as eth1 instead of eth0. Only eth0 is configured in /etc/network/interfaces. This in turn is caused by /etc/udev/rules.d/70-presisten-net.rules listing the network card twice, once with eth0 and once with eth1. The file look like this: # This file was automatically generated by the /lib/udev/write_net_rules # program, run by the persistent-net-generator.rules rules file. # # You can modify it, as long as you keep each rule on a single # line, and change only the value of the NAME= key. # PCI device 0x8086:0x10f5 (e1000e) SUBSYSTEM==net, ACTION==add, DRIVERS==?*, ATTR{address}==00:1f:16:0b:47:4d, ATTR{dev_id}==0x0, ATTR{type}==1, KERNEL==eth*, NAME=eth0 # PCI device 0x8086:0x10f5 (e1000e) SUBSYSTEM==net, ACTION==add, DRIVERS==?*, ATTR{address}==00:1f:16:0b:47:4d, ATTR{dev_id}==0x0, ATTR{type}==1, KERNEL==eth*, NAME=eth1 As this have not happend to me every time, I have tried to figure out what is special about this setup, but do not know the udev stuff enough to have a clue. I do notice this part in the log, which seem to be related: Oct 16 10:51:35 main-menu[186]: INFO: Menu item 'ethdetect' selected Oct 16 10:51:35 kernel: [2.532038] usb 2-2: new full-speed USB device number 3 using uhci_hcd Oct 16 10:51:35 net/hw-detect.hotplug: Detected hotpluggable network interface lo Oct 16 10:51:35 net/hw-detect.hotplug: Detected hotpluggable network interface eth1 Oct 16 10:51:35 kernel: [2.620227] systemd-udevd[51]: renamed network interface eth0 to eth1 Oct 16 10:51:35 kernel: [2.636070] Switched to clocksource tsc Oct 16 10:51:35 kernel: [2.707037] usb 2-2: New USB device found, idVendor=0a5c, idProduct=2145 Oct 16 10:51:35 kernel: [2.707039] usb 2-2: New USB device strings: Mfr=1, Product=2, SerialNumber=0 Oct 16 10:51:35 kernel: [2.707042] usb 2-2: Product: ThinkPad Bluetooth with Enhanced Data Rate II Oct 16 10:51:35 kernel: [2.707043] usb 2-2: Manufacturer: Lenovo Computer Corp Oct 16 10:51:35 hw-detect: Detected module 'usb-storage' for 'USB storage' Notice how eth0 was renamed to eth1 by udev while hw-detect version 1.104 was running. Any clue what is going wrong here? -- Happy hacking Petter Reinholdtsen -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Bug#765577: udev-udeb: Write dupliate entries into 70-persistent-net.rules
Am 16.10.2014 um 13:09 schrieb Petter Reinholdtsen: Package: udev-udeb Version: 215-5+b1 Severity: important User: debian-...@lists.debian.org Usertags: debian-edu I ran into this problem when installing a Debian Edu Jessie workstation using PXE on a Lenovo Thinkpad X200. The problem at the end is that users can not log into the workstation because the network interface is not properly configured. This is caused by the network card to show up as eth1 instead of eth0. Only eth0 is configured in /etc/network/interfaces. This in turn is caused by /etc/udev/rules.d/70-presisten-net.rules listing the network card twice, once with eth0 and once with eth1. The file look like this: # This file was automatically generated by the /lib/udev/write_net_rules # program, run by the persistent-net-generator.rules rules file. # # You can modify it, as long as you keep each rule on a single # line, and change only the value of the NAME= key. # PCI device 0x8086:0x10f5 (e1000e) SUBSYSTEM==net, ACTION==add, DRIVERS==?*, ATTR{address}==00:1f:16:0b:47:4d, ATTR{dev_id}==0x0, ATTR{type}==1, KERNEL==eth*, NAME=eth0 # PCI device 0x8086:0x10f5 (e1000e) SUBSYSTEM==net, ACTION==add, DRIVERS==?*, ATTR{address}==00:1f:16:0b:47:4d, ATTR{dev_id}==0x0, ATTR{type}==1, KERNEL==eth*, NAME=eth1 As this have not happend to me every time, I have tried to figure out what is special about this setup, but do not know the udev stuff enough to have a clue. I do notice this part in the log, which seem to be related: Oct 16 10:51:35 main-menu[186]: INFO: Menu item 'ethdetect' selected Oct 16 10:51:35 kernel: [2.532038] usb 2-2: new full-speed USB device number 3 using uhci_hcd Oct 16 10:51:35 net/hw-detect.hotplug: Detected hotpluggable network interface lo Oct 16 10:51:35 net/hw-detect.hotplug: Detected hotpluggable network interface eth1 Oct 16 10:51:35 kernel: [2.620227] systemd-udevd[51]: renamed network interface eth0 to eth1 Oct 16 10:51:35 kernel: [2.636070] Switched to clocksource tsc Oct 16 10:51:35 kernel: [2.707037] usb 2-2: New USB device found, idVendor=0a5c, idProduct=2145 Oct 16 10:51:35 kernel: [2.707039] usb 2-2: New USB device strings: Mfr=1, Product=2, SerialNumber=0 Oct 16 10:51:35 kernel: [2.707042] usb 2-2: Product: ThinkPad Bluetooth with Enhanced Data Rate II Oct 16 10:51:35 kernel: [2.707043] usb 2-2: Manufacturer: Lenovo Computer Corp Oct 16 10:51:35 hw-detect: Detected module 'usb-storage' for 'USB storage' Notice how eth0 was renamed to eth1 by udev while hw-detect version 1.104 was running. Any clue what is going wrong here? Could be a race. Maybe hwdetect triggers a uevent for your ethernet device, while /lib/udev/write_net_rules has not finished yet writing 70-persistent-net.rules and udev having picked up the changed 70-persistent-net.rules (via inotify). So instead of applying the generated rule for eth0, it generates a new rule, for eth1. Marco is the expert here though, so maybe he can shed some light on this. -- Why is it that all of the instruments seeking intelligent life in the universe are pointed away from Earth? signature.asc Description: OpenPGP digital signature