Bug #90681 MySQL 8.0 fails to install and start from Oracle .debs on debian 9 x86_64
Submitted: 29 Apr 2018 15:19 Modified: 10 Sep 2019 9:36
Reporter: Jaime Crespo (OCA) Email Updates:
Status: Can't repeat Impact on me:
None 
Category:MySQL Server: Packaging Severity:S3 (Non-critical)
Version:8.0 OS:Debian
Assigned to: MySQL Verification Team CPU Architecture:Any

[29 Apr 2018 15:19] Jaime Crespo
Description:
MySQL 8.0 Server is not successfully installed using Oracle-provided packages for debian 9 on amd64.

How to repeat:
Follow the same steps that were successful on 5.7:

https://dbahire.com/how-to-install-mysql-server-on-debian-stretch/

(all steps up to the final apt run work correctly).

$ sudo apt install mysql-server
The following additional packages will be installed:
  mysql-client mysql-common mysql-community-client mysql-community-client-core
  mysql-community-server mysql-community-server-core
The following NEW packages will be installed:
  mysql-client mysql-common mysql-community-client mysql-community-client-core
  mysql-community-server mysql-community-server-core mysql-server
0 upgraded, 7 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/41.3 MB of archives.
After this operation, 355 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 ... 159213 files and directories currently installed.)
Preparing to unpack .../0-mysql-common_8.0.11-1debian9_amd64.deb ...
Unpacking mysql-common (8.0.11-1debian9) ...
Selecting previously unselected package mysql-community-client-core.
Preparing to unpack .../1-mysql-community-client-core_8.0.11-1debian9_amd64.deb ...
Unpacking mysql-community-client-core (8.0.11-1debian9) ...
Selecting previously unselected package mysql-community-client.
Preparing to unpack .../2-mysql-community-client_8.0.11-1debian9_amd64.deb ...
Unpacking mysql-community-client (8.0.11-1debian9) ...
Selecting previously unselected package mysql-client.
Preparing to unpack .../3-mysql-client_8.0.11-1debian9_amd64.deb ...
Unpacking mysql-client (8.0.11-1debian9) ...
Selecting previously unselected package mysql-community-server-core.
Preparing to unpack .../4-mysql-community-server-core_8.0.11-1debian9_amd64.deb ...
Unpacking mysql-community-server-core (8.0.11-1debian9) ...
Selecting previously unselected package mysql-community-server.
Preparing to unpack .../5-mysql-community-server_8.0.11-1debian9_amd64.deb ...
Failed to stop mysql.service: Unit mysql.service not loaded.
invoke-rc.d: initscript mysql, action "stop" failed.
dpkg: error processing archive /tmp/apt-dpkg-install-BjELOw/5-mysql-community-server_8.0.11-1debian9_amd64.deb (--unpack):
 subprocess new pre-installation script returned error exit status 5
Failed to start mysql.service: Unit mysql.service not found.
invoke-rc.d: initscript mysql, action "start" failed.
Unit mysql.service could not be found.
dpkg: error while cleaning up:
 subprocess new post-removal script returned error exit status 5
Selecting previously unselected package mysql-server.
Preparing to unpack .../6-mysql-server_8.0.11-1debian9_amd64.deb ...
Unpacking mysql-server (8.0.11-1debian9) ...
Errors were encountered while processing:
 /tmp/apt-dpkg-install-BjELOw/5-mysql-community-server_8.0.11-1debian9_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

Suggested fix:
I am not sure this is entirely the package's fault- this was not a clean install- however, I made sure to delete all related mariadb and mysql packages and /etc files beforehand. Maybe there is still some dependency that is badly managed and maybe the packages can handle it. Maybe there is some additional package I have to uninstall?

Right now it is easier to me to compile the server than trying to handle all package dependencies (it is not easy as there are by default mariadb/debian-provided packages with the same name).
[30 Apr 2018 5:12] Lars Tangvald
Hi,

It's hard to be entirely sure, but a few steps to check for a clean reinstall:

