DEBCONF(7)
πΈ DEBCONF(7) β Miscellaneous Information Manual πΈ
okay bestie, sit down, we're learning debconf(7) and honestly? it's a whole vibe π
β¨ NAME β¨
debconf β the Debian package configuration system. yes queen, the thing that asks you all those questions when you install stuff π
π¦ DESCRIPTION π¦
So debconf is a configuration system for Debian packages. fr fr. There's also a rarely-used command named debconf, which is documented over in debconf(1) β we don't talk about her much π
Here's the slay: debconf gives you a consistent interface for configuring packages, and lets you pick from several different user interface frontends. It supports preconfiguring packages before they are installed, which means big installs and upgrades can ask you for literally everything up front, and then go do the work while you go do something else. main character energy honestly π
And if you're in a hurry? It lets you skip over less important questions and information while installing a package β and revisit them later. no stress, bestie π«Ά
π Preconfiguring packages
debconf can configure packages before they are even installed onto your system. The way that this is useful: all the questions the packages are going to ask get asked at the beginning of an install, so the rest of the install can just proceed while you're away getting a cup of coffee ββ¨
If you use apt (version 0.5 or above), and you have apt-utils installed, each package apt installs will be automatically preconfigured. This is controlled via /etc/apt/apt.conf.d/70debconf π₯
Sometimes you might want to preconfigure a package by hand, when you're not installing it with apt. You can use dpkg-preconfigure(8) to do that β just pass it the filenames of the packages you want to preconfigure. You will need apt-utils installed for that to work. that's the rule, i don't make them π
π Reconfiguring packages
Suppose you installed the package, and answered debconf's questions, but now that you've used it awhile, you realize you want to go back and change some of your answers. we've all been there. In the past, reinstalling a package was often the thing to do when you got in this situation β but when you reinstall the package, debconf seems to remember you have answered the questions, and doesn't ask them again (this is a feature, bestie, it's not a bug π).
Luckily, debconf makes it easy to reconfigure any package that uses it. Suppose you want to reconfigure debconf itself. Just run, as root:
dpkg-reconfigure debconf
This will ask all the questions you saw when debconf was first installed. It may ask you other questions as well, since it asks even low priority questions that may have been skipped when the package was installed. You can use it on any other package that uses debconf, as well. iconic behavior, honestly β
π Frontends
One of debconf's unique features is that the interface it presents to you is only one of many, and they can be swapped in at will. There are many debconf frontends available:
dialogβ The default frontend, this uses thewhiptail(1)ordialog(1)programs to display questions to you. It works in text mode. solid, reliable, the girl next door πreadlineβ The most traditional frontend, this looks quite similar to how Debian configuration always has been: a series of questions, printed out at the console using plain text, and prompts done using thereadlinelibrary. It even supports tab completion β¨ Thelibterm-readline-gnu-perlpackage is strongly recommended if you chose to use this frontend; the default readline module does not support prompting with default values. At the minimum, you'll need theperl-modulespackage installed to use this frontend.
This frontend has some special hotkeys. Pageup (or ctrl-u) will go back to the previous question (if that is supported by the package that is using debconf), and pagedown (or ctrl-v) will skip forward to the next question. shortcuts queen π
This is the best frontend for remote admin work over a slow connection, or for those who are comfortable with unix. iykyk π§
noninteractiveβ This is the anti-frontend. It never interacts with you at all, and makes the default answers be used for all questions. It might mail error messages toroot, but that's it; otherwise it is completely silent and unobtrusive β a perfect frontend for automatic installs. If you are using this front-end, and require non-default answers to questions, you will need to preseed the debconf database; see the section below on Unattended Package Installation for more details. the silent treatment, but make it productive πgnomeβ This is a modern X GUI using thegtkandgnomelibraries. Of course, it requires a validDISPLAYto work;debconfwill fall back to other frontends if it can't work. Note that this frontend requires you have thelibgtk3-perlpackage installed. pretty AND demanding, we respect it πkdeβ This frontend provides a modern X GUI based on the KDE Platform. You of course need aDISPLAYto use this frontend and you must installdebconf-kde-helperpackage. The frontend will fall back todialogif some of the prerequisites are not met. she knows her standards πeditorβ This is for those fanatics who have to do everything in a text editor. It runs your editor on a file that looks something like a typical unix config file, and you edit the file to communicate withdebconf. Debconf's author prefers to not comment regarding the circumstances that led to this frontend being written. πππ the lore is realwebβ This frontend acts as a web server, that you connect to with your web browser, to browse the questions and answer them. It has a lot of promise, but is a little rough so far. When this frontend starts up, it will print out the location you should point your web browser to. You have to run the web browser on the same machine you are configuring, for security reasons.
Do keep in mind that this is not a very secure frontend. Anyone who has access to the computer being configured can currently access the web server and configure things while this frontend is running. So this is more of a proof of concept than anything. bestie, pls be careful with this one π
You can change the default frontend debconf uses by reconfiguring debconf. On the other hand, if you just want to change the frontend for a minute, you can set the DEBIAN_FRONTEND environment variable to the name of the frontend to use. For example:
DEBIAN_FRONTEND=readline apt-get install slrn
The dpkg-reconfigure(8) and dpkg-preconfigure(8) commands also let you pass --frontend= to them, followed by the frontend you want them to use. options on options, we love to see it πΈ
Note that not all frontends will work in all circumstances. If a frontend fails to start up for some reason, debconf will print out a message explaining why, and fall back to the next-most similar frontend. she's got a backup plan always π«Ά
β Priorities
Another nice feature of debconf is that the questions it asks you are prioritized. If you don't want to be bothered about every little thing, you can set up debconf to only ask you the most important questions. On the other hand, if you are a control freak, you can make it show you all questions. Each question has a priority. In increasing order of importance:
lowβ Very trivial questions that have defaults that will work in the vast majority of cases. we're barely even trying here tbh π€mediumβ Normal questions that have reasonable defaults. the everyday girlie πΈhighβ Questions that don't have a reasonable default. now we're getting serious πcriticalβ Questions that you really, really need to see (or else). π¨ the drama of it all π¨
Only questions with a priority equal to or greater than the priority you choose will be shown to you. You can set the priority value by reconfiguring debconf, or temporarily by passing --priority= followed by the value to the dpkg-reconfigure(8) and dpkg-preconfigure(8) commands, or by setting the DEBIAN_PRIORITY environment variable. three ways, pick your fighter π
π Backend Database
debconf uses a rather flexible and potentially complicated backend database for storing data such as the answers to questions. The file /etc/debconf.conf is used to configure this database. If you need to set up something complicated, like make debconf read a remote database to get defaults, with local overrides, read the debconf.conf(5) man page for all the gory details π Generally, the backend database is located in /var/cache/debconf/.
more to come bestie, this was just part 1 π¦β¨
β¨ Unattended Package Installation β¨
okay so picture this: you've got like, a million machines to manage π« and sometimes you just gotta do an unattended install or upgrade of packages across all of them, except the default answers to some config questions are just... not it. not acceptable. so what do you do? there's actually a bunch of ways to approach this, but every single one of them involves setting up a database and making debconf use it to get the answers you want. that's the whole vibe π
bestie. fr fr go read debconf.conf(5) before you dive into this section. like actually. you need to understand how debconf's databases work or none of this is gonna make sense.
The easiest way to set up that database? Install the packages on one machine and answer all their questions like normal. Or, you could just use dpkg-preconfigure(8) to configure a set of packages without even installing them. Or honestly? You could raw-dog it and write a plain text debconf database by hand or something. no rules β¨
So once you've got your database, now you gotta figure out how to make the remote systems actually use it. And that, of course, depends on how those systems are configured and what database types they're set up to use. no cap.
If you're running the LDAP debconf database, then an entire network of debian machines can have any or all of their package installation questions answered automatically by a single LDAP server. iconic behavior honestly π
But maybe you're using something a lil easier to set up, like, say, the default debconf database configuration? Or maybe you just don't want your remote systems talking to LDAP 24/7? In that case, the best approach is to temporarily configure the remote systems to stack your database underneath their own existing databases, so they pull default values out of it. Debconf gives you two environment variables for this β DEBCONF_DB_FALLBACK and DEBCONF_DB_OVERRIDE β so you can do it on the fly, easy peasy. Here's a sample use:
cat /var/cache/debconf/config.dat | \
ssh root@target "DEBIAN_FRONTEND=noninteractive \
DEBCONF_DB_FALLBACK=Pipe apt-get upgrade"
What this does is make the debconf on the remote host read in the data piped across the ssh connection and interpret it as a plain text format debconf database. Then it uses that database as a fallback database β which is a read-only database that gets queried for answers to questions if the system's main debconf database is missing answers. cute, right? π
Here's another way to use the DEBCONF_DB_FALLBACK environment variable:
ssh -R 389:ldap:389 root@target \
"DEBCONF_DB_FALLBACK='LDAP{host:localhost}' apt-get upgrade"
Here ssh is used to set up a tunneled LDAP connection and run debconf, and debconf is told to use the LDAP server as the fallback database. Note the use of "{host:localhost}" to configure how debconf accesses the LDAP database by providing the "host" field with a value of "localhost". see what they did there π
And here's another method:
scp config.dat root@target:
ssh root@target "DEBCONF_DB_FALLBACK='File{/root/config.dat}' apt-get upgrade"
Here you copy the database over with scp, then ssh over and make debconf use the file you copied. This one also shows off a shorthand you can use in the DEBCONF_DB_FALLBACK parameters β if a field name is left off, it defaults to "filename". shortcuts, we love her π¦
ok but there's literally one problem with all these uses of theDEBCONF_DB_FALLBACKparameter: while the fallback database can provide answers to questions the other debconf databases have never seen, it's only ever queried as a fallback β after the other databases. so if you need to instead temporarily override an existing value on the remote host, you should use theDEBCONF_DB_OVERRIDEvariable instead. LikeDEBCONF_DB_FALLBACK, it sets up a temporary database, but this one is consulted before any others, so it can override existing values. periodt.
π§ Developing for Debconf π§
Package developers and anyone else who wants to build packages that use debconf should go read debconf-devel(7). required reading bestie, no skipping πΈ
So, briefly: debconf communicates with maintainer scripts or other programs via standard input and output, using a simple line-oriented command language that's similar to what common internet protocols like SMTP use. Programs use this protocol to ask debconf to display questions to the user and to retrieve the user's answers. The questions themselves are defined in a separate file called the "templates file", which has a format not unlike a debian control file. iykyk.
Debian packages that use debconf typically provide both a templates file and a "config" script (which gets run to preconfigure the package) in the control metadata section of the package. that's the whole package deal π
π ENVIRONMENT π
DEBIAN_FRONTENDβ used to temporarily change the frontend debconf uses. see above β¨DEBIAN_PRIORITYβ used to temporarily change the minimum priority of question debconf will display. see above β¨DEBCONF_DEBUGβ turns on debugging output on standard error. You can set it to a facility name, or to a regular expression that matches a facility name (like'.*'to output all debug info). The facility names include:userβ debugging info of interest to a debconf user.developerβ debugging info of interest to a package developer.dbβ debugging info about the backend database.
DEBCONF_NOWARNINGSβ set to"yes"to disable some warnings that debconf may display. Does not suppress display of fatal errors. just so you know πDEBCONF_TERSEβ set to"yes"to enable terse mode, in which debconf frontends cut down on the verbiage as much as possible. short queen energy, we stan πDEBCONF_DB_FALLBACKβ stack a database after the normally used databases, so that it's used as a fallback to get configuration information from. See"Unattended Package Installation"above. If the value of the variable is the name of an existing database indebconf.conf, then that database will be used. Otherwise, the environment variable can be used to configure a database on the fly, by telling the type of database, and optionally passingfield:valuesettings, inside curly braces after the type. Spaces are used to separate fields, so you cannot specify a field value containing whitespace. β οΈ
So, this uses the fallbackdb in debconf.conf:
DEBCONF_DB_FALLBACK=fallbackdb
While this sets up a new database of type File, and tells it a filename to use and turns off backups:
DEBCONF_DB_FALLBACK=File{Filename:/root/config.dat Backup:no}
And as a shorthand, this sets up a database of type File with a filename:
DEBCONF_DB_FALLBACK=File{/root/config.dat}
Note that if a fallback database is set up on the fly, it will be read-only by default. π
DEBCONF_DB_OVERRIDEβ stack a database before the normally used databases, so that it can override values from them. The value of the variable works the same as does the value ofDEBCONF_DB_FALLBACK. πDEBCONF_DB_REPLACEβ use a given database instead of the normally used databases. This may be useful for testing with a separate database without having to create a separatedebconf.conf, or to avoid locking the normal databases. lowkey so handy π«ΆDEBCONF_SYSTEMRCβ if this environment variable is set, debconf will ignore a user's~/.debconfrcfile and use the system one instead. If it's set to the name of a regular file, debconf will use that file in preference to the system configuration files. β¨DEBCONF_FORCE_DIALOGβ if this environment variable is set, debconf will usedialogin preference towhiptailfor the dialog frontend. πDEBCONF_FORCE_XDIALOGβ if this environment variable is set, debconf will useXdialogin preference towhiptailfor the dialog frontend. πDEBCONF_NONINTERACTIVE_SEENβ set to"true"to cause theseenflag to be set for questions asked in the noninteractive frontend. π
π BUGS π
Probably quite a few, there's a lot of code here. it's giving "trust the process" π
If you do file a bug report, be sure to include the following information:
- The debconf frontend you were using when the problem occurred
- What you did to trigger the problem.
- The full text of any error messages. If you can reproduce the bug, do so with
DEBCONF_DEBUG='.*'set and exported. This speeds up debugging a lot. seriously, do this one π
π₯ SEE ALSO π₯
π AUTHOR π
Joey Hess <joeyh@debian.org>
and that's the whole debconf(7) man page bestie!! πβ¨ this whole thing is straight out of the debconf(7) manual page itself (source and version are printed right there in its footer, along with the date it was generated) β so if you ever need the receipts, they're at the bottom of the real thing π go forth and configure, you absolute icon π¦π
π¦ where this page comes from
- debian trixie: debconf-doc 1.5.91 Β· BSD-2-Clause
- epel 10: debconf-doc 1.5.91-1.el10_1 Β· LicenseRef-Callaway-BSD
- epel 9: debconf-doc 1.5.91-1.el9 Β· LicenseRef-Callaway-BSD
- fedora 43: debconf-doc 1.5.91-5.fc43 Β· LicenseRef-Callaway-BSD
- fedora 44: debconf-doc 1.5.91-7.fc44 Β· LicenseRef-Callaway-BSD
- ubuntu noble: debconf-doc 1.5.86ubuntu1 Β· BSD-2-Clause
- ubuntu questing: debconf-doc 1.5.91
- ubuntu resolute: debconf-doc 1.5.92 Β· BSD-2-Clause
- ubuntu stonking: debconf-doc 1.5.92 Β· BSD-2-Clause
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms