package mysql-server-5.7 5.7.11-0ubuntu6 failed to install/upgrade: subprocess installed post-installation script returned error exit status 1 during release upgrade

Bug #1573279 reported by Nicholas Sharp on 2016-04-21
250
This bug affects 53 people
Affects Status Importance Assigned to Milestone
mysql-5.7 (Ubuntu)
High
Unassigned

Bug Description

Doing Release upgrade from 14.04 to 16.04, mysql-5.7-server/mysql-server failed during post-installation.

Before upgrade:
lsb_release -rd
Description: Ubuntu 14.04.4 LTS
Release: 14.04

After upgrade:
lsb_release -rd
Description: Ubuntu 16.04 LTS
Release: 16.04

apt-cache policy mysql-server-5.7
mysql-server-5.7:
  Installed: 5.7.11-0ubuntu6
  Candidate: 5.7.11-0ubuntu6
  Version table:
 *** 5.7.11-0ubuntu6 500
        500 http://us.archive.ubuntu.com/ubuntu xenial/main amd64 Packages
        100 /var/lib/dpkg/status

Expected: Release upgrade without issue
What happened: mysql-server-5.7 post-installation script exited with error code 1

ProblemType: Package
DistroRelease: Ubuntu 16.04
Package: mysql-server-5.7 5.7.11-0ubuntu6
ProcVersionSignature: Ubuntu 4.4.0-21.37-generic 4.4.6
Uname: Linux 4.4.0-21-generic x86_64
NonfreeKernelModules: nvidia
ApportVersion: 2.20.1-0ubuntu2
Architecture: amd64
Date: Thu Apr 21 17:02:39 2016
ErrorMessage: subprocess installed post-installation script returned error exit status 1
InstallationDate: Installed on 2016-03-16 (36 days ago)
InstallationMedia: Xubuntu 14.04.4 LTS "Trusty Tahr" - Release amd64 (20160217.1)
Logs.var.log.daemon.log:

MySQLConf.etc.mysql.conf.d.mysql.cnf: [mysql]
MySQLConf.etc.mysql.conf.d.mysqld_safe_syslog.cnf:
 [mysqld_safe]
 syslog
MySQLConf.etc.mysql.conf.d.mysqldump.cnf:
 [mysqldump]
 quick
 quote-names
 max_allowed_packet = 16M
MySQLConf.etc.mysql.mysql.conf.d.mysqld_safe_syslog.cnf:
 [mysqld_safe]
 syslog
MySQLVarLibDirListing: ['ib_logfile0', 'sys', 'ibtmp1', 'ibdata1', 'ib_logfile1', 'debian-5.7.flag', 'performance_schema', 'auto.cnf', 'mysql_upgrade_info', 'ib_buffer_pool', 'debian-5.5.flag', 'mysql']
ProcCmdline: BOOT_IMAGE=/vmlinuz-4.4.0-21-generic root=/dev/mapper/LTP-ROOT ro quiet splash
RelatedPackageVersions:
 dpkg 1.18.4ubuntu1
 apt 1.2.10ubuntu1
SourcePackage: mysql-5.7
Title: package mysql-server-5.7 5.7.11-0ubuntu6 failed to install/upgrade: subprocess installed post-installation script returned error exit status 1
UpgradeStatus: Upgraded to xenial on 2016-04-21 (0 days ago)

UPDATE:
I just wanted to make sure that I add that the release-upgrade did a dpkg --configure -a succesfully. However, dpkg says mysql-server-5.7 was already installed.

Nicholas Sharp (nsharpent) wrote :
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in mysql-5.7 (Ubuntu):
status: New → Confirmed
description: updated
KaotikPaladin (byo) wrote :

The mysql installation fail also to me in the upgrade process and also trying a new install:

Configurazione di mysql-server-core-5.7 (5.7.11-0ubuntu6)...
Configurazione di mysql-server-5.7 (5.7.11-0ubuntu6)...
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.
dpkg: errore nell'elaborare il pacchetto mysql-server-5.7 (--configure):
 il sottoprocesso installato script di post-installation ha restituito lo stato di errore 1
Configurazione di mysql-client (5.7.11-0ubuntu6)...
dpkg: problemi con le dipendenze impediscono la configurazione di mysql-server:
 mysql-server dipende da mysql-server-5.7; comunque:
  Il pacchetto mysql-server-5.7 non è ancora configurato.

dpkg: errore nell'elaborare il pacchetto mysql-server (--configure):
 problemi con le dipendenze - lasciato non configurato
Segnalazione apport non scritta poiché il messaggio di errore indica la presenza di un fallimento precedente.
                             Elaborazione dei trigger per systemd (229-4ubuntu4)...
Elaborazione dei trigger per ureadahead (0.100.0-19)...
Si sono verificati degli errori nell'elaborazione:
 mysql-server-5.7
 mysql-server
E: Sub-process /usr/bin/dpkg returned an error code (1)

I had try:
sudo apt remove --purge mysql-server-5.5
sudo apt remove --purge mysql-server-5.6
sudo apt remove --purge mysql-server-5.7
sudo apt-get autoremove
sudo apt-get autoclean
sudo apt update
sudo apt upgrade
sudo apt install mysql-server mysql-client

but nothing, still the error

Just tried

sudo apt install mysql-server mysql-client

and it worked.

Previously was trying several times to install just mysql-server and it didn't install both via Synaptic and apt.

Gremlyn1 (gremlyn1) wrote :

I'm having the same problem, so far nothing is working to get this installed.

The same is happening on my system.

I used strace to see errors in the installation, and i saw this line in /tmp/trace

open("/var/lib/dpkg/info/mysql-server-5.7.triggers", O_RDONLY) = -1 ENOENT (No such file or directory)

Can this be the culprit?

Rick (invisibunny) wrote :

I finally got it to install by removing any previous configuration files that I had altered. Back them up first if you are nervous

cd /etc/mysql
sudo cp my.cnf my.cnf.april16
Sudo rm /etc/mysql/my.cnf

that may be enough to get it running. I also removed a the mysqld.cnf file under /etc/mysqld/mysqld.cnf

After that,, when I ran
sudo dpkg --configure -a
It noticed the config files missing, reinstalled, and everything works now.

eiro (eiro1980) wrote :

Just enable mysql if you disabled it before, and it should work.
command:
sudo systemctl enable mysql.service

Rodney Shupe (rodney-shupe) wrote :

Purged all aspects of mysql from the system, Uninstalled and deleted any directories related to mysql. Apt install worked after that.

ChrisAga (chrisaga) wrote :

Hi !
I had the same issue and fixed it almost like Rick except I had to remove all the possible my.cnf "alternatives".
Before that I purged mysql-server-5.7.
Then I was able to reinstall it. I checked again all my databases and everything was OK.

sudo apt-get purge mysql-server-5.7
cd /etc/mysql
sudo rm my.cnf my.cnf.fallback my.cnf.migrated my.cnf.wba.bak /etc/alternatives/my.cnf
sudo apt-get install mysql-server
sudo mysqlcheck --all-databases -p

I think I could just have reconfigured all (sudo dpkg --configure -a) instead of purging sql-server-5.7 but after multiple trial and errors I thought it was safer.

Bastian (bastian433) wrote :

what Christophe Agathon (christophe-agathon) says works for me, at first I still get a dependancy error of some sort but somehow the mysqlcheck straightens it all out or something. well, the result is it works after doing that.

just doing sudo dpkg --configure -a does not work for me, I needed to purge it and also delete the cnf files.

Robie Basak (racb) wrote :

From log:

Setting up mysql-server-5.7 (5.7.11-0ubuntu6) ...
Installing new version of config file /etc/apparmor.d/usr.sbin.mysqld ...
Installing new version of config file /etc/init.d/mysql ...
Installing new version of config file /etc/init/mysql.conf ...
Installing new version of config file /etc/logrotate.d/mysql-server ...
Installing new version of config file /etc/mysql/debian-start ...
update-alternatives: using /etc/mysql/mysql.cnf to provide /etc/mysql/my.cnf (my.cnf) in auto mode
mysql start/running, process 11230
Checking if update is needed.
Checking server version.
Running queries to upgrade MySQL server.
mysql_upgrade: [ERROR] 1007: Can't create database 'performance_schema'; database exists
mysql_upgrade failed with exit status 5
dpkg: error processing package mysql-server-5.7 (--configure):
 subprocess installed post-installation script returned error exit status 1

Gremlyn1 (gremlyn1) wrote :

How is this a duplicate of a more recently reported bug? Shouldn't it be the other way around??

Gremlyn1 (gremlyn1) wrote :

I got this to work for me too, but I had a slightly different config file setup. Once I found them all and removed them, I was able to upgrade no problem.

Axel Pospischil (apos) wrote :
Download full text (4.1 KiB)

