Finally, a goddamn tutorial that doesn’t waste hours of your life because some dipshit decided to write it for Ubuntu from 2018.
The Problem (aka Why Every Other Tutorial is Trash)
Every single fucking tutorial online for connecting a Pi Zero to Ubuntu via USB is either:
- Written for Ubuntu 16/18 (ancient shit that doesn’t apply anymore)
- Overcomplicated with manual IP configs that straight up don’t work
- Missing crucial details about how Ubuntu 24 actually handles this because the author probably never even tested it
- Written by people who think you need to manually edit
/etc/network/interfaces
like it’s still 2015
After testing this extensively and getting pissed off at bad tutorials, here’s how to ACTUALLY do it in 2025 without losing your sanity.
What You Need (Don’t Overthink This Shit)
- Raspberry Pi Zero 1 WH (or any Pi Zero model, they’re all basically the same for this)
- MicroSD card (obviously)
- Ubuntu 24.04 host machine (not 22.04, not 20.04, not some random distro – 24.04)
- Micro USB cable that actually carries data (not some garbage charging-only cable)
- 5 minutes of your time and basic reading comprehension
Step 1: Flash Raspbian Bullseye
Fire up the official Raspberry Pi Imager and flash Bullseye (regular or Lite, whatever you prefer) to your SD card. Don’t use some sketchy third-party imager.
Optional but recommended if you’re not a masochist: Configure SSH, username, and hostname in the imager’s advanced settings. This saves you from having to fiddle with files later, but you absolutely don’t have to do this – the old-school manual way still works perfectly fine.
Step 2: Enable USB OTG Ethernet and SSH (The Part Where You Actually Edit Files)
BEFORE YOU EJECT THE SD CARD (seriously, don’t fuck this up), you need to edit some files on the boot partition. After flashing, the SD card should auto-mount at /media/youruser/bootfs/
or similar:
Enable SSH (only if you didn’t do it in the imager) – Create an empty file called ssh
(no extension, no .txt
, just ssh
) in the boot partition:
touch /media/youruser/bootfs/ssh
Or just right-click in the folder and create a new file. Whatever works for you.
Edit /media/youruser/bootfs/config.txt
– Open this file and add this line at the very end (don’t put it in the middle somewhere random):
dtoverlay=dwc2
Edit /media/youruser/bootfs/cmdline.txt
– This is the tricky part that every tutorial fucks up. After rootwait
, add exactly one space and then:
modules-load=dwc2,g_ether
The whole line should look something like this mess:
console=serial0,115200 console=tty1 root=PARTUUID=be52ef00-02 rootfstype=ext4 fsck.repair=yes rootwait modules-load=dwc2,g_ether quiet init=/usr/lib/raspberrypi-sys-mods/firstboot systemd.run=/boot/firstrun.sh systemd.run_success_action=reboot systemd.unit=kernel-command-line.target
CRITICAL: Don’t fuck up the formatting. cmdline.txt is extremely picky about spaces and line breaks. If you add extra line breaks or mess up the spacing, your Pi won’t boot and you’ll be back to square one.
Step 3: Boot This Bad Boy and Connect It
- Shove the SD card into your Pi Zero
- Connect the DATA USB port (the inner one, closest to the HDMI port – NOT the power port, don’t be that person) to your Ubuntu machine
- Wait a fucking while – First boot takes 2-3 minutes because it needs to expand the filesystem, generate SSH keys, and do other first-boot bullshit. Don’t be impatient.
Step 4: Watch Network Manager Have a Mental Breakdown
You’ll see Network Manager in your system tray start spinning its little loader graphic desperately trying to connect to this new mysterious network device. This is totally normal – it detected your Pi Zero masquerading as an ethernet gadget and it’s confused as hell.
Here’s what’s happening behind the scenes (check /var/log/syslog
if you’re curious):
kernel: usb 1-4: Product: RNDIS/Ethernet Gadget
kernel: cdc_ether 1-4:1.0 usb0: register 'cdc_ether' at usb-0000:02:00.0-4, CDC Ethernet Device
kernel: cdc_ether 1-4:1.0 enxee08593ce9f4: renamed from usb0
NetworkManager: auto-activating connection 'Wired connection 1'
NetworkManager: dhcp4: activation: beginning transaction (timeout in 45 seconds)
NetworkManager: dhcp4: state changed no lease
Here’s the key part: Go into the GUI and disconnect from this new connection. Tell Network Manager to stop trying to configure it with DHCP because that shit will never work and you’ll sit there waiting forever like an idiot.
Step 5: Find Your Interface Name (The Naming Scheme is Fucking Stupid But We Deal With It)
Run this command and prepare to see some ridiculous interface names:
ifconfig
Look for something completely unreadable like enx8ecc03797e5a
or enxba4bf3d8ed05
– that abomination is your Pi Zero’s USB ethernet interface. Ubuntu’s interface naming scheme is about as intuitive as assembling IKEA furniture blindfolded, but that’s what we’re stuck with.
Step 6: Configure the Connection (The Right Way That Actually Works)
Method A: Command Line (For People Who Aren’t Afraid of Terminals)
Replace enxba4bf3d8ed05
with whatever ridiculous name your system generated:
nmcli connection add con-name pi-zero-usb ifname enxba4bf3d8ed05 type ethernet ipv4.method link-local
Method B: GUI (If You Enjoy Clicking Things Unnecessarily)
- First assign a temporary IP to make the GUI happy:
sudo ip addr add 192.168.4.2/24 broadcast 192.168.4.255 dev enx8ecc03797e5a
- Open Network Manager GUI settings
- Navigate to IPv4 settings
- Set the method to “Link-Local Only”
- Apply and hope it works
But seriously, just use the fucking command. It takes 2 seconds and actually works consistently.
Step 7: SSH Into Your Pi Zero (The Moment of Truth)
Wait about 30 seconds for link-local addressing to kick in and do its magic, then:
ssh [email protected]
Or if you kept the default hostname because you couldn’t be bothered to change it:
ssh [email protected]
If it asks for a password and you didn’t configure one in the imager, the default is raspberry
. Change that shit immediately after you log in.
If it’s not working: Check if your USB cable is actually pushed in all the way. Seriously. Like 90% of “network issues” are just loose cables. Push that fucker in properly and try again.
That’s It, You’re Done
You now have a Pi Zero connected via USB that you can SSH into without any of the manual IP configuration nonsense, obsolete network configs, or troubleshooting hell that other tutorials put you through.
This method works because it leverages Ubuntu 24’s modern NetworkManager instead of fighting against it with ancient workarounds from 2015 that some blogger copy-pasted without testing.
Now stop reading tutorials and go build something cool with your Pi Zero instead of wasting time on connectivity bullshit.