Installing the Latest Debian on an Ancient Laptop
The challenge: Install Linux on a really old laptop. The catch: It has only 32 MB of RAM, no network ports, no CD-ROM, and the floppy drive makes creaking noises. Is it possible? Yes. Is it easy? No. Is is useful? Maybe...
MotivationWhy? Like mountain climbers say: because it's there. As an environmental nut, I don't like to throw away things that still work. But I have a PCMCIA network card and I would rather not have to hunt down and install 10 year old drivers to get it to work with Windows 95. The latest Linux definitely supports more hardware out of the box than Windows 95.
The LaptopI don't know very much about this laptop. I recall that the system information utility in Windows 95 is "MSD" or "MSDIAG", but either didn't exist in this installation, or my memory is faulty and I was typing the wrong command.
The only thing I do know is that it has 32 MB of RAM, integrated stereo sound and modem, no network card, and no CDROM drive. When it boots, there is no obvious way to enter the BIOS utility. I tried DEL, F8, etc but I figure it doesn't have one.
Ubuntu's Tragic FailureI tried really hard to install Ubuntu, which I am familiar with on my other machines. The problem is that Ubuntu has removed the ability to install it from floppies. You have to a) use the CDROM or b) do a network boot.
I wasted hours trying to do the network boot, which I have done before for the machine running this web server (The DELL DVD drive died long ago). I followed the instructions to put the network boot CDROM onto another Linux server, and installed TFTP and a DHCP server. But the ancient Compaq laptop presented a problem.
Normally you could go to http://rom-o-matic.net/ and make a boot floppy, which will boot up, detect the network interface, and then do a network boot (which would start the Ubuntu installer). However, the only network card I had was a PCMCIA 3com card that is supposed to be supported by rom-o-matic. But no matter what I did, etherboot would not detect it and would just sit there dumbly.
It may have been possible to use the PLIP (IP over parallel port networking) option and boot from over the network using a special cable. But I don't have the cable, and such an install is so uncommon, it would be a miracle if it worked at all.
Debian saves the dayAfter some research I found that Debian still supports the floppy install option. All you need are 4 floppies for boot.img, root.img, and two additional disks of network drivers. Of course, I only own one floppy disk so I had to keep re-imaging it during the install.
The minimum memory required for installation is 32 MB, so we are in luck. The problem is that the installer enters a "low memory mode" and doesn't load any kernel modules on its own. Instead, it pops up a list and you have to guess what drivers you are going to need. If you are wrong, you can always click "go back" to back up. I went through the four floppy disks that it asked for, and selected anything that looked like IDE (for the hard drive), 3COM, and PCMCIA (for the network card). Actually, at first I didn't select the IDE components. As a result, the installer offered to partition my floppy disk. I went back to add in the hard disk drivers.
Finally, the installer was working. It connected to the network and downloaded and installed the minimum debian distribution. The only changes I made were to the partitioning. Initially, it offered a 90 MB swap partition. That seems small, so I increased it to 400 MB, leaving 1.3 GB of disk space left over for the install.
HiccupsThe installer seemed to freeze at one stage, while "preparing installation report." I rebooted the machine and it worked the second time.
When the laptop boots up, I get lots of kernel messages about failed I/O operations. However, once it starts everything is okay. I did a surface check using
e2fsck -c but the errors persist.
Running ProgramsOnce everything was set up, I installed gvim, xdm, Xorg, and icewm, (which is a great window manager that doesn't take up too much space). When I started X for the first time, the screen was red and didn't look right. It turns out that I had to limit it to 16-bit and reduce the resolution to 800x600, the native resolution of the screen. Then everything worked.
Battle of the BrowsersOnce the graphics were set up, I used good old lynx, the text based browser, to download Firefox. But once I started my favourite browser, I waited, and waited, and waited...
It turns out that Firefox is a memory pig. It took 15 minutes to start, and it takes up over 100 MB of memory to show a blank window. Ugh!
There isn't a lot of choice of browsers out there. Galeon is part of Gnome, and I definitely didn't want any bloated Gnome packages on my lean but slow machine. Instead, I downloaded the latest version of Opera.
Opera starts in only 10 seconds or so. It's usable, if you don't mind waiting a few seconds between clicks. So Opera wins the browser wars for low-resource machines.
vncviewerSince the laptop is so slow to use, I mostly use it to connect to other machines using xtightvncviewer. For this purpose, it works very well.
- For old machines with no CD-ROM drive, you are better off installing Debian than Ubuntu.
- Because of Debian's low-memory mode installer, you'd better be a computer expert to pick the right drivers during installation.
- The best package manager is "aptitude", but only when run from the command line, because even the text-based GUI is too slow. It keeps stopping everytime you do something to do housekeeping.
- The best browser for low-resource machines is Opera.
- Aside from a minor hiccup with X.org's graphics detection, all hardware works flawlessly.
Zero load time file formatsWhen your app needs to be fast, you can't afford to load things fro disk. In this toy example, an on-disk data structure helps you instantly look up lists of related words.
Compress your JSON with automatic type extractionJSON is horribly inefficient data format for data exchange between a web server and a browser. Here's how you can fix it.
Rules for Effective C++The rules for safe C++ code are surprisingly controversial.
Minimal usable Ubuntu with one commandIf you install the default "ubuntu-desktop" you also get with it a gigabyte of crap that you will never use. But if you don't install the ubuntu desktop, you get a system with a text-only login: prompt, and it's not clear what to install to get it to a usable state.
I have an irrational need to optimize my Ubuntu installation. I did some investigating and came up with this method, which gives a minimal graphical 1.2 GB install, with gnome, networking, and no applications.
VP trees: A data structure for finding stuff fastLet's say you have millions of pictures of faces tagged with names. Given a new photo, how do you find the name of person that the photo most resembles?
In the cases I mentioned, each record has hundreds or thousands of elements: the pixels in a photo, or patterns in a sound snippet, or web usage data. These records can be regarded as points in high dimensional space. When you look at a points in space, they tend to form clusters, and you can infer a lot by looking at ones nearby.