udev weirdness

I found a little usb drive that's the same size as my nsul2, since running it from a usb key was getting a bit cramped. So now I have a system capable of being a Debian mirror that I can fit in my hand. Anyway..

Switching over to this drive was difficult, boot seemed to hang after init started, but with no console it was hard to debug. I eventually tracked it down to udev's init script. Apparently udevsynthesize somehow makes the kernel very unhappy about this usb device:

Jan 10 00:43:41 slug kernel: usb 1-1: reset high speed USB device using ehci_hcd and address 2 Jan 10 00:43:44 slug kernel: usb 1-1: device descriptor read/64, error -110 Jan 10 00:44:00 slug kernel: usb 1-1: reset high speed USB device using ehci_hcd and address 2

And goes on to refuse to do IO to it and mark it as dead. But this only happens if the drive is connected during udev startup; connect it later and it's ok.

I've stepped through the udev init script and, since I'm running 2.6.15, I was also able to step through /sbin/udevsynthesize. Sure enough, after I run this bit and wait a minute, the drive dies:

for file in $first $default $last; do echo 'add' > $file done

The variables are set earlier to every uevent in /sys/class, which includes lots of usb stuff, but from here it's black magic to me; I don't know whether it would be udev's or the kernel's bug that writing to these sys files makes the disk stop working.

Three other usb drives work fine with udev, so it's tempting to just disable udev on this one and ignore the issue.