B.1. 介绍

预置提供了一种在安装过程中回答问题,而无须手动键入答案的途径。这让完全自动进行大多数的安装成为可能,并提供了一些普通安装方式下不具备的特性。

预置文件并非必须。如果您使用空的预置文件,安装程序就会跟正常手动安装一样。每个问题的预置(如果使用正确!)都会以同样的方式修改对应的基准。

B.1.1. 预置方法

一共有三种方法可用于预置: initrdfilenetwork。initrd 方法可以用于任何一种安装方式并支持较多的预置内容,但它需要做的准备工作也最多。file 和 network 方法分别用于不同的安装方式。

下面的表格显示了各种安装方式可选择的预置方法。

安装方式 initrd file network
CD/DVD/USB yes yes yes[a]
netboot yes no yes
硬盘 (包括 U 盘) yes yes yes[a]

[a] 除非您有网络并正确设置 preseed/url

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 installation image has been loaded. For network preseeding it is only after the network has been configured.

[重要] 重要

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 第 B.2.2 节 “使用引导参数预置问题的答案”.

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 第 B.2.3 节 “auto 模式” for details.

B.1.2. 限制

虽然使用这种方法能预先设置 debian-installer 的绝大多数问答,但还是有明显的例外。您必须(重新)分区整个硬盘,或者使用磁盘上的剩余空间; 但无法使用已经存在的分区。