I'm trying to create a provision file that installs MariaDB but it keeps failing.

The provision looks like this:

sudo apt-get install -y software-properties-common
sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xcbcb082a1bb943db
sudo add-apt-repository 'deb http://ftp.cc.uoc.gr/mirrors/mariadb/repo/10.0/ubuntu trusty main'

apt-get update -y
apt-get install -y mariadb-server

And the error I'm getting is:

==> default: Preparing to unpack .../mariadb-server-10.0_10.0.17+maria-1~trusty_amd64.deb ...
==> default: (B)00
==> default: Package configuration??????????????????????????????????????????????????????????????? Configuring mariadb-server-10.0 ?????????????????????????????????????????????????????????????????? While not mandatory, it is highly recommended that you set a password   ?????? for the MariaDB administrative "root" user.???????????? If this field is left blank, the password will not be changed.???????????? New password for the MariaDB "root" user:???????????? _______________________________________________________________________ ????????????<Ok>???
==> default: Failed to open terminal.debconf: whiptail output the above errors, giving up!
==> default: dpkg: error processing archive /var/cache/apt/archives/mariadb-server-10.0_10.0.17+maria-1~trusty_amd64.deb (--unpack):
==> default:  subprocess new pre-installation script returned error exit status 255
==> default: Selecting previously unselected package libhtml-template-perl.
==> default: Preparing to unpack .../libhtml-template-perl_2.95-1_all.deb ...
==> default: Unpacking libhtml-template-perl (2.95-1) ...
==> default: Selecting previously unselected package mariadb-server.
==> default: Preparing to unpack .../mariadb-server_10.0.17+maria-1~trusty_all.deb ...
==> default: Unpacking mariadb-server (10.0.17+maria-1~trusty) ...
==> default: Processing triggers for man-db ( ...
==> default: Errors were encountered while processing:
==> default:  /var/cache/apt/archives/mariadb-server-10.0_10.0.17+maria-1~trusty_amd64.deb
==> default: E
==> default: :
==> default: Sub-process /usr/bin/dpkg returned an error code (1)
==> default: Reading package lists...
==> default: Building dependency tree...
==> default: Reading state information...
==> default: You might want to run 'apt-get -f install' to correct these.
==> default: The following packages have unmet dependencies:
==> default:  mariadb-server : Depends: mariadb-server-10.0 (= 10.0.17+maria-1~trusty) but it is not installed
==> default: E
==> default: :
==> default: Unmet dependencies. Try using -f.

It seems like it fails to open the terminal that asks you to enter a password and fails. I can always manually install MariaDB but I'd like to do it through the provision file. Any ideas/suggestions?

  • dpkg asks for some input before installing mariadb-server. Check debconf-set-selections how to set the variables it wants non-interactively
    – akuzminsky
    Apr 27 '15 at 22:58
  • @akuzminsky ty found the solution :) Apr 28 '15 at 13:37

I had a similar issue. Setting the environment variable DEBIAN_FRONTEND=noninteractive worked for me.

So in your case, you need to run (as root)

DEBIAN_FRONTEND=noninteractive apt-get install -y mariadb-server
  • 2
    I tried to export DEBIAN_FRONTEND=noninteractive but that wouldn't work. But if you sudo DEBIAN_FRONTEND=noninteractive apt-get install whatever-you-want, it works. Thanks for the tip. Nov 12 '15 at 14:07

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.