FIRST: I think this should be the primary bug (not duplicate of #1574168 or #1574204 ) and because it has the most useful information in it. Someone should fix this.

----------------------------------

SECOND:

Searching the web I found, that in the XENIAL RELEASE NOTES the problem is already addressed and links to bug #1571865 :

* https://wiki.ubuntu.com/XenialXerus/ReleaseNotes#MySQL_5.7

So this bug should also be marked as DUPLICATE of bug #1571865 !

----------------------------------

THIRD:

So this bug should be considered of HIGH IMPORTANCE.

----------------------------------

For me, I could get this going on one of my computers moving /etc/mysql/my.cnf out of the way and running "apt-get -f install".

On another system this did NOT work. I did an Update from Ubuntu 14.04 to 16.04. I simply cannot get mysql-server.5.7 package getting installed and the server to be run.

I tried the solutions mentioned in bug #1571865 and the article in askubuntu: http://askubuntu.com/questions/760724/16-04-upgrade-broke-mysql-server. Nothing of the worked to get - even purging everything out of the way.

#> dpkg --configure -a
# Setting up mysql-server-5.7 (5.7.12-0ubuntu1) ...
# initctl: Unable to connect to Upstart: Failed to connect to socket /com/ubuntu/upstart: Connection refused
# 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.
# 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
# Errors were encountered while processing:
# mysql-server-5.7
# mysql-server

# > journalctl -xe
# Apr 26 15:52:37 teneriffa mysqld[31909]: 2016-04-26T13:52:37.020799Z 0 [Note] InnoDB: Shutdown completed; log sequence number 166631303
# Apr 26 15:52:37 teneriffa mysqld[31909]: 2016-04-26T13:52:37.024809Z 0 [Note] InnoDB: Removed temporary tablespace data file: "ibtmp1"
# Apr 26 15:52:37 teneriffa mysqld[31909]: 2016-04-26T13:52:37.024898Z 0 [Note] Shutting down plugin 'MEMORY'
# Apr 26 15:52:37 teneriffa mysqld[31909]: 2016-04-26T13:52:37.024910Z 0 [Note] Shutting down plugin 'PERFORMANCE_SCHEMA'
# Apr 26 15:52:37 teneriffa mysqld[31909]: 2016-04-26T13:52:37.025086Z 0 [Note] Shutting down plugin 'MRG_MYISAM'
# Apr 26 15:52:37 teneriffa mysqld[31909]: 2016-04-26T13:52:37.025093Z 0 [Note] Shutting down plugin 'MyISAM'
# Apr 26 15:52:37 teneriffa mysqld[31909]: 2016-04-26T13:52:37.025104Z 0 [Note] Shutting down plugin 'CSV'
# Apr 26 15:52:37 teneriffa mysqld[31909]: 2016-04-26T13:52:37.025113Z 0 [Note] Shutting down plugin 'sha256_password'
# Apr 26 15:52:37 teneriffa mysqld[31909]: 2016-04-26T13:52:37.025119Z 0 [Note] Shutting down plugin 'mysql_native_password'
# Apr 26 15:52:37 teneriffa mysqld[31909]: 2016-04-26T13:52:37.025353Z 0 [Note] Shut...

Read more...

Vertago1 (vertago1) wrote :

I ran into a problem upgrading mysql-server-5.7 and the issue was I had at some point disabled mysql by default with "sudo systemctl disable mysql.service". I have it installed so I can run it when I need it. To get the upgrade to work I had to:

sudo systemctl enable mysql.service
sudo apt-get install mysql-server-5.7
sudo systemctl disable mysql.service

This worked for me.

Axel Pospischil (apos) wrote :
Download full text (7.7 KiB)

Thanks. But did not work. I tried this before (really tried everything I could imagine).

.... whereas the list of duplicate bugs in bug #1571865 rises and rises ;-( But I am shure guys at ubuntu will fix this.

Serious admins would not update critical systems for now. Mine is only the entertainment server and I can live a few days without mythtv ;-)

Just for note:

#> systemctl enable mysql.service
#> service mysql start
#> tail -f /var/log/mysql/error.log

