0

I'm working with USB network interfaces (Ethernet over USB), on a Raspberry Pi. The goal is basically to flash several Linux machines at the same time through TFTP U-boot, using the four USB ports offered by the Raspberry Pi.

Right now, I've defined four usb interfaces, and each of them has an IP address. I've set up the tftp server. It works fine, however if I try to plug several Linux machines at the same time, it seems like DHCP mixes the interfaces (like, old usb0 becomes new usb1 and old usb1 becomes new usb0), and I believe it creates confusion in the leases and so the TFTP exchanges seem to get stuck in a soft-locked state.

Well, this can't happen. So I set up four udev rules that give these devices a fixed name, based on the usb port they're plugged in. Something like this :

SUBSYSTEM=="usb", ACTION=="add", DEVPATH=="*.2", NAME="usb0"

(I got these values using udevadm info)

I obviously need to rename the device, since it will be the name of my network interface. So, in this case, a symlink isn't of any use (unless there is something I'm not aware of).

However, systemd-udevd doesn't let me rename the device :

Feb 28 17:25:01 pi systemd-udevd[3749]: NAME="usb2" ignored, kernel device nodes can not be renamed; please fix it in /lib/udev/rules.d/99-systemd.rules:49

I've read online that this was possible before version 15.04, so I believe there should be a way to restore this old behavior?

Any piece of advice would be greatly appreciated.

2

A few things need to be clarified:

  1. There is a tree hierarchy of devices. Your USB Ethernet adapter shows up as multiple "devices" in different subsystems, representing different layers:

    • subsystem usb, devtype usb_device – a USB device connected to some port;
    • subsystem usb, devtype usb_interface – a specific function that the USB device provides (the term 'interface' has a different meaning than in networking!);
    • subsystem net – the actual network interface (this time in the regular networking sense).

    (The net device is a child of the usb_interface, which itself is a child of the usb_device, etc.)

  2. Not all devices even have "device nodes," e.g. network interfaces do not show up in /dev. (Which is unfortunate, but besides the point.)

  3. Only network interfaces can be renamed. Other devices cannot. This policy became stricter when Linux switched from udev creating device nodes to the kernel itself doing so. (Yes, technically mv /dev/foo /dev/bar still works, but the policy is that udev will not mess with what the kernel exports.)

So, point #1 is important: your whole post is talking about network interfaces (which belong to the net subsystem) but your udev rules are matching against the usb subsystem – as a result you're trying to rename some abstract USB device in /sys.

Your rule needs to specifically have SUBSYSTEM=="net". If you want to additionally match parent devices, SUBSYSTEMS=="usb" could be used (note the 'S').

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.