-
-
Notifications
You must be signed in to change notification settings - Fork 499
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Headless setup on Pi Zero SSH over USB OTG #3253
Comments
@omnidepp The dwc2 driver is btw default on RPi Zero, hence the dtoverlay should be without any effect. What do you mean by it does not work? Does the host machine recognise the attached Pi Zero when attached and booting, hence drivers can be installed? How do you try to connect to the Pi? Note that the default hostname on DietPi is " |
Thanks for the quick reply. My mac recognizes the device as RNDIS/Ethernet Gadget, it remains "disconnected" though (red bubble indicator). I've tried the correct host name and I've performed arp- and ip-scans - it's not found. I've been successful at connecting to the Zero with standard raspbian. |
I think I found the issue: Ethernet-over-USB network interfaces are called usb0 etc, not eth0. Hence they are not configured on DietPi by default. You need to add an /etc/network/interfaces.d/ config to have this done. This can currently be applied on DietPi via custom firstrun script (see dietpi.txt) before doing first boot. A related automation could be done with v6.28 as I plan some network setup rework anyway. The config could contain:
I'll verify and give some more detailed instructions later to test. |
Setting up the usb0-interface manually works indeed. I had to enable hdmi and get a keyboard to do so first, though ;-) |
@omnidepp |
Hi, I'd really like to know how you got this to work because I'm having no success after making these changes to my Pi Zero W. I added a config file to interfaces.d as suggested above with the following text: # USB #auto usb0 allow-hotplug usb0 #iface eth0 inet dhcp iface usb0 inet static address 192.168.1.10 netmask 255.255.255.0 gateway 192.168.1.1 I've tried it with the "auto usb0" line uncommented as well. My Mac never sees the device on a network. Booting with RaspberryPi os works fine in this mode so not sure what's wrong. It would be great if this feature was added to DietPi. I'm using latest release of DietPi as of 3 Dec. 2021. Thanks. |
You did enable the device tree overlay and adjusted the kernel module options? |
Not initially. But in continued searching, I found the following explanation echoing what is written above with more detail and tried it with the changes already made and now I can see and connect to the DietPi via usb network. I have a bit more work to do in order to get internet sharing working as the DietPi seems to demand that on boot (I tried disabling those switches in the config but DietPi still wants to call home). I'll come back and report full solution with internet sharing once I resolve it. Thanks for your reply and assistance. This will be a nice feature to include once you get the cycles to add it. I understand the challenges to doing so though. Thanks again. |
The same is explained in the posts above 😄. If you want to configure this for first boot, try to disable Ethernet and WiFi both in
DietPi does not want to call "home" but wants to update your system, especially all APT packages to the latest versions, as a general best practice for any initial system setup. You can abort that, but whatever you do, setting up network at last one time to update the system is the first thing you should do in any case, optionally after some firewalling/hardening, of course. |
Can confirm the following makes a dietpi rpi Zero 2 W a USB gadget with a working data connection:
(Unclear if
Understanding that this is with a Zero 2, not a Zero (1), sharing the above both as a datapoint that this can work with dietpi, and to help anyone else who stumbles upon this bug. As an aside, when I connect my Mac to the rpi in gadget mode, the Mac's internet connection ceases, despite being connected on wifi AND being able to share the internet connecting with the rpi. Still trying to figure out what's causing that. |
Great. You should be able to simplify the interface config to:
|
Thanks. Confirmed the CIDR notation works, and that leaving out the gateway means it uses another connection for internet. |
Exactly, with ip r |
I tried to setup DietPi on pi zero 1.3 in headless mode using USB OTG on Windows. Didn't make it unfortunately 🙁 Followed these steps and used Automation_Custom_PreScript.sh to enable USB as network. For sure I messed something in the script, but as accessing ext4 on sd card on windows is troublesome, I couldn't easily check what went wrong. Frustrated I flashed Raspberry OS Lite on sd card, and just modified config.txt and cmdline.txt to enable USB OTG (no need for custom conf file in /etc/network/interfaces.d/) , and it worked on first try. I really prefer DietPi, but the experience for headless USB OTG is currently lacking. |
You assured that the static IP and gateway match your local network and router? As it works on RPi OS without explicit network configuration (it uses allow-hotplug usb0
iface usb0 inet dhcp |
Thanks for advice, will give it a try in two weeks, busy right now. I wasn't connected to any real local network on host system the pi was connected to - I just set it to be in same subnet as RNDIS virtual adapter. I guess with RPi OS it defaulted to dhcp on dietpi and also on RNDIS adapter I could leave dhpc, and it worked. |
Version: DietPi_v6.25_RPi-ARMv6-Buster
I'm trying to install my pi zero in headless mode with USB OTG as the only means of accessing the device via SSH.
All tutorials suggest to just add
dtoverlay=dwc2
to config.txt andmodules-load=dwc2,g_ether
after rootwait to cmdline.txt. This does not work for Dietpi unfortunately - any insights on why and how to fix this?The text was updated successfully, but these errors were encountered: