My Raspi OS Image

I don't intend to use the Raspberry Pi as a desktop computer, so I've always used a lite version of RaspiOS. In the past the only official OS that was available did have a desktop environment in it. I used to remove that from the image in order to shrink the image so it could fit on 2GB sized SD cards. Every time a new official version came out I posted it here on this page. However that became a bit of a tedious job, and you can download an original lite version for many years now. Therefore I've decided to stop creating my own nox versions from now on.

How To Write An Image To SD Card Using A Linux Computer

Once you have download an image file, any image file, you can write it on an SD card of at least the size of the image. First you'll need to find out what device name your SD card will have on your computer.
Before inserting the SD card into your computer's card reader type the next command in the terminal:

df -h

Then insert the SD card into the card reader and repeat the command. The first field of the line which wasn't there the first time contains the device name of your SD card. It usually is the last line of the list and it usually looks like /dev/sdc1 (the c can be any other letter). I'll use this device name throughout the rest of this page. You will have to replace it with your particular device name of course. Be careful, using the wrong device name will probably over write some other partition, destroying all its data!
Now unmount the SD card, but leave it in the card reader. Type the next command:

sudo umount /dev/sdc?

If you want to re-use an SD card which you have previously used in your Raspberry Pi there will be two partitions. Simply unmount both of them before you continue, that's what the question mark does for you automatically.

Use the cd command to change into the directory which holds the downloaded and unpacked image file you want to write to the SD card. Then give the next command to actually write the image to the card:

sudo dd bs=1M if=imagefile of=/dev/sdc

This will take quite a while. Don't be surprised if it takes over 5 minutes to complete. Of course you'll have to replace imagefile with the actual name of the image file. And please note that the device name no longer contains the partition number, it's now called plainly /dev/sdc.

How To Make A Copy Of Your SD Card On A Linux Computer

Now I'll explain the reverse process, reading the card back to your computer. Perhaps you have made some tweaks of your own and want to save them so you can easily copy it all to a new card, or you want to keep a backup of your card in case something goes wrong.

You can't just copy the files from the SD card to create an image. However, creating an image is as simple as reversing the if and of parameters in the previous command. But before you can do that you'll have to insert the SD card into the computer again and then unmount the two partitions which are now present on your SD card. The reason why there are 2 partitions now is because the GPU has its own FAT formatted partition of about 56MB. This GPU is the first to start after booting your Raspberry Pi. Once it's started it will boot the CPU using the second EXT4 formatted partition. Obviously you'll need a copy of both to make a complete image.

sudo umount /dev/sdc?

Then it's only a matter of entering the command below.

sudo dd bs=1M of=newimagefile if=/dev/sdc

Don't forget to give your newimagefile a proper name and to use the correct device, as described above. And B.T.W., since you had to use sudo to read directly from the SD card reader device, the image file is now owned by root. You can easily change that after reading to the user pi (or any other user) with

sudo chown pi:pi newimagefile

I used the user name and group name pi here, but since you're executing this on your Linux desktop computer you have to use your own user name and group name.

User Name, Password And Host Name

Normally this is something you want to do immediately too. But for now I'll keep the default user pi and his password raspberry as it was from the original image. Changing the host name can easily be done with the raspi-config script nowadays.

There is one little thing I like to change in order to increase the security. In Linux you can execute commands as super user by preceding sudo to the command you want to executed. It is customary that you'll have to enter your password before the command is executed. Not so in Raspi OS, there you don't have to enter the password.
Although it is convenient, I don't like it very much. So I've taken the liberty to change that. As of version 2016-11-29 this is done by deleting (or renaming) a file in /etc/sudoers.d . I have chosen to rename the file 010_pi-nopasswd to 010_pi-nopasswd.disabled.

Disable Sleep Mode

I hate it when the screen blanks out, just because I haven't touched a key in the last 15 seconds. It's no use having a screen saver for an LCD monitor anyway. So I really want to disable the screen saver. As we are no longer going to have a GUI, we only have to disable the text mode screen saver.
Execute sudo nano /etc/rc.local and add the following line, just before the line containing exit 0.

setterm -blank 0 -powerdown 0 -powersave off

Install Some Useful Tools

Now that we have plenty of free disk space again we can add some tools which I find usefull. Don't worry, it's all fairly small stuff.

sudo apt-get install screen links lynx silversearcher-ag
sudo apt-get autoclean

Directories

