package mysql-server-5.7 (not installed) failed to install/upgrade: подпроцесс установлен сценарий post-installation возвратил код ошибки 1

Bug #1562362 reported by pl7ofit
58
This bug affects 12 people
Affects Status Importance Assigned to Milestone
mysql-5.7 (Ubuntu)
Expired
High
Unassigned

Bug Description

package mysql-server-5.7 failed to install/upgrade

ProblemType: Package
DistroRelease: Ubuntu 16.04
Package: mysql-server-5.7 (not installed)
ProcVersionSignature: Ubuntu 4.4.0-15.31-generic 4.4.6
Uname: Linux 4.4.0-15-generic x86_64
ApportVersion: 2.20-0ubuntu3
Architecture: amd64
Date: Fri Mar 25 11:59:03 2016
ErrorMessage: подпроцесс установлен сценарий post-installation возвратил код ошибки 1
InstallationDate: Installed on 2015-11-17 (130 days ago)
InstallationMedia: Xubuntu 14.04.3 LTS "Trusty Tahr" - Beta amd64 (20150805)
RelatedPackageVersions:
 dpkg 1.18.4ubuntu1
 apt 1.2.7
SourcePackage: mysql-5.7
Title: package mysql-server-5.7 (not installed) failed to install/upgrade: подпроцесс установлен сценарий post-installation возвратил код ошибки 1
UpgradeStatus: No upgrade log present (probably fresh install)

Revision history for this message
pl7ofit (pl7ofit) wrote :
Revision history for this message
Launchpad Janitor (janitor) wrote :

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

Changed in mysql-5.7 (Ubuntu):
status: New → Confirmed
Changed in mysql-5.7 (Ubuntu):
importance: Undecided → High
Revision history for this message
Robie Basak (racb) wrote :

Thank you for taking the time to report this bug and helping to make Ubuntu better.

There isn't really enough information here for a developer to confirm this issue is a bug, or to begin working on it, so I am marking this bug Incomplete for now.

If you can provide exact steps so that a developer can reproduce the original problem, then please add them to this bug and change the status back to New.

Changed in mysql-5.7 (Ubuntu):
status: Confirmed → Incomplete
Revision history for this message
Andrew (am-public-o) wrote :
Download full text (9.2 KiB)

mysql failed to upgrade

:~$ sudo apt-get update && sudo apt-get upgrade -y

Setting up mysql-server-5.7 (5.7.12-0ubuntu1) ...
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
E: Sub-process /usr/bin/dpkg returned an error code (1)

:~$ journalctl -xe
-- Subject: Unit mysql.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit mysql.service has failed.
--
-- The result is failed.
May 03 10:50:07 <hostname> systemd[1]: mysql.service: Unit entered failed state.
May 03 10:50:07 <hostname> systemd[1]: mysql.service: Failed with result 'exit-code'.
May 03 10:50:07 <hostname> systemd[1]: mysql.service: Service hold-off time over, scheduling restart.
May 03 10:50:07 <hostname> systemd[1]: Stopped MySQL Community Server.
-- Subject: Unit mysql.service has finished shutting down
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit mysql.service has finished shutting down.
May 03 10:50:07 <hostname> systemd[1]: Starting MySQL Community Server...
-- Subject: Unit mysql.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit mysql.service has begun starting up.
May 03 10:50:09 <hostname> systemd[1]: mysql.service: Main process exited, code=exited, status=1/FAILURE

