Minimal Slackware

23 July 2010
Although I am no stranger to setting up Linux boxes with low resource overheads (typically memory rather than CPU cycles), this know-how was targeted at VPSs installations where file-system usage is not really a premium. Particularly when compared to modern distributions (let alone Windows) circa 300-700MB of dead-weight is no major deal.

Bare-bones disk-set A

The best how-to I found on minimal Slackware (I didn't quite have the courage to try stripping down OpenBSD) is a bit out-dated, so I decided to have a go at updating it. Rather than do a completely command-line install I prefer to do an 'expert' install of just the 'A' disk-set, and these seem to be (close to) the minimal package set with Slackware v13.0:

aaa_base aaa_elflibs aaa_terminfo bash bin coreutils devs dialog e2fsprogs etc findutils gawk glibc-solibs grep gzip kbd kernel-firmware kernel-huge-smp kernel-modules-smp less lilo module-init-tools pkgtools procps sed shadow sysvinit sysvinit-scripts tar udev util-linux xz

These all weigh in at circa 170MB. Rather annoyingly the kernel packages can be unpredictable, and the only sure-fire way of getting the system to work is to install all of them, and then remove the one that is not used (see uname -a). A pain as the two sets of kernel packages are ~70MB each. In my case the SMP kernel was used, even though I was testing using a single processor system. Also note that xz and findutils are used by pkgtools.

A further strip-down

The kernel modules package includes a lot of hardware drivers, most of which you will never actually use. Next stage is to only keep the ones that are being used. Note that this script is intended to be illustrative rather than used as-is on a production system:

cd /lib/modules for i in `cat /proc/modules | awk -F" " '{print $1}' | sed s/[-_]/\?/g'; do     tar -rf modules.tar `find . -iname "$s.ko" done rm -r tar -xf modules.tar

And while at it, may as well clear out foreign locale information:

cd /usr/share/local rm -r [^eu]* e[lost]

Together these two clear-outs saved 77MB. There are a few other bits that can be trimmed out, but by this point it is diminishing returns (and I don't remember everything I culled).

Adding in (mostly) network support

Not much to say. I tend to use headless servers, so network support is basically an essential. Its easier to install these manually, rather than enable disksets AP & N and untick everything else during initial installation:

a/openssl-solibs ap/nano n/network-scripts n/net-toolsdf n/dhcpcd n/iputils

All this comes to 7MB extra. Nano is a pico clone, and those who are observant that I left out Elvis (a vi clone) earlier because I think that a command-not-found error is a lot more friendly than being dumped into Vi.

Adding in graphics support

Although my company uses stripped down Ubuntu as its embedded OS, I decided how far I could strip down an install of Slackware that also included graphics capability. Since the aim was a barebones base (all interaction would be through a single full-screen X application) I manually stripped out TWM and most X utilities such as Xwininfo (suspect this could be automated by using a script to deinstall any package that contains only one file), but those did not seem to save much space. It is fonts and internationalisation stuff that takes up all the space, and stripping that out bought the whole lot down to around (i think) 114MB.

114MB is still a lot for an embedded system, but I suspect going any lower would cause problems elsewhere. A DirectFB install should come out significantly lower than 15MB, but at the expense of a more complex development & testing set-up.

Some final remarks

I was disinclined to try busybox because I wanted to limit myself to pre-built Slackware binaries. For my own system this means I can use slapt-get to auto-update, and from a work perspective it avoids licencing issues: since I am not recompiling any GPL code, there should be no need to release any source code and/or build scripts.