[MDEV-18526] mysql_install_db fails because basedir is incorrect Created: 2019-02-09  Updated: 2019-02-19  Resolved: 2019-02-19

Status: Closed
Project: MariaDB Server
Component/s: Packaging, Platform RedHat, Scripts & Clients
Affects Version/s: 10.1.38
Fix Version/s: 10.2.23, 10.3.13, 10.1.39

Type: Bug Priority: Blocker
Reporter: Tim Ruhl Assignee: Oleksandr Byelkin
Resolution: Fixed Votes: 1
Labels: None
Environment:

CentOS Linux release 7.5.1804 (Core)

Linux localhost.localdomain 3.10.0-862.11.6.el7.x86_64 #1 SMP Tue Aug 14 21:49:04 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux


Issue Links:
Duplicate
duplicates MDEV-18563 mysql_install_db uses wrong path for ... Closed

 Description   

Since the release of 10.1.38 mysql_install_db fails when called without arguments:

[root@localhost vagrant]# mysql_install_db 
 
FATAL ERROR: Could not find //share/mysql/fill_help_tables.sql
 
If you compiled from source, you need to either run 'make install' to
copy the software into the correct location ready for operation.
If you don't want to do a full install, you can use the --srcdir
option to only install the mysql database and privilege tables
 
If you are using a binary release, you must either be at the top
level of the extracted archive, or pass the --basedir option
pointing to that location.
 
The latest information about mysql_install_db is available at
https://mariadb.com/kb/en/installing-system-tables-mysql_install_db

This problem does not occur with 10.1.37.



 Comments   
Comment by Elena Stepanova [ 2019-02-09 ]

Is it a source build or are you using binary packages, and if so, which ones?
If it's a source build, how do you build it – in-source, out-of-source, do you run make install, ...?

Comment by Tim Ruhl [ 2019-02-09 ]

This is the binary build from the mariadb repository:

[root@localhost vagrant]# cat /etc/yum.repos.d/MariaDB.repo
[MariaDB]
baseurl = http://yum.mariadb.org/10.1/centos7-amd64
gpgcheck = 1
gpgkey = https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
name = MariaDB repository

[root@localhost vagrant]# rpm -q -f /bin/mysql_install_db
MariaDB-server-10.1.38-1.el7.centos.x86_64
[root@localhost vagrant]# yum list installed |fgrep MariaDB-server
Failed to set locale, defaulting to C
MariaDB-server.x86_64 10.1.38-1.el7.centos @MariaDB

Comment by Martin Häcker [ 2019-02-13 ]

I'm seeing the same issue

$ cat /etc/yum.repos.d/mariadb.repo 
[mariadb]
baseurl = https://yum.mariadb.org/10.2/centos7-amd64
gpgcheck = 1
gpgkey = https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
name = MariaDB
 
$ rpm -q -f /bin/mysql_install_db
MariaDB-server-10.2.22-1.el7.centos.x86_64
 
$ yum list installed |grep MariaDB-server
MariaDB-server.x86_64              10.2.22-1.el7.centos                @mariadb 

Looks like this is a systematic issue?

Comment by Martin Häcker [ 2019-02-13 ]

I was able to workaround by adding this to the configuration:

[mysql_install_db]
basedir = /usr

Sadly I can't simply use that as that config file is reused across different machines with different basedirs of the installed MariaDB.

Comment by Martin Häcker [ 2019-02-13 ]

I've since resorted to add this config via the shell

# Workaround for https://jira.mariadb.org/browse/MDEV-18526
if [ $HOSTNAME =  'redacted' ]
then
    MYSQL_INSTALL_DB_CONFIG="--basedir=/usr"
fi
 
mysql_install_db $MYSQL_INSTALL_DB_CONFIG $CONFIG

Comment by Elena Stepanova [ 2019-02-14 ]

Thanks for the report. It appears to be a problem specific to configuration created by RPMs, at least on CentOS, but probably not limited to it.

MDEV-14580 is a culprit, it doesn't take into account this configuration.
On CentOS, mysqld is installed into /usr/sbin, while all the tools are installed into /usr/bin. Further, it has a symlink /sbin -> usr/sbin.

So, additions made by MDEV-14580

  • set dirname0 to /;
  • check that / exists and /sbin/mysqld exists and is executable, both of which happen to be true;
  • set basedir to /;
  • set bindir to //sbin;
  • set resolveip to //sbin/resolveip which is bound to fail later, which is probably the reason for MDEV-18563;
  • set mysqld to //sbin/mysqld which is okay;
  • set srcpkgdatadir and buildpkgdatadir to //share/mysql which causes the trouble described here.

Luckily, RPM installation happens to work.

Comment by Rick Salevsky [ 2019-02-18 ]

Same issue happens on openSUSE / SUSE. Any idea if this will this be fixed in the next 10.2.X release?

Comment by Sergei Golubchik [ 2019-02-19 ]

rsalevsky, yes, that's what the Blocker status means. No new releases (from the Fix Version/s list) until it's fixed.

Generated at Thu Feb 08 08:44:47 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.