84 MB Minimal Raspbian ARMHF Image for Raspberry Pi

Many embedded systems applications do not require a desktop environment or graphical interface on the screen (e.g. server), and you may want to only install the files you really need on the SD card either to reserve as much space as possible for data and/or your program or to reduce costs.

After searching for a minimal image based on Raspbian ARMHF distribution for the Raspberry, I could only find Linux Systems minimal image based on the Alpha version of the Raspbian Wheezy. Their compressed image is 109 MB in size, has a custom kernel, sshd and ntpd are enabled, but the wireless tools were deleted, and at the time the swap was located in another partition instead of a file inside the rootfs. The uncompress rootfs is about 414 MB (as reported by df -h when mounted as a loop device).

I decided to prepare a minimal image myself based on the first Raspbian Wheezy release, that supports about the same features of the image mentioned above, plus support for the wireless tools. I’ll describe how I proceeded below, but for those who are only interested in the image, and could not care less how it was done, here’s the download link (84 MB compressed image). The username / password are the same: pi /raspberry.

Upon the first boot you can change the time zone:

sudo dpkg-reconfigure tzdata

This image only support US keyboard layout and English locale, if you need to change those:

If you are mainly going to access your board via ssh, you probably don’t need those.

Instructions to Generate a Minimal Raspbian Image

I’ve downloaded the image via BiTorrent and copied it to the SD card using dd. During the first boot, I configured the keyboard to US layout, Bangkok timezone, enabled SSH and disabled X are started and did not resize the partition.

Now that’s more interesting! The first 3 files are the apt caches and the swap, we’ll take care of those at the end. Some icon takes appear to take a lot of space, the .a file show there are some development libs installed and the last file reminded me there’s some Raspberry media sample code.

Let’s take care of those code samples:

sudo rm -rf opt

Now I need to find a way to list development packages installed in the system. Luckily there is a command to list installed packages, which I can filter to list development packages:

We now have 550 MB used space in the rootfs, minus the 100 MB swap file, that’s still 450 MB which is well above the 414 MB for Linux Systems image. I can see gcc is still there, and we should not need to build anything directly on the device. let’s remove it!:

sudo apt-get remove `sudo dpkg --get-selections | grep -v "deinstall" | grep gcc\- | sed s/install//`
After this operation, 234 MB disk space will be freed.
You are about to do something potentially harmful.
To continue type in the phrase 'Yes, do as I say!'
?] no

OK, this was a bad idea, and I answered no. So instead, I decided to only keep gcc 4.7:

It’s certainly possible to even go slightly lower, as a basic debootstrap of Debian unstable comes out at 269MB uncompressed, and using Emdebian Grip might even allow a ~100 MB uncompressed rootfs with all the features we need, but I doubt this option is available with Raspbian mirrors (TBC).

Deleting the whole /opt directory is not a wise thing, because you will lose the ability to change resolutions and use OpenGL. I guess you can remove “include” and “src” directories, however “bin”, “lib” and “sbin” should be spared.

Hi, thanks for the image.
I found out that there is no sftp-server in openssh-server
I had to do a: “apt-get install openssh-server –reinstall” to get it back
removing useless packages is a good thing.
But removing files from packages is not a good idea.
Are there any other files deleted like this?

@sophana
I’m not sure, but if you look the instructions, I removed all installed packages with the string “ssh”, before installing dropbear. So I guess it’s possible dropbear uses a subset of openssh, but I don’t know the details.

When will someone produce an image which is actually shrunk to fit? It’s easy to expand an image once its copied onto a card, not so easy to shrink one down using loopback or some other method beforehand. I want to run a minimal distro on 512Mb card. I can’t be the only one?

You an also do that manually, as the rootfs in the image above should fit into your 512 MB SD card, simply mount the image, and copy the files to your SD card with cp -a (assuming it is already partitioned correctly).

I just wanted to give the minimal image a try in the hope to use one of my 128 MB or 256 MB SD cards. Unfortunately the image is tailored to a 2 GB card. How much is actually needed? Would it be possible to provide a smaller image?

I tried to copy the image to a 256 MB card and to fix the partition table, but fdisk complained even about the start of the partitions so I refrained from further experiments.

Hi,
I am pretty new to this and recently I downloaded one of the images online.
However, this one had at boot a logo which I wanted to remove.
If I use your image, will there be an option to enable splash or a simple picture as log at boot time?
If so, in which file can I change the boot logo?

Andre :
Hi,
I am pretty new to this and recently I downloaded one of the images online.
However, this one had at boot a logo which I wanted to remove.
If I use your image, will there be an option to enable splash or a simple picture as log at boot time?
If so, in which file can I change the boot logo?
Ps.: nice work as you make it sound easy even for a newbe like me.

Search online for a “plymouth” tutorial. “plymouth” allows you to have a custom boot animation/logo.

I’m just performing your cleanup on a new 2013.05 Raspbian Image and I got to notice the following. First you just use apt-get remove, but since you want to get rid of the packages at all you better should use apt-get purge which will also remove any configuration etc file Freeed up another 40 MB or so (as mentioned before by DrB)

In doing all the stuff from your post and stuff mentioned in the comments, I get an rootfs of 675MB. There is still the icon-theme.cache around (74MB), apt’s cache not cleared, logs still in place etc. So you could say can squeeze another 100MB out of it (maybe more).

@cnxsoft
Thanks a lot for the reply.
I am trying to do some real time sensor data processing. I still have latency, even with the minimal raspbian.
Can you please suggest me with some other compatible OS, which can support real-time sensor data processing.
Right now I think the problem is wiht memory, and my fear is about the stability of the processor, if I overlock it.
Thanks in advance.

Thanks, it worked for me if I used compressed image directly downloaded, but facing some issues when I executed the commands to remove unnecessary components, Actually I want to use this compressed image for executing nodeJs components further, so is there any other way to compress the image a little more.

@cnxsoft
Thank you so much for the quick reply. There is no doubt in it, Your post really helps me a lot,
Sure will try for the provided links too.
Ya I know its little complicated but not impossible so I want to try with it.
and the version for the provided minimal image is also older so I was trying commands provided by you for latest image and facing some issues so asked for this.
means, not exactly the image get compressed to 84MB.
So can you please tell me solution for this?
And one more thing since I required those specific tools so can i go for this : first I will install all the tools and will make .img for it.
and then I will distribute or use for further use. So will it work ?

@Pranita
OK, so you are using the latest Raspbian image and try to make it small.. I don’t know which issues you are facing.
But if you want to make it smaller, run “ls -lR > tree.txt” in the root directory, and check which files may be removed.

Why would removing gcc be potentially harmful? If you install packages via apt-get only, I don’t see a problem with removing gcc. A full list of packges removed by your operation would be interesting. Also, I’d spend some more MiB for vim and aptitude, when you’re building a custom image anyway.

@Ben
I can’t really remember, but I have seen some funny things with apt-get somethings.
Maybe removing gcc would have remove libc, or something like that. It’s not suppose to happen however, as gcc is not an essential of a system.

@Mattias
Thanks for letting me know. They must have re-orgainized their server since I wrote this post.
Anyway, I think most people going through these instructions will probably want to get the latest version of Raspbian.