B.3. Creating a preconfiguration file
| Appendix B. Automating the installation using preseeding |

## B.3. Creating a preconfiguration file

The preconfiguration file is in the format used by the debconf-set-selections command. The general format of a line in a preconfiguration file is:

    <owner> <question name> <question type> <value>

There are a few rules to keep in mind when writing a preconfiguration file.

- Put only a single space or tab between type and value: any additional whitespace will be interpreted as belonging to the value.

- A line can be split into multiple lines by appending a backslash (“`\`”) as the line continuation character. A good place to split a line is after the question name; a bad place is between type and value. Split lines will be joined into a single line with all leading/trailing whitespace condensed to a single space.

- For debconf variables (templates) used only in the installer itself, the owner should be set to “d-i”; to preseed variables used in the installed system, the name of the package that contains the corresponding debconf template should be used. Only variables that have their owner set to something other than “d-i” will be propagated to the debconf database for the installed system.

- Most questions need to be preseeded using the values valid in English and not the translated values. However, there are some questions (for example in `partman`) where the translated values need to be used.

- Some questions take a code as value instead of the English text that is shown during installation.

The easiest way to create a preconfiguration file is to use the example file linked in Section B.4, “Contents of the preconfiguration file (for bionic)” as basis and work from there.

An alternative method is to do a manual installation and then, after rebooting, use the debconf-get-selections from the `debconf-utils` package to dump both the debconf database and the installer's cdebconf database to a single file:

    $ debconf-get-selections --installer > file
    $ debconf-get-selections >> file

However, a file generated in this manner will have some items that should not be preseeded, and the example file is a better starting place for most users.

| Note

This method relies on the fact that, at the end of the installation, the installer's cdebconf database is saved to the installed system in `/var/log/installer/cdebconf`. However, because the database may contain sensitive information, by default the files are only readable by root.

The directory `/var/log/installer` and all files in it will be deleted from your system if you purge the package `installation-report`.

To check possible values for questions, you can use nano to examine the files in `/var/lib/cdebconf` while an installation is in progress. View `templates.dat` for the raw templates and `questions.dat` for the current values and for the values assigned to variables.

To check if the format of your preconfiguration file is valid before performing an install, you can use the command debconf-set-selections -c `preseed.cfg`.

B.2. Using preseeding |  | B.4. Contents of the preconfiguration file (for bionic)