MySQL fresh install failes with ext4 data partition on Ubuntu 16.04

Bug #1685136 reported by Christian Zunker
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
MySQL Server
Unknown
Unknown
mysql-5.7 (Ubuntu)
Confirmed
Undecided
Unassigned

Bug Description

Ubuntu Version:
# lsb_release -rd
Description: Ubuntu 16.04 LTS
Release: 16.04

MySQL Package Version:
# apt-cache policy mysql-server
mysql-server:
  Installed: 5.7.17-0ubuntu0.16.04.2
  Candidate: 5.7.17-0ubuntu0.16.04.2
  Version table:
 *** 5.7.17-0ubuntu0.16.04.2 500
        500 http://Cluster_C.clouds.archive.ubuntu.com/ubuntu xenial-updates/main amd64 Packages
        100 /var/lib/dpkg/status
     5.7.17-0ubuntu0.16.04.1 500
        500 http://security.ubuntu.com/ubuntu xenial-security/main amd64 Packages
     5.7.11-0ubuntu6 500
        500 http://Cluster_C.clouds.archive.ubuntu.com/ubuntu xenial/main amd64 Packages

On a fresh Ubuntu 16.04 I tried to install mysql-server with an extra ext4 volume mounted at /var/lib/mysql, but the installation failed:
# apt install mysql-server
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
  libaio1 libcgi-fast-perl libcgi-pm-perl libencode-locale-perl libevent-core-2.0-5 libfcgi-perl libhtml-parser-perl libhtml-tagset-perl libhtml-template-perl libhttp-date-perl libhttp-message-perl
  libio-html-perl liblwp-mediatypes-perl libtimedate-perl liburi-perl mysql-client-5.7 mysql-client-core-5.7 mysql-common mysql-server-5.7 mysql-server-core-5.7
Suggested packages:
  libdata-dump-perl libipc-sharedcache-perl libwww-perl mailx tinyca
The following NEW packages will be installed:
  libaio1 libcgi-fast-perl libcgi-pm-perl libencode-locale-perl libevent-core-2.0-5 libfcgi-perl libhtml-parser-perl libhtml-tagset-perl libhtml-template-perl libhttp-date-perl libhttp-message-perl
  libio-html-perl liblwp-mediatypes-perl libtimedate-perl liburi-perl mysql-client-5.7 mysql-client-core-5.7 mysql-common mysql-server mysql-server-5.7 mysql-server-core-5.7
0 upgraded, 21 newly installed, 0 to remove and 181 not upgraded.
Need to get 19.0 MB of archives.
After this operation, 162 MB of additional disk space will be used.
Do you want to continue? [Y/n]
...
Setting up libhttp-message-perl (6.11-1) ...
No apport report written because the error message indicates its a followup error from a previous failure.
                                                                                                          dpkg: dependency problems prevent configuration of mysql-server:
 mysql-server depends on mysql-server-5.7; however:
  Package mysql-server-5.7 is not configured yet.

dpkg: error processing package mysql-server (--configure):
 dependency problems - leaving unconfigured
Processing triggers for libc-bin (2.23-0ubuntu3) ...
Processing triggers for ureadahead (0.100.0-19) ...
Processing triggers for systemd (229-4ubuntu4) ...
Errors were encountered while processing:
 mysql-server-5.7
 mysql-server
E: Sub-process /usr/bin/dpkg returned an error code (1)

Taking a look at /var/log/syslog, it suggests this:
Apr 21 06:46:27 cloudcentric-base-image-ubuntu-16 systemd[1]: Starting MySQL Community Server...
Apr 21 06:46:27 cloudcentric-base-image-ubuntu-16 mysql-systemd-start[13362]: MySQL system database not found in /var/lib/mysql. Please run mysqld --initialize.
Apr 21 06:46:27 cloudcentric-base-image-ubuntu-16 systemd[1]: mysql.service: Control process exited, code=exited status=1
Apr 21 06:46:27 cloudcentric-base-image-ubuntu-16 systemd[1]: Failed to start MySQL Community Server.

Executing the suggested command shows this
# mysqld --initialize
2017-04-21T06:53:53.584517Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2017-04-21T06:53:53.587467Z 0 [ERROR] --initialize specified but the data directory has files in it. Aborting.
2017-04-21T06:53:53.587746Z 0 [ERROR] Aborting

At this time the only files in /var/lib/mysql are:
# ll /var/lib/mysql
total 24
drwx------ 3 mysql mysql 4096 Apr 21 06:46 ./
drwxr-xr-x 46 root root 4096 Apr 21 06:46 ../
-rw-r--r-- 1 root root 0 Apr 21 06:46 debian-5.7.flag
drwx------ 2 mysql mysql 16384 Apr 21 06:44 lost+found/

Removing debian-5.7.flag doesn't change anything.
Removing everything from the directory works. mysqld --initialize finishes without error. Removing the mysql packages and executing apt install mysql-server again on an empty /var/lib/mysql works fine.

Searching the web, their are already bug reports present, like:
https://bugs.mysql.com/bug.php?id=22615
These suggest to fix this issue with --ignore-db-dir=lost+found

Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

Thank you for your report and your help to make Ubuntu better.
I was liking in the related upstream bug as task above to get better visibility of its status.

On the upstream issue discussions reopened around the question if mysql has to provide updated start scripts or if the packages shall add the --ignore-db-dir on their own.

Never the less I think that is a valid issue, but I'd leave the final triage to Lars/Robie that I will subscribe now.

Changed in mysql-5.7 (Ubuntu):
status: New → Confirmed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.