B.1. Introduction
| Appendix B. Automating the installation using preseeding |

## B.1. Introduction

Preseeding provides a way to set answers to questions asked during the installation process, without having to manually enter the answers while the installation is running. This makes it possible to fully automate most types of installation and even offers some features not available during normal installations.

Preseeding is not required. If you use an empty preseed file, the installer will behave just the same way as in a normal manual installation. Each question you preseed will (if you got it right!) modify the installation in some way from that baseline.

### B.1.1. Preseeding methods

There are three methods that can be used for preseeding: initrd, file and network. Initrd preseeding will work with any installation method and supports preseeding of more things, but it requires the most preparation. File and network preseeding each can be used with different installation methods.

The following table shows which preseeding methods can be used with which installation methods.

Installation method | initrd | file | network
--- | --- | --- | ---
CD/DVD | yes | yes | yes[a]
netboot | yes | no | yes
hd-media | yes | yes | yes[a]
[a] but only if you have network access, and set `preseed/url` appropriately

An important difference between the preseeding methods is the point at which the preconfiguration file is loaded and processed. For initrd preseeding this is right at the start of the installation, before the first question is even asked. Preseeding from the kernel command line happens just after. It is thus possible to override configuration set in the initrd by editing the kernel command line (either in the bootloader configuration or manually at boot time for bootloaders that allow it). For file preseeding this is after the CD or CD image has been loaded. For network preseeding it is only after the network has been configured.

| Important

Obviously, any questions that have been processed before the preconfiguration file is loaded cannot be preseeded (this will include questions that are only displayed at medium or low priority, like the first hardware detection run). A not so convenient way to avoid these questions from being asked is to preseed them through the boot parameters, as described in Section B.2.2, “Using boot parameters to preseed questions”.

| Important

In order to easily avoid the questions that would normally appear before the preseeding occurs, you can start the installer in “auto” mode. This delays questions that would normally be asked too early for preseeding (i.e. language, country and keyboard selection) until after the network comes up, thus allowing them to be preseeded. It also runs the installation at critical priority, which avoids many unimportant questions. See Section B.2.3, “Auto mode” for details.

### B.1.2. Limitations

Although most questions used by `debian-installer` can be preseeded using this method, there are some notable exceptions. You must (re)partition an entire disk or use available free space on a disk; it is not possible to use existing partitions.

### B.1.3. Debconf basics

Preseeding makes use of the `debconf` framework. This framework is the preferred mechanism used in Ubuntu to interact with the user when configuring packages and also forms the heart of `debian-installer`. In the `debconf` framework questions or dialogs are based on templates. There are different types of templates for different types of questions. The actual questions are “generated” from templates at runtime; multiple questions can use the same template.

The following types of templates are relevant for preseeding.

- string: allows the user to type any value

- password: similar to string but the value typed is not displayed

- boolean: for yes/no or true/false type of questions

- select: allows the user to select one option from a list

- multiselect: allows the user to select zero, one or more options from a list

- note: used to display a message

In `debian-installer` templates are stored in a readable file `/var/cache/debconf/templates.dat`. This file contains all fixed text and all translations. It can also contain a default value for the template. The fixed text can include variables that will be replaced at runtime.

Another readable file `/var/cache/debconf/questions.dat` is used to store the values for variables and the answers given to questions. A question always refers to the template used to ask it. For obvious security reasons the values for questions of type “password” are stored in a separate, non-readable file in the same directory.

Appendix B. Automating the installation using preseeding |  | B.2. Using preseeding