jficz
jficz

Reputation: 289

Unattended Percona Server 5.7 install on Debian Jessie

I'm trying to do an unattended install of Percona Server 5.7 from Percona's repository on Debian Jessie. I don't really care what root password I end up with, if any. That's secondary.

So far I have been unsuccesful, ending up with three different scenarios, each failing in a different step:

1) DEBIAN_FRONTEND=noninteractive apt-get -y install percona-server-server-5.7 which hangs indefinitely: http://pastebin.com/QiYUsSJW

The server is started and I can even connect to it using mysql -S /var/run/mysqld/mysqld.sock which is strange because of the "cannot connect to socket" warning in the paste above.

There is no /etc/mysql/my.cnf file present at the time of the hang, however, the directory is there.

2) use debconf-set-selections to pre-seed debconf database with these:

percona-server-server-5.7 percona-server-server-5.7/root-pass password supersecret

percona-server-server-5.7 percona-server-server-5.7/re-root-pass password supersecret

and then proceed with apt-get install percona-server-server-5.7

In this step, apt fails because the password is still apparently blank: http://pastebin.com/hMsjn0wJ with these logs: http://pastebin.com/61KPgTth

In this case the mysql service won't even start so I can't tell whether the password was actually set or not. However, checking debconf database at /var/cache/debconf/passwords.dat I can see the Password Value field is empty. Going back through the log to the line

Apr 16 16:14:53 gtest mysql-systemd-start[2659]: /usr/share/mysql/mysql-systemd-start: line 37: [: too many arguments

and analyzing the file I get to the point where my_print_defaults binary is executed and is supposed to return mysqld configuration values. Instead it prints nothing causing the start script fail with the above error. Why is it empty? Don't know. Likely because the /etc/mysql/my.cnf is nonexistent, much like as in previous case. This is also mentioned here:

Apr 16 17:01:51 gtest mysql-systemd-start[12214]: Percona Server configuration not found at /etc/mysql/my.cnf. Please install one using update-alternatives.

But I would expect this to be populated by apt at the installation time. Looks like some kind of a chicken-and-egg loop within apt but beyond my abilities.

3) same as 2 except the password is deliberately set as empty. Results are the same as in step 1.

I'm out of ideas. Any tips?

thx.

Upvotes: 3

Views: 1970

Answers (3)

Lars
Lars

Reputation: 31

With Debian 10 the answer described by myol doesn't work for percona-server-server-5.7, but pre-seeding works fine, as described by mikky in it's initial post:

echo "percona-server-server-5.7 percona-server-server-5.7/root-pass password supersecret" | debconf-set-selections
echo "percona-server-server-5.7 percona-server-server-5.7/re-root-pass password supersecret" | debconf-set-selections

To show what's currently in the pre-seed database run:

debconf-show percona-server-server-5.7

Install and access the database:

apt-get install percona-server-server-5.7
mysql -u root -psupersecret

The Value field of the password in the pre-seed database in /var/cache/debconf/passwords.dat is indeed empty after the installation, but the pre-seeded password still works. So I guess this might be a new security measure, to clean up the actual values.

To retry the process run (use with caution, it will remove the database!):

dpkg -P percona-server-server-5.7

Upvotes: 0

jficz
jficz

Reputation: 289

Good news everyone! I figured out what the problem really was.

All of the above was most likely caused by me repeatedly trying to succeed on an already set-up box. This caused an apt-typical split-package dependency hell problem. Going up through the dependency tree I found out that, among others, there is a dependency package mysql-common which surprisingly contains just the one file, /etc/mysql/my.cnf plus some empty directories and typical Debian docs structure.

After taking this package into consideration the unattended installation works as expected using all three methods. The only thing that remains now is how to do the mysql_secure_installation automatically as well.

Upvotes: 0

myol
myol

Reputation: 9828

Just spent hours on this after looking at incorrect answers on SO. This seems to work on Ubuntu. I did NOT use export DEBIAN_FRONTEND=noninteractive and I was not prompted for a password. I have a feeling that with the incorrect debconf entries, noninteractive just ok's the prompt with the blank password.

echo "percona-server-server-5.7 mysql-server/root_password password supersecret" | debconf-set-selections
echo "percona-server-server-5.7 mysql-server/root_password_again password supersecret" | debconf-set-selections

Percona 'hooks into' MySQL so you can check it is indeed running using

service mysql status

and you will know it is percona if you see something like

mysql.service - LSB: Start and stop the mysql (Percona Server) daemon

then test logging in

mysql -u user -psupersecret

I actually got this to work from your throwaway comment about checking /var/cache/debconf/passwords.dat so thanks for that

Upvotes: 2

Related Questions