* Ensure no mysqld processes are running
* Purge (not just remove, as apt-get remove won't remove support files like service scripts, etc) any mariadb and mysql packages (there's a chance a previous attempt might leave behind broken mysql packages)
* Delete or rename /etc/mysql and /var/lib/mysql, since MariaDB uses both and may not remove them even when purging the package
[30 Apr 2018 7:22] Jaime Crespo
Those were done for sure. I don't know if there is something else with package pinning/priority, other packages etc that would be missing, etc. (I guess there is QA in place so it works on a clean environment).

Note I am not asking for support -I can have MySQL 8.0 with my own deb package, but if I have found problems with the upstream package, I guess other people will. Right now I cannot recommend the same installations steps than with 5.7 for my readers.
[1 May 2018 21:23] Terje Røsten
mariadb seems to add Alias=mysql.service in mariadb.service file.

Do you have any (dangling) symlink called mysql.service in 
/etc/systemd/system ?
[1 May 2018 22:25] Jaime Crespo
This could be it (totally my fault for having those files there):
sudo grep -R mysql.service /lib
/lib/systemd/system/mysql.service:# /lib/systemd/system/mysql.service
/lib/systemd/system/mysql@.service:# /lib/systemd/system/mysql.service

sudo rm -Rf /lib/systemd/system/mysql*
sudo systemctl daemon-reload
sudo grep -R mysql.service /lib

However,

Preparing to unpack .../mysql-community-server_8.0.11-1debian9_amd64.deb ...
................
dpkg: error processing archive /var/cache/apt/archives/mysql-community-server_8.0.11-1debian9_amd64.deb (--unpack):
 subprocess new pre-installation script returned error exit status 1
Errors were encountered while processing:
 /var/cache/apt/archives/mysql-community-server_8.0.11-1debian9_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

By running the preinst script manually, I think at least partially, the problem is the /run/mysqld directory, that I created manually owned by root, and that the script tries to access via /var/run/mysqld and change it to mysql user/group. Not sure what is the right thing to do there, given PermissionsStartOnly=true is also in your package, but it was complaining about the mysql user not existing.

I am not 100% sure if the package dependencies are in the right order, or if the premissions were trying to be setup before the user and group were being created?
[1 May 2018 22:32] Jaime Crespo
In other words, I would suggest to move the bug from packaging to documentation, and list under the debian packages an explicit list of checks/actions for upgrade, at https://dev.mysql.com/doc/refman/8.0/en/linux-installation-debian.html or https://dev.mysql.com/doc/mysql-apt-repo-quick-guide/en/ , including:

* Use of purge to uninstall other packages
* A list of known conflicting packages
* A list of shared paths to clean up (/var/lib, /run, /lib, /etc ,etc..)
[10 Sep 2019 9:28] MySQL Verification Team
Debian 9.11:

root@debian:~# wget https://dev.mysql.com/get/mysql-apt-config_0.8.13-1_all.deb
--2019-09-10 05:23:14--  https://dev.mysql.com/get/mysql-apt-config_0.8.13-1_all.deb
Resolving dev.mysql.com (dev.mysql.com)... 137.254.60.11
Connecting to dev.mysql.com (dev.mysql.com)|137.254.60.11|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://repo.mysql.com//mysql-apt-config_0.8.13-1_all.deb [following]
--2019-09-10 05:23:15--  https://repo.mysql.com//mysql-apt-config_0.8.13-1_all.deb
Resolving repo.mysql.com (repo.mysql.com)... 184.51.9.74
Connecting to repo.mysql.com (repo.mysql.com)|184.51.9.74|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 35560 (35K) [application/x-debian-package]
Saving to: ‘mysql-apt-config_0.8.13-1_all.deb’

mysql-apt-config_0.8.13-1_all.de 100%[========================================================>]  34.73K  --.-KB/s    in 0.001s

2019-09-10 05:23:17 (55.3 MB/s) - ‘mysql-apt-config_0.8.13-1_all.deb’ saved [35560/35560]

