Recently, the Raspberry Pi Foundation introduced a new tool, the Raspberry Pi Imager. This page documents how to use it to achieve the exact same setup as could be obtained before, using the procedure on my first Vanilla Headless Setup page. You don’t need to read it, the prose is pretty much the same except for the technical details. I kinda worn-out the copy and paste shortcut keys.
This setup is the basis for getting a Raspberry Pi to boot and then being able to use it remotely through your local network. The point is to do this without ever plugging a keyboard, mouse and monitor directly to the Pi. That’s what headless means.
Just follow the steps, don’t ask questions, I know what I’m doing.
1. Buy a microSD Card
This step isn’t as trivial as it seems, but it is critical. There are countless types of SD card with different speed standards and for the most part those standards offer no indication of the actual performance of a card.
Disclaimer : I’m not getting paid to recommend any product. Remember, this is my personal website and I’m merely nice enough to let you read it and learn from my experience. In the end, you do you.
After some experimentation, I have found that the SD card which offers the best compromise between speed, reliability and price is the SanDisk High Endurance microSDHC card, which looks like this before you ravage its package :
Price is usually well under 15 â‚¬, but it varies based on Jeff Bezos’ hair length. The 32 GB is the smallest one in the family, which goes all the way up to 256 GB. I have yet to come up with a project that requires anything bigger than 32 GB, but given enough time I probably will.
It’s designed for continuous operation in CCTV applications, so it should survive well in a Raspberry Pi. None has died on me yet. As for the speeds printed on the packaging, the real-life numbers I’ve observed are actually quite good : 55 MB/s write speed and 66 MB/s read speed. More than enough. Sure, there are faster cards out there, but they’ll be very expensive and well past the point of diminishing returns.
It is a fact, no SD Card is designed to operate as the system drive of a computer. SD cards are designed for recording photos and videos in digital cameras. Using one like it’s a hard drive or an SSD is actually a form of abuse. Keep that in mind, especially if you’re going to run programs that write a lot of data to disk.
Because Raspberry Pi’s are very cheap, it’s tempting to use a cheap SD card as well. Resist that temptation. It’s OK for your SD card to be more expensive than the Raspberry Pi it’s slotted into. It’s not OK to slow down your entire project and/or have it die within a few weeks just to save a dozen Euros.
2. Get the Raspberry Pi Imager
This is a recent addition to the Raspberry Pi software ecosystem : an interactive tool that lets you configure your SD Card and flash it in one fell swoop. I really works as advertised; which is nice for a change. Unfortunately, it’s yet another piece of software you need to install on your computer. At least until they release a portable version.
You may not want to install this program on your PC. You may not even have a choice, if it’s a business PC and your IT department has made it impossible. In that case, you can still use the legacy method of setting up a Raspberry Pi : it is detailed in the previous version of this page, accessible by clicking here. It’s not as comfortable, but it’s not particularly complicated.
If you’d rather install the new Imager, you can download it from https://www.raspberrypi.com/software/. It installs like any other program. Then you can launch it :
The user interface is minimalist, I don’t suppose you need help with that.
“Choose OS” lets you pick the operating system you want to install, and that’s where you’ll find the familiar choice between versions of Raspbian with or without a desktop GUI. You also get additional options for erasing your card and selecting image files that are not presented in the menu. Looks like they thought of everything.
An interesting detail : this installer caches the OS images it downloads. You will not need to download gigabytes each time you need to flash a card.
3. Select the SD Card
The “Write” button won’t become available until you’ve chosen something to write to. Only SD Cards appear to be detected; there doesn’t seem to be a risk that you’ll overwrite one of your hard drives by mistake.
Once you do select your card, another button will appear in the bottom right corner :
It opens a settings dialog box that is of particular interest to us. It’s where we’ll configure the Pi’s OS before it even runs for the first time. And that’s how we’ll be able to set it up the way we want to without plugging a physical console to the Pi.
Click that little gear wheel button. Do it now !
4. Set All the Settings !
The Imager allows you to save your settings as default, or create a one-off configuration. That’s why the settings dialog starts with this option :
That one’s for you to decide. I do almost only embedded builds, so I’m chosing “to always use”.
This is the name your Pi will call itself on the network. Among other things, it’s what you’ll enter instead of an IP address when you connect to it. The traditional default, “raspberrypi”, is too long to my taste. I suggest changing it to something that matches your project.
This setting is particularly important if you plan on running multiple Pi’s on the same network at the same time. You need a way to tell them apart.
4.2. Remote Access Options
Enabling SSH is pretty much mandatory : if you’re not going to plug in a keyboard and monitor, your options for using the Pi are going to be severely limited. Basically, that would leave you with just the UART.
4.3. Username and Password
Since you need this information to log into your Pi remotely, any headless setup recipe involves setting your user account ahead of time. Do it.
I’m not your mom. You know what your application is and what risks it may be exposed to. Choose something easy to type if you’re working locally; choose something hard to guess if your Pi’s mission is to be forever accessible through the digital cesspool known as the Internet.
4.4. Wireless Settings
This may or may not matter to you, especially if your Pi has no WiFi. On the contrary, if your primary means of connecting to the Pi is wirelessly, then you must set your WiFi network credentials now. The Pi will need to automatically connect to your network before you can log into it, creating an egg-and-chicken dilemma for setting up WiFi locally.
It’s very important to set your Wireless LAN country correctly ! Some might be thinking this is yet another plot by the Illuminati to track your every move by forcing you to disclose your location… but it’s not. Simply, different countries have different laws regarding the frequency ranges that can be used for WiFi. Setting the wrong country could mean your Pi emitting on reserved bands and landing you into legal trouble.
Just to hammer the point home : this isn’t about your nationality, it’s about where your WiFi interface is transmitting from. It also means that you may need to change that setting a posteriori if you’re travelling abroad with your Pi.
4.5. Locale Settings
Locale is different from the WiFi’s country setting. It’s more about keyboard layout. If you’re not going to be using a keyboard, or your application doesn’t depend on locale, you can safely ignore these settings.
5. Write the Card
Using the card I recommend, this takes just a couple of minutes, provided your card reader is fast enough. If you need to buy one, make sure it’s at least USB 3.0.
At the end of the write, you may see this dialog box from your computer’s OS :
Microsoft being Microsoft, it obviously considers that any drive which doesn’t contain a Microsoft filesystem needs to contain a Microsoft filesystem or it couldn’t possibly work on a Microsoft machine. Just hit “Cancel” and eject the freshly-baked SD Card.
6. First Boot
Slot the card into your Raspberry Pi.
Because we’re operating headless, you only need to connect a network cable to the Pi, going to your Ethernet switch. If you’re adept at configuring your PC’s network settings you may even connect your Pi’s Ethernet directly to that of your PC.
If you’d rather use WiFi, then you obviously don’t need a network cable.
Finally, apply power to your Pi. For most people, that means plugging a USB charger into the Pi’s power input socket.
Deprived of a display, you won’t be able to know if or when your Pi has booted. Sure, there are some LED’s on the Pi but that’s not exactly helpful since none of those is a dedicated “I’m ready” LED. But there are tell-tale signs :
If you’ve configured WiFi, the Pi will attempt to connect to your network as soon as it’s ready. When the Pi appears in the list of devices connected to your access point, it’s done booting.
If you’re using Ethernet, the Pi will request an IP address from your LAN using DHCP. Keep an eye on your LAN’s list of DHCP clients : as soon as the Pi appears, it’s done booting. Remember, the Pi’s default network hostname is raspberrypi but you may have changed it when you setup your SD Card with the Imager. Note down its assigned IP address, it might come in handy.
If the Pi never shows up, review all previous steps. Maybe you typed something wrong. Maybe your SD Card died immediately for some reason. Maybe your Pi itself is dead.
7. First Login
Once you see the Pi on your network, SSH into it. On a Windows PC you can use the Command Prompt application or use any alternative you prefer. I’m partial to MobaXterm, myself.
Use the following command (replace pi and raspberrypi with the username and hostname you setup earlier) :
If you’ve already been connecting to Pi’s with this method, it’s possible Windows will not be able to resolve the name “raspberrypi” because it’ll be associated with a different board. Just replace “raspberrypi” with the Pi’s IP address.
Whichever method you use, here’s what it’ll look like :
Unless you changed it in the Imager, the default password is raspberry. Once you enter it, you get this :
Congratulations : you are now in command of your Raspberry Pi.
Notice the security warning. It only appears if you’re using the default username and password. Those can be changed in the raspi-config tool we’re going to look at right now. You should change them right away. Default SSH accounts are the number one cause of hacking according to nine doctors out of ten.
8. Launch Raspi-Config
The very first command you should type at this point is :
This will launch the Raspbian configuration tool, in terminal mode :
You exact menus may vary depending on the Pi and OS version you’re using, but I’m sure you’ll find your way.
Do change the password for the default “pi” user. The change will be effective immediately, you don’t need to reboot. Which is nice, because there are other things we need to setup in “raspi-config”.
9. Expand the File System
Raspbian images assume your SD card has a capacity of 8 GB. If yours is larger than that, you need to expand the file system to use your whole SD card. Let’s not leave money on the table.
Under Advanced Options select Expand Filesystem, then reboot the Pi.
10. Miscellaneous Settings
The “raspi-config” tool has various entries that may be worth your time. In fact you may end-up using it on a regular basis.
Network Options lets you change the network name of your Raspberry Pi. This is very useful if you have more than one Pi on the same network. It’s also a way to name your system according to your application. Remember : that name is stored on the SD card. If you’re using several SD cards for different projects you can give each of them their own name.
Boot Options lets you decide whether the Pi boots straight to desktop, or to the command line. Booting to the command line means you’re not running a GUI. This saves resources and may be perfect for an embedded application. But you won’t be able to use VNC to connect to the Pi’s desktop remotely :
Well duh !
The “auto-login” options are nice if you love living dangerously for the sake of saving a few keystrokes here and there.
Interfacing Options is my favorite entry. Note that by default, the camera interface, SPI, I2C, 1-Wire and remote GPIO access are all disabled. Later on, you may need to come back here to enable any interface your project requires. The UART on the GPIO connector, however, is enabled by default and can also be used to login. This is a headless option for people who also don’t have (or don’t want) a local network.
11. Starting VNC Server on Boot
SSH will only get you a command line. If you have need of a GUI, and have selected a Raspbian “with desktop”, you can use VNC to gain remote access to the Pi’s desktop.
The VNC protocol is open, you can install any client that you like on your PC.
Raspbian (with desktop) includes a VNC server, but it is not enabled by default, for the same reason that SSH isn’t enabled by default.
Under “raspi-config”, go into Interfacing Options. It’s all self-explanatory. Notice our good friend SSH is there. Choose the VNC entry and enable it.
You can now fire up your VNC client and connect to the Pi. You will see something like this :
You’re in !
And you’re done ! This concludes the Vanilla Headless Setup.