Ethernet keeps deactivating and reactivating randomly

Try this and see if it works:

[Unit]
Description=ethernetpower

[Service]
Type=simple
ExecStart=/usr/bin/usbpower/power.sh
Restart=on-failure

[Install]
WantedBy=multi-user.target

sudo systemctl enable power-usb.service

I fixed it by adding some sleep to the script as it takes 5ms to run the script and it runs it too early on boot.

I was pretty sure it had something to do with power management on usb.

Edit: Glad it is resolved for you.

You could have also added it here for startup? “This line can be added to /etc/rc.local to have it executed at startup.” But if the script works then you’re good.

Script works fine, problem now is that whenever I disconnect my usb hub, the power setting resets again so I’m trying to set a rule where it runs the script every time it detects my usb hub connects.

So far I’m making limited progress, I added this to a /etc/udev/rules.d/99-usbc-connect.rules

KERNEL=="sd*", ATTRS{idVendor}=="0bda", ATTRS{idProduct}=="8153", RUN+="/usr/bin/usbpower/poweron.sh"

But so far it won’t work just yet