Linux on An Old Laptop

I’ve got an old Toshiba Portege 3110. Unfortunately the screen got broken, so now it’s a 40×25 display in text mode, or 400×600 in graphics mode. But I couldn’t help thinking that it would be a nice quiet, compact, low-power headless server at the least, and I haven’t seen GNOME or KDE for a while so I wanted to see what they’re like these days so maybe it would even do that with its colossal 128MB of RAM.

The little Toshiba has never had a CD-ROM, which does suck; but hey it’s the 90s right? Who needs physical media when you have the network? I’ve got a 12Mbit ADSL connection (hah, </brag>) and plenty of other machines so I should be able to get some Linux distro on there pretty easy you would think. Well, no.

You used to be able to boot a couple of floppy disks and install Redhat 9 via FTP, NFS or HTTP, which I did a few times. Other distros aren’t as easy to install this way, but some do it. I wanted to try Ubuntu, but couldn’t figure out how to install it that way so I went back to Fedora Core 4, thinking it would be similar to ye olde Redhatte. It is, but you need FIVE floppy disks. My floppy disk collection is dwindling and writing floppy images is pretty hit-and-miss not to mention slow, so I didn’t want to do that.

To cut a VERY long story quite short, I ended up downloading a cool distribution that boots off a USB device, like one of those keychains or, as in my case, an SD card. It’s called RUNT Linux . The old Toshiba of course doesn’t boot directly off USB, so I had to use the floppy image that comes with RUNT to bootstrap it. RUNT then detects the first USB device and boots off it, and you get network and all the goodness that 100MB+ of command-line Linux provides — including games! Bomb, but I only needed fdisk, ftp or wget, and lilo.

Next step is to somehow (FTP, wget) the FC4 ISO image(s) onto the hard disk of the laptop, which wasn’t too hard with RUNT. I tried with some other floppy distributions (um tomsrtbt and SYSLINUX I think) and this was a real hassle because of their sparseness of utilities available, but it was possible. So if you have a USB device and a port to stick it in, use RUNT. I was copying all four images onto the laptop, and the first time I did this I had a big partition the entire size of the disk. Of course Disk Druid (the disk partitioner in FC4 setup) wouldn’t let me install on the partition with the images, and I had no more space for another partition. fdisk time!

Next time I made a smaller partition leaving enough space for an installation besides, I think the partition for the ISOs was 2.5GB or so. But, in hindsight, this is dumb because all you need is the 6.5MB or so ISO (called boot.iso) that is provided to get the installation started, then you can do a network install over FTP or HTTP. So you really only need a tiny partition for the installation boot ISO, not 2.5GB. Although to run lilo, it’s easiest to copy the entire RUNT distro onto your hard disk so you don’t need to worry about any conflicts. So some commands to do this would be something like:

#mount the partition you created with fdisk that is about 300MB in size, to be safe
$ mount -t ext2 /dev/hda2 /mnt/hda2
$ cp -r /etc /mnt/hda2
$ cp -r /dev /mnt/hda2
$ cp -r /bin /mnt/hda2
$ cp -r /sbin /mnt/hda2
$ cd /mnt/hda2

$ wget ftp://anothercomputer/somepath/boot.iso

This gets you a near-enough copy of the RUNT distro, so you can run lilo and boot that little ISO that you downloaded from a public FTP site or another computer of yours.

Oh, I almost forgot! You need to mount the ISO and get the stuff out of /boot and copy it locally, so that lilo has a kernel to boot. I think. Just do this anyway:

$ mkdir /mnt/fc4
$ mount -t iso9660 /mnt/hda2/boot.iso /mnt/fc4 -o loop

Now you can access the ISO’s filesystem as normal, and copy the /boot directory onto your hard disk’s /boot directory:

$ mkdir /mnt/hda2/boot
$ cp /mnt/fc4/boot/* /mnt/hda2/boot/

The next step is a bit tricky, you have to get lilo loaded onto the master boot record (MBR) of your hard drive. lilo is rad because it can boot directly from an ISO image! How cool. So you need to run lilo in a chroot jail so that it knows what hard disk it’s gotta setup, and you do that like this:

$ lilo -C /etc/lilo.hda.conf -m /boot/map -v -r /mnt/hda2

Oh, I’m pointing lilo to a configuration file that tells it to boot the ISO. You have to put this in /mnt/hda2/etc since you’re chrooting lilo to /mnt/hda2, so it thinks /mnt/hda2/etc is just /etc. This is what it contains:

lba32 # Allow booting past 1024th cylinder with a recent BIOS
boot = /dev/hda
disk = /dev/hda
bios = 0x80
prompt
timeout = 1200

image = /boot/vmlinuz
initrd = /boot/initrd.img
root = /dev/hda2
label = fc4_install
read-write

You also need to write lilo to the MBR. Do this with:
$ lilo -M /dev/hda -C /etc/lilo.hda.conf -v -r /mnt/hda2

So now, you should be ready to reboot, and hopefully Fedora’s installation screen will come up when your computer boots. If it doesn’t, you’ve done something wrong — my instructions are just a rough guide, I’m writing this from memory! Read the man pages and use Google like there’s no tomorrow.

By the way, if you don’t have an FTP server to serve up your ISOs and RPM files, and you’re running Windows chuck SlimFTPD on another machine on your network, and do an FTP install. Microsoft’s FTP server (part of IIS on WinXP etc) gets all confused because FC4’s FTP client mungs the URLs a little bit. If you have another Linux box I’m sure you will have no problems.

Well this was going to be a 5-minute post just so I remember that lilo chroot command, so I bloody hope this helps somebody ;)