Hacker News new | past | comments | ask | show | jobs | submit login
Raspberry Pi Zero Headless Setup (davidmaitland.me)
164 points by davidmaitland on Dec 2, 2015 | hide | past | favorite | 43 comments



One of the very useful things to own when dealing with embedded computers is a low-voltage/CMOS usb-to-serial cable, such as this one: https://www.adafruit.com/products/954

There are modules that have variable I/O voltage, very handy when dealing with devices that have 1,8V, 2.5V, 3.3V or 5V logic: https://www.sparkfun.com/products/12731

Equipped with such a cable, you can also observe any errors that might occur on bootup, such as when you have made a mistake in configuring your config files on the filesystem.

For normal "Rasperry Pi"-Level work, the cheapest eBay-cable will probably be ok. If you have more exotic devices you'll appreciate UARTs that can produce almost arbitrary baudrates, or might support inverted Tx/Rx pins. I found some chinese knockoffs using a "CH310" UART/i2c/spi chip to be particularly broken.

(EDIT: Added last paragraph, fixed a few typos)


I noticed that the SparkFun product has export restrictions, which seemed funny.

I dug up this text on their site: https://www.sparkfun.com/support#IntExportRestrictions, which says:

[...] These are products designed for civilian use, but that could be used for devious purposes in the wrong hands. [...]

So, I guess that tells me there are weapons or other "dangerous" machines that have UARTs. Who would have thought that, huh? :| Really dubious restriction, but I guess they don't have a choice.


You get that for an awful lot of chips or software which are thought to have "dual use" to aid inadequately defined nefarious things.

On most orders for electronics parts, even if it's European distributors shipping to me, in Europe, I'll have to click some boilerplate where I assert to not make the chips available to terrorists on the Denied Persons List of the US department of commerce, which is conveniently available in ASCII...

https://www.bis.doc.gov/dpl/dpl.txt


The same applies when buying microcontroller starter kits, like the MSP430 for school.

That, and clauses about not using it to controller missiles. Which is admittedly more applicable than the weapons of mass destruction (exaggerated) clause in iTunes.


Ah the beauracracy.


Do belive the export restriction on encryption is still on the books, just sleeping.


One of my hard drives "bricked" itself, and I was able to use such a cable to unbrick it.

This SuperUser post talks about it: http://superuser.com/questions/365999/how-do-i-recover-data-...

http://howto.starahead.com/?p=61

http://www.overclock.net/t/457286/seagate-bricked-firmware-d...

https://sites.google.com/site/seagatefix/Home

I had backups, but still, it was nice to be able to do this.


When I worked in PC repair I used to see one of these every couple of months or so. It feels great to be able to being them back with no loss of data for the customer. I still have the hacked together PL2302 bridge somewhere in my toolbox.


Having had a proper play with a Raspberry Pi (Zero) for the first time this week I've been very surprised that setting up wifi is so much harder than it ought to be, especial when taking it out and about.

Is there any reason why Pi plus Raspbian can't/won't/doesn't have a Chromecast style setup built in, i.e. boots up, finds wifi adapter but no known network, hosts own network allowing connection from smartphone app to configure wifi settings for new network?


That would be a pretty useful utility to build actually. I can't think of any reason why it wouldn't work unless these wifi adapters don't have the ability to broadcast their own network. Would be fun to give it a try!


I really like this idea actually. May see if I can cobble together a little program to do this.


Found a guide to do this [0] but without a web interface for configuration, or figuring out if there is a wifi device. Would be easy to setup a script to run on boot to check to see if a wireless network interface is attached, then set up the ad-hoc network accordingly and serve a simple config page. Finally something to do with my pi(s)!

[0]http://spin.atomicobject.com/2013/04/22/raspberry-pi-wireles...


Pro-Tip: Raspbian comes with loads of bloatware. If you really need a headless server go ahead and install Ubuntu Server 14.04... IMO much better than Snappy Ubuntu Core

https://wiki.ubuntu.com/ARM/RaspberryPi


Ubuntu Snappy Core does not work on Raspberry Pi Zero, or for that matter on any ARMv6, such as most RPi models: 0,A,A+,B and B+. All of above are based on BCM2835/BCM2708 SoC.

UbuntuSC requires ARMv7 ISA CPU, which among Raspberry Pi models is only featured on the BCM2836/BCM2709 SoC in "Rasbperry Pi 2 Model B" (note the "2").


Also available:

DietPi http://dietpi.net/

Minibian https://minibianpi.wordpress.com/

Both Raspbian-based

And, in just 80MB, Slitaz-ARM http://arm.slitaz.org/

Though I don't know if the latter has SSH enabled by default.



This distro was just added a couple weeks ago, and is the same as Raspbian, but without all the GUI bits, apps like Minecraft and Wolfram, and it boots to the console without automatic login.

I used to use 'Diet Raspbian,' which took plain Raspbian and stripped it down, but this is a much nicer alternative, since it's an official build!


Or ArchLinux ARM: http://archlinuxarm.org/




What do you consider "bloatware" - all the graphical X server and applications?


Precisely... for many use cases you don't need them. It's better if you start with a server distro.


I tried Snappy and won't use it again. to enable wifi involves manually installing dpkgs, rather than using the snappy package system. that's a regression from ubuntu.


Good tip. Also, there are options that can be built from source (e.g., BSD) so that all that cruft is not installed by default. IME, 8 GB SD cards are not needed; 1 GB and smaller can suffice.


Ubuntu only works on Raspberry Pi 2.


Another way (which I usually use) is to plug in a USB ethernet adapter (or on Pis with LAN, just plug in onboard), then when the Pi is booted, use something like Fing[1] to ID the new IP address on the network. SSH into it (it's enabled by default) with `ssh pi@[ip]` and away you go!

Look also at the official Raspberry Pi documentation[2], which is more succinctly summed up on SO[3].

For WiFi, you can configure the microSD card in another Pi (I usually mint cards on my Mac, then configure a master copy in a Pi 2, then drop it into other Pis headless) so it has the SSID/PSK in the wpa config file.

[1] http://www.overlooksoft.com/fing [2] https://www.raspberrypi.org/documentation/troubleshooting/ha... [3] http://raspberrypi.stackexchange.com/a/13937/6506


Thanks for posting this, I was second guessing that a simple nmap/fing and SSH would do the trick. From there you can set up a VNC and be able to tackle most tasks. Thats what I did on my Pi 2, not sure why it would be different on a zero.


It's no different at at. Although VNC is a bit overkill for most tasks.


I've always just used this http://www.adafruit.com/products/954 and connect to the pi via serial. Although with the 0 it would require soldering on 2-4 pins.


I've got an older raspberry pi, like maybe from 2013, that I never got around to using because I haven't got a monitor handy that'll work with it. Will this work on that model?


It sure will. It's a bit easier though as you can just use the ethernet port as that's already configured to use DHCP. So you can skip the step that envolves changing the files on the SD card.


Cool, thanks.


I wouldn't do this without having a USB serial cable as a fallback. It's too easy for the pi to not come up and then you have basically zero options to debug remotely.


Umm, but you can always remount the SD card on your computer or even reinstall the image. There is essentially no way to brick your device by doing this.


How does that help debugging why your device didn't come up on the network? There are a number of reasons the device won't come up; often those are not easily deduced from a log file but can be easily debugged with a serial connection. Also that doesn't require you to mount the SD or reinstall the image.


A serial adapter is great if you have one. But for the average person who may have picked up their first Pi free with a magazine is highly unlikely to have one. For most people changing two files is a pretty quick, safe and easy way to get wireless networking going with minimal extra hardware. Although you could easily remount the SD card and view the log files if you needed.


If you don't have a computer that can read and write the filesystem on the image, it gets a little more complicated. In that case, you might be able to make these changes using a hex editor directly on the Raspbian images.


Vastly simpler to run Linux in Virtualbox and pass the USB controller for the SD card through.


Yeah it's a pain. Although easy on Linux, shouldn't be too hard on a Mac (Fuse drivers are available). Although if I didn't have one of them I would just use another a Pi 2 with Ethernet.


Not a chance.


I've done it myself on a FreeBSD RPi image. I don't see why it wouldn't work on linux.


What is the "it" that you did?

Changing a string like 'foo=yes' to 'foo=no ' would be easy enough - as long as the filesystem does not checksum data.

Adding multiple lines to multiple files is not going to work very well.


I've modified configuration files on a FreeBSD filesystem image with a hex editor to cause it to obtain a dhcp lease and allow password ssh login for the default account. (Linux cannot read/write to the default FreeBSD filesystem.)

This allowed me to set up the RPi headless and keyboardless.

Of course the filesystem was dirty, but it's nothing an fsck couldn't solve.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: