How to disable debconf for automated installs of packages using apt-get

I have been working on an application for the whole last month. Last week I realized that I need to disable debconf for packages that will be installed by my application using apt-get. I found in manuals that we can configure apt-get to don’t preconfigure packages by editing file /etc/apt/apt.conf.d/70debconf.

As a quick hack I just commented out the only single line that was uncommented in that file. But that didn’t worked out for me. So, I spent lot of time in searching how can I stop debconf showing up and asking me questions for the bunch of applications that will be automatically installed.

I found two ways of changing this behavior, although only the second one was suitable for me  but I will share both.

First method
This method will change the debconf configuration and so debconf will not ask you when ever it will be called. If you want this solution the enter the following command and select the last (6th) option i.e “Noninteractive”.

dpkg-reconfigure debconf

Second method
This method allows to disable debconf interactive dialogs for a single execution of apt-get. And this is done by changing environmental variables. Got this tip from debconf manpage.  Below is the example apt-get installation of exim4 package.

DEBCONF_FRONTEND='noninteractive' apt-get install exim4

This was the solution that took me so long, I know I should be missing something or I should have consulted the man page on the very first place, because this is the reason they are provided on every Linux.

So, from now on. Read man page before going to Google. Yes, Google has made me lazy.

Advertisements

5 Responses to “How to disable debconf for automated installs of packages using apt-get”

  1. Karolina Berkeley Says:

    Cesar Pelli & Associates – Architects

    Useful, thank you!

  2. _ Says:

    Thanks a lot!

  3. Lone Wolf Says:

    Hi,

    just to give a little update on the second method, it is not DEBCONF_FRONTEND on Debian 4.0 Etch, but DEBIAN_FRONTEND:

    DEBIAN_FRONTEND=’noninteractive’ apt-get install exim4

    Anyway, thank you for this great tip.

  4. Hameedullah Khan Says:

    @Lone Wolf
    Thanks for updating us. Really appreciated.

  5. peter Says:

    thank you. One thing to keep in mind

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


%d bloggers like this: