ZoneMinder – adding USB camera

Goal is to attach a USB camera to UbuntuServer and then configure for ZoneMinder

LESSONS LEARNED:
-Really look at installation docs carefully
-I needed to use the default zmpass login
-I needed to make sure of:
ScriptAlias matches PATH_ZMS.
ScriptAlias /zm/cgi-bin /usr/lib/zoneminder/cgi-bin
From console go to Options->Path and make sure PATH_ZMS is set to /zm/cgi-bin/nph-zms.-
-I didn’t quite read it correctly, and thought I should enter /zoneminder
-There is a slight delay when loading the image before it comes on screen
-Overall – key is to review and understand ALL installer documentation before actually beginnning.

-Attached my Logitech Orb Camera to USB port on server
-To see a list of your USB devices (the vendor and device ID’s), run:
lsusb
Note: Came back with — Bus 001 Device 011: ID 046d:0994 Logitech, Inc. QuickCam Orbit/Sphere AF
Note: This is a good start, as it appears to have auto-loaded the USB device

-I think first step is to run some program called Cheese to confirm camera is functioning
https://help.ubuntu.com/community/Webcam

sudo apt-get install cheese
Note: I believe it installed, but…

Note: When I run: cheese
Failed to connect to Mir: Failed to connect to server socket: No such file or directory
Unable to init server: Could not connect: Connection refused

** (cheese:26617): ERROR **: cheese-application.vala:86: Unable to initialize libcheese-gtk
Trace/breakpoint trap (core dumped)

I read someplace that if a user wants to access the webcam, they have to be in the video group
usermod – G video paul
Note: I don’t think this is quite the answer

When I go into Log within ZM, I see:
Failed to open video device /dev/video0: Permission denied

Checking security:
ls -al /dev/video (returns with)
crw-rw—- 1 root video 81, 0 Dec 17 18:16 /dev/video0

I remember seeing a message earlier, upon logging in, that said to restart server
sudo reboot

I think there is a rights issue. Within the log it says:
Failed to open video device /dev/video0: Permission denied

sudo chmod 777 /dev/video0
sudo a2enmod cgi (NOTE: Don’t think I needed to do this)
service zoneminder restart

Checked the log. Don’t see the rights issue, but I see:
Failed to set camera source 11: Invalid argument
Note: This could be because I set camera to what I thought was channel 11

Note: Getting close now, because the camera now has an orange light on it…

Now I’m seeing this in log:
Socket /var/run/zm/zms-327516s.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/latest/faq.html#why-can-t-i-see-streamed-images-when-i-can-see-stills-in-the-zone-window-etc for more information.

Goal: enable CGI in Apache
Followed: https://code-maven.com/set-up-cgi-with-apache
cd /etc/apache2/mods-enabled
sudo ln -s ../mods-available/cgi.load (Note: Said something about already existing)
sudo service apache2 reload
Note: According to Log: Logi-USB-Orbit: 7000 – Capturing at 5.00 fps
Camera still on amber

Restarted server

Need to resolve this error, and also be logged in as Paul:
ERR Socket /var/run/zm/zms-770262s.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/latest/faq.html#why-can-t-i-see-streamed-images-when-i-can-see-stills-in-the-zone-window-etc for more information.

1) Keep the default zone apache.conf without the ScriptAlias.

2) Stop both zoneminder and apache2
sudo service apache2 stop
sudo service zoneminder stop

2) Remove any stale sockets from /tmp/zm (default location):
sudo rm -vf /tmp/zm/*.*

3) sudo a2enmod cgi
NOTE: Got this error again:
1) Keep the default zone apache.conf without the ScriptAlias.

2) Stop both zoneminder and apache2
sudo service apache2 stop
sudo service zoneminder stop

2) Remove any stale sockets from /tmp/zm (default location):
sudo rm -vf /tmp/zm/*.*

3) sudo a2enmod cgi
Note: Got this error:
AH00558: apache2: Could not reliably determine the server’s fully qualified domain name, using 127.0.1.1. Set the ‘ServerName’ directive globally to suppress this message

Within /etc/hostname it has “ubuntusec” — this is legacy and I’ll keep it for now
https://askubuntu.com/questions/256013/apache-error-could-not-reliably-determine-the-servers-fully-qualified-domain-n

Within /etc/apache2 I created a folder called conf.d
Within /etc/apache2/conf.d I created a new file called fqdn with:
ServerName localhost

4) Start zoneminder
sudo service zoneminder start

5) Start apache2
sudo service apache2 start

I found out that the order was important for step 4 and 5, otherwise it doesn’t work.
4) Start zoneminder
sudo service zoneminder start

5) Start apache2
sudo service apache2 start

I found out that the order was important for step 4 and 5, otherwise it doesn’t work.

I’m getting close, but still have this error:
Socket /var/run/zm/zms-138038s.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/latest/faq.html#why-can-t-i-see-streamed-images-when-i-can-see-stills-in-the-zone-window-etc for more information.

About Paul

CERT Coordinator, Ham Radio Operator, GTD Fan; Photographer; Domino/Notes Administrator
This entry was posted in Ubuntu, ZoneMInder. Bookmark the permalink.