:~$ vim /var/log/mysql/mysql.log
2016-05-03T00:52:39.082298Z 0 [Warning] Changed limits: max_open_files: 1024 (requested 5000)
2016-05-03T00:52:39.082361Z 0 [Warning] Changed limits: table_open_cache: 431 (requested 2000)
2016-05-03T00:52:39.218362Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2016-05-03T00:52:39.218701Z 0 [Note] /usr/sbin/mysqld (mysqld 5.7.12-0ubuntu1) starting as process 8583 ...
2016-05-03T00:52:39.221607Z 0 [Note] InnoDB: PUNCH HOLE support available
2016-05-03T00:52:39.221626Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2016-05-03T00:52:39.221631Z 0 [Note] InnoDB: Uses event mutexes
2016-05-03T00:52:39.221638Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2016-05-03T00:52:39.221643Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.8
2016-05-03T00:52:39.221647Z 0 [Note] InnoDB: Using Linux native AIO
2016-05-03T00:52:39.221816Z 0 [Note] InnoDB: Number of pools: 1
2016-05-03T00:52:39.221891Z 0 [Note] InnoDB: Using CPU crc32 instructions
2016-05-03T00:52:39.227090Z 0 [Note] Inn...

Read more...

Revision history for this message
Andrew (am-public-o) wrote :
Download full text (3.9 KiB)

I thought it might have been an old mysql 5.6 config file that was incompatible so I did the following (still unresolved):

:~$ sudo mv /etc/mysql/ /etc/mysql-backup

:~$ sudo apt-get remove --purge mysql-server mysql-server-5.7
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
  mysql-client-5.7 mysql-client-core-5.7 mysql-server-core-5.7
Use 'sudo apt autoremove' to remove them.
The following packages will be REMOVED:
  mysql-server* mysql-server-5.7*
0 to upgrade, 0 to newly install, 2 to remove and 2 not to upgrade.
2 not fully installed or removed.
After this operation, 48.5 MB disk space will be freed.
Do you want to continue? [Y/n] Y
(Reading database ... 335892 files and directories currently installed.)
Removing mysql-server (5.7.12-0ubuntu1) ...
Removing mysql-server-5.7 (5.7.12-0ubuntu1) ...
update-alternatives: warning: alternative /etc/mysql/my.cnf.fallback (part of link group my.cnf) doesn't exist; removing from list of alternatives
update-alternatives: warning: alternative /etc/mysql/my.cnf.migrated (part of link group my.cnf) doesn't exist; removing from list of alternatives
update-alternatives: warning: alternative /etc/mysql/mysql.cnf (part of link group my.cnf) doesn't exist; removing from list of alternatives
update-alternatives: warning: /etc/alternatives/my.cnf is dangling; it will be updated with best choice
Purging configuration files for mysql-server-5.7 (5.7.12-0ubuntu1) ...
Processing triggers for man-db (2.7.5-1) ...

:~$ sudo apt-get install mysql-server
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
  mysql-server-5.7
Suggested packages:
  tinyca
The following NEW packages will be installed:
  mysql-server mysql-server-5.7
0 to upgrade, 2 to newly install, 0 to remove and 2 not to upgrade.
Need to get 0 B/2,594 kB of archives.
After this operation, 48.5 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Preconfiguring packages ...
Selecting previously unselected package mysql-server-5.7.
(Reading database ... 335805 files and directories currently installed.)
Preparing to unpack .../mysql-server-5.7_5.7.12-0ubuntu1_amd64.deb ...
grep: /etc/mysql/: No such file or directory
Unpacking mysql-server-5.7 (5.7.12-0ubuntu1) ...
Selecting previously unselected package mysql-server.
Preparing to unpack .../mysql-server_5.7.12-0ubuntu1_all.deb ...
Unpacking mysql-server (5.7.12-0ubuntu1) ...
Processing triggers for systemd (229-4ubuntu4) ...
Processing triggers for ureadahead (0.100.0-19) ...
Processing triggers for man-db (2.7.5-1) ...
Setting up mysql-server-5.7 (5.7.12-0ubuntu1) ...
update-alternatives: using /etc/mysql/mysql.cnf to provide /etc/mysql/my.cnf (my.cnf) in auto mode
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-in...

Read more...

Revision history for this message
Simos Xenitellis  (simosx) wrote :

I got the exact same issue.

This is about installing "mysql-server" on a pristine Ubuntu 16.04 on DigitalOcean.
The installation fails.

Revision history for this message
Simos Xenitellis  (simosx) wrote :
Revision history for this message
Simos Xenitellis  (simosx) wrote :

Output of command "systemctl status mysql.service".

root@db:~# 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 Sat 2016-05-21 00:25:16 EEST; 11s ago
  Process: 3893 ExecStart=/usr/sbin/mysqld (code=exited, status=1/FAILURE)
  Process: 3892 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=0/SUCCESS)
 Main PID: 3893 (code=exited, status=1/FAILURE); : 3894 (mysql-systemd-s)
    Tasks: 2 (limit: 512)
   Memory: 3.0M
      CPU: 352ms
   CGroup: /system.slice/mysql.service
           └─control
             ├─3894 /bin/bash /usr/share/mysql/mysql-systemd-start post
             └─3919 sleep 1

May 21 00:25:16 db systemd[1]: mysql.service: Service hold-off time over, scheduling restart.
May 21 00:25:16 db systemd[1]: Stopped MySQL Community Server.
May 21 00:25:16 db systemd[1]: Starting MySQL Community Server...
May 21 00:25:16 db systemd[1]: mysql.service: Main process exited, code=exited, status=1/FAILURE

Revision history for this message
Simos Xenitellis  (simosx) wrote :

Output of "journalctl -xe"

Revision history for this message
Simos Xenitellis  (simosx) wrote :

I figured out the source of the problem in my case.
It was a memory issue (/var/log/mysql/error.log):

2016-05-20T21:10:32.004395Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2016-05-20T21:10:32.008319Z 0 [Note] /usr/sbin/mysqld (mysqld 5.7.12-0ubuntu1) starting as process 1968 ...
2016-05-20T21:10:32.048643Z 0 [Note] InnoDB: PUNCH HOLE support available
2016-05-20T21:10:32.048704Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2016-05-20T21:10:32.048719Z 0 [Note] InnoDB: Uses event mutexes
2016-05-20T21:10:32.048730Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2016-05-20T21:10:32.048742Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.8
2016-05-20T21:10:32.048753Z 0 [Note] InnoDB: Using Linux native AIO
2016-05-20T21:10:32.051586Z 0 [Note] InnoDB: Number of pools: 1
2016-05-20T21:10:32.052497Z 0 [Note] InnoDB: Using CPU crc32 instructions
2016-05-20T21:10:32.101825Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
2016-05-20T21:10:32.104758Z 0 [ERROR] InnoDB: mmap(137428992 bytes) failed; errno 12
2016-05-20T21:10:32.104802Z 0 [ERROR] InnoDB: Cannot allocate memory for the buffer pool
2016-05-20T21:10:32.105114Z 0 [ERROR] InnoDB: Plugin initialization aborted with error Generic error
2016-05-20T21:10:32.105152Z 0 [ERROR] Plugin 'InnoDB' init function returned error.
2016-05-20T21:10:32.105175Z 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2016-05-20T21:10:32.105190Z 0 [ERROR] Failed to initialize plugins.
2016-05-20T21:10:32.105201Z 0 [ERROR] Aborting

The problem is that the installation of the mysql-server package requires a successful launch of the MySQL server. If MySQL cannot start, then the package is not fully installed.

Revision history for this message
Andrew (am-public-o) wrote :

I tried again. This time journalctl -xe throws this useful error:
mysqld[23361]: mysqld: Can't read dir of '/etc/mysql/conf.d/' (Errcode: 2 - No such file or directory)

Easy fix now:
sudo cp -r /etc/mysql/mysql.conf.d/ /etc/mysql/conf.d/

Successfully migrated databases to 5.7

Repairing tables
mysql.proxies_priv OK
Upgrade process completed successfully.
Checking if update is needed.
Setting up mysql-server (5.7.12-0ubuntu1) ...

Revision history for this message
adrian15 (adrian15) wrote :
Download full text (4.0 KiB)

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 b...

Read more...

Revision history for this message
Launchpad Janitor (janitor) wrote :

[Expired for mysql-5.7 (Ubuntu) because there has been no activity for 60 days.]

Changed in mysql-5.7 (Ubuntu):
status: Incomplete → Expired
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.