Comment 12 for bug 1562362

Revision history for this message
adrian15 (adrian15) wrote :

0) We have a very similar problem to this bug.
Basically we are trying to install mysql-server-5.7 5.7.12-0ubuntu1 package in Ubuntu 16.04 and while installing it we get, among other messages:

Job for mysql.service failed because the control process exited with error code. See "systemctl status mysql.service" and "journalctl -xe" for details.

1) In order to get debug information we run:

sudo /usr/sbin/mysqld --log-error=/tmp/error.log --log-error-verbosity=2

and the /tmp/error.log contents are:

2016-06-09T11:12:04.525246Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
mysqld: Table 'mysql.plugin' doesn't exist
2016-06-09T11:12:04.635835Z 0 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
2016-06-09T11:12:04.636223Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2016-06-09T11:12:04.636276Z 0 [Warning] Failed to set up SSL because of the following SSL library error: SSL context is not usable without certificate and private key
2016-06-09T11:12:04.636338Z 0 [ERROR] Could not create unix socket lock file /var/run/mysqld/mysqld.sock.lock.
2016-06-09T11:12:04.636344Z 0 [ERROR] Unable to setup unix socket lock file.
2016-06-09T11:12:04.636349Z 0 [ERROR] Aborting

2) If you try to get rid of mysql (BEWARE this would probably delete all your databases) and try to install it again:

sudo apt-get remove --purge mysql\*
sudo apt-get install mysql-server

You get the same problems once again.

3) What causes the problem?

Having a partition mounted on /var/lib/mysql directory.

4) How to solve it (workaround) ?
BEWARE! DO NOT USE THESE COMMANDS UNLESS IT'S A NEW INSTALLATION WHERE YOU DON'T MIND LOOSING DATA.

TL;DR : Install mysql-server without a dedicated mounted partition on /var/lib/mysql. After the installation move the data to the dedicated mounted partition and mount it in /var/lib/mysql.

Remove and purge mysql-server package.
Remove any file inside /var/lib/mysql directory if it has not been removed.
Umount /var/lib/mysql

Install mysql-server package

(Now it should work flawlessly.)

service mysql stop (Make sure service mysql is stopped)

Mount your mysql dedicated partition into a temporary directory. E.g. /mnt/newmysql .
Use cp -a for copying data from /var/lib/mysql to: /mnt/newmysql

Rename or delete /var/lib/msyql
Recreate an empty /var/lib/mysql with same permissions, user owner and group owner than the original one.

Umount /mnt/newmysql

Run 'mount -a' so that your dedicated partition for mysql is mounted on: /var/lib/mysql

service mysql start

Mysql works ok till, probably, the next update if Ubuntu has not fixed this bug on their side.

5) How to solve it (Correct fix) ?

Somewhere in the package post-installation or configuration scripts or even mysql upstream scripts is different between latest version (php 5.5) and current one (php 5.7).

This difference implies handling having a separated partition for /var/lib/mysql .

I suspect that somewhere in the installation it tries to remove /var/lib/mysql directory (e.g. expects to be able to remove completely that directory) and, because of that folder having a partition mounted on it, it cannot be removed.

Please package maintainer try to simulate this problem in a VM and fix the package for this not to happen.

6) Feedback.

  In order to know if what I am describing is another bug or this same bug we need feedback from the other people who have reported this bug.
So... the question is:

* Did you also have a dedicated partition mounted on /var/lib/msyql ?
* Or did you have any other dedicated partition elsewhere related to mysql?

If you don't have any of these dedicated partition I guess that running:

sudo /usr/sbin/mysqld --log-error=/tmp/mysql-1562362-error.log --log-error-verbosity=3
and attaching / copying here the /tmp/mysql-1562362-error.log contents will help the package maintainer on classifying your bug.