Technomancy

Automating an (Ed)Ubuntu install CD

written by rory, on Jul 28, 2009 9:42:00 PM.

(This is a repost from some archives, hence the references to an old version of Ubuntu. I've written scripts to automate a lot of this, in future there'll be a new post about how to do this anew)

I’m involved with Camara a charity that sends computers to Africa. We use Edubuntu on all the machines. Installing Edubuntu is tedious if you have to select the same options all the time. I’ve just finished automating the installation CD. This procedure should be similar for other Ubuntu/Debian based Linux OSs.

Prepare the CD image

Firstly, download the Edubuntu CD from http://ftp.esat.net/mirrors/releases.ubuntu.com/releases/edubuntu/edgy/edubuntu-6.10-install-i386.iso. You then have to ‘unpack’ the CD contents in order to change it.

sudo mount -o loop edubuntu-6.10-install-i386.iso ./cd
cp -rT ./cd ./cd-image
sudo umount ./cd
find ./cd-image -exec chmod +w '{}' ';'

This will mount the CD image onto the directory cd, then copy the contents to the directory cd-image.

After you’ve finished modifying the cd image, this script will create the CD again, ready for burning or emulation:

#! /bin/bash
IMAGE=camarabuntu.iso
BUILD=cd-image
mkisofs -r -V "Camarabuntu" \
              -cache-inodes \
-J -l -b isolinux/isolinux.bin \
-c isolinux/boot.cat -no-emul-boot \
-boot-load-size 4 -boot-info-table \
-o $IMAGE $BUILD

It creates a ISO in the current directory called ‘camarabuntu.iso’

Testing the CD with an emulator

Rather than burning it to a CD, I used qemu to emulate the PC. Create a 5GB file to serve as the harddisk with this command:

dd if=/dev/zero of=./hda.img bs=10M count=500

You can emulate the installation with this command:

qemu -cdrom camarabuntu.iso -hda ./hda.img -boot d

If you compile qemu from source you can avail of kqemu, the qemu accelerator, which makes x86 emulation very fast on x86 processors. You may have to run the qemu as root. Don’t forget to load the kqemu module with

modprobe kqemu

after compilation to load it.

Customizing the splash screen

The first thing I wanted to do was change the splash screen on the install CD. The Edubuntu on is
Edubuntu Install Splash
Modify the image in cd-image/isolinux/splash.pcx. To change the menu options, modify the file cd-image/isolinux/isolinux.cfg. My version is:

              DEFAULT /install/vmlinuz
GFXBOOT bootlogo
LABEL camarabuntu
       menu label ^Install Edubuntu
       kernel /install/vmlinuz
       append file=/cdrom/preseed/camarabuntu.seed initrd=/install/initrd.gz ramdisk_size=16384 root=/dev/ram rw quiet -- locale=en_IE console-setup/layoutcode=uk
LABEL check
       menu label ^Check CD for defects
       kernel /install/vmlinuz
       append MENU=/bin/cdrom-checker-menu initrd=/install/initrd.gz ramdisk_size=16384 root=/dev/ram rw quiet --
LABEL hd
       menu label ^Boot from first hard disk
       localboot 0x80
       append -
DISPLAY isolinux.txt
TIMEOUT 0
PROMPT 1
F1 f1.txt
F2 f2.txt
F3 f3.txt
F4 f4.txt
F5 f5.txt
F6 f6.txt
F7 f7.txt
F8 f8.txt
F9 f9.txt
F0 f10.txt

Which results in this splash screen:
Camarabuntu Install Splash

Automating the installer

Note the references to locale and keyboard layout in the kernel boot options, these values can’t be controlled in the preseed file because these are set before the preseed file is read. Put this in it’s own file in cd-image/preseed/camarabuntu.seed.

The preseed file I used is this:

# Set the installer language to Hiberno-English and UK keybaord layout
# Note: This are set before the cd is loaded, so they must be specified in the
# kernel options as so:
# locale=en_IE console-setup/layoutcode=uk
# These lines are incl
#d-i debian-installer/locale string ie_IE
#d-i console-setup/layoutcode string uk
## Network
d-i netcfg/choose_interface select auto
d-i netcfg/disable_dhcp boolean true
d-i netcfg/get_nameservers string 127.0.0.1
d-i netcfg/get_ipaddress string 127.0.0.1
d-i netcfg/get_netmask string 255.255.255.0
d-i netcfg/get_gateway string 127.0.0.1
d-i netcfg/confirm_static boolean trueable all networking, by not specifing anything here.
d-i mirror/http/proxy string

 
# Adjust the default hostname.
d-i netcfg/get_hostname  string camarabuntu
 
## Partitioning
# Put everything in one partition
d-i partman-auto/disk string /dev/hda
 
d-i partman-auto/choose_recipe \
       select All files in one partition (recommended for new users)
 
d-i partman/confirm_write_new_label boolean true
d-i partman/choose_partition \
       select Finish partitioning and write changes to disk
d-i partman/confirm boolean true
 
# Sync clock to UTC
d-i clock-setup/utc boolean true
 
# Set the timezone
d-i time/zone string Europe/Dublin
 
## user set up
# No root
d-i passwd/root-login boolean false
# But make a normal user
d-i passwd/make-user boolean true
 
# Set username & password
d-i passwd/user-fullname string Camara
d-i passwd/username string camara
d-i passwd/user-password password camara
d-i passwd/user-password-again password camara
 
# install grub in MBR, a handy default
d-i grub-installer/with_other_os boolean true
 
# Install the Edubuntu desktop and server.
tasksel tasksel/first    multiselect edubuntu-desktop, edubuntu-server
 
# don’t show us the ‘Installing successful’ dialog
d-i finish-install/reboot_in_progress note
 
# XServer set up.
xserver-xorg xserver-xorg/autodetect_monitor boolean true
xserver-xorg xserver-xorg/config/display/modes multiselect 1280×1024, 800×600, 640×480
xserver-xorg xserver-xorg/config/monitor/selection-method select medium
xserver-xorg xserver-xorg/config/monitor/mode-list select 1024×768 @ 60 Hz

Which completly automates the installation of Edubuntu. All this should be familiar if you have installed Edubuntu before.

References

Leave a Reply