In my case the problem is a missing /etc/mysql/my.cnf.fallback
configuration file.
Possible workaround:
In /var/log/apt/history.log
Start-Date: 2017-01-20 10:42:27
Commandline: aptdaemon role='role-commit-packages' sender=':1.126'
Upgrade: mysql-server-5.7:amd64 (5.7.16-0ubuntu0.16.04.1, 5.7.17-0ubuntu0.16.04.1), mysql-server:amd64 (5.7.16-0ubuntu0.16.04.1, 5.7.17-0ubuntu0.16.04.1), mysql-client:amd64 (5.7.16-0ubuntu0.16.04.1, 5.7.17-0ubuntu0.16.04.1), libmysqlclient20:amd64 (5.7.16-0ubuntu0.16.04.1, 5.7.17-0ubuntu0.16.04.1), libmysqlclient20:i386 (5.7.16-0ubuntu0.16.04.1, 5.7.17-0ubuntu0.16.04.1), mysql-server-core-5.7:amd64 (5.7.16-0ubuntu0.16.04.1, 5.7.17-0ubuntu0.16.04.1)
Error: Sub-process /usr/bin/dpkg returned an error code (1)
End-Date: 2017-01-20 10:42:27
In /var/log/apt/term.log
Log started: 2017-01-20 10:42:27
Setting up mysql-common (5.7.17-0ubuntu0.16.04.1) ...
update-alternatives: error: alternative path /etc/mysql/my.cnf.fallback doesn't exist
dpkg: error processing package mysql-common (--configure):
subprocess installed post-installation script returned error exit status 2
Errors were encountered while processing:
mysql-common
Log ended: 2017-01-20 10:42:27
So the problem for me seems to be the missing the /etc/mysql/my.cnf.fallback
file.
ll /etc/myql
drwxr-xr-x 4 root root 4096 gen 20 10:59 ./
drwxr-xr-x 189 root root 12288 gen 19 12:44 ../
drwxr-xr-x 2 root root 4096 gen 20 09:43 conf.d/
-rw------- 1 root root 317 nov 19 10:57 debian.cnf
-rwxr-xr-x 1 root root 120 ott 24 17:13 debian-start*
lrwxrwxrwx 1 root root 24 nov 18 21:12 my.cnf -> /etc/alternatives/my.cnf
-rw-r--r-- 1 root root 3028 nov 18 21:27 my.cnf.migrated
-rw-r--r-- 1 root root 682 lug 11 2016 mysql.cnf
drwxr-xr-x 2 root root 4096 nov 18 22:24 mysql.conf.d/
So, because the symlink:
my.cnf -> /etc/alternatives/my.cnf
points back to:
/etc/alternatives/my.cnf -> /etc/mysql/mysql.cnf
i assumed (crossing my fingers) that /etc/mysql/mysql.cnf
should be
eligible as alternative fallback:
sudo cp /etc/mysql/mysql.cnf /etc/mysql/my.cnf.fallback
Run the apt tool to complete the upgrade.
This worked for me.
Initial bug report: https://bugs.launchpad.net/bugs/1579708
enter code here
Title:
mysql maintainer scripts fail if files in /etc/mysql
have been deleted
locally
Status in mysql-5.5 package in Ubuntu:
Invalid
Status in mysql-5.6 package in Ubuntu:
Invalid
Status in mysql-5.7 package in Ubuntu:
Invalid
Bug description:
A common report is that MySQL-related maintainer scripts have failed after files in /etc/mysql/ have been deleted. This is expected behaviour since policy is that users' modifications of conffiles (for example, files in /etc/mysql/) should be preserved.
The logic is that if you have modified /etc/mysql/, it is presumed that those modifications are what you want. Packaging cannot fix up any broken customizations for you, so for example if you have deleted those files, then packaging will be broken.
Before attempting to fix this up, make sure to take a full backup of your system and in particular any databases (by default in /var/lib/mysql
) in case your attempt results in destruction of your data.
To fix this situation up, you could try purging all mysql-related packages (particularly mysql-common, mariadb-server-* and/or mysql-server-*) and reinstalling them. Note that just removing the packages will not work since dpkg will preserve your local modifications to /etc/mysql/ as designed.
Since this behaviour is by design, this is not a bug in Ubuntu that will be fixed and so this bug's status is set to Invalid to reflect this.
This helped me out. Thanks!