for some reason mysql doesn't starts at boot, when I run it from cli for the first time, I get this: mysql | * Caching service dependencies ... [ ok ] mysql | * Starting ... mysql | * "/var/run/mysqld/mysqld.pid" is still present and the process is running. mysql | * Please stop it "kill 2498" maybe ? [ !! ] mysql | * ERROR: mysql failed to start running it the second time boots it ok Reproducible: Always
1. at boot, what else is on that pid? 2. why did the pid file exist if you shut down cleanly?
(In reply to comment #1) > 1. at boot, what else is on that pid? pid file you mean? > 2. why did the pid file exist if you shut down cleanly? that is the question... in what stage should the file be deleted?
(In reply to comment #2) > (In reply to comment #1) > > 1. at boot, what else is on that pid? > pid file you mean? No. If you do a hard shutdown, and the pidfile does not get removed, and on the next start, the pidfile contains a low numbered pid, there is a chance that it conflicts with some system process from boot. > > 2. why did the pid file exist if you shut down cleanly? > that is the question... in what stage should the file be deleted? the stop phase of the mysql init script removes the pidfile (mysqld itself actually removes it).
(In reply to comment #3) > (In reply to comment #2) > > (In reply to comment #1) > > > 1. at boot, what else is on that pid? > > pid file you mean? > No. > > If you do a hard shutdown, and the pidfile does not get removed, and on the > next start, the pidfile contains a low numbered pid, there is a chance that it > conflicts with some system process from boot. > > > > 2. why did the pid file exist if you shut down cleanly? > > that is the question... in what stage should the file be deleted? > the stop phase of the mysql init script removes the pidfile (mysqld itself > actually removes it). I do a normal shutdown, from what I can see, mysql shuts down ok, I'll double check to verify it.
double checked: dagg@NCC-5001-D ~ $ rc-status | grep mysql mysql [ stopped ] dagg@NCC-5001-D ~ $ ll /var/run/mysqld total 5 srwxrwxrwx 1 mysql mysql 0 Nov 29 2011 mysqld.sock -rw-rw---- 1 mysql mysql 5 Nov 29 2011 mysqld.pid drwxr-xr-x 18 root root 744 Nov 29 2011 .. drwxr-xr-x 2 mysql mysql 112 Nov 29 2011 . right after boot but I see what can be the issue, /var/log/messages shows this: Nov 29 20:48:33 NCC-5001-D /etc/init.d/mysql[2730]: MySQL NOT started (0) Nov 29 20:48:33 NCC-5001-D /etc/init.d/mysql[2131]: ERROR: mysql failed to start it seems that it fails to start and the content of /var/run/mysqld is still there, how can I debug this?
1. Is there anything in the mysql log files? /var/log/mysql/* 2. Follow this process for me, and report results: #1 - ensure mysqld is not running #2 - rm /var/run/mysql*/mysql*pid #3 - /etc/init.d/mysql start
(In reply to comment #6) > 1. > Is there anything in the mysql log files? > /var/log/mysql/* > > 2. > Follow this process for me, and report results: > #1 - ensure mysqld is not running > #2 - rm /var/run/mysql*/mysql*pid > #3 - /etc/init.d/mysql start using rc-config start mysql in #3 instead causes the second flow to work. I remember I've done it but just to make sure I'll try it at home later today.
Created attachment 294353 [details] mysqld.err (In reply to comment #6) > 1. > Is there anything in the mysql log files? > /var/log/mysql/* > dagg@NCC-5001-D ~ $ ll /var/log/mysql/* -rw-rw---- 1 mysql mysql 0 Oct 2 11:22 /var/log/mysql/mysql.log -rw-rw---- 1 mysql mysql 0 Oct 2 11:22 /var/log/mysql/mysql.err -rw-rw---- 1 mysql mysql 20146 Nov 30 2011 /var/log/mysql/mysqld.err content of /var/log/mysql/mysqld.err attached
(In reply to comment #6) > 2. > Follow this process for me, and report results: > #1 - ensure mysqld is not running > #2 - rm /var/run/mysql*/mysql*pid > #3 - /etc/init.d/mysql start dagg@NCC-5001-D ~ $ rc-status | grep mysql mysql [ stopped ] dagg@NCC-5001-D ~ $ Su rm /var/run/mysql*/mysql*pid Password: dagg@NCC-5001-D ~ $ Su /etc/init.d/mysql start Password: mysql | * Starting ... mysql | * Strange, the socket file already exist in "/var/run/mysqld/mysqld.sock" mysql | * it will be removed now and re-created by the MySQL server mysql | * BUT please make your checks. mysql | * Starting (/etc/mysql/my.cnf) mysql | * MySQL NOT started (0) [ !! ] mysql | * ERROR: mysql failed to start
did you check with ps that no mysqld was actually running? rc-status just tells you the state of the init.d, which isn't entirely accurate to stuck processes.
(In reply to comment #10) > did you check with ps that no mysqld was actually running? rc-status just tells > you the state of the init.d, which isn't entirely accurate to stuck processes. dagg@NCC-5001-D ~ $ ps -ef | grep sql mysql 2662 1 0 08:01 ? 00:00:00 /usr/sbin/mysqld --defaults-file=/etc/mysql/my.cnf --basedir=/usr --datadir=/var/lib/mysql --pid-file=/var/run/mysqld/mysqld.pid --socket=/var/run/mysqld/mysqld.sock dagg 3643 3541 0 08:14 pts/0 00:00:00 grep --colour=auto sql it seems that the service is up so it is a openrc issue, right?
do you have a large innodb setup that takes a long time to check? look in /etc/conf.d/mysql and adjust the STARTUP_TIMEOUT and STOP_TIMEOUT values maybe.
(In reply to comment #12) > do you have a large innodb setup that takes a long time to check? > I don't think so, I have like 3 virtually empty dbs > look in > /etc/conf.d/mysql > and adjust the STARTUP_TIMEOUT and STOP_TIMEOUT values maybe. that would not explain why when I try to restart it, the process works ok.
is there any fix for this?
I did see this covered so... Which version of mysql-init-scripts are installed? I've had frequent issues with the v1 series failing to report OK at times. The new mysql-init-scripts-2.0_pre1-r2, currently requested stable, seem to work a lot better.
Bad typing.. (In reply to comment #15) > I did see this covered so... I *didn't* > Which version of mysql-init-scripts are installed? > > I've had frequent issues with the v1 series failing to report OK at times. > The new mysql-init-scripts-2.0_pre1-r2, currently requested stable, seem to requested stable in bug 397925 Sorry for the noise.
Should work fine with new scripts which are now stable on most arches