Debian – Automate Postfix instalaltion with debconf-set-selections

debianpostfix

I'm currently trying to automate my Postfix installation and most things work really… but I can't seem to stop postfix-policyd asking for the MySQL root password.

Here is what I got so far:

echo 'dbconfig-common postfix-policyd/dbconfig-install boolean false' | debconf-set-selections

echo 'postfix-policyd postfix-policyd/dbconfig-install boolean false' | debconf-set-selections

echo 'postfix-policyd postfix-ploicyd/internal/skip-preseed boolean false' | debconf-set-selections

echo 'dbconfig-common dbconfig-common/internal/skip-preseed boolean false' | debconf-set-selections

echo 'postfix-policyd postfix-policyd/dbconfig-upgrade boolean false' | debconf-set-selections

echo 'postfix-policyd/dbconfig-reinstall boolean false' | debconf-set-selections

echo 'dbconfig-common dbconfig-reinstall boolean false' | debconf-set-selections

echo "postfix-policyd postfix-policyd/internal/reconfiguring boolean false" | debconf-set-selections

It seems postfix-policyd just ignores the

postfix-policyd
postfix-policyd/dbconfig-install
boolean false

How do I fix this?

Best Answer

In my script I disable the interactive frontend first:
export DEBIAN_FRONTEND=noninteractive

Then I set al the preferences, f.e.:
postconf -e "mynetworks = 127.0.0.0/8, ${NETWORK_CIDR}"

You can then re-enable it by unsetting it:
unset DEBIAN_FRONTEND

Or, you can make it very easy by just running this command:
DEBIAN_FRONTEND=noninteractive apt-get install postfix-policyd

Related Topic