How to install Zoneminder 1.30 on a 9.10 jail

Status
Not open for further replies.

melloa

Wizard
Joined
May 22, 2016
Messages
1,749

IceBoosteR

Guru
Joined
Sep 27, 2016
Messages
503
Why isn't there a comment to your documentation?
Mhh, I'll catch this up -> So thanks to your work and share your information with us! ;)
 

melloa

Wizard
Joined
May 22, 2016
Messages
1,749
Why isn't there a comment to your documentation?
Mhh, I'll catch this up -> So thanks to your work and share your information with us! ;)

Like for questions and corrections? Wouldn't be a good place for it as I only documented the steps with the help of several FreeBSD/Zoneminder gurus and I wouldn't be able to answer them :)
 

Fabbat

Dabbler
Joined
Oct 24, 2013
Messages
46

Thank you very much!!!! I spent a lot of time trying to put zoneminder on freenas and now with your guide I succesfully complete this task! Thank you again !
I just connecteda sigle IP 2P2 Cam and works quite well. The motion part works great and I also see snapshots of the event. The only issue that I have is related to the video stream. When I click on the name of cam, a new windows appears with a placeholder for the video stream, under that I have the control buttons (f.forward, play, pause,...) and just undel the list of event.
So I cannot see the video stream from camera, just the placeholder with a green puzzle piece on top left corner.
Do you have in mind what is missing in my system?

Thnak you
 

melloa

Wizard
Joined
May 22, 2016
Messages
1,749
Do you have in mind what is missing in my system?

So you can see the snapshots but not live stream ... I'd try to talk with the folks on the zm support forum. Post your camera maker/model, the source information (path, port, etc). Also check with the developer for the freebsd port listed on the pdf. He might be able to help as well.
 

Fabbat

Dabbler
Joined
Oct 24, 2013
Messages
46
Thank you I've fixed, just put the right resolution (640x480 instead of 320x240, which is wrongly written on paper manula of my cam). Thank you again
 

bestboy

Contributor
Joined
Jun 8, 2014
Messages
198
I just installed Zoneminder in a jail following the given instructions in the attached PDF and this link. The guide worked out quite ok, but I could not get the live view working.
Zoneminder logged an error regarding accessing the zoneminder streaming service (zms) via cgi.
Socket /var/run/zm/zms-356834s.sock does not exist. This file is created by zms, and since it does not exist, either zms did not run, or zms exited early. Please check your zms logs and ensure that CGI is enabled in apache and check that the PATH_ZMS is set correctly. Make sure that ZM is actually recording. If you are trying to view a live stream and the capture process (zmc) is not running then zms will exit. Please go to http://zoneminder.readthedocs.io/en...-when-i-can-see-stills-in-the-zone-window-etc for more information.

The log message contained a hint to a FAQ page that was not really useful for solving the issue. Thus I thought I write up a quick post in case anyone is running into this as well.

So scavenging the logs, I found the problem in the nginx error.log. The real problem were the permissions of the fcgiwrapper socket.
[crit] 60531#102267: *1 connect() to unix:/var/run/fcgiwrap/fcgiwrap.sock failed (13: Permission denied) while connecting to upstream, client: 172.22.22.11, server: , request: "GET /cgi-bin/nph-zms?mode=jpeg&scale=100&maxfps=30&buffer=1000&monitor=2&connkey=135143&rand=1497346315 HTTP/1.1", upstream: "fastcgi://unix:/var/run/fcgiwrap/fcgiwrap.sock:", host: "zoneminder.home.lan", referrer: "http://zoneminder.home.lan/index.php?view=watch&mid=2"

Even though I added the www user for the CGI wrapper as per the guide, there was still a permission problem.
sysrc fcgiwrap_user="www"

Looking at /var/run/fcgiwrap/ showed that the socket was owned by root and thus not accessible by the www user.
Code:
root@zoneminder:/ # ll /var/run/fcgiwrap/
total 1
-rw-------  1 www   wheel  5 Jun 13 12:19 fcgiwrap.pid
srwxr-xr-x  1 root  wheel  0 Jun 13 12:19 fcgiwrap.sock=

So I tried to make the www user the owner on the fcgiwrap directory via
chown -R www /var/run/fcgiwrap
This did work in letting the socket being used by Zoneminder and the live view showed the live stream of the camera. But unfortunately not for long. This is because the ownership is resetted, when the system/jail reboots.

So I learned here that one has to set the socket ownership via rc.conf.
sysrc fcgiwrap_socket_owner="www"
sysrc fcgiwrap_socket_group="www"


That did the trick.

