Non-starting zm* with almost total lack of diagnostics

Support and queries relating to all previous versions of ZoneMinder
User avatar
lazyleopard
Posts: 403
Joined: Tue Mar 02, 2004 6:12 pm
Location: Gloucestershire, UK

Non-starting zm* with almost total lack of diagnostics

Post 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...
Rick Hewett
User avatar
cordel
Posts: 5210
Joined: Fri Mar 05, 2004 4:47 pm
Location: /USA/Washington/Seattle

Post 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.
User avatar
lazyleopard
Posts: 403
Joined: Tue Mar 02, 2004 6:12 pm
Location: Gloucestershire, UK

Post 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...
Rick Hewett
User avatar
cordel
Posts: 5210
Joined: Fri Mar 05, 2004 4:47 pm
Location: /USA/Washington/Seattle

Post 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?
User avatar
lazyleopard
Posts: 403
Joined: Tue Mar 02, 2004 6:12 pm
Location: Gloucestershire, UK

Post 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...
Rick Hewett
User avatar
victor_diago
Posts: 245
Joined: Wed Jan 21, 2004 2:44 pm
Location: Brazil, sao paulo
Contact:

Post by victor_diago »

try to use su -c instead of --command, this is true for slackware like systems...



victor diago
User avatar
cordel
Posts: 5210
Joined: Fri Mar 05, 2004 4:47 pm
Location: /USA/Washington/Seattle

Post 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 $?
}
User avatar
lazyleopard
Posts: 403
Joined: Tue Mar 02, 2004 6:12 pm
Location: Gloucestershire, UK

Post 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.
Last edited by lazyleopard on Tue Mar 15, 2005 12:49 pm, edited 2 times in total.
Rick Hewett
User avatar
zoneminder
Site Admin
Posts: 5215
Joined: Wed Jul 09, 2003 2:07 pm
Location: Bristol, UK
Contact:

Post 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
User avatar
cordel
Posts: 5210
Joined: Fri Mar 05, 2004 4:47 pm
Location: /USA/Washington/Seattle

Post 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
Image
Image
3939663646337

It's better to keep your mouth shut and appear stupid than open it and remove all doubt.
-Mark Twain
User avatar
lazyleopard
Posts: 403
Joined: Tue Mar 02, 2004 6:12 pm
Location: Gloucestershire, UK

Post 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"
}
Rick Hewett
User avatar
zoneminder
Site Admin
Posts: 5215
Joined: Wed Jul 09, 2003 2:07 pm
Location: Bristol, UK
Contact:

Post by zoneminder »

Good work, keep it up!

Don't forget to tell me when there's one posted that I should take.

Phil
User avatar
lazyleopard
Posts: 403
Joined: Tue Mar 02, 2004 6:12 pm
Location: Gloucestershire, UK

Post 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.
Rick Hewett
User avatar
cordel
Posts: 5210
Joined: Fri Mar 05, 2004 4:47 pm
Location: /USA/Washington/Seattle

Post 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.
Image
Image
3939663646337

It's better to keep your mouth shut and appear stupid than open it and remove all doubt.
-Mark Twain
User avatar
lazyleopard
Posts: 403
Joined: Tue Mar 02, 2004 6:12 pm
Location: Gloucestershire, UK

Post 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

Code: Select all

opts="start stop"
before the depend block.
Rick Hewett
Locked