root@debian:~# dpkg -i mysql-apt-config_0.8.13-1_all.deb
Selecting previously unselected package mysql-apt-config.
(Reading database ... 27533 files and directories currently installed.)
Preparing to unpack mysql-apt-config_0.8.13-1_all.deb ...
Unpacking mysql-apt-config (0.8.13-1) ...
Setting up mysql-apt-config (0.8.13-1) ...
Warning: apt-key should not be used in scripts (called from postinst maintainerscript of the package mysql-apt-config)
OK
root@debian:~# apt-get update
Get:1 http://repo.mysql.com/apt/debian stretch InRelease [21.6 kB]
Hit:2 http://security.debian.org/debian-security stretch/updates InRelease
Get:3 http://repo.mysql.com/apt/debian stretch/mysql-8.0 Sources [947 B]
Ign:4 http://ftp.us.debian.org/debian stretch InRelease
Get:5 http://repo.mysql.com/apt/debian stretch/mysql-apt-config amd64 Packages [564 B]
Hit:6 http://ftp.us.debian.org/debian stretch-updates InRelease
Get:7 http://repo.mysql.com/apt/debian stretch/mysql-8.0 amd64 Packages [7,464 B]
Hit:8 http://ftp.us.debian.org/debian stretch Release
Get:9 http://repo.mysql.com/apt/debian stretch/mysql-tools amd64 Packages [4,475 B]
Fetched 35.1 kB in 0s (47.1 kB/s)
Reading package lists... Done
root@debian:~# apt-get install mysql-server
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
  libaio1 libmecab2 libnuma1 mecab-ipadic mecab-ipadic-utf8 mecab-utils mysql-client mysql-common mysql-community-client
  mysql-community-client-core mysql-community-server mysql-community-server-core
The following NEW packages will be installed:
  libaio1 libmecab2 libnuma1 mecab-ipadic mecab-ipadic-utf8 mecab-utils mysql-client mysql-community-client
  mysql-community-client-core mysql-community-server mysql-community-server-core mysql-server
The following packages will be upgraded:
  mysql-common
