ZM on FreeBSD

Support and queries relating to third party Live CDs and DVD, VM images and other packaged distributions
abi
Posts: 61
Joined: Fri Oct 23, 2015 11:25 am

Re: ZM on FreeBSD

Post by abi »

I solved the mystery of 1 camera show! fcgiwrap spawns 1 children on default settings (the rc file mentions 4 workers - so I was confused until I looked into rc script deeply).
Last edited by abi on Sat Apr 09, 2016 9:50 am, edited 1 time in total.
abi
Posts: 61
Joined: Fri Oct 23, 2015 11:25 am

Re: ZM on FreeBSD

Post by abi »

One blocker left - Signal 4 on replay. I doubt this one as easy as fcgiwrap settings. As ZM was compiled, it simply can't contain illegal instructions ? So, this is a stack corruption ?
Darius121
Posts: 9
Joined: Sun Mar 27, 2016 10:01 pm

Re: ZM on FreeBSD

Post by Darius121 »

Yes I get signal 4 on replay too :(

I have told it to dump cores but I can't find where it puts them.

I tried to dig in but I can't see which process is actually crashing, I only have an nph-zms process running and if I trace it I don't see it crash :-/

Any hints?
User avatar
knight-of-ni
Posts: 2406
Joined: Thu Oct 18, 2007 1:55 pm
Location: Shiloh, IL

Re: ZM on FreeBSD

Post by knight-of-ni »

Code: Select all

'zmtelemetry.pl' exited abnormally, exit status 9
This likely means you are missing at least one Perl module. As always, execute the script from the command line (as root) to get more information.
It will tell you exactly which modules are missing.

Replay is a mode in ZoneMinder which can be one of: Single Event, Gapless Events, or All Events. However, from the context of your message this does not appear to be what you mean. Do you mean you are simply trying to play back a recorded event?

In any case, please provide the full log of the crash. More is better. It would be helpful to turn on debug and include what happens just before the crash.
Visit my blog for ZoneMinder related projects using the Raspberry Pi, Orange Pi, Odroid, and the ESP8266
All of these can be found at https://zoneminder.blogspot.com/
abi
Posts: 61
Joined: Fri Oct 23, 2015 11:25 am

Re: ZM on FreeBSD

Post by abi »

knnniggett wrote:This likely means you are missing at least one Perl module. As always, execute the script from the command line (as root) to get more information.
Probably, I didn't looked into it yet.
knnniggett wrote:Replay is a mode in ZoneMinder which can be one of: Single Event, Gapless Events, or All Events. However, from the context of your message this does not appear to be what you mean. Do you mean you are simply trying to play back a recorded event?
Still image works. The crash is when I try to playback the recorded event. (Monitor's events -> click on event name).
I included gist with some debugging on GitHub https://github.com/ZoneMinder/ZoneMinder/issues/1357
https://gist.github.com/abishai/85541fb7e61ac61b0a8c
If this is not enough, please tell what I should provide.

Also, I'm interested in the minor issue with monitor names - http://i.imgur.com/pUUOYkE.png Looks like N is for macro used to substitute real monitor name?

And, even if my problem with 1 stream solved, I have stalled sock files with suspisious names generated every time I look the live streams. I think it will be hundreds of them in real work. Are you sure, that they really should be "soc" - without "k" ?

Code: Select all

abishai@freezm:~ % ls -la /var/run/zm
total 8
drwxr-xr-x  2 www   www    512 Apr  9 21:44 .
drwxr-xr-x  7 root  wheel  512 Apr  9 05:10 ..
srwxr-xr-x  1 www   www      0 Apr  9 12:42 zms-316652s.soc
srwxr-xr-x  1 www   www      0 Apr  9 12:45 zms-334113s.soc
srwxr-xr-x  1 www   www      0 Apr  9 12:42 zms-342574s.soc
srwxr-xr-x  1 www   www      0 Apr  9 12:49 zms-351807s.soc
srwxr-xr-x  1 www   www      0 Apr  9 12:33 zms-504999s.soc
srwxr-xr-x  1 www   www      0 Apr  9 12:45 zms-510731s.soc
srwxr-xr-x  1 www   www      0 Apr  9 12:49 zms-578770s.soc
srwxr-xr-x  1 www   www      0 Apr  9 12:49 zms-587422s.soc
srwxr-xr-x  1 www   www      0 Apr  9 12:45 zms-708748s.soc
-rw-------  1 www   www      0 Apr  9 12:45 zms-770387.lock
srwxr-xr-x  1 www   www      0 Apr  9 12:45 zms-770387s.soc
-rw-------  1 www   www      0 Apr  9 21:44 zms-872322.lock
srwxr-xr-x  1 www   www      0 Apr  9 21:44 zms-872322s.soc
srwxr-xr-x  1 www   www      0 Apr  9 12:49 zms-883746s.soc
-rw-------  1 www   www      0 Apr  9 21:44 zms-903044.lock
srwxr-xr-x  1 www   www      0 Apr  9 21:44 zms-903044s.soc
srwxr-xr-x  1 www   www      0 Apr  9 12:49 zms-950772s.soc
srwxr-xr-x  1 www   www      0 Apr  9 12:42 zms-987045s.soc
srwxr-xr-x  1 www   www      0 Apr  9 12:49 zms-993348s.soc
abi
Posts: 61
Joined: Fri Oct 23, 2015 11:25 am

Re: ZM on FreeBSD

Post by abi »

I inserted some debug code and looks like I found the function that crashes zms

Code: Select all

if(zm_sendfile(fileno(stdout), fileno(fdj), 0, (int)filestat.st_size) != (int)filestat.st_size) {
No return from here.

I inserted debug code there and got Signal 11 after the first Foo1 (was Signal 4 with original sources).

Code: Select all

#ifdef HAVE_SENDFILE4_SUPPORT
#include <sys/sendfile.h>
int zm_sendfile(int out_fd, int in_fd, off_t *offset, size_t size) {
        int err;

        err = sendfile(out_fd, in_fd, offset, size);
        if (err < 0)
                return -errno;

        return err;
}
#elif HAVE_SENDFILE7_SUPPORT
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/uio.h>
int zm_sendfile(int out_fd, int in_fd, off_t *offset, off_t size) {
        int err;
        Debug(2, "Foo1");
        err = sendfile(in_fd, out_fd, *offset, size, NULL, &size, 0);
        Debug(2, "Foo2");
        if (err && errno != EAGAIN)
                return -errno;

        if (size) {
                *offset += size;
                return size;
        }

        return -EAGAIN;
}
#else
#error "Your platform does not support sendfile. Sorry."
#endif

Code: Select all

04/17/16 15:47:46.678725 zms[100176].DB2-zm_sendfile.h/18 [Foo1]
04/17/16 15:47:46.678793 zms[100176].ERR-zm_signal.cpp/54 [Got signal 11 (Segmentation fault), crashing]
As signal changed, I suspect. that that one is for second debug call. Something is breaking after sendfile call. More debug code is needed, but atm I have power shortage at home, so now I'm on UPS power. Cya later :-)
abi
Posts: 61
Joined: Fri Oct 23, 2015 11:25 am

Re: ZM on FreeBSD

Post by abi »

OK, I built ZM with ZENDFILE disabled - now it plays.

Code: Select all

04/17/16 18:45:41.346025 zms[100144].DB1-zm_stream.cpp/311 [We have obtained a lock on /var/run/zm/zms-284362.lock fd: 8]
04/17/16 18:45:41.346168 zms[100144].DB2-zm_event.cpp/1222 [Sending frame 1]
04/17/16 18:45:41.601179 zms[100144].DB2-zm_event.cpp/1222 [Sending frame 2]
04/17/16 18:45:41.931828 zms[100144].DB2-zm_event.cpp/1222 [Sending frame 3]
04/17/16 18:45:42.307969 zms[100144].DB2-zm_event.cpp/1222 [Sending frame 4]
04/17/16 18:45:42.684060 zms[100144].DB2-zm_event.cpp/1222 [Sending frame 5]
04/17/16 18:45:43.040713 zms[100144].DB2-zm_event.cpp/1222 [Sending frame 6]
04/17/16 18:45:43.429165 zms[100144].DB2-zm_event.cpp/1222 [Sending frame 7]
04/17/16 18:45:43.740155 zms[100144].DB2-zm_event.cpp/1222 [Sending frame 8]
04/17/16 18:45:44.174712 zms[100144].DB2-zm_event.cpp/1222 [Sending frame 9]
04/17/16 18:45:44.498401 zms[100144].DB2-zm_event.cpp/1222 [Sending frame 10]
04/17/16 18:45:44.842668 zms[100144].DB2-zm_event.cpp/1222 [Sending frame 11]
04/17/16 18:45:45.234649 zms[100144].DB2-zm_event.cpp/1222 [Sending frame 12]
04/17/16 18:45:45.529661 zms[100144].DB2-zm_event.cpp/1222 [Sending frame 13]
04/17/16 18:45:45.886655 zms[100144].DB2-zm_event.cpp/1222 [Sending frame 14]
04/17/16 18:45:46.230929 zms[100144].DB2-zm_event.cpp/1222 [Sending frame 15]
04/17/16 18:45:46.587655 zms[100144].DB2-zm_event.cpp/1222 [Sending frame 16]
However, I wonder what's wrong with sendfile call ? Any ideas?
achix
Posts: 146
Joined: Tue Oct 02, 2007 9:38 am
Location: Greece

Re: ZM on FreeBSD

Post by achix »

Guys are you sure you have read this : viewtopic.php?f=9&t=23298 ?
abi
Posts: 61
Joined: Fri Oct 23, 2015 11:25 am

Re: ZM on FreeBSD

Post by abi »

achix wrote:Guys are you sure you have read this : viewtopic.php?f=9&t=23298 ?
I read it. That patches was accepted by upsteam mostly. The issues ZM has now are not covered by that thread.
achix
Posts: 146
Joined: Tue Oct 02, 2007 9:38 am
Location: Greece

Re: ZM on FreeBSD

Post by achix »

A ok, glad to hear that! This thread talks about 1.25, that's why I asked. Anyway, summer is approaching and normally this means ZM-time for me. Unless things get really heavy with my regular job, I might start hacking this again.

BTW, is there any official FreeBSD port made out of those patches?
abi
Posts: 61
Joined: Fri Oct 23, 2015 11:25 am

Re: ZM on FreeBSD

Post by abi »

achix wrote:BTW, is there any official FreeBSD port made out of those patches?
I'm making one here - https://github.com/abishai/Zoneminder-port
It's almost ready, however, I'd like to solve at least one of minor issue - V4L support.
root.rnd
Posts: 1
Joined: Tue May 10, 2016 5:53 pm

Re: ZM on FreeBSD

Post by root.rnd »

hi!
port dont install :(
abi wrote:
achix wrote:BTW, is there any official FreeBSD port made out of those patches?
I'm making one here - https://github.com/abishai/Zoneminder-port
It's almost ready, however, I'd like to solve at least one of minor issue - V4L support.

Code: Select all

uname -a
FreeBSD hik-free 10.3-RELEASE FreeBSD 10.3-RELEASE #0 r297264: Fri Mar 25 03:51:29 UTC 2016     root@releng1.nyi.freebsd.org:/usr/obj/usr/src/sys/GENERIC  i386

Code: Select all


root@hik-free:/home/serg/Zoneminder-port-master # make install
===>  Installing for zoneminder-1.29.1.a.20160426
===>   zoneminder-1.29.1.a.20160426 depends on package: p5-DBI>=0 - found
===>   zoneminder-1.29.1.a.20160426 depends on package: p5-DBD-mysql>=0 - found
===>   zoneminder-1.29.1.a.20160426 depends on package: p5-Date-Manip>=0 - found
===>   zoneminder-1.29.1.a.20160426 depends on package: p5-Test-LWP-UserAgent>=0 - found
===>   zoneminder-1.29.1.a.20160426 depends on package: p5-Sys-Mmap>=0 - found
===>   zoneminder-1.29.1.a.20160426 depends on package: p5-LWP-Protocol-https>=0 - found
===>   zoneminder-1.29.1.a.20160426 depends on package: p5-Sys-CPU>=0 - found
===>   zoneminder-1.29.1.a.20160426 depends on package: p5-Sys-MemInfo>=0 - found
===>   zoneminder-1.29.1.a.20160426 depends on executable: ffmpeg - found
===>   zoneminder-1.29.1.a.20160426 depends on executable: sudo - found
===>   zoneminder-1.29.1.a.20160426 depends on executable: zip - found
===>   zoneminder-1.29.1.a.20160426 depends on package: perl5>=5.20<5.21 - found
===>   zoneminder-1.29.1.a.20160426 depends on shared library: libjpeg.so - found (/usr/local/lib/libjpeg.so)
===>   zoneminder-1.29.1.a.20160426 depends on shared library: libintl.so - found (/usr/local/lib/libintl.so)
===>   zoneminder-1.29.1.a.20160426 depends on shared library: libmysqlclient.so.18 - found (/usr/local/lib/mysql/libmysqlclient.so.18)
===>  Checking if zoneminder already installed
===>   Registering installation for zoneminder-1.29.1.a.20160426
pkg-static: Unable to access file /usr/home/serg/Zoneminder-port-master/work/stage/usr/local/lib/perl5/site_perl/man/man3/ONVIF::Media::Elements::GetCompatibleVideoSou: No such file or directory
pkg-static: duplicate file listing: /usr/local/lib/perl5/site_perl/mach/5.20/auto/ZoneMinder/.packlist, ignoring
pkg-static: duplicate file listing: /usr/local/lib/perl5/site_perl/mach/5.20/auto/ONVIF/.packlist, ignoring
*** Error code 74

Stop.
make[1]: stopped in /usr/home/serg/Zoneminder-port-master
*** Error code 1

Stop.
make: stopped in /usr/home/serg/Zoneminder-port-master

melloa
Posts: 25
Joined: Tue Apr 05, 2016 12:54 am

Re: ZM on FreeBSD

Post by melloa »

Not sure someone can help...

Found the port in FreeBSD and the github for it at
https://raw.githubusercontent.com/freeb ... ME.FreeBSD

The instructions are not too detailed, but for what I understood you'd need a FEMP, so went ahead and installed nginx, mysql-server, and php. All installed with pkg, not make from ports and all worked after installation/configuration.

Started going through the steps and saw that also needed fast cgi wraper, so installed. Noticed that instructions never starts it, so run service start on my own - not a FreBSD SME :)

Item # 2 starts the ZM installation with setting up sql, but doesn't mention to install ZM, so used pkg to install it from ports, but the installation broke sql and I couldn't continue:

Code: Select all

root@freebsd-1:~ # mysql -u root -p
Enter password: 
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
As mentioned above FEMP was working, including sql.

Also in the instructions:

Code: Select all

mysql -u root -p zm < /usr/local/share/zoneminder/db/zm_create.sql
Is wrong, as the path for zm_create.sql is incorrect or the installation failed and didn't move/create the file in the right directory:

Code: Select all

root@freebsd-1:~ # find / -name zm_create.sql
/usr/local/share/doc/zoneminder/zm_create.sql
Any help will be appreciated,
Al
achix
Posts: 146
Joined: Tue Oct 02, 2007 9:38 am
Location: Greece

Re: ZM on FreeBSD

Post by achix »

melloa wrote:so used pkg to install it from ports
This is wrong. pkg != ports.

zm on FreeBSD was never easy. Try to move step by step.
melloa
Posts: 25
Joined: Tue Apr 05, 2016 12:54 am

Re: ZM on FreeBSD

Post by melloa »

I've documented the steps to install ZM on FreeBSD and FreeNAS with Abi but can't attach a pdf to this forum (invalid file extension). I've posted on the FreeNAS forum but would like to have it available here as well. Any ideas how can I make this happen?
Post Reply