🛠 Installation headless : la Zero en carte réseau USB (g_ether)
Goal
Set up the Zero with no monitor, no keyboard and no network cable, using its OTG gadget mode: plugged into a laptop's USB port it enumerates as a network adapter (g_ether) plus keyboard, and you SSH in. This is the natural Zero setup — the board has no WiFi, no Bluetooth and no Ethernet at all.
Parts
- Zero + microSD with Raspberry Pi OS Lite written on it
- A real micro-USB data cable (many cheap ones are charge-only)
- A second 5 V / 1.2 A supply on the power port — the data port does not power the board
Steps
On the laptop, mount the card's FAT boot partition and add two lines:
sudo mount /dev/sdX1 /mnt
echo "dtoverlay=dwc2" | sudo tee -a /mnt/config.txt
sudo sed -i 's/rootwait/rootwait modules-load=dwc2,g_ether/' /mnt/cmdline.txt
sudo umount /mnt
Boot the Zero, then plug its DATA micro-USB port into the laptop — it appears as usb0 / a RNDIS network adapter:
ssh pi@raspberrypi.local
sudo apt update && sudo apt full-upgrade -y
Check
The laptop shows a new USB network interface, ping raspberrypi.local answers and SSH drops you into a shell on the Zero.
Pitfalls
- cmdline.txt must stay a SINGLE line — a newline in that file breaks the boot.
- Forgetting the power cable: gadget mode over the data port does not feed the board.
- Windows may need a USB Ethernet (RNDIS) driver; Linux and macOS usually just work.
- Editing the ext4 root partition instead of the small FAT boot partition where config.txt and cmdline.txt live.
Other tutorials for this board
- Premier démarrage de la Zero avec écran (mini-HDMI)
- Alimentation et consommation : le point faible de la Zero
- GPIO en Python : LED et bouton avec gpiozero
- Console série sur USB : la Zero en port série (CDC-ACM)
- Camera CSI sur Zero v1.3 : le nappe 22 broches
- Sauver une Zero qui ne boot plus : le flux legacy sans EEPROM
Code examples for this board
clignotante.pyPythonbouton-gpio.pyPythoncapteur-i2c.shBashsurveillance-temperature.shBashcapteur-dht11.pyPythonservo-pwm-sysfs.shBash