Last modified: Mon Oct 13 13:45:51 EDT 2008
Back in the early days, I ran Linux 1.X on a 33 MHz 386DX with only 2 MiB RAM. Even X11 ran, albeit swappily. So in 2008-10, when I salvaged a 486 with only 8 MiB RAM, I thought it reasonable to attempt to install a current Linux kernel and Slackware distribution on it.
It was not easy.
Udev kills you in two ways. First, it needs a lot of memory just to run. Slackware doesn't normally enable swap until after udev is started; that's a problem. Second, rc.udev mounts a tmpfs over /dev, and that also runs out of memory. I thought a tmpfs would go into swap if it got too big, but it just wouldn't work no matter what size I gave it.
Enabling swap early to fix the first problem is easy enough. The fix for the second problem is a bit more esoteric. Instead of mounting tmpfs over /dev, I mounted an actual physical partition on the hard drive.
Following is the hack to rc.udev that makes it work, using /dev/sda1 as the surrogate tmpfs:
*** /etc/rc.d/rc.udev 2008-10-12 20:51:11.000000000 -0400 --- rc.udev 2008-10-12 20:50:57.649395503 -0400 *************** *** 73,79 **** # Mount tmpfs on $UDEV_ROOT: # the -n is because we don't want $UDEV_ROOT umounted when # someone (rc.) calls umount -a ! mount -n -o mode=0755 -t tmpfs tmpfs $UDEV_ROOT # Remount pts: mkdir $UDEV_ROOT/pts 2> /dev/null --- 73,86 ---- # Mount tmpfs on $UDEV_ROOT: # the -n is because we don't want $UDEV_ROOT umounted when # someone (rc.) calls umount -a ! echo "Executing low memory udev workaround" ! echo "- Activating swap early" ! /sbin/swapon -a ! echo "- Wiping physical /dev partition" ! mke2fs -m 0 /dev/sda1 >& /dev/null ! echo "- Mounting physical /dev partition" ! mount -n -t ext2 /dev/sda1 $UDEV_ROOT ! echo "Low memory udev workaround completed." # Remount pts: mkdir $UDEV_ROOT/pts 2> /dev/null
It sucks, of course. The 486 boots really fast if I exclude significant kernel functions and disable stuff, but I want all the foo-foo. With this kernel config and all the usual daemons enabled (including udevd, hald, syslogd, klogd, and dbus-daemon, but not the cache updaters), it takes 3 minutes and 3 seconds to boot from LILO prompt to login prompt and stop all disk activity. I am able to run small programs without difficulty. Larger programs and X11 run too, but with lots of swapping.