https://github.com/loguecow/rpi-usb-headless
setup usb headless
https://github.com/loguecow/rpi-usb-headless
headless raspberry-pi raspberry-pi-4 raspberry-pi-zero raspberry-pi-zero-2 raspberry-pi-zero-2-w raspberry-pi-zero-w
Last synced: over 1 year ago
JSON representation
setup usb headless
- Host: GitHub
- URL: https://github.com/loguecow/rpi-usb-headless
- Owner: loguecow
- Created: 2024-03-20T21:10:12.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2025-02-11T13:56:14.000Z (over 1 year ago)
- Last Synced: 2025-02-11T14:42:27.824Z (over 1 year ago)
- Topics: headless, raspberry-pi, raspberry-pi-4, raspberry-pi-zero, raspberry-pi-zero-2, raspberry-pi-zero-2-w, raspberry-pi-zero-w
- Homepage:
- Size: 1000 Bytes
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Raspberry Pi USB Headless Setup
This guide explains how to set up a Raspberry Pi for headless operation over USB, enabling SSH access without the need for an external monitor, keyboard, or network connection.
## Prerequisites
- A Raspberry Pi (Zero, Zero W, or other models supporting USB gadget mode)
- A microSD card with Raspberry Pi OS installed
- A computer with an available USB port
## Steps to Configure Headless USB Access
### 1. Modify `cmdline.txt`
Edit the boot configuration file on the SD card:
```sh
sudo nano /boot/cmdline.txt
```
Add the following before `rootwait`:
```
modules-load=dwc2,g_ether
```
Save and exit.
### 2. Modify `config.txt`
Edit the Raspberry Pi configuration file:
```sh
sudo nano /boot/config.txt
```
Add the following line at the end:
```
dtoverlay=dwc2,dr_mode=peripheral
```
Save and exit.
### 3. Configure Network Interface
Edit the network interfaces file:
```sh
sudo nano /etc/network/interfaces
```
Add the following:
```
allow-hotplug usb0
iface usb0 inet static
address 192.168.7.2
netmask 255.255.255.0
network 192.168.7.0
broadcast 192.168.7.255
gateway 192.168.7.1
```
Save and exit.
### 4. Enable SSH
To enable SSH, create an empty file named `ssh` in the `/boot` directory:
```sh
touch /boot/ssh
```
### 5. Connect and Access via SSH
- Connect the Raspberry Pi to your computer using a USB cable.
- Wait for the Pi to boot up.
- SSH into the Raspberry Pi using:
```sh
ssh pi@192.168.7.2
```
(Default password: `raspberry`)
## Troubleshooting
- Ensure your computer recognizes the Raspberry Pi as a network device.
- Try restarting both the Raspberry Pi and your computer.
- Use `ifconfig` or `ip a` to check the USB interface status.
## References
- Raspberry Pi USB Gadget Mode Documentation
- Official Raspberry Pi OS Setup Guide
Enjoy your headless Raspberry Pi setup!