2016-04-26T15:35:03.306607Z 0 [Warning] Changed limits: max_open_files: 1024 (requested 5000)
2016-04-26T15:35:03.306733Z 0 [Warning] Changed limits: table_open_cache: 457 (requested 2000)
2016-04-26T15:35:03.550179Z 0 [Warning] option 'net_buffer_length': unsigned value 8388608 adjusted to 1048576
2016-04-26T15:35:03.550287Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2016-04-26T15:35:03.551657Z 0 [Note] /usr/sbin/mysqld (mysqld 5.7.12-0ubuntu1) starting as process 12296 ...
2016-04-26T15:35:03.561978Z 0 [Note] InnoDB: PUNCH HOLE support available
2016-04-26T15:35:03.562120Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2016-04-26T15:35:03.562133Z 0 [Note] InnoDB: Uses event mutexes
2016-04-26T15:35:03.562143Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2016-04-26T15:35:03.562153Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.8
2016-04-26T15:35:03.562168Z 0 [Note] InnoDB: Using Linux native AIO
2016-04-26T15:35:03.562712Z 0 [Note] InnoDB: Number of pools: 1
2016-04-26T15:35:03.562985Z 0 [Note] InnoDB: Not using CPU crc32 instructions
2016-04-26T15:35:03.584765Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
2016-04-26T15:35:03.608347Z 0 [Note] InnoDB: Completed initialization of buffer pool
2016-04-26T15:35:03.613754Z 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
2016-04-26T15:35:03.629460Z 0 [Note] InnoDB: Highest supported file format is Barracuda.
2016-04-26T15:35:03.680261Z 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2016-04-26T15:35:03.680485Z 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
2016-04-26T15:35:03.778536Z 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
2016-04-26T15:35:03.781534Z 0 [Note] InnoDB: 96 redo rollback segment(s) found. 96 redo rollback segment(s) are active.
2016-04-26T15:35:03.781618Z 0 [Note] InnoDB: 32 non-redo rollback segment(s) are active.
2016-04-26T15:35:03.783864Z 0 [Note] InnoDB: Waiting for purge to start
2016-04-26T15:35:03.834409Z 0 [Note] InnoDB: 5.7.12 started; log sequence number 166629941
2016-04-26T15:35:03.834940Z 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
2016-04-26T15:35:03.835109Z 0 [Note] Plugin 'FEDERATED' is disabled.
2016-04-26T15:35:03.835306Z 0 [Note] InnoDB: Buffer pool(s) load completed at 160426 17:35:03
2016-04-26T15:35:03.836621Z 0 [Warning] System table 'plugin' is expected to be transactional.
2016-0...

Read more...

Giovanni G. (giovanni-g) wrote :

Well, looks like I managed to install it by removing both mysql AND mariadb.
For some reason, whenever I removed mysql-client it was installing mariadb-client and viceversa, anyway I succeeded this way:

sudo apt purge mariadb-client-10.0 mariadb-common mysql-client mysql-client-5.7 mysql-client-core-5.7 mysql-common dbconfig-mysql

This command also installed "dbconfig-no-thanks", which could have helped in bypassing the issue

after that

sudo apt-get install mysql-client mysql-server

Worked!

Ghoti (dopeghoti) wrote :

Thanks, giovanni-g; your solution worked for me also.

I'd love to hear how upgrading 14.04 LTS to 16.04 LTS with MySQL passed QA with this egregious issue.

Axel Pospischil (apos) wrote :

@giovanni-g: did not work for me.

Amit Sedai (amitsedaiz) wrote :

@giovanni-g: your solution also worked for me.Thanks.

rammstein (doyen-gilles) wrote :

What worked for me (on all the tested scenarios) is to:
sudo apt-get remove --purge mysql*
sudo apt-get install mysql-server

(this will also flush the client and I think it's actually him the root cause of the issue)

After this, mysql works like a charm on my machines

Also affects me, I've tried *everything* listed above, purging etc. and nothing works (even after rm'ing config and other old files)

DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=16.04
DISTRIB_CODENAME=xenial
DISTRIB_DESCRIPTION="Ubuntu 16.04 LTS"

Chris (cnizzardini) wrote :

Also receiving this error. A ton of errors really. It also failed to update several MySQL tables in information_schema and performance_schema and many other things. Over a series of hours I got MySQL to work by running mysql_upgrade and doing several other things, some of which are linked to below, sorry I did not create exact steps:

http://askubuntu.com/questions/705458/ubuntu-15-10-mysql-error-1524-unix-socket
http://stackoverflow.com/questions/31967527/table-performance-schema-session-variables-doesnt-exist

Finally I noticed this:
Setting up mysql-server-5.7 (5.7.12-0ubuntu1.1) ...
mysql_upgrade: Got error: 1045: Access denied for user 'debian-sys-maint'@'localhost' (using password: YES) while connecting to the MySQL server

