Andrew Mercer
on this page

Preseeding answers debian-installer's questions ahead of time by pre-loading values into debconf, the configuration-question database Debian packages use. It predates and is more granular than Autoinstall (which superseded it on Ubuntu specifically); Debian itself, and derivatives that still use debian-installer, continue to use preseed files directly.

File format

Each line is <owner> <question-name> <question-type> <value>:

# /preseed.cfg

d-i debian-installer/locale string en_US.UTF-8
d-i keyboard-configuration/xkb-keymap select us

d-i netcfg/choose_interface select auto
d-i netcfg/get_hostname string server01
d-i netcfg/get_domain string example.com

d-i passwd/root-login boolean false
d-i passwd/user-fullname string Admin User
d-i passwd/username string admin
d-i passwd/user-password-crypted password $6$roundsaltedhashhere

d-i clock-setup/utc boolean true
d-i time/zone string America/Toronto

# Partitioning — "atomic" recipe = one big root partition
d-i partman-auto/method string regular
d-i partman-auto/choose_recipe select atomic
d-i partman-partitioning/confirm_write_new_label boolean true
d-i partman/choose_partition select finish
d-i partman/confirm boolean true
d-i partman/confirm_nooverwrite boolean true

tasksel tasksel/first multiselect standard, ssh-server
d-i pkgsel/include string chrony vim

d-i grub-installer/only_debian boolean true
d-i finish-install/reboot_in_progress note

d-i preseed/late_command string \
    in-target systemctl enable chrony

d-i is the debian-installer owner most lines use; tasksel/pkgsel questions belong to those packages specifically.

Debconf priority and how much gets asked

The install can run at different debconf priority levels; priority=critical on the boot line suppresses everything but truly critical unanswered questions, which is what makes a preseed file fully unattended as long as it actually answers everything that isn't critical:

auto url=http://<server>/preseed.cfg priority=critical

Partman recipes for more control

The atomic recipe above is the simple case (one big /). Custom partman-auto/expert_recipe strings give LVM, separate /boot, /home, swap, etc. — the syntax is dense; base a custom recipe on the Debian Installer partman-auto documentation examples rather than writing one from scratch.

Generate a starting file from an existing install

sudo debconf-get-selections --installer > preseed-installer.cfg
sudo debconf-get-selections > preseed-packages.cfg

Run on a machine already installed the way you want, this dumps its current debconf answers in preseed format — often a faster starting point than hand-writing one, similar in spirit to reusing anaconda-ks.cfg on the Kickstart side.

Delivering the file

# HTTP (works well with PXE, see that page)
auto url=http://<server>/preseed.cfg priority=critical

# From the install media itself, preseed/file instead of preseed/url
file=/cdrom/preseed.cfg priority=critical

Validate

There isn't a standalone linter equivalent to Kickstart's ksvalidator; the practical check is running the install (often in a VM) and watching whether any question you expected to be preseeded still prompts — an unanswered question at priority=critical means either a typo in the question name or a value debconf rejected.