1 upgraded, 12 newly installed, 0 to remove and 0 not upgraded.
Need to get 32.7 MB of archives.
After this operation, 234 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://repo.mysql.com/apt/debian stretch/mysql-8.0 amd64 mysql-common amd64 8.0.17-1debian9 [84.6 kB]
Get:2 http://repo.mysql.com/apt/debian stretch/mysql-8.0 amd64 mysql-community-client-core amd64 8.0.17-1debian9 [1,518 kB]
Get:3 http://ftp.us.debian.org/debian stretch/main amd64 libaio1 amd64 0.3.110-3 [9,412 B]
Get:4 http://repo.mysql.com/apt/debian stretch/mysql-8.0 amd64 mysql-community-client amd64 8.0.17-1debian9 [2,533 kB]
Get:5 http://ftp.us.debian.org/debian stretch/main amd64 libmecab2 amd64 0.996-3.1 [256 kB]
Get:6 http://repo.mysql.com/apt/debian stretch/mysql-8.0 amd64 mysql-client amd64 8.0.17-1debian9 [81.1 kB]
Get:7 http://repo.mysql.com/apt/debian stretch/mysql-8.0 amd64 mysql-community-server-core amd64 8.0.17-1debian9 [15.9 MB]
Get:8 http://ftp.us.debian.org/debian stretch/main amd64 libnuma1 amd64 2.0.11-2.1 [33.3 kB]
Get:9 http://ftp.us.debian.org/debian stretch/main amd64 mecab-utils amd64 0.996-3.1 [7,364 B]
Get:10 http://ftp.us.debian.org/debian stretch/main amd64 mecab-ipadic all 2.7.0-20070801+main-1 [12.1 MB]
Get:11 http://repo.mysql.com/apt/debian stretch/mysql-8.0 amd64 mysql-community-server amd64 8.0.17-1debian9 [91.7 kB]
Get:12 http://repo.mysql.com/apt/debian stretch/mysql-8.0 amd64 mysql-server amd64 8.0.17-1debian9 [81.1 kB]
Get:13 http://ftp.us.debian.org/debian stretch/main amd64 mecab-ipadic-utf8 all 2.7.0-20070801+main-1 [4,262 B]
Fetched 32.7 MB in 2s (13.8 MB/s)
Reading changelogs... Done
Preconfiguring packages ...
(Reading database ... 27538 files and directories currently installed.)
Preparing to unpack .../00-mysql-common_8.0.17-1debian9_amd64.deb ...
Unpacking mysql-common (8.0.17-1debian9) over (5.8+1.0.2) ...
Selecting previously unselected package mysql-community-client-core.
Preparing to unpack .../01-mysql-community-client-core_8.0.17-1debian9_amd64.deb ...
Unpacking mysql-community-client-core (8.0.17-1debian9) ...
Selecting previously unselected package mysql-community-client.
Preparing to unpack .../02-mysql-community-client_8.0.17-1debian9_amd64.deb ...
Unpacking mysql-community-client (8.0.17-1debian9) ...
Selecting previously unselected package mysql-client.
Preparing to unpack .../03-mysql-client_8.0.17-1debian9_amd64.deb ...
Unpacking mysql-client (8.0.17-1debian9) ...
Selecting previously unselected package libaio1:amd64.
Preparing to unpack .../04-libaio1_0.3.110-3_amd64.deb ...
Unpacking libaio1:amd64 (0.3.110-3) ...
Selecting previously unselected package libmecab2:amd64.
Preparing to unpack .../05-libmecab2_0.996-3.1_amd64.deb ...
Unpacking libmecab2:amd64 (0.996-3.1) ...
Selecting previously unselected package libnuma1:amd64.
Preparing to unpack .../06-libnuma1_2.0.11-2.1_amd64.deb ...
Unpacking libnuma1:amd64 (2.0.11-2.1) ...
Selecting previously unselected package mysql-community-server-core.
Preparing to unpack .../07-mysql-community-server-core_8.0.17-1debian9_amd64.deb ...
[10 Sep 2019 9:28] MySQL Verification Team
Unpacking mysql-community-server-core (8.0.17-1debian9) ...
Selecting previously unselected package mysql-community-server.
Preparing to unpack .../08-mysql-community-server_8.0.17-1debian9_amd64.deb ...
Unpacking mysql-community-server (8.0.17-1debian9) ...
Selecting previously unselected package mecab-utils.
Preparing to unpack .../09-mecab-utils_0.996-3.1_amd64.deb ...
Unpacking mecab-utils (0.996-3.1) ...
Selecting previously unselected package mysql-server.
Preparing to unpack .../10-mysql-server_8.0.17-1debian9_amd64.deb ...
Unpacking mysql-server (8.0.17-1debian9) ...
Selecting previously unselected package mecab-ipadic.
Preparing to unpack .../11-mecab-ipadic_2.7.0-20070801+main-1_all.deb ...
Unpacking mecab-ipadic (2.7.0-20070801+main-1) ...
Selecting previously unselected package mecab-ipadic-utf8.
Preparing to unpack .../12-mecab-ipadic-utf8_2.7.0-20070801+main-1_all.deb ...
Unpacking mecab-ipadic-utf8 (2.7.0-20070801+main-1) ...
Setting up libnuma1:amd64 (2.0.11-2.1) ...
Setting up mysql-common (8.0.17-1debian9) ...
Installing new version of config file /etc/mysql/conf.d/mysql.cnf ...
Installing new version of config file /etc/mysql/my.cnf.fallback ...
Setting up libmecab2:amd64 (0.996-3.1) ...
Setting up mysql-community-client-core (8.0.17-1debian9) ...
Processing triggers for libc-bin (2.24-11+deb9u4) ...
Setting up libaio1:amd64 (0.3.110-3) ...
Processing triggers for man-db (2.7.6.1-2) ...
Setting up mecab-utils (0.996-3.1) ...
Setting up mysql-community-client (8.0.17-1debian9) ...
Setting up mecab-ipadic (2.7.0-20070801+main-1) ...
Compiling IPA dictionary for Mecab.  This takes long time...
reading /usr/share/mecab/dic/ipadic/unk.def ... 40
emitting double-array: 100% |###########################################|
/usr/share/mecab/dic/ipadic/model.def is not found. skipped.
reading /usr/share/mecab/dic/ipadic/Noun.adverbal.csv ... 795
reading /usr/share/mecab/dic/ipadic/Noun.nai.csv ... 42
reading /usr/share/mecab/dic/ipadic/Noun.demonst.csv ... 120
reading /usr/share/mecab/dic/ipadic/Adj.csv ... 27210
reading /usr/share/mecab/dic/ipadic/Interjection.csv ... 252
reading /usr/share/mecab/dic/ipadic/Prefix.csv ... 221
reading /usr/share/mecab/dic/ipadic/Conjunction.csv ... 171
reading /usr/share/mecab/dic/ipadic/Adverb.csv ... 3032
reading /usr/share/mecab/dic/ipadic/Noun.number.csv ... 42
reading /usr/share/mecab/dic/ipadic/Filler.csv ... 19
reading /usr/share/mecab/dic/ipadic/Adnominal.csv ... 135
reading /usr/share/mecab/dic/ipadic/Noun.place.csv ... 72999
reading /usr/share/mecab/dic/ipadic/Noun.others.csv ... 151
reading /usr/share/mecab/dic/ipadic/Auxil.csv ... 199
reading /usr/share/mecab/dic/ipadic/Noun.proper.csv ... 27327
reading /usr/share/mecab/dic/ipadic/Others.csv ... 2
reading /usr/share/mecab/dic/ipadic/Noun.org.csv ... 16668
reading /usr/share/mecab/dic/ipadic/Symbol.csv ... 208
reading /usr/share/mecab/dic/ipadic/Noun.csv ... 60477
reading /usr/share/mecab/dic/ipadic/Postp.csv ... 146
reading /usr/share/mecab/dic/ipadic/Suffix.csv ... 1393
reading /usr/share/mecab/dic/ipadic/Noun.name.csv ... 34202
reading /usr/share/mecab/dic/ipadic/Noun.verbal.csv ... 12146
reading /usr/share/mecab/dic/ipadic/Noun.adjv.csv ... 3328
reading /usr/share/mecab/dic/ipadic/Verb.csv ... 130750
reading /usr/share/mecab/dic/ipadic/Postp-col.csv ... 91
emitting double-array: 100% |###########################################|
reading /usr/share/mecab/dic/ipadic/matrix.def ... 1316x1316
emitting matrix      : 100% |###########################################|

