Activate "ETH over USB" on Linux [SIMPLE TRICK]

The easiest way is still to have serial console, WiFi or Ethernet cable connected to your Zeroes. I mention this again since you didn’t seem to be aware that you can control Zero with serial port, which is relatively low cost, and can even be used to access boot loader environment, which is not possible with USBNET or Ethernet. The point is if this is a production system it is always better to have redundant connections to the system to reduce downtime, since we all know the question of hardware failure is not whether but when.

With that being said, you can try to modify the image before you flash it to your Zero so you can have USBNET pre-configured. This is more of a general Linux question so you can find some articles online, but the major steps on top of my head should be:

# Install qemu-user-static to run aarch64 binary on x86_64 system,
# and kpartx from multipath-tools to mount distro image
sudo apt update && sudo apt install -y qemu-user-static multipath-tools
# Mount image
sudo kpartx -a debian.img && sudo mount /dev/mapper/loop0p1 /mnt
# Chroot into aarch64 system
sudo cp /usr/bin/qemu-aarch64-static /mnt/usr/bin/
LANG=C.UTF-8 sudo chroot /mnt /usr/bin/qemu-aarch64-static /bin/bash
###
# You can now set up the system as you wish, including install USBNET and set up IP address
###
# Exit chroot and umount the image
exit
sudo umount /mnt && sudo kpartx -d debian.img
# You can now flash this updated debian.img as usual

This script is untested but should give you a starting point.

1 Like