Installing Debian on a laptop with only 32MB of RAM and a USB drive.

I have just successfully got the Debian installer to run on an old Compaq Armada with only ?32MB of RAM... without needing to use the local hard disk for swap (in the initial stages) this is how:

What you need:

Boot off the CD, do

 linux26

then when it comes up it will warn you that you have a critically low amount of RAM and advise you to mount some swap ASAP.

As soon as you have chosen your language etc you can switch over to tty2 (with <Alt-F2>) and set up the USB swap...

If you left it a little while and went over to tty4 (<Alt-F4>) you would find that the syslog tail would show that the installer process was running out of memory, being killed and endlessly looping:

 Feb 20 01:48:57 anna["3278"]: DEBUG: resolver (lowmem): mark
 Feb 20 01:48:57 anna["3278"]: DEBUG: resolver (bugreporter-udeb): mark
 Feb 20 01:48:57 anna["3278"]: DEBUG: resolver (mkreiserfs-udeb): mark
 Feb 20 01:48:57 anna["3278"]: DEBUG: resolver (wireless-tools-udeb): mark
 Feb 20 01:49:29 init: ^["MProcess"] '/sbin/debian-installer' (pid 537) exited.  Scheduling it for restart.
 Feb 20 01:49:29 init: ^["MStarting"] pid 4653, console /dev/vc/1: '/sbin/debian-installer'

OK... the process... firstly... the Sarge netinstall doesn't create device files for your USB devices, so you have to make them yourself:

 mknod /dev/sda b 8 0
 mknod /dev/sda1 b 8 1

 modprobe usb-storage

I skipped the next step because I had fdisked the card, and done mkfs.ext3 on it first... but if you don't want to wipe your card:

 modprobe vfat
 mkdir /mnt
 mount /dev/sda1 /mnt

Then I made a shell script on the card using nano, and ran it:

 #
 echo "Calculating free disk space on /dev/sda1 ..."
 FREE=$(df /dev/sda1 || grep /dev/sda1 || cut -c 41-50)
 let COUNT=FREE-1
 #
 echo "Creating $COUNT block swapfile /mnt/swapfile ..."
 dd if=/dev/zero of=/mnt/swapfile bs=1024 count=$COUNT
 #
 echo "Making swap ..."
 mkswap /mnt/swapfile
 #
 echo "Mounting swap ..."
 swapon /mnt/swapfile

Then you will find you should have enough free memory that the installer will work :o)

You will notice here that I made the swapfile 1 block smaller than the available free space. That was so I had somewhere to save my shell script as I was writing it. You may just want to use the whole free space, or even the raw device.

Here were some more notes I took:

 #
 # To do it without using fdisk (slightly slower)
 #
 dd if=/dev/zero of=/mnt/swapfile bs=1024
 # -rw-r--r--    1 root     root     14561280 Feb 20 01:19 /mnt/swapfile
 SIZE=$(ls -l /mnt/swapfile||cut -c 30-43)
 let FULL=SIZE/1024
 let COUNT=FULL-1
 dd if=/dev/zero of=/mnt/swapfile bs=1024 count=$COUNT
 #

 # fdisk -l /dev/sda

Unfortunately when it realises it has such low RAM it ditches any concept of being anywhere except in the US - so you loose any international options and have to set them up later, but at the end of the day this still is... another box claimed back for Debian!