Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 722118 - dev-db/mysql-8.0.19-r1 : emerge --config =dev-db/mysql-8.0.19-r1 fails with "Failed to initialize mysql data directory"
Summary: dev-db/mysql-8.0.19-r1 : emerge --config =dev-db/mysql-8.0.19-r1 fails with "...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: AMD64 Linux
: Normal normal with 1 vote (vote)
Assignee: Gentoo Linux MySQL bugs team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-05-10 12:45 UTC by Tor Rune Skoglund
Modified: 2020-06-01 23:16 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tor Rune Skoglund 2020-05-10 12:45:10 UTC
Fresh install on fully up-to-date system:

# emerge --config =dev-db/mysql-8.0.19-r1


Configuring pkg...

 * Will use username 'mysql' and group 'mysql' ...
 * mysql data directory detected as '/var/lib/mysql' ...

 * Please select default authentication plugin (enter number or plugin name):
 * 1) caching_sha2_password [MySQL 8.0 default]
 * 2) mysql_native_password [MySQL 5.7 default]
 * 
 * For details see:
 * https://dev.mysql.com/doc/refman/8.0/en/upgrading-from-previous-series.html#upgrade-caching-sha2-password
    >1

 * Ensuring that default-auth is set to 'caching_sha2_password' in '/etc/mysql/mysql.d/50-distro-client.cnf' ...
 * Ensuring that default-authentication-plugin is set to 'caching_sha2_password' in '/etc/mysql/mysql.d/50-distro-server.cnf' ...

 * Trying to get password for mysql 'root' user from 'mysql' section ...
 * Trying to get password for mysql 'root' user from 'client' section ...

 * No password for mysql 'root' user was specified via environment
 * variable MYSQL_ROOT_PASSWORD and no password was found in config
 * file like '/root/.my.cnf'.
 * To continue please provide a password for the mysql 'root' user
 * now on console:
 * NOTE: Please avoid ["'\_%] characters in the password!
    > [typed in pwd here]
 * Retype the password
    > [typed in pwd here]

 * Initializing mysql data directory: /usr/sbin/mysqld --loose-skip-host-cache --loose-skip-name-resolve --loose-skip-networking --loose-skip-slave-start --loose-skip-federated --loose-skip-ssl --loose-skip-log-bin --loose-skip-relay-log --loose-skip-slow-query-log --loose-skip-external-locking --loose-skip-log-slave-updates --initialize-insecure --init-file='/var/tmp/portage/dev-db/mysql-8.0.19-r1/temp/tz.sql' --basedir='/usr' --datadir='/var/lib/mysql' --tmpdir='/var/tmp/portage/dev-db/mysql-8.0.19-r1/temp/mysqld-tmp.212222413' --log-error='/var/tmp/portage/dev-db/mysql-8.0.19-r1/temp/mysql_install_db.log' --user=mysql
2020-05-10T12:32:54.758983Z 0 [System] [MY-013169] [Server] /usr/sbin/mysqld (mysqld 8.0.19) initializing of server in progress as process 23787
2020-05-10T12:32:54.773976Z 0 [ERROR] [MY-010187] [Server] Could not open file '/var/tmp/portage/dev-db/mysql-8.0.19-r1/temp/mysql_install_db.log' for error logging: Permission denied
2020-05-10T12:32:54.774461Z 0 [ERROR] [MY-013236] [Server] The designated data directory /var/lib/mysql/ is unusable. You can remove all files that the server added to it.
2020-05-10T12:32:54.774544Z 0 [ERROR] [MY-010119] [Server] Aborting
2020-05-10T12:32:54.775828Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.19)  Gentoo Linux mysql-8.0.19-r1.
 * ERROR: dev-db/mysql-8.0.19-r1::gentoo failed (config phase):
 *   Failed to initialize mysql data directory. Please review '/var/tmp/portage/dev-db/mysql-8.0.19-r1/temp/mysql_install_db.log'!
 * 
 * Call stack:
 *     ebuild.sh, line 125:  Called pkg_config
 *   environment, line 3129:  Called die
 * The specific snippet of code:
 *           die "Failed to initialize ${PN} data directory. Please review '${mysql_install_log}'!";
 * 
 * If you need support, post the output of `emerge --info '=dev-db/mysql-8.0.19-r1::gentoo'`,
 * the complete build log and the output of `emerge -pqv '=dev-db/mysql-8.0.19-r1::gentoo'`.
 * The complete build log is located at '/var/tmp/portage/dev-db/mysql-8.0.19-r1/temp/build.log'.
 * The ebuild environment file is located at '/var/tmp/portage/dev-db/mysql-8.0.19-r1/temp/environment'.
 * Working directory: '/var/tmp/portage/dev-db/mysql-8.0.19-r1/homedir'
 * S: '/var/tmp/portage/dev-db/mysql-8.0.19-r1/work/mysql-8.0.19'

