[debian-mysql] Bug#928758: mariadb-server: mysql_install_db fails if basedir option isn't set, expecting resolveip to be present in /usr/sbin/

Michael Prokop mika at debian.org
Fri May 10 15:12:20 BST 2019


Package: mariadb-server
Version: 10.1.38-0+deb9u1
Severity: important

Hi,

starting with mariadb-server version 10.1.38-0+deb9u1, executing
/usr/bin/mysql_install_db fails if --basedir option isn't
explicitly set or configured accordingly via my.cnf:

| root at prx01b:~# /usr/bin/mysql_install_db --user=mysql --datadir=/tmp/foo
| Neither host 'prx01b' nor 'localhost' could be looked up with
| '/usr/sbin/resolveip'
| Please configure the 'hostname' command to return a correct
| hostname.
| If you want to solve this at a later stage, restart this script
| with the --force option
| 
| The latest information about mysql_install_db is available at
| https://mariadb.com/kb/en/installing-system-tables-mysql_install_db

While resolveip is present in /usr/bin (instead of /usr/sbin):

| root at prx01b:~# which resolveip
| /usr/bin/resolveip

Whereas it works fine with `--basedir` explicitly set to /usr:

| root at prx01b:~# /usr/bin/mysql_install_db --basedir=/usr
| Installing MariaDB/MySQL system tables in '/var/lib/mysql' ...
| 2019-05-10 15:38:34 140091769200000 [Note] /usr/sbin/mysqld (mysqld 10.1.38-MariaDB-0+deb9u1) starting as process 24550 ...
| 2019-05-10 15:38:34 140091769200000 [Note] InnoDB: innodb_empty_free_list_algorithm has been changed to legacy because of small buffer pool size. In order to use backoff, increase buffer pool at least up to 20MB.
| 
| 2019-05-10 15:38:34 140091769200000 [Note] InnoDB: Using mutexes to ref count buffer pool pages
| 2019-05-10 15:38:34 140091769200000 [Note] InnoDB: The InnoDB memory heap is disabled
| 2019-05-10 15:38:34 140091769200000 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
| 2019-05-10 15:38:34 140091769200000 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
| 2019-05-10 15:38:34 140091769200000 [Note] InnoDB: Compressed tables use zlib 1.2.8
| 2019-05-10 15:38:34 140091769200000 [Note] InnoDB: Using Linux native AIO
| 2019-05-10 15:38:34 140091769200000 [Note] InnoDB: Using SSE crc32 instructions
| 2019-05-10 15:38:34 140091769200000 [Note] InnoDB: Initializing buffer pool, size = 128.0M
| 2019-05-10 15:38:34 140091769200000 [Note] InnoDB: Completed initialization of buffer pool
| 2019-05-10 15:38:34 140091769200000 [Note] InnoDB: Highest supported file format is Barracuda.
| 2019-05-10 15:38:34 140091769200000 [Note] InnoDB: 128 rollback segment(s) are active.
| 2019-05-10 15:38:34 140091769200000 [Note] InnoDB: Waiting for purge to start
| 2019-05-10 15:38:34 140091769200000 [Note] InnoDB:  Percona XtraDB (http://www.percona.com) 5.6.42-84.2 started; log sequence number 1616727
| 2019-05-10 15:38:35 140091057989376 [Note] InnoDB: Dumping buffer pool(s) not yet started

This breaking change was caused by the following change in between
10.1.37-0+deb9u1 and 10.1.38-0+deb9u1 (see mariadb-10.1.git):

| (git)-[debian/10.1.38-0+deb9u1] % git diff debian/10.1.37-0+deb9u1.. scripts/mysql_install_db.sh
| diff --git a/scripts/mysql_install_db.sh b/scripts/mysql_install_db.sh
| index 0bbac8ba8..b89ea716a 100644
| --- a/scripts/mysql_install_db.sh
| +++ b/scripts/mysql_install_db.sh
| @@ -39,6 +39,9 @@ install_params=""
|  auth_root_authentication_method=normal
|  auth_root_socket_user='root'
| 
| +dirname0=`dirname $0 2>/dev/null`
| +dirname0=`dirname $dirname0 2>/dev/null`
| +
| [...]
|    fi
| +# relative from where the script was run for a relocatable install
| +elif test -n "$dirname0" -a -x "$dirname0/@INSTALL_SBINDIR@/mysqld"
| +then
| +  basedir="$dirname0"
| +  bindir="$basedir/@INSTALL_SBINDIR@"
| +  resolveip="$bindir/resolveip"
| +  mysqld="$basedir/@INSTALL_SBINDIR@/mysqld"
| +  srcpkgdatadir="$basedir/@INSTALL_MYSQLSHAREDIR@"
| +  buildpkgdatadir="$basedir/@INSTALL_MYSQLSHAREDIR@"
|  else
|    basedir="@prefix@"
|    bindir="@bindir@"

This change is causing bindir being set to bindir=/usr/sbin, while
it's supposed to be bindir=/usr/bin on Debian systems, so that
resolveip is used as /usr/bin/resolveip.

FTR: We're using multiple sections inside /etc/mysql/my.cnf
(`[mysqld1]` and `[mysqld2]`). When adding a `mysqld` section with
the following configuration to /etc/mysql/my.cnf it also works
without having to explicitly specify the `--basedir` option:

| [mysqld]
| basedir = /usr

As expected it also works in our setup when we specify the
`--defaults-group-suffix` option, like:

| root at prx01b:~# /usr/bin/mysql_install_db --defaults-group-suffix=1
| Installing MariaDB/MySQL system tables in '/var/lib/mysql' ...
| 2019-05-10 16:00:23 139685437468032 [Note] /usr/sbin/mysqld (mysqld 10.1.38-MariaDB-0+deb9u1) starting as process 25302 ...
| [....]

But neither of this was necessary so far, and the new
mysql_install_db behavior isn't as reliable as it used to be. The
directory /usr/bin should be detected and assumed as sensible
default for bindir (instead of relying on the base path of the
«mysqld» binary inside /usr/sbin).

regards
-mika-



More information about the pkg-mysql-maint mailing list