How to preconfigure package using debconf-set-selections?

Solution 1:

Sometimes the debconf database is left in inconsistent state after the package removal. Open the file /var/cache/debconf/templates.dat and try to locate templates mentioning your package. Remove them and try again with the debconf-set-selections.

Solution 2:

Try /usr/share/debconf/fix_db.pl