SOLUTION:
CREATE USER 'debian-sys-maint'@'localhost' IDENTIFIED BY '***';GRANT ALL PRIVILEGES ON *.* TO 'debian-sys-maint'@'localhost' IDENTIFIED BY '***' REQUIRE NONE WITH GRANT OPTION MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0 MAX_UPDATES_PER_HOUR 0 MAX_USER_CONNECTIONS 0;

Then: sudo apt-get upgrade

Anyways good luck folks, this took me several hours to move through this hell. I believe something messed up with the install, the debian-sys-maint user was not created, so system could not update MySQL schema which probably lead to a whole host of other errors. Be sure to check your logs so you can resolve this quicker than it took me.

The solution provided by "rammstein (doyen-gilles) wrote on 2016-06-13"

Worked for me - just remember that this command :

sudo apt-get remove --purge mysql*

Will ask You if You want to REMOVE your databases from /var/lib/mysql - so make a BACKUP first !

After this I could install database by :

sudo apt-get install mysql-server

Changed in mysql-5.7 (Ubuntu):
importance: Undecided → High
abhijit (abhijit13) wrote :

I've tried all options mentioned above and still facing the problem. This happened after upgrade from 14.04 to 16.04.

Tried: Remove all .cnf files from /etc/mysql and then did "apt purge mysql*" and then "apt install mysql-server".

Getting following error:
Setting up mysql-server-5.7 (5.7.13-0ubuntu0.16.04.2) ...
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.
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
No apport report written because the error message indicates its a followup error from a previous failure.
                                                                                                          Processing triggers for systemd (229-4ubuntu7) ...
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)

root@foss:/# systemctl status mysql.service
● mysql.service - MySQL Community Server
   Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
   Active: activating (start-post) (Result: exit-code) since Tue 2016-09-13 17:06:16 IST; 22s ago
  Process: 6850 ExecStart=/usr/sbin/mysqld (code=exited, status=1/FAILURE)
  Process: 6847 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=0/SUCCESS)
 Main PID: 6850 (code=exited, status=1/FAILURE); : 6851 (mysql-systemd-s)
   CGroup: /system.slice/mysql.service
           └─control
             ├─6851 /bin/bash /usr/share/mysql/mysql-systemd-start post
             └─6925 sleep 1

Sep 13 17:06:16 foss.coep.org.in systemd[1]: Starting MySQL Community Server...
Sep 13 17:06:18 foss.coep.org.in systemd[1]: mysql.service: Main process exited, code=exited, status=1/FAILURE

abhijit (abhijit13) wrote :

root@foss:~# /bin/systemctl --no-pager start mysql.service
Job for mysql.service failed because the control process exited with error code. See "systemctl status mysql.service" and "journalctl -xe" for details.

this is what I get on running the systemctl command directly.

Alex (tlex) wrote :

My workaround was to edit /var/lib/dpkg/info/mysql-server-5.7.triggers and to change the invoke() function:

invoke() {
  if pathfind invoke-rc.d; then
    invoke-rc.d mysql $1
    systemctl $1 mysql
  else
    /etc/init.d/mysql $1
  fi
}

I'm running mysql in an LXC container.

Hi abhijit,
if all the mentioned fixes for the local configuration don't help you you might be affected by a similar but different issue. In that case to try to help I'd ask you to report a new bug.
Using apport will upload your logs so one can check if things are different in your case.
See https://help.ubuntu.com/community/ReportingBugs for more.

Please mention this bug in your report so the one checking your uploaded logs can compare and easily finds this one to close as dup in case the bug is really the same - although in that case the foxes should apply as well.

Robie Basak (racb) wrote :

@Reza

Why did you undupe this bug?

The original reporter's problem clearly states in its log message "mysql_upgrade: [ERROR] 1007: Can't create database 'performance_schema'; database exists". The cause of the reporter's problem was bug 1574168, so I am re-marking this as a duplicate.

If you have a problem with your installation, ask yourself whether you saw this particular error message. If you did, you should refer to bug 1574168. If you did not, then you have a separate problem unrelated to this bug. It may share some of the same symptoms, but it is a separate problem and it is confusing and unproductive to treat it as the same root issue as in this bug.

I understand that sometimes different root causes result in the same symptoms; however in this case, we believe we understand the problem in bug 1574168 and I'm reasonably confident that it has the same root cause.

WhyteHorse (whytehorse) wrote :

Same here. I fixed it with the christophe agathe method

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers