4

Let's say I want to install mysql from a script without being asked any configuration questions like what root password I want to set by apt. I would then preset the debconf variables:

echo mysql-server-5.5 mysql-server/root_password password xyzzy | debconf-set-selections
echo mysql-server-5.5 mysql-server/root_password_again password xyzzy | debconf-set-selections

I got this from a tutorial. What is unclear to me: How did the guy find out the variable names? How did he knew that he had to set mysql-server-5.5 mysql-server/root_password password and mysql-server-5.5 mysql-server/root_password_again respectively?

I know I could extract the .deb package by issuing dpkg-deb -R package.deb EXTRACTDIR/ - but I don't see where those variables are stored.

How would I find out the debconf variables for any other package?

0

You can inspect what gets stored in debconf using debconf-get-selections. This is useful if you have actually done the installation already.

Alternately, these settings are used in the package maintainer scripts. With the dpkg-deb command you have run, these are in the DEBIAN subdirectory of EXTRACTDIR.

As an example, from lightdm:

$ grep db_ lightdm/DEBIAN -R
lightdm/DEBIAN/postrm:  db_purge
lightdm/DEBIAN/prerm:    db_unregister shared/default-x-display-manager
lightdm/DEBIAN/prerm:    if db_get shared/default-x-display-manager; then
lightdm/DEBIAN/prerm:      db_metaget shared/default-x-display-manager owners
lightdm/DEBIAN/prerm:      db_subst shared/default-x-display-manager choices "$RET"
lightdm/DEBIAN/prerm:      db_get shared/default-x-display-manager
lightdm/DEBIAN/prerm:     if db_get "$RET"/daemon_name; then
lightdm/DEBIAN/prerm:        db_fset shared/default-x-display-manager seen false
lightdm/DEBIAN/prerm:        db_input critical shared/default-x-display-manager || true
lightdm/DEBIAN/prerm:        db_go
lightdm/DEBIAN/prerm:          db_get shared/default-x-display-manager
lightdm/DEBIAN/prerm:          db_get "$RET"/daemon_name
lightdm/DEBIAN/postinst:  if db_get shared/default-x-display-manager; then
lightdm/DEBIAN/postinst:    if db_get "$DEFAULT_DISPLAY_MANAGER"/daemon_name; then
lightdm/DEBIAN/postinst:db_stop
lightdm/DEBIAN/config:if db_metaget shared/default-x-display-manager owners; then
lightdm/DEBIAN/config:if db_metaget shared/default-x-display-manager choices; then
lightdm/DEBIAN/config:  db_subst shared/default-x-display-manager choices "$OWNERS" || :
lightdm/DEBIAN/config:  db_fset shared/default-x-display-manager seen false || :
lightdm/DEBIAN/config:    db_set shared/default-x-display-manager "$CURRENT_DEFAULT"
lightdm/DEBIAN/config:  if db_get shared/default-x-display-manager; then
lightdm/DEBIAN/config:    db_set shared/default-x-display-manager lightdm
lightdm/DEBIAN/config:    db_fset shared/default-x-display-manager seen true
lightdm/DEBIAN/config:    db_input high shared/default-x-display-manager || :
lightdm/DEBIAN/config:    db_go || :
lightdm/DEBIAN/config:if db_get shared/default-x-display-manager; then

The various db_* functions are helper functions for handling debconf, obtained from /usr/share/debconf/confmodule.

So, in the case of lightdm, shared/default-x-display-manager is an important debconf key.

10

You can get the variables for a specific installed package using debconf-show packagename

ex.

$ sudo debconf-show mysql-server-5.7
* mysql-server/root_password: (password omitted)
* mysql-server/root_password_again: (password omitted)
  mysql-server-5.7/start_on_boot: true
  mysql-server/no_upgrade_when_using_ndb:
  mysql-server/password_mismatch:
  mysql-server-5.7/really_downgrade: false
  mysql-server-5.7/nis_warning:
  mysql-server-5.7/postrm_remove_databases: false
  mysql-server-5.7/installation_freeze_mode_active:

You can get a list of all the installed packages that have variables in the database using debconf-show --listowners, so if you're not sure what the package name is you could do something like

# debconf-show --listowners | grep mysql | xargs debconf-show
* mysql-server/root_password: (password omitted)
* mysql-server/root_password_again: (password omitted)
  mysql-server-5.7/postrm_remove_databases: false
  mysql-server-5.7/nis_warning:
  mysql-server-5.7/installation_freeze_mode_active:
  mysql-server/password_mismatch:
  mysql-server-5.7/start_on_boot: true
  mysql-server/no_upgrade_when_using_ndb:
  mysql-server-5.7/really_downgrade: false

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.