Code:
root@zoneminder:/ # uname -a
FreeBSD zoneminder 10.3-STABLE FreeBSD 10.3-STABLE #0 r295946+21897e6695f(HEAD): Thu Jun  8 20:02:12 UTC 2017  root@gauntlet:/freenas-9.10-releng/_BE/objs/freenas-9.10-releng/_BE/os/sys/FreeNAS.amd64  amd64

root@zoneminder:/ # cat /etc/rc.conf
portmap_enable="NO"
sshd_enable="NO"
sendmail_enable="NO"
sendmail_submit_enable="NO"
sendmail_outbound_enable="NO"
sendmail_msp_queue_enable="NO"
hostname="zoneminder"
devfs_enable="YES"
devfs_system_ruleset="devfsrules_common"
inet6_enable="YES"
ip6addrctl_enable="YES"
fcgiwrap_enable="YES"
fcgiwrap_user="www"
fcgiwrap_socket_owner="www"
fcgiwrap_socket_group="www"
fcgiwrap_flags="-c 3"
nginx_enable="YES"
php_fpm_enable="YES"
zoneminder_enable="YES"

root@zoneminder:/ # ll /var/run/fcgiwrap/
total 1
-rw-------  1 www  wheel  5 Jun 13 12:35 fcgiwrap.pid
srwxr-xr-x  1 www  www	0 Jun 13 12:35 fcgiwrap.sock=

root@zoneminder:/ # pkg info fcgiwrap
fcgiwrap-1.1.0_6
Name  : fcgiwrap
Version  : 1.1.0_6
Installed on  : Mon Jun 12 14:38:17 2017 CEST
Origin  : www/fcgiwrap
Architecture  : FreeBSD:10:amd64
Prefix  : /usr/local
Categories  : www
Licenses  : MIT
Maintainer  : ports@FreeBSD.org
WWW  : http://nginx.localdomain.pl/wiki/FcgiWrap
Comment  : Simple FastCGI wrapper for CGI scripts
Shared Libs required:
  libfcgi.so.0
Annotations  :
Flat size  : 25.1KiB
Description  :
fcgiwrap is a simple server for running CGI applications over FastCGI. It hopes
to provide clean CGI support to Nginx (and other web servers that may need it).

Features:
  * very lightweight (84KB of private memory per instance)
  * fixes broken CR/LF in headers
  * handles environment in a sane way (CGI scripts get HTTP-related env. vars
  * from FastCGI parameters and inherit all the others from fcgiwrap's
  * environment)
  * no configuration, so you can run several sites off the same fcgiwrap pool
  * passes CGI stderr output to fcgiwrap's stderr (this is by design but
  * stderr could be also passed to FastCGI stderr stream)

WWW: http://nginx.localdomain.pl/wiki/FcgiWrap
 
Last edited:

melloa

Wizard
Joined
May 22, 2016
Messages
1,749
Did you suggested/discussed the above @ github? It might be beneficial to others. I did a guide several moons ago but didn't noticed the above problem. Thanks for sharing!
 

fracai

Guru
Joined
Aug 22, 2012
Messages
1,212
I installed ZM over the weekend and couldn't get zmNinja (iOS) to work or any API commands until I created two directories:
api/app/tmp/cache/persistent
api/app/tmp/cache/models
 

StevieBBQ

Dabbler
Joined
Feb 4, 2017
Messages
12
Hi, I am trying to work through the PDF and when I get to #4 I hit a wall. I don't see anything remotely close to what is displayed. I see this:


Code:
root@SecCams:~ # ee /usr/local/etc/php-fpm.conf
^[ (escape) menu  ^y search prompt  ^k delete line   ^p prev li   ^g prev page
^o ascii code	 ^x search		 ^l undelete line ^n next li   ^v next page
^u end of file	^a begin of line  ^w delete word   ^b back 1 char
^t top of text	^e end of line	^r restore word  ^f forward 1 char
^c command		^d delete char	^j undelete char ^z next word
=====line 1 col 0 lines from top 1 ============================================
;;;;;;;;;;;;;;;;;;;;;
; FPM Configuration ;
;;;;;;;;;;;;;;;;;;;;;

; All relative paths in this configuration file are relative to PHP's install
; prefix (/usr/local). This prefix can be dynamically changed by using the
; '-p' argument from the command line.

;;;;;;;;;;;;;;;;;;
; Global Options ;
;;;;;;;;;;;;;;;;;;

[global]
; Pid file
; Note: the default prefix is /var
; Default Value: none
pid = run/php-fpm.pid

; Error log file
; If it's set to "syslog", log is sent to syslogd instead of being written
; in a local file.
; Note: the default prefix is /var
; Default Value: log/php-fpm.log
;error_log = log/php-fpm.log

; syslog_facility is used to specify what type of program is logging the
; message. This lets syslogd specify that messages from different facilities
; will be handled differently.
; See syslog(3) for possible values (ex daemon equiv LOG_DAEMON)
; Default Value: daemon
;syslog.facility = daemon

; syslog_ident is prepended to every message. If you have multiple FPM
; instances running on the same server, you can change the default value
; which must suit common needs.
; Default Value: php-fpm
;syslog.ident = php-fpm

; Log level
; Possible Values: alert, error, warning, notice, debug
; Default Value: notice
;log_level = notice

; If this number of child processes exit with SIGSEGV or SIGBUS within the time
; interval set by emergency_restart_interval then FPM will restart. A value
; of '0' means 'Off'.
; Default Value: 0
;emergency_restart_threshold = 0

; Interval of time used by emergency_restart_interval to determine when
; a graceful restart will be initiated.  This can be useful to work around
; accidental corruptions in an accelerator's shared memory.
; Available Units: s(econds), m(inutes), h(ours), or d(ays)
; Default Unit: seconds
; Default Value: 0
;emergency_restart_interval = 0


This is quite a challenging task for me. I'll be the first to admit that my experience working in the CLI is limited and this is a huge learning experience. I'm really drawing a blank here. Any thoughts on what might be the issue?

Thanks!
 

melloa

Wizard
Joined
May 22, 2016
Messages
1,749
I've captured all the steps from a live installation that lead to a working system, but that was FreeBSD 10. Let me check if the above still valid for FreeBSD 11. Stand by ... need to create a VM here ;)
 

melloa

Wizard
Joined
May 22, 2016
Messages
1,749
It seems the items on step #4 has been moved to: /usr/local/etc/php-fpm.d/www.conf. Try to change there and see if will work. If you find something else let me know and I'll see if there are other differences from FreeBSD 10 to 11. Also check https://github.com/abishai/Zoneminder-port
 

StevieBBQ

Dabbler
Joined
Feb 4, 2017
Messages
12

melloa

Wizard
Joined
May 22, 2016
Messages
1,749
Also note from the dev, in reply to my e-mail about above:

I believe, in original pdf we forgot about fcgiwrap socket owner, I saw people hit socket owner issue.

rc.conf

fcgiwrap_user="www"
fcgiwrap_socket_owner="www"
 

StevieBBQ

Dabbler
Joined
Feb 4, 2017
Messages
12

StevieBBQ

Dabbler
Joined
Feb 4, 2017
Messages
12
this is what's in my /usr/local/etc folder

Code:
root@ZMSecCams:/usr/local/etc # ls
bash_completion.d			   pcbsd.conf					  pkg							 sudoers.d
ffserver.conf				   periodic						pkg.conf						sudoers.dist
ffserver.conf.sample			php							 pkg.conf.sample				 tcsd.conf
fonts						   php-fpm.conf					rc.d							tcsd.conf.sample
man.d						   php-fpm.conf.default			rhashrc						 vdpau_wrapper.cfg
mysql						   php.conf						rhashrc.sample				  vdpau_wrapper.cfg.sample
nginx						   php.ini-development			 ssl							 zm.conf
pam.d						   php.ini-production			  sudoers						 zm.conf.sample
root@ZMSecCams:/usr/local/etc #
root@ZMSecCams:/usr/local/etc #

 

melloa

Wizard
Joined
May 22, 2016
Messages
1,749
I reinstall on a fresh FreeBSD 11 bhyve VM and got it up and running. Only change was added on step 8.3, as reported above by dev:
Code:
root@zminder:/usr/local/etc/nginx # sysrc fcgiwrap_socket_owner="www"  


upload_2017-9-9_23-16-12.png



upload_2017-9-9_23-16-28.png


One thing I've noticed was that the issue I saw with joe /usr/local/etc/php-fpm.conf, didn't happen again.

Either way, attached the steps for this test in the txt file (Zoneminder install on FreeBSD 11.txt).
 

Attachments

  • Zoneminder install on FreeBSD 11.txt
    8.4 KB · Views: 646

StevieBBQ

Dabbler
Joined
Feb 4, 2017
Messages
12
Thanks again. I figured it out. Lack of experience in this type of environment leads n00bs like me to do silly things, like not realize that when you write "find this" in your guide, you literally mean, find something by searching for it using the appropriate tool.

ZM up and running on my FreeNAS box. Now I just need some cameras.
 

fracai

Guru
Joined
Aug 22, 2012
Messages
1,212
Now I just need some cameras.
I wonder if it'd be worth having a thread on the cameras that FreeNAS users have put in to use and their experiences with them? Is there anything like that on the ZM forums?
 
Status
Not open for further replies.
Top