13

I'm trying to run some experiments with Linux and look for the smallest distribution by installation size. (RAM, CPU doesn't really matter)

8
  • Do you want to consider ready-made bootable distributions only, or is it OK if you have to manually compile a kernel and choose the contents of the filesystem? May 12, 2015 at 12:09
  • 4
    Do you want current distributions only? The ones from 20 years ago are probably likelier to hold the title of "smallest"? May 12, 2015 at 12:21
  • 1
    @MarkPlotnick: Everything is fine as long as it runs on my harddrive/laptop. If I have to do everything manually the tutorial is the requirement ;) If you can give me the link to a 20 year old distro which is smaller than 8Mb (ttylinux), I'm happy
    – Qohelet
    May 12, 2015 at 13:43
  • What are your criteria for selecting a distribution? Debian could be relatively small, but it depends entirely on how much "stuff" you include in the installation. Do you want a GUI? Do you want office/productivity applications? What about a webserver or database? May 12, 2015 at 14:00
  • @roaima: As said: The installation-size should be small. Really really small. GUI would be nice indeed, but if it was necessary I would have mentioned it. (As the rest)
    – Qohelet
    May 12, 2015 at 18:15

5 Answers 5

25

Update: ttylinux is unmaintained at the moment! If you're still interested start here or here.

Depending on your platform, ttylinux is maybe something for you:

This smallest ttylinux system has an 8 MB file system and runs on i486 computers within 28 MB of RAM, but provides a complete command line environment and is ready for Internet access.

Started in 2001 and latest release is from 2015-03-05 so it is still maintained.

2
  • I assume we have a winner. Thank you, I don't think it's possible to go much lower than that. I'm surprised, thank you for the answer
    – Qohelet
    May 12, 2015 at 13:47
  • 1
    The given link is no longer valid. Is this distro still available anywhere? This looks like a possibility, but I haven't tested it. (Yet.)
    – LondonRob
    Oct 18, 2016 at 11:03
5

The small distro that comes to mind is "Damn Small Linux", with a size of 50 MB (link, wiki)

But also there's even smaller distro "Tiny Core Linux" which is about 15 MB (link, wiki)

1
  • 1
    DSL looks discontinued.
    – Dubu
    May 12, 2015 at 12:17
4

OpenWrt is also one of the smallest.

4

Buildroot

If you are willing to go through a compiling process and cut down on features, you could try buildroot. I created a very basic Linux install (essentially just the kernel, minimal Busybox utilities and one extra application) which fit into a 6MB ISO image.

The key here is to reduce the kernel and Busybox configuration ("make linux-nconfig" and "make busybox-menuconfig") to the bare minimum you need, and then to enable the XZ compression on the initial kernel ramdisk. Cutting down on everything I didn't need allowed me to reduce the whole ISO image down to about 9MB, and after enabling the XZ compression further down to 6MB.

For the kernel, I just checked each option in the configuration menu and disabled it unless I specifically needed it. You could disable all network drivers for which you don't have a corresponding network adapter, disable other, less common hardware which you don't foresee using (multi-port serial cards, joysticks, multi-function devices...) and so on. You can also leave many subsystems on the basic implementations rather than more sophisticated ones (e.g. basic ACPI CPU idle states rather than Intel/AMD CPU idle states), which may mean that you will trade off power efficiency and full hardware support for kernel size. You could also disable entire subsystems like hibernation/sleep support and sound system if you don't need to use them.

You could save a lot of space by doing that. For example, the KVM (virtualisation) and btrfs support modules (which I decided to put outside the kernel as loadable modules in case I will need them in the future) take up 1.1 MB by themselves. By deleting those module files you could get down to about 4.9MB. It could be that they take up less space integrated into the kernel binary, but then I've seen that other, smaller modules are sized 20-100 kilobytes, so your mileage may vary.

Busybox

Busybox is a single binary that behaves like different binaries depending on how it's called from the command line, which lets you save space. It's included in Buildroot by default. It can behave as ls, df, dd, cat, nc, bash and many others. It looks like a good replacement for almost the entire *nix userland, unless you need some specific utility extensions which you can only find in more fully-featured/traditional (e.g. GNU, BSD) versions of these utilities. Busybox is similar to the kernel in terms of disabling features - disable everything except for the binaries (AKA applets) you need, and the size will be reduced down. Dynamically compiled Busybox binary it takes up 512 kilobytes in Buildroot and about 2.1MB on Ubuntu 14.10. The larger Ubuntu version supports a lot more than my Buildroot version, and it's still smaller than the default userland in terms of size - 2.1 MB for Busybox which includes all basic utilities (plus md5, sha256, sha512 sum, telnet, gzip, grep, df, dd, and many, many other applets) vs the traditional userland - 2.1MB gives you Bash and only a few of these utilities.

Extreme methods of decreasing the system size

You can try some of the things below to reduce the size further, but make backups of the working directory often as you may break the Buildroot install you are working on and may have to rebuild some of the binaries.

  • Compress all executables (including the kernel) with the UPX compressor. Since UPX is designed specifically to perform executable compression, this makes the resulting executables much smaller. But please make sure that you test all the executables afterwards and that they work correctly.

  • Use a different libc. I'm using uClibc, but I heard that musl and dietlib are much smaller and produce smaller executables. I had some build problems with musl this time, but it may work better.

  • Replace some or all userland utilities with asmutils. These utilities implement some of the common *nix utilities in pure Assembly (rather than C or other languages), which theoretically allows for much more compact code. Some of them work well, but some can be only used in very basic ways (e.g. "mount" only takes parameters in a specific sequence and no FS-specific mount options are implemented). On the other hand, they are very small (most are less than 1KB compiled, smalles ones about 139 bytes or so). You can pick which ones you want to use, so you can use these replacements only for the commands you want to save space on and keep more feature-rich versions as Busybox applets.

3

Tomsrtbt is a couple megabytes; it fits on a floppy.

3
  • That was a great piece of distribution 13 years ago. At least that is the freshest available on iBiblio. Or do you know about more recent versions?
    – manatwork
    May 12, 2015 at 15:02
  • I don't know of anything more recent. May 12, 2015 at 15:05
  • Gave it a try... Difficult to find a version of it. Most of them are in dead archives. One is working (ibiblio.org/pub/Linux/system/recovery) But the tests I was running weren't successful. A pity, 2,9Mb are awesome
    – Qohelet
    May 12, 2015 at 19:27

Not the answer you're looking for? Browse other questions tagged .