<!-- LinuxDoc file was created by LyX 1.0 (C) 1995-1999 by <brichardson> Sat Apr 15 12:37:07 2000
-->
<article>
<title>
4mb Laptop HOWTO
</title>
<author>
Bruce Richardson <brichardson@lineone.net>
</author>
<date>
25 March 2000
</date>
<abstract>
How to put a "grown-up" Linux on a small-spec (4mb RAM, <=200mb hard disk)
laptop.
</abstract>
<toc>
<sect>
Introduction
<sect1>
Why this document was written.
<p>
I got my hands on two elderly laptops, both with just 4mb RAM and small
(<=200mb) hard drives. I wanted to install Linux on them. The documentation
for this kind of laptop all recommends installing either a mini-Linux or an
old (and therefor compact) version of one of the professional distributions.
I wanted to install an up-to-date professional distribution.
</p>
<sect1>
What use is a small laptop?<label id="sec:whatuse" >
<p>
Plenty. It isn't going to run X or be a development box (see <ref id="sec:whichcomponents" name="Which components to install?" >) but if you
are happy at the console you have a machine that can do e-mail, networking,
writing etc. Laptops also make excellent diagnostic/repair tools and the utilities
for that will easily fit onto small laptops.
</p>
<sect1>
Why not just upgrade the laptop?
<p>
Upgrading old laptops is not much cheaper than upgrading new ones. That's
a lot to spend on an old machine, especially considering that the manufacturer
isn't supporting it any more and spare parts are hard to find.
</p>
<sect1>
What about 4mb desktop machines?
<p>
The procedure described in this document will work perfectly well on a
desktop PC. On the other hand, upgrading a desktop machine is far easier and
cheaper than upgrading a laptop. Even if you don't upgrade it, there are still
simpler options. You could take out the hard disk, put it in a more powerful
machine, install Linux, trim it to fit and then put the disk back in the old
machine.
</p>
<sect1>
What this document doesn't do.
<p>
This document is not a general HOWTO about installing Linux on laptops
or even a specific HOWTO for either of the two machines mentioned here. It
simply describes a way of squeezing a large Linux into a very small space,
citing two specific machines as examples.
</p>
<sect1>
Where to find this document.
<p>
The latest copy of this document can be found in several formats at <htmlurl url="http://website.lineone.net/~brichardson/linux/4mb_laptops/" name="http://website.lineone.net/~brichardson/linux/4mb_laptops/">.
</p>
<sect1>
Copyright
<p>
This document is copyright (c) Bruce Richardson 2000. It may be distributed
under the terms set forth in the LDP license at sunsite.unc.edu/LDP/COPYRIGHT.html.
</p>
<p>
This HOWTO is free documentation; you can redistribute it and/or modify
it under the terms of the LDP license. This document is distributed in the
hope that it will be useful, but without any warranty; without even the implied
warranty of merchantability or fitness for a particular purpose. See the LDP
license for more details.
</p>
<p>
Toshiba and T1910 are trademarks of Toshiba Corporation. Compaq and Contura
Aero are trademarks of Compaq Computer Corporation.
</p>
<sect>
The Laptops
<p>
This section describes the laptops that I have used this procedure on,
the problems faced when installing Linux on them and the solutions to those
problems (in outline).
</p>
<sect1>
Basic Specifications
<sect2>
Compaq Contura Aero
<p>
<itemize>
<item>
25MHz 486SX CPU
<item>
4mb RAM
<item>
170mb Hard Disk
<item>
1 PCMCIA Type II slot
<item>
External PCMCIA 3.5" Floppy drive <footnote>
The PCMCIA floppy drive has a proprietary interface which is partly handled
by the Aero's unique BIOS. The Linux PCMCIA drivers can't work with it. According
to the PCMCIA-HOWTO, if the drive is connected when the laptop boots it will
work as a standard drive and Card Services will ignore the socket but it is
not hot-swappable. However, I found that the drive becomes inaccessible as
soon as Card Services start unless there is a mounted disk in the drive. This
has implications for the installation process - these are covered at the relevant
points. </footnote>
</itemize>
</p> <sect2>
Toshiba T1910
<p>
<itemize>
<item>
33MHz 486SX CPU
<item>
4mb RAM
<item>
200 mb Hard Disk
<item>
Internal 3.5" Floppy drive
<item>
1 PCMCIA Type II/III slot
</itemize>
</p> <sect1>
The Problem
<p>
The small hard disks and the lack of an internal floppy on the Aero make
the installation more tricky than normal but the real problem is the RAM. None
of the current distributions has an installation disk that will boot in 4mb,
not even if the whole hard disk is a swap partition.
</p>
<p>
The standard installation uses a boot disk to uncompress a root-partition
image (either from a second floppy or from CD-ROM) into a ram-disk. The root-image
is around 4mb in size. That's all the RAM available in this scenario. Try it
and it freezes while unpacking the root-image.
</p>
<sect1>
The Solution
<p>
The answer is to eliminate the ram-disk. If you can mount root on a physical
partition you will have enough memory to do the install. Since the uncompressed
ram-disk is too big to fit on a floppy, the only place left is on the hard
disk of the laptop. The steps are:
</p>
<p>
<enum>
<item>
Find something that will boot in 4mb ram and which can also create ext2
partitions.
<item>
Use it to create a swap partition and a small ext2 partition on the laptop's
hard disk.
<item>
Uncompress the installation root-image and copy it onto the ext2 partition.
<item>
Boot the laptop from the installation boot-disk, pointing it at the ext2
partition on the hard disk.
<item>
The installation should go more or less as normal from here.
</enum>
</p> <p>
The only question was whether a distribution that wouldn't install (under
normal circumstances) on the laptops would run on them. The short answer is
"Yes".
</p>
<p>
If you're an old Linux hand then that's all you need to know. If not, read
on - some of the steps listed above aren't as simple as they look.
</p>
<sect>
Choices Made
<p>
This section describes the choices available, which options are practical,
which ones I decided on and why.
</p>
<sect1>
What to use to create the initial root partition?
<p>
The best tool for this is a mini-Linux. There's a wide selection of small
Linuces available on the net, but most of them won't boot in 4mb RAM. I found
two that will:
</p>
<p>
<descrip>
<tag>
SmallLinux <htmlurl url="http://smalllinux.netpedia.net/" name="http://smalllinux.netpedia.net/"></tag>SmallLinux will boot in as little as 2mb RAM but its
root disk can't be taken out of the drive, which is a shame since otherwise
it has everything we need (i.e. fdisk, mkswap and mkfs.ext2). SmallLinux can
create the needed partitions but can't be used to copy the root partition.
<tag>
muLinux <htmlurl url="http://sunsite.auc.dk/mulinux/" name="http://sunsite.auc.dk/mulinux/"></tag>muLinux will boot in 4mb but only in a limited single-user
mode. In this mode fdisk and mkswap are available but mkfs.ext2 and the libraries
needed to run it are on the /usr partition which is not available in maintenance
mode. To use muLinux to do the whole pre-installation procedure the files needed
to create ext2 file-systems must be extracted from the usr disk image and copied
onto a floppy.
</descrip>
</p> <p>
This gives the option of either using SmallLinux to create the partitions
and muLinux to copy the root partition or using muLinux to do the whole job.
Since I had two laptops I tried both.
</p>
<sect1>
The Distribution
<p>
It didn't take much time to choose Slackware. Apart from the fact that
I like it but haven't used it much and want to learn more, I considered the
following points:
</p>
<p>
<itemize>
<item>
Slackware has possibly the most low-tech DIY install of all the major distributions.
It is also one of the most flexible, coming with a wide range of boot-disk
kernels to suit many different machines. This makes it well suited to the kind
of hacking about required in this scenario.
<item>
Slackware supports all the methods listed in <ref id="sec:whichmethod" name="Which Installation method to use?" >.
<item>
Slackware is a distribution designed by one person. I'm sure Patrick Volkerding
won't object if I say this means its configuration tools are simpler and more
streamlined. In my opinion this makes the job of trimming the installation
to fit cramped conditions easier.
</itemize>
</p> <p>
Version 7.0 was the latest version when I tried this so that's what I used.
On a normal machine you would simply reboot once the installation is complete.
If you do that here you may have to wait 6 or 8 hours for a login prompt to
appear and another half hour to get to the command prompt. Before rebooting
you need to change or remove the elements that cause this slowdown. This involves
editing config files so you need to be familiar with vi, ed or sed.
</p>
<p>
At this stage your future root partition is still mounted as /mnt so remember
to at that to the paths given here.
</p>
<p>
<descrip>
<tag>
/etc/passwd</tag>Edit this to change root's login shell to ash. ash really
is the only practical login shell for 4mb RAM.
<tag>
/etc/rc.d/rc.modules</tag>Comment out the line 'depmod -a'. You only need
to update module dependencies if you have changed your module configuration
(recompiled or added new ones, for example). On a standard system it only takes
a second or two and so it doesn't matter that it's needlessly performed each
time. On a 4mb laptop it can take as much as 8 hours.
When you do change your
module set-up you can simply uncomment this line and reboot. Alternatively,
change this part of the script so that it will only run if you pass a parameter
at the boot-prompt. For example:
<code>
if [ "NEWMODULES" == "1" ] ; then
depmod -a
fi
</code>
<tag>
/etc/rc.d/rc.inet2</tag>This script starts network services like nfs.
You probably don't need these and certainly not at start-up. Rename this script
to something like RC.inet2 - that will stop it from being run at boot and you
can run it manually when you need it.
<tag>
/etc/rc.d/rc.pcmcia</tag>On the Aero you should also rename this script,
otherwise you'll lose the use of your floppy drive on start-up. It's worth
considering for any other small laptop as well - you can always run it manually
before inserting a card.
</descrip>
</p> <p>
Once these changes have been made, you are ready to reboot.
</p>
<sect1>
Post-reboot Configuration.
<p>
If you made the changes recommended in section <ref id="sec:prebootconfig" name="Pre-reboot configuration" > then the boot process will
only take a few minutes, as opposed to several hours. Login as root and check
that everything is functioning properly.
</p>
<sect2>
Re-use the temporary root.
<p>
Once you are sure the installation is solid you can reclaim the partition
you used as the temporary root. Don't just delete the contents, reformat the
filesystem. Remember, the mke2fs that came with the mini-Linux is out of date.
</p>
<p>
If you intend to re-use this partition as /home, remember not to create
any user accounts until you have completed this step.
</p>
<sect2>
Other configuration tweaks.
<p>
In such a small RAM space, every little helps. Go through SlackWare's BSD-style
init scripts in /etc/rc.d/ and comment out anything you don't need. Have a
look at Todd Burgess' Small Memory mini-HOWTO <htmlurl url=" http://eddie.cis.uoguelph.ca/~tburgess/" name=" http://eddie.cis.uoguelph.ca/~tburgess/"> for more ideas.
</p>
<sect>
Conclusion
<p>
That's it all done. You now have a laptop with the core utilities in place
and 50 to 70mb spare for whichever extras you need. Don't mess it up because
it's a lot easier to modify an existing installation on such cramped old machines
than it is to start from scratch again.
</p>
<sect>
Appendix A: <label id="sec:appendixA" >
<p>
This appendix lists which packages (if any) from each category might be
included in the installation and gives my reasons for including or omitting
them. I made no attempt to install X so those categories are ignored.
</p>
<p>
Although this appendix refers specifically to the Slackware distribution
it can be used as a guide with any of the major distributions.
</p>
<sect1>
A - Base Linux System
<p>
Most of the packages in this category are essential, even those that aren't
listed as required by the Slackware set-up program. Because of this, I've listed
those packages that I felt could reasonably be left out rather than all the