Headless setup and boot/SSH through USB

Looking to set up my Pi Zero such that I can connect it to my computer via USB and SSH into it in order to use it. Pretty much all tutorials out there suggest putting dtoverlay=dwc2 in config.txt and modules-load=dwc2,g_ether after rootwait in cmdline.txt however these are all meant for Raspbian/RPi OS rather than DietPi.

I have gone through the initial setup of DietPi and finished the software update/install, and if I connect my Pi Zero to my network I can SSH into it. However that requires using the USB port to an ethernet adapter rather than my PC, so I know that the DietPi install worked and the SSH can work.

However when connecting it up via USB the Pi is very clearly powered and running, however I am unable to SSH into it. I have gone through dietpi.txt and stopped it waiting for network before it continues booting so I know it’s not stuck on that. I also found the GitHub page linked below and added the config file as it suggests however no luck there.

Is there anything else I can do to get this working? Do you have any recommendations to get my Pi Zero working through USB?

GitHub page: https://github.com/MichaIng/DietPi/issues/3253


many thanks for your message. Connecting your device directly to your PC doesn’t make much sense because to complete initial installation, DietPi need a valid network as well as internet connection.

Furthermore, DietPi is not an own OS. In case of Raspberry Pi devices, the OS used is Raspberry OS. It’s an extrem slim/diet version of Raspberry OS where all not needed packages are removed within the default images. Recommendation would be to connect the RPi Zero to WiFi.


I have already completed initial installation separately. Now it is set up I would like to use it in the manner I specified, by connecting it to my PC via USB when I want to use it.

This is not a Pi Zero W so it does not have wifi, and only has one USB port so I can either connect a LAN or a USB through that. Ideally I could share networking with my PC when it is plugged in but that is a problem for a later time.

well as the underlying OS is Raspberry OS, you could follow the guides on the web. According our GitHub entry, it’s important to setup usb0 interface on your device https://github.com/MichaIng/DietPi/issues/3253#issuecomment-562525169

I have done, and still no luck.

Did you ever figure this out? I’m having the same issue -tried the recommended suggestions but still no network over USB. Thanks

My bad. It does work after I enabled the device tree overlay and adjusted the kernel module options as shown in the first post in thread. More information available on the GitHub link as well.