zoneminder not creating local unix sockets for streaming

Bug #1159361 reported by Anshuman Aggarwal
74
This bug affects 13 people
Affects Status Importance Assigned to Milestone
zoneminder (Ubuntu)
Incomplete
Undecided
Unassigned

Bug Description

My configuration is:

Ubuntu Precise 12.04
Zoneminder (from ubuntu official repositories) 1.25.0
Apache 2.2.22
Php 5.3.10

Problem:
I am unable to see the camera streaming and this is happening on two servers with similar 12.04 setups (both were upgraded from previous versions of Ubuntu...however one was a LTS to LTS other was thorough the intermediate releases)..the two servers have different types of cameras (USB vs Network) so this eliminates a lot of the other possibilities.

Logs:
Syslog (and web_php.log created by the apache zoneminder cgi-bin) shows

03/12/13 17:42:20.307107 web_php[5514].ERR [socket_sendto( /var/run/zm/zms-347773s.sock ) failed: No such file or directory] at /usr/share/zoneminder/includes/functions.php line 2322
03/12/13 17:42:20.307107 web_php[5514].ERR [socket_sendto( /var/run/zm/zms-347773s.sock ) failed: No such file or directory] at /usr/share/zoneminder/includes/functions.php line 2322

srwxr-xr-x 1 www-data www-data 0 Mar 12 17:42 zmdc.sock
-rw-r--r-- 1 www-data www-data 5 Mar 12 17:42 zm.pid
srwxr-xr-x 1 www-data www-data 0 Mar 13 18:01 zms-347773w.sock

Tags: zoneminder
Revision history for this message
Dave Gilbert (ubuntu-treblig) wrote :

Yep, seeing this as well; zoneminder 1.25.0-1. on 12.04.2

Symptom is just don't see the video in the monitor.

Changed in zoneminder (Ubuntu):
status: New → Confirmed
Revision history for this message
rsellars (raymond-sellars) wrote :

http://www.zoneminder.com/wiki/index.php/Ubuntu_10.04_Server_64-bit_%28with_ffmpeg,_etc.%29

Hit a similar issue with my 1.25.0 install from source (Ubuntu 12.04).
Adding "ScriptAlias /cgi-bin /usr/share/zoneminder/cgi-bin" to the /etc/zm/apache.conf file as above seem to address the problem.

http://forums.fedoraforum.org/showthread.php?t=288585 - similar hints here for same issue.

BTW: Package manager installs of ZM for me (Kubuntu -Ubuntu 12.04.2 LTS ) don't seem to have this issue.

Revision history for this message
Martin Shaffer Levac (mslporc) wrote :

Using zoneminder 1.26.5,
installed from sources
on Debian 7 (Wheezy)

I had a lot of ERR messages in log saying some .sock files were not found.

Not clear what king of events these messages were related to but one thing for sure adding to /etc/zm/apache.conf the line recommended (2013-05-06) by rsellars solved the problem.

zoneminder logs now only contain INF messages.

Thank You!

Revision history for this message
Alain Danger (alain-danger) wrote :

Using zoneminder 1.26.5 under ubuntu 14.04 AMD64

The problem seems to be the socket is not created under /tmp/zm.

Tested several solutions here and there, regarding cgi-bin directories and "ScriptAlias" but none worked.

Here's the error :

May 3 23:12:37 mx2 zmc_dvideo0[2006]: INF [Monitor-1: 13000 - Capturing at 25.00 fps]
May 3 23:12:39 mx2 web_php[1583]: ERR [socket_sendto( /tmp/zm/zms-425345s.sock ) failed: No such file or directory]
May 3 23:12:39 mx2 web_php[1583]: ERR [getStreamCmdResponse stream error: socket_sendto( /tmp/zm/zms-425345s.sock ) failed: No such file or directory - checkStreamForErrors()]
May 3 23:12:52 mx2 web_php[1584]: ERR [socket_sendto( /tmp/zm/zms-425345s.sock ) failed: No such file or directory]
May 3 23:12:52 mx2 web_php[1584]: ERR [getStreamCmdResponse stream error: socket_sendto( /tmp/zm/zms-425345s.sock ) failed: No such file or directory - checkStreamForErrors()]

My /etc/zm/apache.conf

Alias /zm /usr/share/zoneminder
<Directory /usr/share/zoneminder>
  php_flag register_globals off
  php_value short_open_tag 1
  Options Indexes FollowSymLinks
  AllowOverride All
  <IfModule mod_dir.c>
    DirectoryIndex index.php
  </IfModule>
</Directory>
ScriptAlias /cgi-bin /usr/lib/cgi-bin
<Directory "/usr/lib/cgi-bin">
        Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
        AllowOverride All
        # The code unfortunately uses short tags in many places
        php_value short_open_tag 1
</Directory>

Revision history for this message
Bill Adams (gofish) wrote :

After much head-banging, I got the live steam to work.

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) Start zoneminder
sudo service zoneminder start

4) Start apache2
sudo service apache2 start

I think the start order right after install leaves it in a funny state. Or it could be dumb luck on my part and my "fix" was not a real fix at all.

Revision history for this message
Alain Danger (alain-danger) wrote :

After much searching and purge + reinstall of both apache2 and zoneminder, I suspect the problem is CGI not enabled by default, so one must lauch "sudo a2encgi" after installing apache2 and before installing zoneminder.

Revision history for this message
Donovan Long (donovan-long) wrote :

#6 is correct that CGI is not enabled in Apache but the correct command to enable it on my 14.04 LTS is "sudo a2enmod cgi"

Monitors are functioning now, great.

Revision history for this message
François Jacques (francois-jacques) wrote :

My results, based on Bill, Alain and Donovan comments:

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

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.

Revision history for this message
Eloy Paris (peloy-chapus) wrote :

The steps in comment #8 did it for me. Thanks a lot everyone for their suggestions and workarounds. There's a Debian bug that seems to be tracking this same issue:

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=741738

I am running Ubuntu 14.04 and with the shipped zoneminder.conf for Apache (with no modifications).

Cheers,

Eloy Paris.-

Revision history for this message
AaronELBorg (elmastero74) wrote :

ubuntu 14.04 and zm 1.26.5 here.

#6 was correct and #7's instructions worked like a charm.

So nice when the answer is easy to find.

Many thanks.

Revision history for this message
AaronELBorg (elmastero74) wrote :

Actually......do yourself a favor and do the instructions laid out by François Jacques in #8.

This will have the added benefit of your logs not getting filled-up with the "stream sock error: No such file or directory" messages.

Revision history for this message
Alexey Brodkin (alexey-brodkin) wrote :

For me the same problem was resolved with disabled authentication in ZM options (uncheck OPT_USE_AUTH).

The reason to make this conclusion is here in logs:
===================
Aug 19 00:21:00 ubuntu-server zms[5623]: ERR [Unable to authenticate user]
...
Aug 19 00:21:00 ubuntu-server zms[5633]: ERR [Unable to authenticate user]
Aug 19 00:21:10 ubuntu-server web_php[5446]: ERR [socket_sendto( /tmp/zm/zms-289356s.sock ) failed: No such file or directory]
===================

Revision history for this message
rsellars (raymond-sellars) wrote :

Revisiting this after a clean installation. Responses #6 and #7 are correct. Don't need ScriptAlias was a matter of apache2 not having cgi enabled: sudo a2enmod cgi

Would seen that the package installed needs a check or component to enable cgi (with the respective security confirmation).

Revision history for this message
Paweł Kowalski (pk-i) wrote :

I've got the same problem as #12. With no authentication it works as expected, but when I only check OPT_USE_AUTH, streaming no longer works. Logs look similar:

2014-12-10 16:32:14.549552 web_php 13587 ERR socket_sendto( /tmp/zm/zms-836616s.sock ) failed: No such file or directory includes/functions.php 2344
2014-12-10 16:32:11.491629 zms 15228 ERR Unable to authenticate user zms.cpp 225

Revision history for this message
Paweł Kowalski (pk-i) wrote :

Sorry, wrong log dump. Should be:

2014-12-10 16:34:39.007612 web_php 13573 ERR socket_sendto( /tmp/zm/zms-620154s.sock ) failed: No such file or directory includes/functions.php 2344
2014-12-10 16:34:33.006464 web_js 13573 ERR getStreamCmdResponse stream error: socket_sendto( /tmp/zm/zms-620154s.sock ) failed: No such file or directory - checkStreamForErrors() ?view=watch
2014-12-10 16:34:32.912315 web_php 13573 ERR socket_sendto( /tmp/zm/zms-620154s.sock ) failed: No such file or directory includes/functions.php 2344
2014-12-10 16:34:28.638141 zms 15674 ERR Unable to authenticate user zms.cpp 225
2014-12-10 16:34:28.540816 zms 15672 ERR Unable to authenticate user zms.cpp 225
2014-12-10 16:34:05.308260 zmc_m2 14721 INF cam1: 1000 - Capturing at 4.98 fps zm_monitor.cpp 2783
2014-12-10 16:34:05.209517 zmc_m1 14717 INF cam2: 1000 - Capturing at 4.98 fps zm_monitor.cpp 2783

Revision history for this message
Paweł Kowalski (pk-i) wrote :

Did nothing, and today it works (authentication + streaming) :(

Revision history for this message
Tony (optimised) wrote :

I had the same problem as above and tried #8, this seemed to work for a while but then the errors reappeared in the log files. I then noticed that the time on the Zoneminder web page did not match the server time. I found a post (which for the life of me I can't find again to post here) that described this problem and how set the correct timezone in etc/php5/apache2/php.ini. This fixed the time issue, unauthenticated user issue and the socket issue.

Revision history for this message
Toby Corkindale (tjc-wintrmute) wrote :

Hit this issue as well -- enabling cgi fixed it, but ideally the installation of zoneminder should do that rather than leaving users to google for bug reports?

Revision history for this message
Denis (dnsfnk) wrote :

I have the same issue on Ubuntu 14.04 and on Centos 6.7.
Streaming wasn't worked with authentication. But worked without it.

The source of it was in different time on server side and on php.ini.

I have synchronized it and it's working fine now.
Also you can try to set 'AUTH_RELAY' to NONE if time synchronization wasn't helpful.

Revision history for this message
Lonny (lonny-selinger) wrote :

I had run into this a few times previous and just for posterity ... for those seeing the failed authentication have you tried logging admin out and back in again?

What worked for me was:

1. Enable OPT_USE_AUTH
2. Go into users tab and change admin password
3. at main page of GUI select 'admin' then click log out
4. log in with new credentials
5. Everything worked

I then noticed it again when I came back to an already authenticated session (IOW didn't challenge me for a password for admin). The browser still showed everything fine and the cameras logged in etc but I got the socket errors in the logs again. All I had to do was foce log out admin and re login and everything was fine.

ymmv

Revision history for this message
Staszek (s-aleksinski-f) wrote :

For anybody, who already tried all this things, and nothing worked.

Ift the problem is only when auth is on, try to set AUTH_RELAY option to "none".

I would appreciate, if someome confirm, that this is secure config.

Revision history for this message
Chris Rainey (ckrzen) wrote :

@Staszek: I can confirm that AUTH_RELAY = <none> fixed this problem for me on ZM 1.30.4 and Ubuntu Gnome 17.04 x86_64.

Revision history for this message
Chris Rainey (ckrzen) wrote :

Ubuntu 12.04 (precise) reached end-of-life on April 28, 2017.

See this document for currently supported Ubuntu releases:
https://wiki.ubuntu.com/Releases

We appreciate that this bug may be old and you might not be interested in discussing it any more. But if you are then please upgrade to the latest Ubuntu version and re-test. If you then find the bug is still present in the newer Ubuntu version, please add a comment here telling us which new version it is in and change the bug status to Confirmed.

Changed in zoneminder (Ubuntu):
status: Confirmed → Incomplete
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.