[SOLVED] USB NIC intermittent disconnecting, cant reconnect

kef

New Member
Apr 18, 2026
1
0
1
Hey people,
As one of my nodes is a laptop, with that weird flippy ethernet thing for the port, and it would disconnect if I jostled or looked at it the wrong way. Now, several weeks later and multiple times restarting it manually (ahhgg) I got so annoyed I eventually I gave up and bought a usb-c nic (ugreen brand, not that it matters). It actually works pretty good, but if it disconnects (since usb-c doesn't mechanically hold it in) it isn't able to reconnect for some reason. I was having trouble downloading the drivers that presumably would fix this, but it turns out the command way of doing it with ip link set nic1 up (since it connects as nic1) and then ip link set nic1 master vmbr0 , that works perfectly. So I made a rule in /etc/udev/rules.d/, nano 99-usb-ethernet.rules, ACTION=="add|move", SUBSYSTEM=="net", KERNEL=="eth*|en*|nic*", RUN+="/bin/sh -c 'sleep 5; /usr/bin/ip link set %k up; sleep 2; /usr/bin/ip link set %k master vmbr0 &'" and that works and I am happy. I'm writing this post because I know I will forget about how to fix it (because of course I will) and I don't want to necropost this thread .

note: for the iogear one (since I also have one of those) you need to set the initial delay to 10 seconds or it wont work (or however long after you plug it in and the lights start blinking)
 
Instead of a fixed sleep, you can poll until the interface is actually ready. Here's a more robust version:

Code:
ACTION=="add|move", SUBSYSTEM=="net", KERNEL=="eth*|en*|nic*", RUN+="/bin/sh -c 'i=0; while [ $i -lt 30 ] && ! /usr/bin/ip link show %k | grep -q \"state UP\\|state UNKNOWN\"; do sleep 1; i=$((i+1)); done; /usr/bin/ip link set %k up; sleep 1; /usr/bin/ip link set %k master vmbr0'"

The loop checks every second for up to 30 seconds, then proceeds once the interface appears ready, rather than waiting a fixed amount of time blind.