4.3. Unattended Installations
The Debian and Kali installers are very modular: at the basic level, they are just executing many scripts (packaged in tiny packages called udeb—for µdeb or micro-deb) one after another. Each script relies on
debconf Tool), which interacts with you, the user, and stores installation parameters. Because of this, the installer can also be automated through debconf preseeding, a function that allows you to provide unattended answers to installation questions.
4.3.1. Preseeding Answers
There are multiple ways to preseed answers to the installer. Each method has its own advantages and disadvantages. Depending on when the preseeding happens, the questions that can be preseeded vary.
22.214.171.124. With Boot Parameters
You can preseed any installer question with boot parameters that end up in the kernel command-line, accessible through
/proc/cmdline. Some bootloaders will let you edit these parameters interactively (which is practical for testing purposes), but if you want to make the changes persistent, you will have to modify the bootloader configuration.
You can directly use the full identifier of the debconf questions (such as
debian-installer/language=en) or you can use abbreviations for the most common questions (like
hostname=duke). See the full list of aliases in the Debian installation manual.
There is no restriction on which questions you can preseed since boot parameters are available from the start of the installation process and they are processed very early. However, the number of boot parameters is limited to 32 and a number of those are already used by default. It is also important to realize that changing the boot loader configuration can be non-trivial at times.
In Section 9.3, “Building Custom Kali Live ISO Images” you will also learn how to modify the Isolinux configuration when you generate your own Kali ISO image.
126.96.36.199. With a Preseed File in the Initrd
You can add a file named
preseed.cfg at the root of the installer’s
initrd (this is the initrd which is used to start the installer). Usually, this requires rebuilding the debian-installer source package to generate new versions of the initrd. However,
live-build offers a convenient way to do this, which is detailed in Section 9.3, “Building Custom Kali Live ISO Images”.
This method also does not have any restrictions on the questions that you can preseed as the preseed file is available immediately after boot. In Kali, we already make use of this feature to customize the behaviour of the official Debian installer.
188.8.131.52. With a Preseed File in the Boot Media
You can add a preseed file on the boot media (CD or USB key); preseeding then happens as soon as the media is mounted, which means right after the questions about language and keyboard layout. The
preseed/file boot parameter can be used to indicate the location of the preseeding file (for instance,
/cdrom/preseed.cfg when installing from a CD-ROM, or
/hd-media/preseed.cfg when installing from a USB-key).
You may not preseed answers to language and country options as the preseeding file is loaded later in the process, once the hardware drivers have been loaded. On the positive side,
live-build makes it easy to put a supplementary file in the generated ISO images (see Section 9.3, “Building Custom Kali Live ISO Images”).
184.108.40.206. With a Preseed File Loaded from the Network
You can make a preseed file available on the network through a web server and tell the installer to download that preseed file by adding the boot parameter
preseed/url=http://server/preseed.cfg (or by using the
However, when using this method, remember that the network must first be configured. This means that network-related debconf questions (in particular hostname and domain name) and all the preceding questions (like language and country) cannot be preseeded with this method. This method is most often used in combination with boot parameters preseeding those specific questions.
This preseeding method is the most flexible one as you can change the installation configuration without changing the installation media.
4.3.2. Creating a Preseed File
A preseed file is a plain text file in which each line contains the answer to one Debconf question. A line is split across four fields separated by white space (spaces or tabs). For instance,
d-i mirror/suite string kali-rolling:
The first field indicates the owner of the question. For example, “d-i” is used for questions relevant to the installer. You may also see a package name, for questions coming from Debian packages (as in this example:
atftpd atftpd/use_inetd boolean false).
The second field is an identifier for the question.
The third field lists the type of question.
The fourth and final field contains the value for the expected answer. Note that it must be separated from the third field with a single space; additional space characters are considered part of the value.
The simplest way to write a preseed file is to install a system by hand. Then the
debconf-get-selections --installer command will provide the answers you provided to the installer. You can obtain answers directed to other packages with
debconf-get-selections. However, a cleaner solution is to write the preseed file by hand, starting from an example and then going through the documentation. With this approach, only questions where the default answer needs to be overridden can be preseeded. Provide the
priority=critical boot parameter to instruct Debconf to only ask critical questions, and to use the default answer for others.