Page 1 of 1

Rookie trying to start zoneminder.

Posted: Mon May 01, 2017 2:55 am
by mrgar
Hello,

I have built ZoneMinder from the Arch Linux AUR. It compiled but I am having difficulty getting the software to start.

Startup:

Code: Select all

$ sudo systemctl start zoneminder.service
Job for zoneminder.service failed because the control process exited with error code.
See "systemctl status zoneminder.service" and "journalctl -xe" for details.
$systemctl status zoneminder.service

Code: Select all

 zoneminder.service - ZoneMinder CCTV recording and security system
   Loaded: loaded (/usr/lib/systemd/system/zoneminder.service; enabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Sun 2017-04-30 18:24:54 CDT; 6min ago
  Process: 6558 ExecStart=/usr/bin/zmpkg.pl start (code=exited, status=255)

Apr 30 18:24:44 archer zmpkg[6558]: INF [Command: start]
Apr 30 18:24:44 archer zmdc[6571]: INF [Server starting at 17/04/30 18:24:44]
Apr 30 18:24:44 archer zmdc[6571]: ERR [Can't open pid file at /run/zoneminder/zm.pid]
Apr 30 18:24:46 archer zmdc[6571]: FAT [Can't bind to /var/lib/zoneminder/sock/zmdc.sock: Permission denied]
Apr 30 18:24:54 archer zmdc[6568]: FAT [Can't connect: No such file or directory]
Apr 30 18:24:54 archer zmpkg[6558]: ERR [Unable to run "/usr/bin/zmdc.pl startup", output is "Starting server"]
Apr 30 18:24:54 archer systemd[1]: zoneminder.service: Control process exited, code=exited status=255
Apr 30 18:24:54 archer systemd[1]: Failed to start ZoneMinder CCTV recording and security system.
Apr 30 18:24:54 archer systemd[1]: zoneminder.service: Unit entered failed state.
Apr 30 18:24:54 archer systemd[1]: zoneminder.service: Failed with result 'exit-code'.
I have been scouring pages but to no avail. Any help is greatly appreciated.

Re: Rookie trying to start zoneminder.

Posted: Mon May 01, 2017 3:18 am
by rockedge
Do these directories exist? /var/lib/zoneminder and /var/run/zoneminder

Re: Rookie trying to start zoneminder.

Posted: Mon May 01, 2017 3:31 am
by mrgar
Yes.

Code: Select all

gar@archer ~]$ ls -lh /var/lib/zoneminder/
total 8.0K
drwxr-xr-x 2 root root 4.0K Apr 30 05:35 sock
drwxr-xr-x 2 root root 4.0K Apr 30 05:35 temp
[gar@archer ~]$ ls -lh /var/run/zoneminder/
total 0 

Re: Rookie trying to start zoneminder.

Posted: Mon May 01, 2017 3:49 am
by mrgar
FYI, the sock and temp directories in /var/lib/zoneminder are empty.
The zoneminder directory in /var/run is empty as well.

Re: Rookie trying to start zoneminder.

Posted: Mon May 01, 2017 11:05 am
by rockedge
what happens when in a terminal you type? Can you see any errors?

Code: Select all

zmpkg.pl start

Re: Rookie trying to start zoneminder.

Posted: Mon May 01, 2017 11:59 am
by mrgar
Here's the report:

Code: Select all

$ sudo zmpkg.pl start
[sudo] password for gar: 
Job for zoneminder.service failed because the control process exited with error code.
See "systemctl status zoneminder.service" and "journalctl -xe" for details.
[gar@archer ~]$ systemctl status zoneminder.service
● zoneminder.service - ZoneMinder CCTV recording and security system
   Loaded: loaded (/usr/lib/systemd/system/zoneminder.service; enabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Mon 2017-05-01 06:48:07 CDT; 1min 12s ago
  Process: 16893 ExecStart=/usr/bin/zmpkg.pl start (code=exited, status=255)

May 01 06:47:56 archer zmpkg[16893]: INF [Command: start]
May 01 06:47:57 archer zmdc[16906]: INF [Server starting at 17/05/01 06:47:57]
May 01 06:47:57 archer zmdc[16906]: ERR [Can't open pid file at /run/zoneminder/zm.pid]
May 01 06:47:59 archer zmdc[16906]: FAT [Can't bind to /var/lib/zoneminder/sock/zmdc.sock: Permission denied]
May 01 06:48:07 archer zmdc[16903]: FAT [Can't connect: No such file or directory]
May 01 06:48:07 archer zmpkg[16893]: ERR [Unable to run "/usr/bin/zmdc.pl startup", output is "Starting server"]
May 01 06:48:07 archer systemd[1]: zoneminder.service: Control process exited, code=exited status=255
May 01 06:48:07 archer systemd[1]: Failed to start ZoneMinder CCTV recording and security system.
I am guessing these lines are the culprit:

Code: Select all

May 01 06:47:57 archer zmdc[16906]: ERR [Can't open pid file at /run/zoneminder/zm.pid]
May 01 06:47:59 archer zmdc[16906]: FAT [Can't bind to /var/lib/zoneminder/sock/zmdc.sock: Permission denied]
May 01 06:48:07 archer zmdc[16903]: FAT [Can't connect: No such file or directory]
May 01 06:48:07 archer zmpkg[16893]: ERR [Unable to run "/usr/bin/zmdc.pl startup", output is "Starting server"]
I am not sure if it is because of setting in a config file, or permissions in apache? I am stumped. Thanks for helping.

Re: Rookie trying to start zoneminder.

Posted: Mon May 01, 2017 12:13 pm
by rockedge
This could be the clue:

Code: Select all

gar@archer ~]$ ls -lh /var/lib/zoneminder/
total 8.0K
drwxr-xr-x 2 root root 4.0K Apr 30 05:35 sock
drwxr-xr-x 2 root root 4.0K Apr 30 05:35 temp
[gar@archer ~]$ ls -lh /var/run/zoneminder/
total 0
try this in a terminal:

Code: Select all

chown -R www-data  /var/lib/zoneminder 
then run zmpkg.pl start again and see if there is a change.

Re: Rookie trying to start zoneminder.

Posted: Mon May 01, 2017 12:21 pm
by knight-of-ni
rockedge is right.

ZoneMinder runs as the web account user. That means that any folder which ZoneMinder needs to write to, must be owned by the web account user.

This includes, but is not limited to, these folders:
events folder
images folder
temp folder
socket folder
log folder

Re: Rookie trying to start zoneminder.

Posted: Mon May 01, 2017 12:44 pm
by mrgar
Thanks for your assistance.
I think this is the issue.

Code: Select all

 chown -R www-data /var/lib/zoneminder
chown: invalid user: ‘www-data’
Do I need to create a new user 'www-data'? Please pardon my ignorance.

Re: Rookie trying to start zoneminder.

Posted: Mon May 01, 2017 12:49 pm
by knight-of-ni
mrgar wrote: Mon May 01, 2017 12:44 pm Thanks for your assistance.
I think this is the issue.

Code: Select all

 chown -R www-data /var/lib/zoneminder
chown: invalid user: ‘www-data’
Do I need to create a new user 'www-data'? Please pardon my ignorance.
www-data is the web account name for Debian/Ubuntu systems. Redhat systems use apache, nginx, or lighttpd as the account name, depending on what web server is running. Arch linux.... I have no idea what the web account user is. It probably is not any one of the account names I just mentioned.
One way to find out what the name of the web account user is to look inside the main configuration file for your web server. On my redhat system, that config file is /etc/httpd/conf/httpd.conf. It might be somewhere else on Arch linux.

Re: Rookie trying to start zoneminder.

Posted: Mon May 01, 2017 1:12 pm
by rockedge
did you build ZM using cmake?
something like

Code: Select all

 cmake -DZM_WEBDIR=/usr/share/zoneminder/www  -DZM_WEB_USER=www-data -DZM_WEB_GROUP=www-data -DZM_CGIDIR=/usr/lib/zoneminder/cgi-bin ./
for sure there is a owner/permissions conflict somewhere. Try creating and adding user www-data ..... maybe easy fix?

Re: Rookie trying to start zoneminder.

Posted: Mon May 01, 2017 1:17 pm
by mrgar
chown to http seems to fix it! It is http on Arch. Thanks. Issue solved. :) Hopefully will be testing tonight.

Re: Rookie trying to start zoneminder.

Posted: Mon May 01, 2017 1:19 pm
by rockedge
excellent! Good stuff.