Raspberry Pi can boot headless!

Raspberry Pi Zero is awesome little board. I totally hate the connectors used there. Everything is mini. It makes sense, but if you don’t already own bunch of cables and connectors, you’re gonna make few trips to store to buy what you need.

Last purchase I had to do was to buy reductions for HDMI-mini to HDMI and USB-C to USB-mini. As these are just minor expenses I neither wanted to spend time to go pick them up, nor pay for delivery that cost more then shipment to have them delivered home.

I was pleasently surprised that you can setup Raspbian to start headless. It enables and connects to WIFI you specify and enables sshd

Configure WIFI

Zero W comes with wify but no ethernet. It’s fairly easy to get it running. All you need is to connect SD Card to your Mac and once it opens boot partition, add there file called wpa_supplicant.conf with below content

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
ap_scan=1
fast_reauth=1
country=YOUR_COUNTRY_NAME

network={
	ssid="WIFI_SSID_NAME"
	psk="PASSWORD"
	id_str="0"
	priority=100
  key_mgmt=WPA-PSK
}

When Raspbian finds this file during boot, it will overwrite /etc/wpa_supplicant/wpa_supplicant.conf with it.

SSHD

And this is even easier. Just create empty ssh file and copy it to boot partition. This will automatically enable SSHD on your board.

Both these files gets deleted on a boot, so its a one time configuration.

Connect

Next all you need is to connect through ssh to your board. You will need to lookup what IP it got assigned. Either on a router or some network tool. Once you have that, just do pi@192.168.5.45 and enter raspberry password. Don’t forget to change it as a first step. Lol.

There you go. More next time.