Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 491348 - dev-db/mysql-init-scripts init.d message - /usr/bin/mysql_install_db does not exist
Summary: dev-db/mysql-init-scripts init.d message - /usr/bin/mysql_install_db does not...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo Linux MySQL bugs team
URL:
Whiteboard:
Keywords:
: 523280 (view as bug list)
Depends on:
Blocks:
 
Reported: 2013-11-15 17:13 UTC by Vitaliy Gladkevitch
Modified: 2014-09-21 14:35 UTC (History)
2 users (show)

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


Attachments
mysql-5.1.67-init.d.patch (mysql-5.1.67-init.d.patch,847 bytes, patch)
2014-05-15 14:37 UTC, Brian Evans (RETIRED)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Vitaliy Gladkevitch 2013-11-15 17:13:19 UTC
If you install dev-db/mariadb-5.5.32 and attempt to start it without running --config first you get the following misleading message:
# /etc/init.d/mysql start
 * Starting mysql ...
 * You don't appear to have the mysql database installed yet.
 * Please run /usr/bin/mysql_install_db to have this done...
 * ERROR: mysql failed to start

The file /usr/bin/mysql_install_db does not exist.
# /usr/bin/mysql_install_db
-su: /usr/bin/mysql_install_db: No such file or directory

The error message should be updated asking the user to run emerge --config dev-db/mariadb instead.

Reproducible: Always

Steps to Reproduce:
1. emerge mariadb
2. /etc/init.d/mariadb start
3.
Actual Results:  
# /etc/init.d/mysql start
 * Starting mysql ...
 * You don't appear to have the mysql database installed yet.
 * Please run /usr/bin/mysql_install_db to have this done...
 * ERROR: mysql failed to start
Comment 1 Jorge Manuel B. S. Vicetto (RETIRED) Gentoo Infrastructure gentoo-dev 2013-11-15 17:50:04 UTC
This is a known "issue" and the mariadb / mysql packages do emit a warning about running "emerge --config" on a new install.

 * You might want to run:
 * "emerge --config =dev-db/mariadb-5.5.32"
 * if this is a new install.
Comment 2 Brian Evans (RETIRED) gentoo-dev 2014-05-14 18:13:35 UTC
I came up with this small patch.  Comments welcome from the team.

--- a/mysql-5.1.67-init.d    2013-01-17 20:51:47.000000000 -0500
+++ b/mysql-5.1.67-init.d 2014-05-14 14:08:50.958527172 -0400
@@ -59,8 +59,20 @@
        fi

        if [ ! -d "${datadir}"/mysql ] ; then
-               eerror "You don't appear to have the mysql database installed yet."
-               eerror "Please run /usr/bin/mysql_install_db to have this done..."
+               # find which package is installed to report an error
+               local EROOT=$(portageq envvar EROOT)
+               local DBPKG_P=""
+               # This order follows the virtual for shortest path
+               for pkg in dev-db/mariadb dev-db/mysql dev-db/percona-server dev-db/mariadb-galera dev-db/mysql-cluster ; do
+                       DBPKG_P=$(portageq best_version ${EROOT} ${pkg})
+                       [[ -n ${DBPKG_P} ]] && break
+               done
+               if [[ -z ${DBPKG_P} ]] ; then
+                       eerror "You don't appear to have a server package installed yet."
+               else
+                       eerror "You don't appear to have the mysql database installed yet."
+                       eerror "Please run \`emerge --config =${DBPKG_P}\` to have this done..."
+               fi
                return 1
        fi
Comment 3 Brian Evans (RETIRED) gentoo-dev 2014-05-15 14:37:01 UTC
Created attachment 377010 [details, diff]
mysql-5.1.67-init.d.patch

This seems better as it does not rely on an arbitrary list and expands the virtual instead
Comment 4 Brian Evans (RETIRED) gentoo-dev 2014-05-16 01:50:49 UTC
*mysql-init-scripts-2.0_pre1-r7 (16 May 2014)

  16 May 2014; Brian Evans <grknight@gentoo.org> +files/mysql-5.1.67-init.d-r1,
  +mysql-init-scripts-2.0_pre1-r7.ebuild, -files/mysql-5.1.53-init.d,
  -mysql-init-scripts-2.0_pre1-r2.ebuild,
  -mysql-init-scripts-2.0_pre1-r3.ebuild:
  Revbump to fix bug 491348, remove old
Comment 5 Brian Evans (RETIRED) gentoo-dev 2014-09-21 14:35:14 UTC
*** Bug 523280 has been marked as a duplicate of this bug. ***