My system configuration script does an "apt-get install -y postfix". Unfortunately the script is halted when the postfix installer displays a configuration screen. Is there a method to force postfix to use the defaults during installation so that an automated script can continue to the end?

Does the postfix installer maybe check for existing configuration in /etc/postfix, and if it exists, not bother the user with the configuration screen?


You can use pre-seeding for this, using the debconf-set-selections command to pre-answer the questions asked by debconf before installing the package.

For example:

debconf-set-selections <<< "postfix postfix/mailname string your.hostname.com"
debconf-set-selections <<< "postfix postfix/main_mailer_type string 'Internet Site'"
apt-get install --assume-yes postfix
| improve this answer | |
  • What are the available options for main_mailer_type? Is there a list to reference somewhere without having to run it interactively once first? – beporter Jun 24 '15 at 21:06
  • 3
    beporter, apparently: No configuration , Internet site, Internet with smarthost, Satellite system, Local only however it seems like Internet Site is generally the best choice for most people: bugs.debian.org/cgi-bin/bugreport.cgi?bug=450787 – willbradley Jan 9 '16 at 20:16
  • 1
    Could some body explain how can we get this string for other packages? (kerberos in my case): "postfix postfix/mailname string your.hostname.com" I mean, what is the first "postfix", and the second "postfix/" and then "mailname", etc.... where can i get those strings for my package? – Mohammed Noureldin Nov 28 '16 at 23:33
  • I know the question is about Ubuntu but I need this for Amazon Linux (AWS) which is an offshoot of RHEL... Anyone? – TheStoryCoder Dec 4 '18 at 11:52
  • @MohammedNoureldin Looking at man debconf-set-selections, I see there's also debconf-get-selections which dumps what selections have been made on the current system, in the format used for input here. You could manually setup one system, then just run that to see what to use for kerberos. – morganwahl May 6 '19 at 0:36

If you want this globally:

dpkg-reconfigure debconf

Then configure it to be "noninteractive"

If you just want it for single install run:

DEBIAN_FRONTEND=noninteractive apt-get install PACKAGE
| improve this answer | |
  • 2
    You could also do export DEBIAN_FRONTEND=noninteractive to set it globally in an unattended fashion. – Mahn Sep 5 '14 at 13:49
  • I found this worked well on Ubuntu 14.04 for a default 'deliver to local /var/mail' setup, whereas the debconf-set-selections answer above didn't. – RichVel Apr 28 '17 at 9:00

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.