Bootstraping a Pi Zero
This quick blurb recounts my initial experience “bootstrapping” a Raspberry Pi with the Rasbian distro to connect automatically to a wireless home network. I was aiming to replicate my source:
What does any of that mean?
The Pi Zero is a relatively popular computer-on-a-chip that is relatively powerful for its size and has relatively decent versatility. It can work as a computer hooked up to a monitor (with some additional effort) and it also has a good number of GPIO pins which are intended to be connected directly into electronics so that you can put “brains” into projects using relatively standard software.
Although bootstrapping means a lot of different things, the meaning here is that you get the drive (a micro SD card) ready to run without directly using anything on the computer itself.
Failed Approaches
Sitting at a MacBook, the most obvious approach to use the mac to alter the contents of the SD card to get it into the desired state
Approach 1 — Install Mac Software for ext4
Attempting this was lead to some fantastically bleeding edge software. The instructions I followed are generally good, but do leave out some nuances if you try to actually follow along. There are 2 pieces of software you need, first is MacFUSE, and the next is Fuse-ext2. My only real complaint for those instructions is giving misleading links to actually get these, for which you would be better just copying those names into Google.
There are abundant cautions about how the Fuse-ext2 (in order to give write access) might cause kernel panics (not just corrupting the destination drive, but your host Mac computer). In my case, however, the dead-end was merely this screen in the process of installing Fuse-ext2.

This was exciting to me for a number of reasons. In a household that has the full range of operating systems, filesystem incompatibility are a fairly common headache. Maybe I’ll try again sometime.
Approach 2 — Use Linux in Virtualbox
When I first tried to do this, I looked at some suspiciously short instructions. If you don’t use VirtualBox all the time on your own in various configurations, this will probably not get you there, and I definitely did not get past step 2. Next up, I did find some painfully manual instructions for mounting the drive itself. With this task, I think the distinction lies in whether or not the Mac itself has access to a filesystem, and the latter instructions do not make any such assumptions, and more-or-less patches it directly to the hardware drive.
This is an approach that I genuinely believe could work. I had the .vdmk file, and I think Ubuntu might have been seeing it, but might not have.
What Did Work
But after getting so-far into the weeds in virtual Ubuntu, I gave up and decided I would just use another Raspberry Pi to do this. That worked just fine according to the instructions. The only minor note I made was that “sudo fdisk -l” worked much better to find the drive (still looking for something like /dev/sdb1). Then…
- mounting the drive
- editing the files according to the instructions
- used DHCP
- plugged in the USB OTG cord into the “USB” micro USB slot of the pi zero
- plugging in a wireless adapter into the USB OTG cable
- plugging in the power adapter
- On to the router config!
Routers used to give me much more trouble, but now a modern and decently high-end option will give you a ton of options (and if not, DD-WRT is there). Particularly, I like how it’s easy to point-and-click reserve an IP address on the private network now-a-days. After that, you can even hypothetically port forward (recognizing the security issues that come with it) to accept messages from the broader internet, which can be very exciting. The ISP will not automatically give you a permanent IP address either, but that can be easy to work around, depending on what you’re doing.
But let’s pause and recount this a little bit. We’re talking about a system where 1) you flash a drive and load info 2) you start your device and 3) you set up networking. The unspoken step (4) here is that you use an automation software (*cough*, Ansible) to then get Linux on the Pi in the state you want it. The rest is software and the application, well… and whatever extra hardware your still involves.
N>=2 units
Bootstrapping in this way isn’t exactly necessary, and certainly not every time. After the first one works (and ideally after you’ve changed the default password), you can save the image with ApplePi-baker if you’re on Mac (some other utility if you’re on something else). After that, you can copy that image to however many SDcards you have Pi Zeros for. No, this doesn’t set unique credentials or a hostname for, but that’s arguably not necessary. My router will even helpfully put a (2) at the end of its name when you plug the 2nd one in.
Additionally, you don’t need to confine yourself to the Pi models. You can take whatever projects you had on the Raspberry Pi 2 and move the SDcard to the Pi Zero, no apparent problems.
The Big Picture
I have an image in my mind. It’s an abstract vision of a business, any business. I’m not sure what kind. Maybe it’s a coffee shop. But the point is that the place has tiny computer controllers all over the place. Each is a “Phoenix Server” that does something really cool, and can die and be revived at almost negligible cost. A web-based server contains all the real information and interaction needed for the employees to run the system. If something goes wrong, the cloud server tries to send commands to fix it, but if not, there is a literal jar of micro SD cards that someone has to grab and replace the card in the computer with.
Importantly here, this is working on a typical wireless network. The material costs for what I’ve described involve things like chargers, wireless adapters, and a $5 computer. The system can do basically anything, because the computers are fully networked and have pretty lower power consumption demands.
The Chip
I believe that some of the main shortcomings of the scheme I described are
- that wireless is not built-in to the Pi Zero, necessitating a fairly specialized type of cable and an adapter
- that the GPIO are still only digital
I’m pretty excited about a new product, The Chip, which has a solution to these two gripes of mine.
At this point, I’m talking about an arbitrary network of computers (for some application, I still don’t know what) that can easily make readings of signals from, say, sensors that give some information about the environment around it, and use PWM pins to exert some control of something around it (of course you need a relay board for big things, but these can also be bought for the $10 price range).
But What Application?
Why does a coffee shop have a need to be networked? I guess the obvious shameless self-plug here would be ShareLockers, but I’m attempting to speak in more arbitrary terms. I have a hatred of polling. Whenever you have to poll a server to get feedback, you have a bad design. It’s just outright painful to work on, and if someone is sniffing for suspicious traffic, that is exactly what you are. For something to be cool, it needs to connect easily and connect well to both the real world and the internet. I feel like the system for deployment is looking more and more exciting, and the barriers to moving in on Internet of Things ideas are crumbling.
by the author.