Arch Linux

Please read this before reporting a bug:
https://wiki.archlinux.org/title/Bug_reporting_guidelines

Do NOT report bugs when a package is just outdated, or it is in the AUR. Use the 'flag out of date' link on the package page, or the Mailing List.

REPEAT: Do NOT report bugs for outdated packages!
Tasklist

FS#17765 - [mysql] wont start if newly installed

Attached to Project: Arch Linux
Opened by cotko (cotko) - Saturday, 09 January 2010, 02:03 GMT
Last edited by Allan McRae (Allan) - Wednesday, 20 January 2010, 07:28 GMT
Task Type Bug Report
Category Packages: Extra
Status Closed
Assigned To No-one
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Description:

I've clean installed arch about 2-3 months ago and since then I couldn't start mysql server. I took some time today as I thought that it's time to fix this and I found the following reason:

in mysql package there is a .INSTALL script, that has some commands with not complete paths to commands and directories.
here is .INSTALL script for the last updated mysql package:


post_install(){
groupadd -g 89 mysql &>/dev/null
useradd -u 89 -g mysql -d /var/lib/mysql -s /bin/false mysql &>/dev/null
usr/bin/mysql_install_db --datadir=/var/lib/mysql --user=mysql
chown -R mysql:mysql var/lib/mysql &> /dev/null
chown mysql:mysql var/run/mysqld &> /dev/null
}

post_upgrade(){
getent group mysql >/dev/null 2>&1 || groupadd -g 89 mysql
getent passwd mysql >/dev/null 2>&1 || useradd -u 89 -g mysql -d /var/lib/mysql -s /bin/false mysql
chown -R mysql:mysql var/lib/mysql &> /dev/null
chown mysql:mysql var/run/mysqld &> /dev/null
}

post_remove(){
getent passwd mysql >/dev/null 2>&1 || userdel mysql &> /dev/null
getent group mysql >/dev/null 2>&1 || groupdel mysql &> /dev/null
}


as you can see, there are following errors:
"usr/bin/mysql_install" instead of "/usr/bin/mysql_install"
"chown -R mysql:mysql var/lib/mysql" instead of "chown -R mysql:mysql var/lib/mysql"

etc..

please repair this script as it fails to correctly install whole server :)
This task depends upon

Closed by  Allan McRae (Allan)
Wednesday, 20 January 2010, 07:28 GMT
Reason for closing:  Not a bug
Additional comments about closing:  see comments
Comment by cotko (cotko) - Saturday, 09 January 2010, 02:05 GMT
I meant
"chown -R mysql:mysql var/lib/mysql" instead of "chown -R mysql:mysql /var/lib/mysql"

ofcourse :)
Comment by Eric Belanger (Snowman) - Saturday, 09 January 2010, 06:34 GMT
The "missing" leading slashes is not a bug. It is necessary so the package can be installed in another root (than /). If it doesn't work, then it's probably because of something else.
Comment by Ionut Biru (wonder) - Saturday, 09 January 2010, 09:07 GMT
try to do a stop and then a start.
Comment by cotko (cotko) - Saturday, 09 January 2010, 11:43 GMT
hmm the point is that since my install I had these mysql versions installed:
mysql-5.1.39-1-x86_64.pkg.tar.gz
mysql-5.1.41-2-x86_64.pkg.tar.gz
mysql-5.1.41-3-x86_64.pkg.tar.gz
mysql-5.1.42-1-x86_64.pkg.tar.gz

none of them did work, after running
/etc/rc.d/mysqld start
I always got FAIL response

so yesterday I actually needed mysql and I checked the deamon script, then I ran
/usr/bin/mysqld_safe --datadir=/var/lib/mysql

and got the response saying that there was a problem making some files because directory "/var/lib/mysql/" did not extist

I made that directory and gave it mysql ownership:
mkdir /var/lib/mysql/
chown mysql.mysql /var/lib/mysql/

and ran "/usr/bin/mysqld_safe --datadir=/var/lib/mysql" again. It said something like mysql_safe started and then ended, so I checked error log, it said:
100109 12:33:16 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
100109 12:33:16 [Note] Plugin 'FEDERATED' is disabled.
100109 12:33:16 [Note] Plugin 'ndbcluster' is disabled.
/usr/sbin/mysqld: Table 'mysql.plugin' doesn't exist
100109 12:33:16 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
InnoDB: The first specified data file ./ibdata1 did not exist:
InnoDB: a new database to be created!
100109 12:33:16 InnoDB: Setting file ./ibdata1 size to 10 MB
InnoDB: Database physically writes the file full: wait...
100109 12:33:17 InnoDB: Log file ./ib_logfile0 did not exist: new to be created
InnoDB: Setting log file ./ib_logfile0 size to 5 MB
InnoDB: Database physically writes the file full: wait...
100109 12:33:17 InnoDB: Log file ./ib_logfile1 did not exist: new to be created
InnoDB: Setting log file ./ib_logfile1 size to 5 MB
InnoDB: Database physically writes the file full: wait...
InnoDB: Doublewrite buffer not found: creating new
InnoDB: Doublewrite buffer created
InnoDB: Creating foreign key constraint system tables
InnoDB: Foreign key constraint system tables created
100109 12:33:17 InnoDB: Started; log sequence number 0 0
100109 12:33:17 [ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.host' doesn't exist
100109 12:33:17 mysqld_safe mysqld from pid file /var/lib/mysql/arch.pid ended

I then went to see if install script for mysql package runs "mysql_upgrade" or something similar and found those commands with "missing" slashes.
I ran all of them with corrected paths (my sistem has / for root :D ) and after that starting the mysql deamon worked with no problem.

I think that "/usr/bin/mysql_install_db --datadir=/var/lib/mysql --user=mysql" was the command that made it work, so my thought was that most of users with previous working mysql versions already had databases set up so updates did not cause the problems.

sorry than for posting the bug which really is not a bug:)
Comment by Gerardo Exequiel Pozzi (djgera) - Tuesday, 12 January 2010, 23:16 GMT
  • Field changed: Summary (mysql wont start if newly installed → [mysql] wont start if newly installed)
  • Field changed: Status (Unconfirmed → Waiting on Response)
so this ticket can be closed?
Comment by cotko (cotko) - Wednesday, 13 January 2010, 12:37 GMT
yes, although I don't know why installing mysql package doesn't execute the "mysql_install_db" command (on my machine).

Loading...