done!
update-alternatives: using /var/lib/mecab/dic/ipadic to provide /var/lib/mecab/dic/debian (mecab-dictionary) in auto mode
Setting up mysql-client (8.0.17-1debian9) ...
Setting up mysql-community-server-core (8.0.17-1debian9) ...
Setting up mecab-ipadic-utf8 (2.7.0-20070801+main-1) ...
Compiling IPA dictionary for Mecab.  This takes long time...
reading /usr/share/mecab/dic/ipadic/unk.def ... 40
emitting double-array: 100% |###########################################|
/usr/share/mecab/dic/ipadic/model.def is not found. skipped.
reading /usr/share/mecab/dic/ipadic/Noun.adverbal.csv ... 795
reading /usr/share/mecab/dic/ipadic/Noun.nai.csv ... 42
reading /usr/share/mecab/dic/ipadic/Noun.demonst.csv ... 120
reading /usr/share/mecab/dic/ipadic/Adj.csv ... 27210
reading /usr/share/mecab/dic/ipadic/Interjection.csv ... 252
reading /usr/share/mecab/dic/ipadic/Prefix.csv ... 221
reading /usr/share/mecab/dic/ipadic/Conjunction.csv ... 171
reading /usr/share/mecab/dic/ipadic/Adverb.csv ... 3032
reading /usr/share/mecab/dic/ipadic/Noun.number.csv ... 42
reading /usr/share/mecab/dic/ipadic/Filler.csv ... 19
reading /usr/share/mecab/dic/ipadic/Adnominal.csv ... 135
reading /usr/share/mecab/dic/ipadic/Noun.place.csv ... 72999
reading /usr/share/mecab/dic/ipadic/Noun.others.csv ... 151
reading /usr/share/mecab/dic/ipadic/Auxil.csv ... 199
reading /usr/share/mecab/dic/ipadic/Noun.proper.csv ... 27327
reading /usr/share/mecab/dic/ipadic/Others.csv ... 2
reading /usr/share/mecab/dic/ipadic/Noun.org.csv ... 16668
reading /usr/share/mecab/dic/ipadic/Symbol.csv ... 208
reading /usr/share/mecab/dic/ipadic/Noun.csv ... 60477
reading /usr/share/mecab/dic/ipadic/Postp.csv ... 146
reading /usr/share/mecab/dic/ipadic/Suffix.csv ... 1393
reading /usr/share/mecab/dic/ipadic/Noun.name.csv ... 34202
reading /usr/share/mecab/dic/ipadic/Noun.verbal.csv ... 12146
reading /usr/share/mecab/dic/ipadic/Noun.adjv.csv ... 3328
reading /usr/share/mecab/dic/ipadic/Verb.csv ... 130750
reading /usr/share/mecab/dic/ipadic/Postp-col.csv ... 91
emitting double-array: 100% |###########################################|
reading /usr/share/mecab/dic/ipadic/matrix.def ... 1316x1316
emitting matrix      : 100% |###########################################|

