6.3 Unattended Installations with Preseeding
Key Takeaways
- Preseeding feeds the Debian-Installer a file of pre-answered debconf questions so the install runs without interaction
- Boot parameter preseed/url=http://... fetches the answers from a web server; preseed/file=... reads them from the installation media
- Key directives cover locale, keyboard, network, the passwd/* user settings, partman-auto partitioning recipes, package selection, and GRUB
- The auto=true priority=critical parameters suppress remaining prompts so the install is fully hands-off
- Any question not answered in the preseed file is still asked interactively unless priorities and auto mode are set correctly
6.3 Unattended Installations with Preseeding
Quick Answer: A preseed file is a plain-text list of answers to the Debian-Installer's debconf questions. Boot the installer with
preseed/url=http://server/kali.cfg(orpreseed/file=/cdrom/kali.cfgfor media-resident files), addauto=true priority=critical, and the entire installation — locale, user, partitioning, packages, GRUB — completes with zero keyboard input.
One Kali install is a tutorial; fifty identical installs is a chore. Preseeding exists for the second case. The Kali installer is Debian-Installer under the hood, and Debian-Installer is driven by debconf, the Debian configuration system that asks every question you saw in section 6.2. Each of those questions has a registered name, and a preseed file simply supplies answers to those names in advance. When the installer reaches a question whose answer is already seeded, it skips the prompt and uses your value.
The practical use cases are exactly what the exam expects you to recognize:
- Repeatable lab builds — rebuild an identical attack box every semester or every engagement without clicking through fifteen screens.
- Enterprise or classroom rollouts — dozens of identical machines from one golden configuration.
- PXE/network installs — combine preseeding with network booting and machines can be provisioned with no physical media at all.
Pointing the Installer at the Answers
You pass the preseed location as a boot parameter. At the installer boot menu, press Tab (or Esc, depending on the frontend) to edit the boot command line and append one of:
| Parameter | Effect |
|---|---|
preseed/url=http://192.168.1.10/kali.cfg | Download the preseed file from a web server |
preseed/file=/cdrom/preseed/kali.cfg | Read the file from the installation media itself |
auto=true priority=critical | Enable auto mode and only ask questions of critical priority |
hostname=kali-lab domain=local | Seed individual answers directly on the command line |
The preseed/url form is the workhorse for labs: put the file on any web server (even python3 -m http.server on another machine) and every install pulls the same answers. The preseed/file form suits custom-remastered media. The auto=true priority=critical combination delays the locale and keyboard questions — the ones the installer would otherwise ask before networking exists — until the preseed file has had a chance to answer them, and suppresses everything except critical questions — this is what turns a mostly-automatic install into a fully unattended one.
A critical behavioral detail: any question not answered by the preseed file is still asked interactively. A file that covers partitioning but forgets the mirror question stops and waits at the mirror screen. Fully unattended installs require a complete file plus the auto parameters, and you should always test the file in a VM before trusting it on real hardware.
Anatomy of a Preseed File
Preseed directives are four whitespace-separated fields: owner question-name question-type value — for example d-i + debian-installer/locale + string + en_US. For Debian-Installer questions the owner is d-i. Here is a condensed but realistic file for an unattended Kali install, grouped by the installer stage it controls:
### Localization
d-i debian-installer/locale string en_US
d-i keyboard-configuration/xkb-keymap select us
### Network
d-i netcfg/choose_interface select auto
d-i netcfg/get_hostname string kali-lab
d-i netcfg/get_domain string local
### Mirror
d-i mirror/http/hostname string http.kali.org
d-i mirror/http/directory string /kali
### User setup (non-root, matching the 2020.1+ model)
d-i passwd/user-fullname string Kali User
d-i passwd/username string kali
d-i passwd/user-password password S3cur3P@ss
d-i passwd/user-password-again password S3cur3P@ss
### Clock and time zone
d-i clock-setup/utc boolean true
d-i time/zone string US/Eastern
d-i clock-setup/ntp boolean true
### Partitioning: guided LVM, everything in one volume
d-i partman-auto/method string lvm
d-i partman-auto/choose_recipe select atomic
d-i partman/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
### Packages and desktop
tasksel tasksel/first multiselect standard
d-i pkgsel/include string openssh-server
d-i pkgsel/upgrade select full-upgrade
### Bootloader
d-i grub-installer/only_debian boolean true
d-i grub-installer/bootdev string /dev/sda
### Finish without prompting
d-i finish-install/reboot_in_progress note
The lines that earn the most exam attention:
d-i passwd/username string kali— seeds the standard non-root account; preseeding does not resurrect the old root/toor model.d-i partman-auto/method string lvm— selects the guided partitioning method. Useregularfor plain partitions orcryptofor encrypted LVM;choose_recipe select atomicmeans all files in one partition.- The
partman/confirm*booleans — without these three confirmations the installer stops at the write-changes screen, which is the single most common reason a first preseed attempt hangs. d-i grub-installer/bootdev string /dev/sda— answers the GRUB device question for BIOS systems.
For post-install customization, d-i preseed/late_command string ... runs shell commands in the installer environment just before reboot, with the new system still mounted at /target; prefix a command with in-target (or chroot into /target) to run it inside the installed system — useful for dropping SSH keys, enabling services, or cloning configuration from a Git repository. You do not have to invent every directive from memory. The fastest source of real answers is to install one machine by hand and run debconf-get-selections --installer (from the debconf-utils package) to dump every answer the installer recorded, plus plain debconf-get-selections for package-owned questions; debconf-set-selections loads such a file back into the debconf database. The Debian project also publishes a full annotated example preseed file, and the Kali documentation adapts it for Kali specifics such as the mirror settings and the non-root user model, so start from those references and trim them to your environment.
Build the file incrementally: get localization and user working, then add partitioning, then packages, testing each iteration in a throwaway VM. A working preseed file plus one boot parameter replaces every click in section 6.2, and the file itself becomes version-controlled documentation of exactly how your lab machines are built.
Which boot parameter tells the Kali installer to download its preseed answers from a web server during an unattended install?
In a preseed file, what does the directive d-i passwd/username string kali configure?