Jump to content

Ubuntu installer

From Wikitech

The ubuntu-installer is an older version of the Debian installer. This page describes how it works in the Automated installation setup of Wikimedia.

Netboot

If the server is set to net boot, it requests network settings through DHCP at startup. The DHCP server assigns it an IP (which should be static in Wikimedia's setup) and gives it an IP address and filename of a TFTP server, where the server can retrieve its bootup files.

TFTP

The TFTP files consist of a PXELINUX image, which is "syslinux for netbooting". The config file used by PXELINUX is pxelinux.cfg, in the same directory as the PXELINUX image file pxelinux.0 itself. This configuration file consists of a number of different boot sets which specify a kernel and corresponding kernel parameters (boot options). The default automatic server install set is server, which should boot automatically after 10 seconds.

To automate the first part of the installation, a few parameters are included to the Linux kernel command line to suppress dialogs and questions until the Ubuntu installer can download its preseed configuration file, automating the rest of the install. These parameters (for Ubuntu 8.04) are:

base-installer/kernel/linux/extra-packages-2.6=
tasks=standard
pkgsel/language-pack-patterns= 
pkgsel/install-language-support=false 
vga=normal 
initrd=initrd.gz 
preseed/url=http://apt.wikimedia.org/autoinstall/preseed.cfg 
DEBCONF_DEBUG=5 
debian-installer/locale=en_US 
kbd-chooser/method=us 
console-setup/layoutcode=us 
netcfg/choose_interface=auto 
netcfg/get_hostname=unassigned 
netcfg/dhcp_timeout=60 -- 
console=tty0 
console=ttyS1,115200gn8

(no I don't know why console is in there twice.)

This specifies that the installer should skip the first questions about country, language and locale, and retrieve network settings using DHCP in order to download the preseed file. It will use the first interface with an established link, usually eth0.

Download preseed configuration

After the installer has detected the network interfaces and retrieved network settings through DHCP, it attempts to download the preseed.cfg over HTTP. Based on include directives in the preseed.cfg, it will download other included files as well, possibly depending on the cluster, the specific server or its task.

The preseed files are text files in debconf --set-selections format, that specify variables and their values which will be set in advanced (preseeded). These variables correspond to questions that are normally asked by the installer, but which will be skipped when preseeded with correct values.

Static network configuration

The first step after the preseed file download, is to redo network configuration, but this time do it statically instead of DHCP. DHCP is nice for automated installations, but we want statically configured servers in production. To achieve this without manual prompting, the preseed/early_command command finds the current, DHCP assigned static IP, preseeds it and then reruns the network configuration program (netcfg):

d-i     preseed/early_command   string  echo d-i netcfg/get_ipaddress string \
        $(ifconfig | grep "inet addr" | cut -d ' ' -f 12 | sed 's/addr://' | \
        grep -v 127\.0\.0\.1) > /tmp/static_net.cfg && \
        debconf-set-selections /tmp/static_net.cfg && killall.sh; netcfg; true

Only the IP address is taken from the DHCP network settings, the rest is meant to be specified in the preseed configuration files.