done!
update-alternatives: using /var/lib/mecab/dic/ipadic-utf8 to provide /var/lib/mecab/dic/debian (mecab-dictionary) in auto mode
Setting up mysql-community-server (8.0.17-1debian9) ...
update-alternatives: using /etc/mysql/mysql.cnf to provide /etc/mysql/my.cnf (my.cnf) in auto mode
Created symlink /etc/systemd/system/multi-user.target.wants/mysql.service → /lib/systemd/system/mysql.service.
Setting up mysql-server (8.0.17-1debian9) ...
Processing triggers for libc-bin (2.24-11+deb9u4) ...
root@debian:~# service mysql status
● mysql.service - MySQL Community Server
   Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
   Active: active (running) since Tue 2019-09-10 05:25:54 EDT; 7s ago
     Docs: man:mysqld(8)
           http://dev.mysql.com/doc/refman/en/using-systemd.html
  Process: 2260 ExecStartPre=/usr/share/mysql-8.0/mysql-systemd-start pre (code=exited, status=0/SUCCESS)
 Main PID: 2295 (mysqld)
   Status: "Server is operational"
    Tasks: 39 (limit: 4915)
   CGroup: /system.slice/mysql.service
           └─2295 /usr/sbin/mysqld

Sep 10 05:25:52 debian systemd[1]: Starting MySQL Community Server...
Sep 10 05:25:54 debian systemd[1]: Started MySQL Community Server.
root@debian:~# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 10
Server version: 8.0.17 MySQL Community Server - GPL

Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> select @@version;
+-----------+
| @@version |
+-----------+
| 8.0.17    |
+-----------+
1 row in set (0.00 sec)

mysql> \q
Bye
root@debian:~#
[10 Sep 2019 9:36] MySQL Verification Team
Hi,

Following https://dev.mysql.com/doc/mysql-apt-repo-quick-guide/en/ the installation works as expected.

The same url at the beginning states that "The following instructions assume that no versions of MySQL..." linking to https://dev.mysql.com/doc/mysql-apt-repo-quick-guide/en/#repo-qg-apt-replacing to how to remove the previous one if one is there with autoremove. I don't believe asking users to *purge* anything is safe to go in documentation, this is a sysadmin decision and person doing the syste administration need to know and make decision in this case. We even have a note there that after you put our deb you should not run purge.