Setup a bootable Raspberry SD on Linux

In this post I show you, how to setup a bootable raspberry SD containing an operating system to boot from. The instructions are given using a linux based system, since it’s much faster and easier to perform than on windows based systems. On windows, in the last step you will need to download installers which install the ISO-image on your SD card. Such installers are usually provided in shady sources one cannot trust and has to expect installing backdoors, botnets, viruses or the like, when running the binary. For this reason I recommend not process these steps using windows. You can find a good description of the procedure provided here on this stackoverflow post.

To setup a bootable SD-card on linux, you have to follow the following steps:

  1. Get the Operating System of your choice
  2. Check the image
  3. Install the image onto your SD card (using Linux)

Get an Operating System of your choice

There are several operating systems you can choose to boot your raspi from. Which one you coose depends on your needs and preferences. Check the following link to find the image of your choice:

https://www.raspberrypi.org/downloads/

If you’re about to setting up a faster and more powerful raspberry model, you might want to install an os providing a desktop and graphical UI support, otherwise a shell-based os would probably do the job.

There is also a cool image called ichigojam which provides a bootable BASIC interpreter that can directly be used to learn programming providing a kind of a C64-like basic prompt.

Validate your Image

After having downloaded the image of choice, unzip or unxz the archive if necessary, make sure to validate the checksum of the iso-file indicated on the download page using sha256sum or md5 command. If correct, proceed, otherwise, try to find another image with reproducible checksum.

Install ISO-image onto your SD

Now insert the SD you want to setup into your SD-card reader. Then use the following command to identify the device, your card is located:

sudo fdisk -l' to locate sd-card device

This command provides a list of existing devices in your system. There are two informations required:

  • the drive letter of your SD-card reader
  • the number of partitions available on your SD-card

In most cases you can identify the drive-letter of your SD-card reader based on the capacity indicated, since you know the capacity of your card and it’s mostly much smaller than the one of your harddrive. If you are not absolutely sure, which device is related to your SD-card reader, repeat the command once with your SD card removed and once with the card inserted and compare the device listings ATTENTION: It is essential not to use the wrong drive-letter and destroy your system partition or other device!.

The number of partitions are visible in the device listings. If your SD-card contains multiple partitions several lines will be provided containing the same drive-letter, followed by a differing number (i.e. sdb1, sdb2, where drive-letter were ‘b’ and partition numbers are 1 and 2).

Say, the drive letter of our SD-card reader is x (usually it’s one of ‘a’, ‘b’, ‘c’, …). Then issue the following command(s) to unmount possibly mounted partitions:

 sudo umount /dev/sdx*

Replace * by the number of the partition you want to unmount (in our example we would issue the command for sd1 and sd2).

Now you have all information you need to install the ISO-image onto your SD-card in the reader. Issue the following command (replace x by the drive-letter you have determined following the procedure above):

sudo dd bs=1M if=your_image_file_name.iso of=/dev/sdx'

This will take a while, but after some seconds or minutes, your SD card will be ready to boot your raspberry pi.