Happy (Belated) Birthday IV! (19 Mar 2003)

I totally missed it, but IV (in it's current form) was 1 year old on March 11th. Woo!

I can now read what I was doing a year ago, which is nice. Oddly enough, I was doing pretty much the same thing... (read on)

Mass Installing Gentoo

Dept/Computing at Imperial has rather a lot of computers, as I'm sure you can guess. Nearly all of them install from a common base in order to keep the sysadmin tasks manageable. At the moment that base system is SuSE 7.2, with a few key packages upgraded (X, kernel, JDK and so on). Of course, SuSE 7.2 is getting a bit old now and we are looking for a new install for the coming year.

We are testing a lot of distros, but at the moment I'm trying Gentoo. Good points:

  • It's very easy to autoinstall because the packages shutup (see below)
  • It's very current

Bad points:

  • Since we cannot afford to build from source we have to install binary packages, thus they can only be optimised to fit the lowest class of CPU (PPro for us I believe)
  • Gentoo packages break a fair amount (missing dependencies etc)
  • The gentoo-sources kernel package is just crap

To autoinstall it I have a GRUB boot disk that TFTP/NFSroot boots a 2.4.20 kernel with init=/bin/bash. That (will, at the moment you have to type a command line) run a Python script that uses finds the IP of the box (kernel does DHCP), does a DNS lookup to get the hostname and uses a config file with regexps on the hostname to find a series of scripts to run.

I have a quick python module to handle writing partition tables, other than that the scripts are at the bottom (these aren't final by any means)

Everything is installed from binary packages built on a 2-way Xeon (which looks like a 4-way because of hyperthreading). The grub packages seem broken at the moment, however.

If you look at the scripts, all you need to do is mount the /usr/portage directory from the server and make /usr/portage/distfiles a tmp area.


/sbin/mkfs.xfs -f /dev/ide/host0/bus0/target0/lun0/part2
/sbin/mkswap /dev/ide/host0/bus0/target0/lun0/part1
swapon /dev/ide/host0/bus0/target0/lun0/part1
mount -n -t xfs /dev/ide/host0/bus0/target0/lun0/part2 /mnt
import partitions

def run():
        p = partitions.PartitionTable("/dev/ide/host0/bus0/target0/lun0/disc")
        p.add_size (0x82, 512, 0)
        p.add_size (0x83, -1, 1)
        p.write ()
cd /mnt
tar xjv < /stage1-x86-1.4_rc3.tar.bz2
mount -n --bind /usr/portage /mnt/usr/portage
mount -n --bind /mnt/tmp /mnt/usr/portage/distfiles
cp /etc/make.conf /mnt/etc/make.conf
cp /etc/resolv.conf /mnt/etc/resolv.conf
cp /etc/ /mnt/etc/
cp /config/gentoo-systems/internal /mnt/internal
chmod a+x /mnt/internal
chroot . /internal

cd /
umount /mnt

source /etc/profile
emerge -K gcc gettext glibc baselayout texinfo zlib binutils
ln -sf /usr/share/zoneinfo/Europe/London /etc/localtime
emerge -K system
emerge -K kde
emerge -K prelink
emerge -K sysklogd
emerge -K grub
emerge -K vim
emerge -K libogg
emerge -K libmng
mkdir -p /boot/grub
cd /boot/grub
cp -a /usr/share/grub/i386-pc/* .
printf "root (hd0,1)\nsetup (hd0)\n" | grub

umount /usr/portage/distfiles
swapoff /swap
umount /usr/portage
umount /dev
umount /proc
mkdir /lib/modules/2.4.20-xfs