Table of Contents
The examples in this chapter reflect the status of the Installer during the development of Squeeze, and are based on the CD-ROM and netboot installation methods for x86 (the i386 and amd64 architectures). The choice for x86 was made as this is most familiar to most users, but installations for other architectures are not structurally different.
So what are the basic steps when the installer is run? In any installation five stages can be distinguished.
The first three stages are where the fundamental difference between installation methods can be seen. All components (udebs) used there need to be included in the initrd with which the installer is booted.
The table below shows what components are involved in the first and second stage for the CD-ROM and netboot installation methods and also shows where these differ.
|1||cdrom-detect||ethdetect||Hardware detection and setup|
|-||file-preseed||network-preseed||If selected at boot prompt|
|2||load-cdrom (anna)||download-installer (anna)||Retrieve and unpack additional components|
|3||ethdetect||Hardware detection and setup|
|3||choose-mirror||Mirror selection (only if the base system is not installable from CD)|
|3||clock-setup||Set up clock and time zone|
The remainder of the installation is basically the same for all installation methods.
|4||hw-detect||Additional hardware detection|
|4||partman||Partitioning, file system creation and mount point selection|
|5||base-installer||Base system (debootstrap) & kernel installation|
|5||user-setup||Set up root and normal user accounts|
|5||apt-setup||APT configuration in the target system (sources.list)|
|5||pkgsel||Select and install additional packages (tasksel)|
|5||grub/lilo-installer; nobootloader||Boot loader installation|
|5||finish-install||Finish up the installation and reboot|
The installer supports a lot of different installation methods and in some cases installation methods can be creatively combined. The definition of an installation method is based on the following questions.
The table below shows the answers to these questions for the most common installation methods.
|netboot||network (TFTP server)||network||network||network|
|full CD/DVD||CD||CD||CD||CD (+ network)|
|hd-mediaa)||harddisk/USB stick||CD image||CD image/network||CD image/network|
a) Whether packages for the base system and tasks are retrieved from CD (image) or the network depends on the type of CD used in combination with these boot methods.
b) Unfortunately there are no longer any architectures that support booting from floppy. The main reason is the increased size of the Linux kernel.
The boot process for the installer is similar to the boot of a regular
system. A bootloader (in some cases the system's firmware) is responsible
for loading the kernel and loading the initrd after which init is started.
The boot process can be debugged by adding the
It is possible to pass additional kernel and boot parameters. Kernel parameters are sometimes needed to get non-conformant hardware supported, or to install from serial console instead of an attached keyboard/display.
Boot parameters can also be used to influence the installer itself. More about this in the section on preseeding.
The boot process is quite complex as it has evolved needing to support several generations of linux, with changes in e.g. the kernel and udev.
The following enumeration gives an overview of the main steps in the boot process.
Sets up initial environment (
/dev; run udev)
/etc/inittab is parsed; this contains:
This is a run-parts like script that executes or sources scripts in
/lib/debian-installer-startup.d. The main functions
that are performed are:
<) and set these in the debconf database
This is a run-parts like script that sources scripts in
These scripts will be run again if the main installer process dies for some
reason. The main functions that are performed are:
main-menu(see next section)
See also Section B.1.1, “System boot”.
main-menu drives the rest of the
installation. It is responsible both for dynamically assembling the menu
and for executing components when they are selected. Note that the menu
is only actually visible when installing at low or medium debconf priority.
At higher priorities it is still there, but it will automatically execute
the next component without showing the menu to the user.
In some situations the debconf priority is automatically changed. It is
reduced when the execution of a component fails, or when the user uses the
<Go Back> button to back out all the way to
the menu. In these cases it will also be increased back to the original
level when the next component executed finishes successfully.
An important characteristic of udebs is that execution of their postinst scripts is delayed. On installation udebs are only unpacked; the execution of the postinst is done by main-menu and is actually what happens when a component is selected in the menu. In other words, main-menu can be said to be responsible for “configuring” the udeb.
For a component to be included in the menu, it needs to have an
Installer-Menu-Item line in the
status file (
/var/lib/dpkg/status). The order of
components in the menu is determined primarily by its dependencies; the
menu item number is used only where the order for two or more components
cannot be resolved by dependencies alone.
Provides can be used to define virtual states which other components can depend on, as shown in the next example.
Package: netcfg Status: install ok installed Version: 1.52 Provides: configured-network Depends: libc6-udeb (>= 2.10), libdebconfclient0-udeb, libdebian-installer4-udeb (>= 0.69), libiw30-udeb (>= 30~pre1), ethernet-card-detection Description: Configure the network Installer-Menu-Item: 1800 Package: choose-mirror Status: install ok unpacked Version: 2.32 Depends: configured-network, choose-mirror-bin Description: Choose mirror to install from Installer-Menu-Item: 2300
This example also shows that netcfg has been run successfully (“installed”) while mirror selection has not yet taken place (“unpacked”).
Some components are included in the menu but are not run by default. These
components have a menu number higher than 90000 and are listed after
finish-install in the menu. Examples are
components that allow to change the debconf priority, to save debug logs,
to check the integrity of a CD-ROM or to abort the installation.
At certain points in the installation, components provide run-parts like execution of scripts. This allows other components to just drop scripts there so that commands can be run at that point in the installation, even though the postinst for the component itself is run earlier or later (if the component even has a postinst).
Besides these general hooks, partman is basically structured as one big
collection of hooks where partman components all drop their own scriptlets
to extend partman's functionality. The most noteworthy of these hooks is
/lib/partman/finish.d as some bootloaders drop scripts
there to add checks that ensure the selected partitioning scheme conforms to
The installer has some special commands which can be used in postinst or preseeding scripts:
Used to install additional, non-standard d-i components (udebs). It will
anna has already been run. If it has, the
component is unpacked immediately; if it has not, it will be scheduled for
anna is run.
Performs the same function for normal packages and installs them in the target system. Packages will either be installed immediately (if called after base-installer) or scheduled for installation as one of the “extra” packages installed near the end of base-installer's postinst script.
Allows to run a command and redirect its output (either
stderr or both) to
Allows to run a command in a chroot on
the chroot being set up for more demanding operations. For example,
sysfs are mounted and
policy-rc.d is created. Can obviously only be used
after the base system has been set up.
README in the source for debian-installer-utils
for more detailed information.
There are three preconfiguration methods that are currently supported:
The preconfiguration file
/preseed.cfg needs to be
present in the initrd. It is read as part of the
Triggered by the presence of the
Triggered by the presence of the
boot parameter. It is also possible to trigger this from the DHCP server.
Which of these methods is available depends on the installation method.
The main purpose of preseeding is to set default values for debconf questions. Note that it makes no sense when using file or network preseeding to preseed values for questions that are asked before the preconfiguration file is parsed.
Besides offering the option to set default values for debconf questions,
preseeding also makes it possible to run scripts at two distinct moments
early_command is executed immediately after the
preconfiguration file is parsed (only for file and network preseeding);
late_command is executed as part of the
These scripts can be made as complex as you like. One option is to use them
to install additional packages on the target system (using
could be used to install additional d-i components (using
anna-install) or to install scripts in the various hook
script directories (if commands need to be executed at a specific point in
Additional information about preseeding is available in an appendix of the Installation Guide.
Because most of the installer is scripted, it is fairly easy to debug most
problems by adding a
set -x in the correct place.
The obvious place to start is the postinst of the component you want to
debug. The output will appear in
which can most easily be viewed by starting the internal webserver from the
“Save debug logs” menu option (after the network has been
For components written in C debugging is a bit harder. Options are to use the strace udeb (add it to a custom image if needed) or to create a custom version of a component with added debug statements in the source and use that.
For debugging, you will probably want to control when components are started.
Booting the installer with
is a good way to achieve that. It will make sure the menu is displayed before
a new component is started.
If you boot the installer at medium priority, you will also be able to load
the optional component
openssh-client-udeb. Loading this component will allow you to use scp
to copy files from the system being installed to another computer and vice
versa. Also useful for testing new versions of scripts or commands without
rebuilding the udeb and image. The command nc from the
netcat package is available by default in the installer.
 The mips architectures currently do not use partman for partitioning, file system creation and mount point selection but instead use other components. Some architectures also use specific additional components as part of their default installation. However, this does not make them structurally different.
 With one exception. In floppy disk based installations, the initrd does not contain all needed components for stage 2, but it does have the ability to load additional components that belong to stage 1 or are needed for stage 2 from additional floppy disks.
The last question can also be rephrased as “what source lines are set
up in the
/etc/apt/sources.list file for the target
 If you want to load optional components when installing at the default priority, you need to back out to the menu, change the debconf priority to medium or low, and then select the component that installs additional installer components. After you've installed the desired components, the debconf priority can then be changed back to its original value.