Resolving OpenBSD Bloat: Unpuffing Puffy

by francisco luis roque, April 1, 2005

Talk

Graph 1
Graph 1: OpenBSD (light blue) disk usage compared to other OS's.
It is a well known fact that OpenBSD is currently one of the largest Operating Systems available. Graph 1 at the right shows that OpenBSD (in light blue) can use up to 10 times more of a disk than other OS's.

Additionally, since OpenBSD's inception both the kernel and the install sets have grown exponentially.

Graph 2
Graph 2: OpenBSD growth over 7 years.
For example, the 2.5 i386 kernel was 2281 KB small whereas the 3.5 i386 kernel was 4957 KB large; in only 5 years the kernel more than doubled in size. In addition, i386 base25.tgz was 17775 KB small whereas i386 base35.tgz was 30271 KB large, again almost a doubling in size. Graph 2 at right shows the growth in kernels and install sets over the past 5 years.

Figure 1
Figure 1: Puffy, the bloated OpenBSD mascot.
It should come as no surprise that OpenBSD is so bloated; after all, the OpenBSD mascot is the pufferfish (figure 1), also known as the blowfish or fugu, known for its bloated appearance.

Yet it must also be noted that the blowfish does not need to be bloated, it also has an "unpuffed" state during which it looks normal (figure 2).

That the fugu has an unpuffed states begs the question: can OpenBSD have a less bloated state as well; can puffy be unpuffed?

Figure 2
Figure 2: an unbloated mascot?
One other common complaint about OpenBSD is how useless a default install is. Though the default install allows for remote logins, little else is running by default, leaving a relatively useless install for no apparent gain. Contrast this with more robust OS's which run many more services.

But the lack of running services by default can help as well. Though OpenBSD has over 350 commands in the default path, only around 50 are used by default, the rest are excess baggage. For example, reboot and halt aren't needed on real servers, ls is rarely used because echo * covers most needs and even cat can be replaced by while read line; do echo $line;done < file.

In other words, we can eliminate approximately 85% of the installed binaries and their respective libraries and control files and still have a completely usable system.

But what about the few times someone might need to add on rarely used software like pf, apache, or tcpdump? Since OpenBSD already has a great ports and package system, we can extend this to include the rarely used extras found in base OpenBSD.

 

Summary

We must unbloat OpenBSD by having base include only the software that is actually run in a default install. For the odd people who need some other functionality currently found in base, we must create packages.

 

Work

To move towards this unbloatedness, here is an i386 site37.tgz that contains only the programs and files actually referenced during a default boot as well as pkg_add and its requirements. During a common install, select only this tarball and the kernel, and leave all other choices at their default. The end result will be a bootable system will a very lean install. It is now possible to ssh in and pkg_add more software (provided you have a means to get these packages to the system - a cd or other media will work).

Graph 3
Graph 3: OpenBSD standard install (top) versus unbloated install (bottom).
Graph 3 shows a comparison of the size difference between this unbloated install versus a standard 3.7 install. Note that 30% of the space used by the unbloated install is the kernel. Reducing kernel bloat by compiling a custom kernel at install time is a project for next year.

If you would rather compile your own site37.tgz containing this unbloated install set, follow these directions:

You should now have a similar site37.tgz in your $RELEASEDIR.

One other necessary step will be to redo most of OpenBSD base into the port system. As a beginning, here are a few i386 packages of the more esoteric OpenBSD features:

 

References/Thanks/Related

 

Author, Copyright, License

The author of this document is francisco roque, who can be found at
http://www.blackant.net/

This document is copyright francisco roque 2005.

This document is released under BSD style license and may be used in whole or part for anything so long as this section remains intact.

The author takes no responsibility for damages incurred by following the steps in this document, including but not limited to the loss of data or damage to hardware. Good Luck.