TLDR
Installing mysql-server-5.7 fails at
Renaming removed key_buffer and myisam-recover options (if present)
Question 1: How do I fix the issue described below?
Question 2: Why does it occur?
Background
I'm at my wits' end trying to solve this.
Earlier today I was booting a fresh DB instance on an Ubuntu VM with the intention to run keep the MYSQL db files on a separate drive and log files on a 3rd drive. I booted a fresh Ubuntu 16.04 LTM virtual machine on Microsoft Azure. Then I attached 2 disks to it, initialized thier file systems, and mounted them to /mysql
and /log
respectively. Next I moved /var/log
to /log
and replaced /var/log
with a symlink pointing to /log
.
Then, when I tried to install mysql server (using defaults):
sudo apt-get mysql-server
sudo apt-get mysql-server-5.7
The installation always fails at Renaming removed key_buffer and myisam-recover options (if present)
.
I've tried:
sudo dpkg-reconfigure mysql-server-5.1
,sudo apt-get purge mysql-common mysql-server-5.1
,sudo rm /etc/mysql/my.cnf /etc/mysql/my.cnf.fallback /etc/mysql/my.cnf.migrated my.cnf.wba.bak /etc/alternatives/my.cnf
,sudo systemctl enable mysql.service
sudo apt-get remove --purge mysql*
sudo update-alternatives --remove my.cnf /etc/mysql/my.cnf.migrated
All 3 workarounds
here
Note: workaround 3 fails halfway through becausesudo service mysql start
fails.Job for mysql.service failed because the control process exited with error code. See "systemctl status mysql.service" and "journalctl -xe" for details.
Furthermore, I read and tried several of Canonical's threads to no avail, particularly, this, and this. Whatever workaround or fix I try, I always get the same error at the same place.
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
linux-cloud-tools-4.4.0-81 linux-cloud-tools-4.4.0-81-generic
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
mysql-client-5.7 mysql-client-core-5.7 mysql-common mysql-server-5.7 mysql-server-core-5.7
Suggested packages:
mailx tinyca
The following NEW packages will be installed:
mysql-client-5.7 mysql-client-core-5.7 mysql-common mysql-server mysql-server-5.7 mysql-server-core-5.7
0 upgraded, 6 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/18.2 MB of archives.
After this operation, 160 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Preconfiguring packages ...
Selecting previously unselected package mysql-common.
(Reading database ... 94155 files and directories currently installed.)
Preparing to unpack .../mysql-common_5.7.18-0ubuntu0.16.04.1_all.deb ...
Unpacking mysql-common (5.7.18-0ubuntu0.16.04.1) ...
Selecting previously unselected package mysql-client-core-5.7.
Preparing to unpack .../mysql-client-core-5.7_5.7.18-0ubuntu0.16.04.1_amd64.deb ...
Unpacking mysql-client-core-5.7 (5.7.18-0ubuntu0.16.04.1) ...
Selecting previously unselected package mysql-client-5.7.
Preparing to unpack .../mysql-client-5.7_5.7.18-0ubuntu0.16.04.1_amd64.deb ...
Unpacking mysql-client-5.7 (5.7.18-0ubuntu0.16.04.1) ...
Selecting previously unselected package mysql-server-core-5.7.
Preparing to unpack .../mysql-server-core-5.7_5.7.18-0ubuntu0.16.04.1_amd64.deb ...
Unpacking mysql-server-core-5.7 (5.7.18-0ubuntu0.16.04.1) ...
Processing triggers for man-db (2.7.5-1) ...
Setting up mysql-common (5.7.18-0ubuntu0.16.04.1) ...
update-alternatives: using /etc/mysql/my.cnf.fallback to provide /etc/mysql/my.cnf (my.cnf) in auto mode
Selecting previously unselected package mysql-server-5.7.
(Reading database ... 94311 files and directories currently installed.)
Preparing to unpack .../mysql-server-5.7_5.7.18-0ubuntu0.16.04.1_amd64.deb ...
Unpacking mysql-server-5.7 (5.7.18-0ubuntu0.16.04.1) ...
Selecting previously unselected package mysql-server.
Preparing to unpack .../mysql-server_5.7.18-0ubuntu0.16.04.1_all.deb ...
Unpacking mysql-server (5.7.18-0ubuntu0.16.04.1) ...
Processing triggers for systemd (229-4ubuntu17) ...
Processing triggers for ureadahead (0.100.0-19) ...
Processing triggers for man-db (2.7.5-1) ...
Setting up mysql-client-core-5.7 (5.7.18-0ubuntu0.16.04.1) ...
Setting up mysql-client-5.7 (5.7.18-0ubuntu0.16.04.1) ...
Setting up mysql-server-core-5.7 (5.7.18-0ubuntu0.16.04.1) ...
Setting up mysql-server-5.7 (5.7.18-0ubuntu0.16.04.1) ...
update-alternatives: using /etc/mysql/mysql.cnf to provide /etc/mysql/my.cnf (my.cnf) in auto mode
Renaming removed key_buffer and myisam-recover options (if present)
Job for mysql.service failed because the control process exited with error code. See "systemctl status mysql.service" and "journalctl -xe" for details.
invoke-rc.d: initscript mysql, action "start" failed.
● mysql.service - MySQL Community Server
Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
Active: activating (auto-restart) (Result: exit-code) since Fri 2017-06-30 22:14:16 UTC; 30ms ago
Process: 8314 ExecStartPost=/usr/share/mysql/mysql-systemd-start post (code=exited, status=0/SUCCESS)
Process: 8312 ExecStart=/usr/sbin/mysqld (code=exited, status=1/FAILURE)
Process: 8304 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=0/SUCCESS)
Main PID: 8312 (code=exited, status=1/FAILURE)
Jun 30 22:14:16 PMCTMYSQLWEBDEV systemd[1]: Failed to start MySQL Community Server.
Jun 30 22:14:16 PMCTMYSQLWEBDEV systemd[1]: mysql.service: Unit entered failed state.
Jun 30 22:14:16 PMCTMYSQLWEBDEV systemd[1]: mysql.service: Failed with result 'exit-code'.
dpkg: error processing package mysql-server-5.7 (--configure):
subprocess installed post-installation script returned error exit status 1
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 systemd (229-4ubuntu17) ...
No apport report written because the error message indicates its a followup error from a previous failure.
Processing triggers for ureadahead (0.100.0-19) ...
Errors were encountered while processing:
mysql-server-5.7
mysql-server
E: Sub-process /usr/bin/dpkg returned an error code (1)
From reading an extensive thread on launchpad.net, I know that this was a relatively common occurrence last year, particularly due to a changed configuration directive; however, I'm installing this on a fresh VM, therefore no configurations were changed. Either way, every solution proposed there, the installation still fails. I understand that it's failing when attempting to configure mysql-server after the installation, but I don't understand why it keeps failing at this point.
Shell Outputs
Running systemctl status mysql.service
outputs:
● mysql.service - MySQL Community Server
Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
Active: activating (start-post) (Result: exit-code) since Fri 2017-06-30 23:02:31 UTC; 28s ago
Process: 18500 ExecStart=/usr/sbin/mysqld (code=exited, status=1/FAILURE)
Process: 18491 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=0/SUCCESS)
Main PID: 18500 (code=exited, status=1/FAILURE); : 18501 (mysql-systemd-s)
Tasks: 2
Memory: 312.0K
CPU: 563ms
CGroup: /system.slice/mysql.service
└─control
├─18501 /bin/bash /usr/share/mysql/mysql-systemd-start post
└─18571 sleep 1
Running journalctl -xe
outputs a wall-o-text:
Jun 30 23:03:33 MYVMSERVERNAME kernel: audit: type=1400 audit(1498863813.150:4573): apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/log
Jun 30 23:03:33 MYVMSERVERNAME kernel: audit: type=1400 audit(1498863813.150:4574): apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/log
Jun 30 23:03:33 MYVMSERVERNAME systemd[1]: mysql.service: Main process exited, code=exited, status=1/FAILURE
Jun 30 23:03:36 MYVMSERVERNAME systemd[1]: Time has been changed
-- Subject: Time change
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- The system clock has been changed to REALTIME microseconds after January 1st, 1970.
Jun 30 23:03:36 MYVMSERVERNAME systemd[1]: snapd.refresh.timer: Adding 51min 45.765270s random time.
Jun 30 23:03:36 MYVMSERVERNAME systemd[1]: apt-daily.timer: Adding 9h 36min 3.316616s random time.
Jun 30 23:03:36 MYVMSERVERNAME systemd[4309]: Time has been changed
-- Subject: Time change
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- The system clock has been changed to REALTIME microseconds after January 1st, 1970.
Jun 30 23:03:41 MYVMSERVERNAME systemd[4309]: Time has been changed
-- Subject: Time change
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- The system clock has been changed to REALTIME microseconds after January 1st, 1970.
Jun 30 23:03:41 MYVMSERVERNAME systemd[1]: Time has been changed
-- Subject: Time change
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- The system clock has been changed to REALTIME microseconds after January 1st, 1970.
Jun 30 23:03:41 MYVMSERVERNAME systemd[1]: snapd.refresh.timer: Adding 28min 53.776594s random time.
Jun 30 23:03:41 MYVMSERVERNAME systemd[1]: apt-daily.timer: Adding 2h 8min 50.808503s random time.
Jun 30 23:03:46 MYVMSERVERNAME systemd[1]: Time has been changed
-- Subject: Time change
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- The system clock has been changed to REALTIME microseconds after January 1st, 1970.
Jun 30 23:03:46 MYVMSERVERNAME systemd[1]: snapd.refresh.timer: Adding 5h 21min 26.938184s random time.
Jun 30 23:03:46 MYVMSERVERNAME systemd[1]: apt-daily.timer: Adding 10h 8min 22.523179s random time.
Jun 30 23:03:46 MYVMSERVERNAME systemd[4309]: Time has been changed
-- Subject: Time change
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- The system clock has been changed to REALTIME microseconds after January 1st, 1970.
Jun 30 23:03:51 MYVMSERVERNAME systemd[4309]: Time has been changed
-- Subject: Time change
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- The system clock has been changed to REALTIME microseconds after January 1st, 1970.
Jun 30 23:03:51 MYVMSERVERNAME systemd[1]: Time has been changed
-- Subject: Time change
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- The system clock has been changed to REALTIME microseconds after January 1st, 1970.
Jun 30 23:03:51 MYVMSERVERNAME systemd[1]: snapd.refresh.timer: Adding 1h 36min 20.966420s random time.
Jun 30 23:03:51 MYVMSERVERNAME systemd[1]: apt-daily.timer: Adding 2h 46min 45.417443s random time.
Running sudo grep -Er 'key.buffer|myisam.recover' /etc/mysql
outputs:
/etc/mysql/mysql.conf.d/mysqld.cnf:key_buffer_size = 16M
/etc/mysql/mysql.conf.d/mysqld.cnf:myisam-recover-options = BACKUP
/etc/mysql/my.cnf
#
# The MySQL database server configuration file.
#
# You can copy this to one of:
# - "/etc/mysql/my.cnf" to set global options,
# - "~/.my.cnf" to set user-specific options.
#
# One can use all long options that the program supports.
# Run program with --help to get a list of available options and with
# --print-defaults to see which it would actually understand and use.
#
# For explanations see
# http://dev.mysql.com/doc/mysql/en/server-system-variables.html
#
# * IMPORTANT: Additional settings that can override those from this file!
# The files must end with '.cnf', otherwise they'll be ignored.
#
!includedir /etc/mysql/conf.d/
!includedir /etc/mysql/mysql.conf.d/
/etc/mysql/mysql.conf.d/mysqld.cnf
#
# The MySQL database server configuration file.
#
# You can copy this to one of:
# - "/etc/mysql/my.cnf" to set global options,
# - "~/.my.cnf" to set user-specific options.
#
# One can use all long options that the program supports.
# Run program with --help to get a list of available options and with
# --print-defaults to see which it would actually understand and use.
#
# For explanations see
# http://dev.mysql.com/doc/mysql/en/server-system-variables.html
# This will be passed to all mysql clients
# It has been reported that passwords should be enclosed with ticks/quotes
# escpecially if they contain "#" chars...
# Remember to edit /etc/mysql/debian.cnf when changing the socket location.
# Here is entries for some specific programs
# The following values assume you have at least 32M ram
[mysqld_safe]
socket = /var/run/mysqld/mysqld.sock
nice = 0
[mysqld]
#
# * Basic Settings
#
user = mysql
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
port = 3306
basedir = /usr
datadir = /var/lib/mysql
tmpdir = /tmp
lc-messages-dir = /usr/share/mysql
skip-external-locking
#
# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
bind-address = 127.0.0.1
#
# * Fine Tuning
#
key_buffer_size = 16M
max_allowed_packet = 16M
thread_stack = 192K
thread_cache_size = 8
# This replaces the startup script and checks MyISAM tables if needed
# the first time they are touched
myisam-recover-options = BACKUP
#max_connections = 100
#table_cache = 64
#thread_concurrency = 10
#
# * Query Cache Configuration
#
query_cache_limit = 1M
query_cache_size = 16M
#
# * Logging and Replication
#
# Both location gets rotated by the cronjob.
# Be aware that this log type is a performance killer.
# As of 5.1 you can enable the log at runtime!
#general_log_file = /var/log/mysql/mysql.log
#general_log = 1
#
# Error log - should be very few entries.
#
log_error = /var/log/mysql/error.log
#
# Here you can see queries with especially long duration
#log_slow_queries = /var/log/mysql/mysql-slow.log
#long_query_time = 2
#log-queries-not-using-indexes
#
# The following can be used as easy to replay backup logs or for replication.
# note: if you are setting up a replication slave, see README.Debian about
# other settings you may need to change.
#server-id = 1
#log_bin = /var/log/mysql/mysql-bin.log
expire_logs_days = 10
max_binlog_size = 100M
#binlog_do_db = include_database_name
#binlog_ignore_db = include_database_name
#
# * InnoDB
#
# InnoDB is enabled by default with a 10MB datafile in /var/lib/mysql/.
# Read the manual for more InnoDB related options. There are many!
#
# * Security Features
#
# Read the manual, too, if you want chroot!
# chroot = /var/lib/mysql/
#
# For generating SSL certificates I recommend the OpenSSL GUI "tinyca".
#
# ssl-ca=/etc/mysql/cacert.pem
# ssl-cert=/etc/mysql/server-cert.pem
# ssl-key=/etc/mysql/server-key.pem