Install Raspbian with Linux

If you’re running any flavor of Linux on your computer, then you have an even easier life when it comes to getting Raspbian on to your Pi

Linux users can get Raspbian set up from the comfort of their operating system, too. Much the same as on Windows and Mac, the first steps are to download the Raspbian image (either from a web browser or using Wget) and unzip it. There are a few different options for writing the image. You can use a graphical tool such as Etcher (see www.etcher.io) or Ubuntu’s Startup Disc Creator. These work very much like the image-writing tools for MacOS and Windows.

As with most tasks on Linux, the usual approach is to use the command line.

Insert the target SD card into the machine. We’ll use the dd tool, which is part of all standard Linux installations, to transfer the image. You definitely don’t want to accidentally wipe your hard drive this way (and it’s possible to do just that if you get this wrong), so first use the lsblk command to see which device node it is attached to.

Install Raspbian with Linux

You should be able to identify the SD card by its capacity. It could be /dev/sdb or it could be /dev/sdc. Newer PCs that have a native MMC controller will give it a slightly different name, such as /dev/mmcblk0p1. Note that it is the device, not partitions on that device (such as /dev/sdb1 or /dev/mmcblk0p1n2), that we are interested in. Any existing partition information will be lost when we transfer the image to the device. Writing the image to a partition won’t work at all well, so don’t do that.

We’ll refer to the SD card as /dev/sdX (replace the X with the actual drive letter) and assume you’ve unzipped the Raspbian IMG file to the Downloads directory. In a terminal type: $ sudo dd if=~/Downloads/2605-16-raspbian.img of=/dev/sdX bs=1M

This process can take a long time, particularly on older or cheaper SD cards. Sometimes, even when the command completes (when you are able to enter another command), the job is not done. If your SD card or adaptor has an activity light, then you can see if anything’s still being transferred, but if not, try the sync command. If it doesn’t complete right away, data is still in-flight. Once everything is ready, you can remove the SD card, boot your Pi and tweak the raspi-config program as per the Windows and MacOS instructions.

Linux luck

On Linux, there is a slight advantage in that the SD card can be browsed natively. It’s only a slight advantage because things can be sent over the network to side-step filesystem incompatibilities amongst OSes. Still, it can sometimes be handy (for example, if the Pi is shut down) to just be able to grab the SD card, slip it in a slot, and grab photos or edit configuration files.

The Etcher image writing program is probably the slickest way to make SD cards under Linux, and saves you from getting your hands dirty at the command line.

If you’re not (yet) a Linux user, it’s also possible to use the live disc mode of a distribution (Ubuntu, Fedora, openSUSE, Mint, for example) and create the SD card from there. There’s a slight problem downloading the image to the root filesystem, however, because this is all in RAM for live discs (their modus operandi is to not touch your hard drive), and there typically isn’t enough space for several gigabytes of OS image. This can be worked around, though, because the image can be downloaded to a USB stick beforehand and copied from there. On Ubuntu, USB sticks are mounted in a directory inside /run/media/ubuntu, so change the if parameter of the dd command accordingly. Alternatively, you can use the Startup Disk Creator on an Ubuntu live DVD if you don’t feel like typing things.

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.