I have added 3 of my favourite directories in the main user's home directory, mkdir bin src tmp. The bin directory will hold my scripts and my own programs. It will automatically be included to the $PATH on the next login.
I use the src directory for writing my software in. And the tmp directory is used for temporary junk.

Update Since April 2022

As of this version the default user pi and the associated default password raspberry has been removed from the image. Technically I would welcome such a security improvement. However, many scripts out on the internet rely on the existence of this user. Therefore I have decided to create the default user pi, with the password raspberry on my image again, so it works as if nothing has changed.
This does not mean that you should keep the default password forever. It is good practice to immediately change it to something strong and unknown to the rest of the world, especially if you intend to connect your pi to the internet.
I find the decision to remove the default user a bit strange. So far the raspberry pi user didn't even have to enter the password for any sudo commands. That has been a very insecure decision, which I have always fixed on my images.

Thus, on my images the default user pi is back, and his password is the good old raspberry, known to the entire world. And if you want to execute sudo commands, you do have to enter the password.

By the way, you can restore the default user pi and its password by writing a file called userconf.txt in the boot directory of the SD card before booting from it. This file should hold nothing but the following line.

pi:$6$xns35cXZhtUSqeJI$SAVX2Ad9h8nT6mue2jhQyctM8BPV17RYtp2X0k0NdwLmgL0znKCa8z3F/BY84iG1x4gW6iaO9BzZnY9H04wnE1

What To Do After First Boot

You have downloaded an image and burned it on an SD card, now what?

First of all you'll have to log in to your Raspberry Pi. You can do that using an LCD monitor or TV and a USB keyboard. However if you want to login to your Raspberry Pi while it is not connected to a monitor you'll have to setup an ssh connection. To do that you'll need to know its IP address (I assume you have connected your Raspberry Pi to your network using an ethernet cable). On a Linux machine this is very easy, execute the command sudo nmap -sP 192.168.1.0/24 (assuming your network address is 192.168.1.0 with netmask 255.255.255.0). The output of this command looks something like this:

Starting Nmap 6.00 ( http://nmap.org ) at 2015-01-21 11:16 CET
Nmap scan report for 192.168.1.1
Host is up (0.0011s latency).
MAC Address: 00:14:BF:4E:42:67 (Cisco-Linksys)
Nmap scan report for 192.168.1.10
Host is up (0.00038s latency).
MAC Address: 48:5B:39:5C:75:DC (Asustek Computer)
Nmap scan report for 192.168.1.81
Host is up (0.00058s latency).
MAC Address: B8:27:EB:90:C2:C4 (Raspberry Pi Foundation)

I'll leave you to guess which one is the Raspberry Pi in my network. BTW, this command has to be executed as root (hence the sudo in front of it), otherwise you won't see the lines containing the MAC address. And you may have to install nmap, because it rarely is installed out of the box.

Once you know the Raspberry Pi's IP address you can connect to it with the command ssh [email protected]. You'll have to replace the IP address with your Raspberry Pi's IP address of course.

As soon as you are logged in for the very first time you can run sudo raspi-config to set your home country. This is necessarry for the WiFi settings. You don't have to restart the Raspberry Pi just yet. Then execute the following commands to update the system to the latest release:

sudo apt-get update
sudo apt-get -y upgrade
sudo apt-get clean

After that you certainly should change the password, especially when you intend to connect your Raspberry Pi to the internet. Changing the user name and host name are optional extras. Furthermore you would want to change your locales settings, like character set, keyboard and time zone.
Most of these settings can be done using the program sudo raspi-config. The only thing you can't change with that is the default user name. I've written a special chapter on how that can be done.

Once you've done all that you'll have a working Raspi OS system without a Graphical User Interface but with a reasonable amount of free disk space, even on a 4GB SD card.

Other Real Small Raspi OS Based Images

Do you think my image is still way too heavy for you, then you might consider downloading one of these very minimalistic systems.

LinuxSystems

This version can run off a 512kB SD card if you like. I wouldn't recommend it though as these small sized cards are rather old and therefore rather slow. But if speed doesn't matter much to you it is perfectly possible.

You can read about it and download it from this web site.

Raspbian Un-Attended Net Install

Here's a nice little project on Github, which gives you a system which can just boot and install everything you want afterwards. Raspbian-ua-netinst

Diet Pi

Do you think Raspbian ate too many Pies? Then you can send it on a diet.

Minibian - Raspberry Pi

Another minimal Raspbian image for the Raspberry Pi.