Page 1 of 2
Non-starting zm* with almost total lack of diagnostics
Posted: Mon Mar 14, 2005 7:39 pm
by lazyleopard
I've searched /var/log/* and /var/log/zm, and the only diagnostics I can find are these two lines in /var/log/zm/zmpkg.log
Code: Select all
Command: start
Executing: su apache --shell=/bin/sh --command='/usr/bin/zmdc.pl check'
It's not much to go on, but it doesn't look as if it's getting very far. Any ideas, anyone?
zm 1.20.1, mySQL 4.0.22. Gentoo. All the executables seem to exist:
Code: Select all
-rwxr-xr-x 1 root root 174788 Mar 13 23:09 /usr/bin/zma
-rwxr-xr-x 1 root root 11698 Mar 13 23:09 /usr/bin/zmaudit.pl
-rwxr-xr-x 1 root root 174852 Mar 13 23:09 /usr/bin/zmc
-rwxr-xr-x 1 root root 16224 Mar 13 23:09 /usr/bin/zmdc.pl
-rwxr-xr-x 1 root root 183268 Mar 13 23:09 /usr/bin/zmf
-rwxr-xr-x 1 root root 26507 Mar 13 23:09 /usr/bin/zmfilter.pl
-rws--x--x 1 root root 787932 Mar 13 23:09 /usr/bin/zmfix
-rwxr-xr-x 1 root root 9009 Mar 13 23:09 /usr/bin/zmpkg.pl
-rwxr-xr-x 1 root root 10804 Mar 13 23:09 /usr/bin/zmtrigger.pl
-rwxr-xr-x 1 root root 187876 Mar 13 23:09 /usr/bin/zmu
-rwxr-xr-x 1 root root 12820 Mar 13 23:09 /usr/bin/zmupdate.pl
-rwxr-xr-x 1 root root 9075 Mar 13 23:09 /usr/bin/zmvideo.pl
-rwxr-xr-x 1 root root 6050 Mar 13 23:09 /usr/bin/zmwatch.pl
-rwxr-xr-x 1 root root 19615 Mar 13 23:09 /usr/bin/zmx10.pl
The database is accessible using the zm ID and password, and the Config table contains 133 rows, and looks sane...
Posted: Mon Mar 14, 2005 9:52 pm
by cordel
Hi Rick,
Have you looked in the /tmp directory for logs? I assume you built from source and the defualt location for zm logs is /tmp unless you changed it.
Posted: Mon Mar 14, 2005 10:04 pm
by lazyleopard
Yeah, the log location has been changed to /var/log/zm, which exists and is writable by apache.
It seems that it's possible to start zm via the web interface, but not via the init.d script. Something strange in the way zmpkg.pl is being invoked, I think...
Posted: Mon Mar 14, 2005 10:13 pm
by cordel
Did you change your init.d script? Is it set to +x? And did you do a chkconfig --add zm? I'm sure you have but just in case. I'm not familuar with gentoo so I'm not sure what the diferances are. You also had zm running before so what changed?
Posted: Mon Mar 14, 2005 10:37 pm
by lazyleopard
Hmmm... The problem would seem to be with the version of /bin/su installed by Gentoo. It's a rather archaic one that does not understand the "--shell=/bin/sh --command='/usr/bin/zmdc.pl check'" bit, and simply passes it on to the target user's shell...
Posted: Mon Mar 14, 2005 11:02 pm
by victor_diago
try to use su -c instead of --command, this is true for slackware like systems...
victor diago
Posted: Mon Mar 14, 2005 11:11 pm
by cordel
How would this compare to other rc files that you have?
Code: Select all
#!/sbin/runscript
depend() {
# the daemon needs mysql to function
need mysqld
}
start() {
# display to the user what you're doing
ebegin "Starting ZoneMinder daemon"
# Start the process as a daemon and record the pid number
start-stop-daemon --start --quiet --background --pidfile /var/run/zm.pid --make-pidfile --exec /usr/bin/zmpkg.pl
# output success or failure
eend $?
}
stop() {
# display a message to the user
ebegin "Stopping ZoneMinder daemon"
# stop the daemon using the pid recorded from the start() function
start-stop-daemon --stop --quiet --pidfile /var/run/zm.pid --name zmpkg.pl
# output success or failure
eend $?
}
Posted: Mon Mar 14, 2005 11:39 pm
by lazyleopard
Yeah, I think I'll need to do two things:
- change the su syntax to use "-c" instead of "--command=" and to remove the "--shell=..." bit.
- Change apache's shell in /etc/passwd from /bin/false to /bin/sh.
My runscript is a close enough match for the one above.
Once zmpkg.pl was patched, and /etc/passwd edited, it started to behave.
Posted: Tue Mar 15, 2005 12:00 am
by zoneminder
I'm happy to put a Gentoo suitable run script in the next version (or the after that at least). If you Gentoo/Slackware types can come up with a consensus I'll use that.
Also, I'll try and mod the 'su' parameters so it can be set as an option.
Phil
Posted: Tue Mar 15, 2005 12:09 am
by cordel
I'd be interested in seeing what you have for a run script to see how far off I may have been and also I don't think there is one posted so it would be good for the forum.
Cheers,
Cordel
Posted: Tue Mar 15, 2005 12:48 pm
by lazyleopard
Code: Select all
#!/sbin/runscript
# description: Control ZoneMinder as a Service
# chkconfig: 2345 99 99
depend() {
use mysql apache2
}
prog=ZoneMinder
ZM_PATH_BIN="/usr/bin"
command="$ZM_PATH_BIN/zmpkg.pl"
start() {
ebegin "Starting $prog"
$command start
eend $? "Failed to start $prog"
}
stop() {
ebegin "Stopping $prog"
$command stop
eend $? "Failed to stop $prog"
}
Posted: Tue Mar 15, 2005 9:10 pm
by zoneminder
Good work, keep it up!
Don't forget to tell me when there's one posted that I should take.
Phil
Posted: Tue Mar 15, 2005 11:43 pm
by lazyleopard
The one I posted definitely starts and stops zoneminder successfully on my system, so you're welcome to take it. Shouldn't be more than a trivial exercise to generate the appropriate .z version, either.
Posted: Tue Mar 15, 2005 11:56 pm
by cordel
Does Gentoo use the chkconfig utility? Upon googling I found that Gentoo uses rc.
rc-update add zm default
would be the syntax to invoke the script on boot so you could probably drop that line with chkconfig.
Posted: Wed Mar 16, 2005 10:34 am
by lazyleopard
Yes. The comments are (mostly) just fall-out from my having taken the distributed zm script and edited it. The contents of the depend block are also debatable. The "apache2" should probably be removed. It should also probably have
before the depend block.