Translation(s): English - Fran├žais

(!) ?Discussion

Preseed is a way to configure Debian packages. It can be likened to a response file centralized in /var/cache/debconf/config.dat

Manipulation tools of choice are debconf-set-selections and debconf-get-selections (provided by debpkg: debconf-utils)

Use Case

When you install a package with dpkg or its front-ends, you may need to provide some configuration data. But you won't want to answer those same questions every time the package is updated. Debconf manages this configuration information. Debconf presents questions to the user, and saves the answers in /var/cache/debconf/config.dat to restore the package when needed. You can query debconf to find out what information has been provided about a package.

As of Jessie, you can use the debconf-show command:

$ sudo debconf-show debconf
  debconf/frontend: Dialog

In older versions, the debconf-get-selections gives you all the information

# For the postfix package only
$ sudo debconf-get-selections | grep-B1 "^ postfix"

Note that if you want to change these responses, it is not debconf-set-selections, dpkg-reconfigure but you need to use (for replies to be really taken into account:

$ sudo dpkg-reconfigure postfix

Now suppose that you have already answered these questions on a machine and you want to avoid again on all machines that you will install. This time we will use debconf-set-selections that prerecords answers. Debconf therefore ask you not during installation:

# On the machine already installed
$ sudo debconf-get-selections | grep "^ postfix"> conf.txt

# On the new machine
$ sudo debconf-set-selections < conf.txt
$ sudo apt-get install postfix

This is called preseed and thanks to it we can install hundreds of machines without having to be in front of the screen.

See also