Home | Docs | Forums | Lists | Bugs | Planet | Store | GMN | Get Gentoo!
Not eligible to see or edit group visibility for this bug.
View Bug Activity | Format For Printing | XML | Clone This Bug
When using baselayout-2 on Gentoo/FreeBSD, mysql fails to start with the following error: # /etc/init.d/mysql start * Caching service dependencies ... /etc/init.d/mysql: 9: Syntax error: "(" unexpected /etc/init.d/mysqlmanager: 14: Syntax error: "(" unexpected [ ok ] /etc/init.d/mysql: 9: Syntax error: "(" unexpected * ERROR: mysql failed to start
Created an attachment (id=120196) [details] mysql init script Then then. The current scripts try to re-invent too many wheels. baselayout has supported the concept of multiplexing for some time. link the scripts to mysql to do this like so ln -s mysql /etc/init.d/mysql.foo Then MY_CNF will default to /etc/mysql.foo/my.cnf. This new script is very simple and should work just fine. Any special args should be placed in /etc/conf.d/mysql like so MY_CNF="/etc/myfoo/my.cnf" (defaults to /etc/mysql/my.cnf) MY_ARGS="--optionone=1--optiontwo=2"
Oh yes - what's the mysqlmanager script for? I've not touched that as it seems pointless?
*** Bug 166606 has been marked as a duplicate of this bug. ***
I for one won't let this hold up baselayout-2
Is someone going to fix this one?
Please commit the script!
Well seriously WTH is up with this?
roy: you wrote this, and there's one critical problem with it. MySQL should NOT be considered up until the socket comes into existence at /var/run/mysqld/mysqld.sock. Depending on the size of your databases, this can be anywhere from 0 to ~60 seconds after the process has been backgrounded by s-s-d. If the init script returns success right away, and the next thing that tries to start wants to use the socket, then it's going to fail. In the previous edition of the scripts, we looped checking for that socket - should that logic come back, or can you suggest a better way?
Fix mysql to create the socket before daemonising? But aside from the proper fix, no I don't have any other ideas at this time. If other daemons have the same flaw, then maybe a function could be created ewaitfile /var/run/mysqld/mysqld.sock 60 Give it 60 seconds to create the socket.
roy: mysql doesn't daemonize. ssd does the work itself via --background. I'd be up for an ewaitfile being provided by baselayout, I certainly do see other cases where it would be a good solution.
OK, maybe adding it to ssd would be the better solution then. However, that won't easily fly for baselayout-1.
How about a fallback in the mysql script, that if a ewaitfile function is not already available, it defines one of it's own?
No, I was thinking about adding it to ssd start-stop-daemon --waitfile /foo
here's a trick that should work, but it's a bit unclean. BTW, is there something better than existence of librc that init.d scripts can check to see if they are running under baselayout2? ===== [ -e /lib/librc.so ] && opts="${opts} --waitfile foo" start-stop-daemon ${opts} ... [ -e /lib/librc.so ] || ewaitfile /foo =====
Not really no... I suppose we could export a function openrcpreq so you could do this if openrcpreq 1 2; then funk new feature elif openrcpreq 1 0; then inital release feature else sol :P fi
that's pretty ugly as well we can just add things to baselayout-1.x to ease transition as needed ... ive already been doing this for some time
Created an attachment (id=155247) [details] Add ewaitfile to openrc This adds the ewaitfile function to OpenRC. ewaitfile timeout file1 [file2 ...] If timeout <1, then we wait forever. Comments?
uberlord: looks good, and just in time for final upcoming pass at putting this in the tree. Tell me what version of openrc it goes into, so I can have a suitable RDEPEND entry.
It will go into openrc-0.2.6 which will be cut once bug #224171 is solved - if I can work out wtf is going wrong there :) In the mean time, feel free to patch 0.2.5 with it if you like as it could be out today or a week or so.
ewaitfile now exists in 0.3.0.
*** Bug 173057 has been marked as a duplicate of this bug. ***
Mysql has always started up fine for me until just recently, I presume with the upgrade to openrc 0.4.x (since I run ~amd64). Does that make sense, or is it meant to be working now?
Ping! What's holding this back?
It looks as though a different fix to the one that was suggested was applied at some point since this is already in the init script. Not sure when this happened. while ! [[ -S "${socket}" || "${STARTUPTIMEOUT}" -lt 1 || "${retstatus}" -ne 0 ]] ; do STARTUPTIMEOUT=$(( STARTUPTIMEOUT - 1 )) [[ ${DEBUG} -ge 1 ]] && echo -n "${STARTUPTIMEOUT}," sleep ${TIMEUNIT} done Something's still not right though. I set the timeout to 15 seconds, which was long enough for MySQL to start without the script reporting a failure but mythbackend seems to give up waiting before its ready. I always have to run "rc" after my system has booted to give it another shot at starting. Maybe this isn't the exact cause but I'm pretty sure MySQL is to blame.
Created an attachment (id=191550) [details] Use ewaitfile I've been running Roy's script with the addition of ewaitfile (see attached patch) for quite some time now. No problems so far. I don't have large databases though, so testing from people with some large DBs is appreciated. The timeout parameter for ewaitfile can be made configurable via conf.d if needed, for now it's hardcoded at 60 seconds.