# ls -l /var/tmp/portage/dev-db/mysql-8.0.19-r1/temp/mysql_install_db.log
-rw-r--r-- 1 mysql root 712 May 10 14:32 /var/tmp/portage/dev-db/mysql-8.0.19-r1/temp/mysql_install_db.log

That log file contains the same System/ERROR liner as above.

Doing "chmod 777 /var/tmp/portage/dev-db/mysql-8.0.19-r1/temp/mysql_install_db.log" does not help as the file seems to be recreated on every run.
Comment 1 Alexey Prokopchuk 2020-05-10 17:39:05 UTC
I have the same bug. Perhaps this is due to '/var/tmp/portage/dev-db/mysql-8.0.19-r1' directory permissions, which is portage:portage, 700

I found a workaround to solve this problem:
1. Run "emerge --config =dev-db/mysql-8.0.19-r1", emerge will wait for input.
2. Switch to anonther console and run "chmod 755 /var/tmp/portage/dev-db/mysql-8.0.19-r1"
3. Return to emerge and continue emerge. mysql initialization will succeeds.
Comment 2 Tor Rune Skoglund 2020-05-11 12:46:02 UTC
Thank for the hint, Alexey. That works for me too. It might be that I had to do -R on chown to be sure.

Can also confirm that 8.0.20 is affected by the same bug.
Comment 3 Alexey Prokopchuk 2020-05-12 19:49:22 UTC
(In reply to Tor Rune Skoglund from comment #2)
> It might be that I had to do -R on chown to be sure.
No, this only applies to permissions of /var/tmp/portage/dev-db/mysql-(version).
All other permissions are correct, so '-R' option is not needed.
Such behavior is because mysql initialization process is running from 'mysql' user and "portage:portage; 700" permissions in the middle of file path. In this case the file at the end of the path will never be available despite its own permissions.
Comment 4 Larry the Git Cow gentoo-dev 2020-05-24 20:25:01 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ab0818d2ba2fd2ab8efa5e1ba9bcb2503975a8b1

commit ab0818d2ba2fd2ab8efa5e1ba9bcb2503975a8b1
Author:     Thomas Deutschmann <whissi@gentoo.org>
AuthorDate: 2020-05-24 14:39:52 +0000
Commit:     Thomas Deutschmann <whissi@gentoo.org>
CommitDate: 2020-05-24 20:23:44 +0000

    dev-db/mysql: fix pkg_config
    
    Bug: https://bugs.gentoo.org/722118
    Package-Manager: Portage-2.3.99, Repoman-2.3.22
    Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>

 dev-db/mysql/mysql-8.0.19-r1.ebuild | 183 +++++++++++++++++++++---------------
 dev-db/mysql/mysql-8.0.20.ebuild    | 183 +++++++++++++++++++++---------------
 2 files changed, 212 insertions(+), 154 deletions(-)
Comment 5 Thomas Deutschmann (RETIRED) gentoo-dev 2020-05-24 21:04:57 UTC
Keep in mind: You need to re-emerge the package to get the updated pkg_config code because I did not rev bump.
Comment 6 Petr Morávek 2020-05-31 04:24:51 UTC
It looks like this also affects mysql 5.7 ebuilds. I'm getting config failure of freshly installed dev-db/mysql-5.7.30:

Configuring pkg...

 * Trying to get password for mysql 'root' user from 'mysql' section ...
 * Found password in 'mysql' section!
 * Please provide a password for the mysql 'root' user now
 * or through the /root/.my.cnf file.
 * Avoid ["'\_%] characters in the password
    >
 * Retype the password
    >
 * Creating the mysql database and setting proper permissions on it ...
 * Command: /usr/sbin/mysqld --initialize-insecure --init-file='/var/tmp/portage/dev-db/mysql-5.7.30/temp/tmp.neTXYCNuMh' --basedir=/usr --loose-skip-host-cache --loose-skip-name-resolve --loose-skip-networking --loose-skip-slave-start --loose-skip-federated --loose-skip-ssl --loose-skip-log-bin --loose-skip-relay-log --loose-skip-slow-query-log --loose-skip-external-locking --loose-skip-log-slave-updates --datadir=/var/lib/mysql --tmpdir=/tmp/
 * ERROR: dev-db/mysql-5.7.30::gentoo failed (config phase):
 *   Failed to initialize mysqld. Please review /var/log/mysql/mysqld.err AND /var/tmp/portage/dev-db/mysql-5.7.30/temp/mysql_install_db.log
 * 
 * Call stack:
 *     ebuild.sh, line 125:  Called pkg_config
 *   environment, line 4111:  Called die
 * The specific snippet of code:
 *           die "Failed to initialize mysqld. Please review ${EPREFIX}/var/log/mysql/mysqld.err AND ${TMPDIR%/}/mysql_install_db.log";
 * 
 * If you need support, post the output of `emerge --info '=dev-db/mysql-5.7.30::gentoo'`,
 * the complete build log and the output of `emerge -pqv '=dev-db/mysql-5.7.30::gentoo'`.
 * The complete build log is located at '/var/tmp/portage/dev-db/mysql-5.7.30/temp/build.log'.
 * The ebuild environment file is located at '/var/tmp/portage/dev-db/mysql-5.7.30/temp/environment'.
 * Working directory: '/var/tmp/portage/dev-db/mysql-5.7.30/temp'
 * S: '/var/tmp/portage/dev-db/mysql-5.7.30/work/mysql-5.7.30'






# cat /var/log/mysql/mysqld.err 
2020-05-31T03:55:35.318237Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2020-05-31T03:55:35.730278Z 0 [Warning] InnoDB: New log files created, LSN=45790
2020-05-31T03:55:35.807817Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2020-05-31T03:55:35.871866Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: 954add8f-a2f2-11ea-8e79-0242ac110002.
2020-05-31T03:55:35.875275Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2020-05-31T03:55:35.982102Z 1 [Warning] root@localhost is created with an empty password ! Please consider switching off the --initialize-insecure option.
2020-05-31T03:55:38.943892Z 1 [ERROR] Failed to open the bootstrap file /var/tmp/portage/dev-db/mysql-5.7.30/temp/tmp.neTXYCNuMh
2020-05-31T03:55:38.943930Z 1 [ERROR] 1105  Bootstrap file error, return code (0). Nearest query: 'SET @@sql_log_bin = @sql_log_bin;
'
2020-05-31T03:55:38.944152Z 0 [ERROR] Aborting
Comment 7 Larry the Git Cow gentoo-dev 2020-06-01 23:16:59 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=03df35088276f459b96fddfea06753ea93b81989

commit 03df35088276f459b96fddfea06753ea93b81989
Author:     Thomas Deutschmann <whissi@gentoo.org>
AuthorDate: 2020-06-01 23:13:51 +0000
Commit:     Thomas Deutschmann <whissi@gentoo.org>
CommitDate: 2020-06-01 23:16:30 +0000

    dev-db/mysql: fix pkg_config
    
    Closes: https://bugs.gentoo.org/722118
    Package-Manager: Portage-2.3.100, Repoman-2.3.22
    Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>

 dev-db/mysql/mysql-5.6.45-r2.ebuild | 15 ++++++++++++---
 dev-db/mysql/mysql-5.7.30.ebuild    | 15 ++++++++++++---
 2 files changed, 24 insertions(+), 6 deletions(-)