LINUX GAZETTE
[ Prev ][ Table of Contents ][ Front Page ][ Talkback ][ FAQ ][ Next ]

"Linux Gazette...making Linux just a little more fun!"


Working with Micro-Distributions
--or--
Linux in Your Pocket

By Larry "Dirt Road" Kollar


In these days of distributions that come on six CDs, it's good to remember that a very functional Linux fits on a Zip cartridge -- or even a couple of floppies.

To prove the utility of a tiny Linux, I set up a two-floppy system on a 486 and used it to write this article.

Introduction

"It all" began when I was given a pair of PCs and one monitor. The larger computer, an Aptiva, had a P133 CPU, a 2GB hard drive, a CD-ROM drive, and no RAM at all. The second computer was an HP Vectra 486/33N with a 170MB hard drive, Windows 3.1, and 8MB of RAM (no CD). Both systems had mice, but no keyboards. A trip to Wal-Mart and $10(US) later, and I had a PS/2-compatible keyboard. Since the two computers both used 72-pin SIMMs, the first thing I did was to swap the RAM into the Aptiva and see if anything useful was on that big hard drive.

I learned something valuable. I learned what Window 98 chokes on insufficient RAM, ungraciously.

I didn't happen to have any extra RAM lying around. So I put the RAM back in the Vectra and dug up the RedHat 4.0 disks I had... oops, they're CDs and this Vectra doesn't have a CD (and no slots in the case to mount one). Obviously, I needed another strategy.

Lookin' Mighty Floppy

Linux Daily News is one of my daily stops on the Web. If LWN doesn't have the info you need, they have a link to it. I pulled up the Distributions page and scrolled down to the floppy-based list.

My first thought was everyone's favorite single-floppy rescue distribution, tomsrtbt. I have a Windows laptop at work, strictly secondary to my Mac G3, but on occasion it actually makes itself useful. Unfortunately, tomsrtbt uses some funky disk voodoo to pack 1.7MB onto a 1.44MB floppy, and IT had recently "up"graded the laptop to Windows 2000. W2K doesn't allow such shenanigans, and I don't have easy access to another Windows system.

Back to the list. While poking around a few other resources, I found that BasicLinux isn't really a CD-based distribution (like the LWN Distribution page claims). It comes in a single ZIP file, totalling 2MB, but the unpacked files fit easily on two floppies and doesn't require you to write an image (it uses LOADLIN.EXE to start from DOS). Derived from Slackware 3.5, it sports a 2.0.34 kernel and libc5. It also allocates only 4MB for its RAMdisk, allowing the Vectra to get its first taste of free software.

Up and Away

Despite differences in software vintage, disk format, and intent, floppy-based distributions have a fairly similar startup sequence:

  1. Initialization, either at startup (LILO) or after DOS loads (LOADLIN).
  2. The loader decompresses the kernel and starts it.
  3. The kernel creates a RAMdisk for its userland.
  4. The loader decompresses the userland and loads it into the RAMdisk.
  5. Booting proceeds as normal, with the RAMdisk mounted at root.

A disk image containing the userland (i.e. the contents of the filesystem) usually fits snugly on a 1.44MB floppy and expands to about 3MB. Running from a RAMdisk, even a 486/33 feels pretty snappy.

Tradeoffs

Wedging even a minimal Linux onto two floppies brings to mind Heinlein's immortal observation "TANSTAAFL" (There Ain't No Such Thing As A Free Lunch). While it's possible to offer some basic utilities and even X11, you won't find KDE, Gnome, or Mozilla. Emacs addicts can just forget it (well, mostly).

Even the basic commands and utilities, the things you expect from any OS whose name ends in 'X,' are cut-back versions. Actually, most of them are simply symbolic links to a program called BusyBox. Lineo developed this clever kit for embedded Linux systems, but it has also found its way into the various rescue and micro distributions. It packs 54 of the essential commands into a single binary of just over 110K. Create a link (using ln -s) named cp, and when you enter that command Busybox acts like a cp command. When you run it as mv, it moves or renames files. The --help option provides a brief description of the command, eliminating an absolute need for manpages as well. Without BusyBox, I dare say floppy-based distributions would have to make even more compromises.

Working with BasicLinux

BasicLinux is a compact but competent networking system. Besides the essentials (via BusyBox), it provides network connectivity through both Ethernet and dialup, and can pull firewall duty using ipfwadm. Utilities like fetchmail and links (not lynx, that threw me) provide mail and web connectivity. To keep seasoned Linux users comfortable as possible, it provides the familiar bash shell. The default inittab provides three console logins, more than enough for my purposes (I sometimes use two consoles at a time, one for me and one for root).

Unlike some distributions, BasicLinux offers two text editors, the tiny e3 and the popular pico. Taking advantage of some leftover space in the boot image, and the historic Slackware package archive, I replaced them both with joe. Joe is an editor slightly larger than pico but it can emulate pico, WordStar, and Emacs (but without all the bloated Emacs hyper-functionality). The result is a larger compressed image, but one that still fits on a floppy.

Editing the Image

The readme.txt file that comes with BasicLinux is brief, but provides enough detail for anyone familiar with a console to customize the system or create a bootable floppy image.

As I write this section of the article, I have the BasicLinux files on the C: drive of a 486 that would otherwise be running MS-DOS. Customizing the image is simple:

  1. Use gunzip to decompress the image.
  2. Mount the image on a loopback device.
  3. Make changes as desired.
  4. Unmount the image.
  5. Gzip the image.

I've written up a separate page describing the loopback device.

Migrating to the Hard Drive

This isn't difficult, if you're willing to wipe out everything on the hard drive. The Vectra had Windows 3.1 and a pile of applications, nothing that I particularly needed to keep.

Before plunging forward, I did a little research and backed up the MS-DOS directory onto floppy (using a zip compressor that was already on the computer). With a 160MB hard drive and 8MB of RAM, I figured I would have enough room to build a capable system without being tempted to overload it.

A Google search for partition resizing programs turned up the free FIPS (First non-destructive Interactive Partiton Splitting program). Following the instructions, I put FIPS on a boot floppy and used it to shrink the C: partition. I wanted to reduce it to 10MB, but FIPS (for whatever reason) would not go below 16MB. After wiping out all the Windows 3.1 stuff and defragmenting the hard drive, I had less than 5MB on C: so I'm not sure what happened. Oh well.

Now I started Linux again and used the fdisk utility that came with BasicLinux to create a 32MB swap partition and dedicate the rest of the drive to root. Running mkswap, mke2fs, and e2fsck prepared the new partitions for use. Finally, I unpacked the BasicLinux instl2hd.zip archive and followed the instructions that came with it to load my RAMdisk image (and some extras) onto the hard drive. From there, it was a simple matter of editing /etc/fstab to point to the new root and swap partitions. One more reboot, and I was running from the hard drive. Life is good. I copied my article to the Linux partition and continued writing.

Caught in the Net

With the console-based system using less than 5MB of RAM, and leaving 3MB of RAM free, I set my sights a little higher. In short, I wanted to add:

Fortunately, the Vectra came with an SMB-Ultra network card. It didn't take long to find the proper module, and the BasicLinux documentation told me to load the 8390 module first. Since I already have my Mac G3 running a NAT firewall (ipchains) under Linux to share the dialup, adding the Vectra to the network was mainly a matter of carrying it into the room with the LAN and plugging in a cable. After some fiddling and reading the route manpage several times, I finally figured out the incantations needed to get Skeeter (as I started calling the Vectra) talking to the LAN then through the G3's gateway and into the outside world.

Downloading the X11 packages reminded me that there are even slower network links than my dialup. This was one of the few times I was glad to not have broadband; I would have felt cheated. But eventually, I got them all onto the hard drive, then set about configuring X11. Poking around on the net for help, I learned that the SuperProbe utility would tell me what the Vectra's on-board video was, and that my monitor was strictly 640x480. On my second evening, I got the GUI running and switched to the recommended icewm for a window manager. Icewm's pager and small size made the cramped screen tolerable if not palatable. But to be fair, a 35-line rxvt window beats a 25-line console screen for writing, so overall I'm satisfied.

The Rest

With the network and GUI working, it was now time to finish out the build. At this point, the entire system weighed in at just under 21MB of hard drive space (out of 113MB available). Adding the compiler packages took this up to 35MB.

Adding the packages needed to compile groff and gawk, plus the compiled applications themselves, went over 60MB used. After installing the programs and deleting the build directories, I was satisfied with the 57MB in use.

Having dealt with sharing a printer over a LAN via lpr before, it wasn't long before I was able to run a few test groff documents and have them print to the G3's USB laser printer. At this point, Skeeter is doing everything I'd planned for it. I'd like to put a larger monitor on it (800x600 at least), and perhaps compile Chimera 1.x for use as a graphical web browser, but neither of these are absolute necessities.

Finding its Own Niche

Besides being available for writing articles like this one, Skeeter can connect to MUDs for recreation (imagine three people sharing a dialup -- since two are using telnet, and the third is just reading email in a browser, nobody complains about the connection being slow). Rogue captivated my teenage son and his friend -- the friend marvelled at how a game without graphics could be so fun!

Skeeter has also made itself useful as a sort-of remote floppy drive. The iMac (now running MacOS X) has no floppy, and the G3's drive is somewhat dodgy. So if we need to read or write a floppy, we call on Skeeter. Skeeter may become a print server in the future as well.

In the end, I deem the experiment a success. An investment of $10 plus a little sweat equity gave me another useful computer and some new skills.

Larry Kollar

Larry's job title is "Technical Writer," but he secretly dreams of being a BOFH some day. At work, he manages to find time to write scripts, set up departmental Linux servers (on Macs, of course), and fend off hordes of jealous IT staffers who want his G3. At his home at the bottom of the Georgia mountains, he does what he can to keep a wife, two kids, and four computers healthy and happy.


Copyright © 2002, Larry "Dirt Road" Kollar.
Copying license http://www.linuxgazette.com/copying.html
Published in Issue 77 of Linux Gazette, April 2002

[ Prev ][ Table of Contents ][ Front Page ][ Talkback ][ FAQ ][ Next ]