Unable to view events after upgrade: Unable to open sock lock file No such file or directory

Forum for questions and support relating to the 1.30.x releases only.
Locked
martian_tom
Posts: 6
Joined: Sun Jan 10, 2016 11:33 pm

Unable to view events after upgrade: Unable to open sock lock file No such file or directory

Post by martian_tom »

Hi,

I've been using ZM for years on Ubuntu. I recently upgraded from Ubuntu 16.10 and ZM 1.30.0 to Ubuntu 17.10, and ZM 1.30.4. ZM appears to be working capturing events: i.e. I get email notifications when there's an event. However I now see two problems in the ZM web console: The status is permanently "Stopped", and if I try and view an event, no video is displayed and I get the following errors in the log:

Code: Select all

2017-11-18 19:40:09.326619	web_js		2210	ERR	getCmdResponse stream error: socket_bind( /tmp/zm/zms-127346w.sock ) failed: No such file or directory - checkStreamForErrors()	?view=event	
2017-11-18 19:40:09.304777	web_php		2210	ERR	socket_bind( /tmp/zm/zms-127346w.sock ) failed: No such file or directory	/usr/share/zoneminder/www/includes/functions.php	2033
2017-11-18 19:40:08.913968	zms		10232	FAT	Can't bind: No such file or directory	zm_stream.cpp	337
2017-11-18 19:40:08.910721	zms		10232	ERR	Unable to open sock lock file /tmp/zm/zms-127346.lock: No such file or directory	zm_stream.cpp	303
I should note that I upgraded Ubuntu in 2 steps: 16.10 to 17:04, then immediately from 17.04 to 17.10. At the intermediate 17.04 stage ZM was still at version 1.30.0 and I did a quick check and these problems were already present, so it's most likely caused by the Ubuntu upgrade, not the ZM upgrade.

Research mostly points to there being an issue with PATH_ZMS or the Apache configuration, but after reading numerous posts with similar symptoms, everything on my system appears to be set up correctly.

In the ZM web options PATH_ZMS = /zm/cgi-bin/nph-zms

This agrees with ScriptAlias in the Apache config which looks like this:

Code: Select all

# Remember to enable cgi mod (i.e. "a2enmod cgi").
ScriptAlias /zm/cgi-bin "/usr/lib/zoneminder/cgi-bin"
<Directory "/usr/lib/zoneminder/cgi-bin">
    Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
    AllowOverride All
    Require all granted
</Directory>

Alias /zm /usr/share/zoneminder/www
<Directory /usr/share/zoneminder/www>
  Options -Indexes +FollowSymLinks
  <IfModule mod_dir.c>
    DirectoryIndex index.php
  </IfModule>
</Directory>

<Directory /usr/share/zoneminder/www/api>
    AllowOverride All
</Directory>
"/usr/lib/zoneminder/cgi-bin" does indeed exist and contains zms and nph-zms symlinked to it.

In apache CGI is enabled

Code: Select all

sudo a2enmod cgi
Module cgi already enabled
The path "/tmp/zm" does exist with the expected user www-data and permissions 755. When I try and view an event, there is no socket file there. I've tried removing this folder and it gets recreated when I restart ZM from systemd.

In the Apache error log I see an error like this:

Code: Select all

[Sat Nov 18 19:40:09.307438 2017] [php7:notice] [pid 2210] [client 192.168.0.1:39902] ERR [socket_bind( /tmp/zm/zms-127346w.sock ) failed: No such file or directory], referer: https://mythbox.local/zm/index.php?view=event&eid=121587&filter[terms][0][attr]=DateTime&filter[terms][0][op]=%3E%3D&filter[terms][0][val]=-1+hour&sort_field=StartTime&sort_asc=1&page=1
After reading multiple threads on similar issues, everything I have configured appears to be correct, so I'm looking for help on what else I can try.

The second issue is that the ZM console constantly shows that ZM is Stopped and as a result I can't view live video. If I try to change the state to Start, the console just reloads in the Stopped state again. As previously said, in all respects apart from the console, ZM appears to be running as I see new events in the events folder and I receive notification emails. Also:

Code: Select all

sudo zmdc.pl check
running
This may or not be related to being unable to view events, but it started at the same time after upgrading Ubuntu.

Any help in what else I should try will be much appreciated.
bbunge
Posts: 2934
Joined: Mon Mar 26, 2012 11:40 am
Location: Pennsylvania

Re: Unable to view events after upgrade: Unable to open sock lock file No such file or directory

Post by bbunge »

There are known issues with Ubuntu 17.10. Your best bet is to start over with 16.04 or see the install procedure in the WIKI for 17.10
martian_tom
Posts: 6
Joined: Sun Jan 10, 2016 11:33 pm

Re: Unable to view events after upgrade: Unable to open sock lock file No such file or directory

Post by martian_tom »

Thanks bbunge,

I see that there is no build for 17.10 in the iconnor PPA which explains why your wiki page says to use the zesty .deb, however all of the actions from the other steps in your procedure are already done on my system. I uninstalled Zoneminder and re-installed as per the wiki for good measure, but I still have exactly the same issues.

Is there any documentation or bug reports which detail the issues with Ubuntu 17.10? I've searched and not found anything specifically about problems with 17.10.

My system is running many other applications, so starting again with 16.04 is not feasible. I may consider using a virtual machine if there is unlikely to be a quick fix or workaround, but it's not the ideal solution.
martian_tom
Posts: 6
Joined: Sun Jan 10, 2016 11:33 pm

Re: Unable to view events after upgrade: Unable to open sock lock file No such file or directory

Post by martian_tom »

Well in fact I've now solved this and the solution is very simple, although I'm extremely confused about why it works.

I changed the value of the PATH_SOCKS option to point to a different folder and both problems are solved. In my case I created a folder in "/var/cache/zoneminder" and gave it the same owner and permissions as "/tmp/zm" (www-data:www-data 755). It also worked when I created a folder in home. For good measure I tested with a new folder created in /tmp and it didn't work.

So presumably something about PATH_SOCKS being under /tmp was causing the socket files to not be created, but I don't understand why because on my system /tmp is just a folder on the same drive as /var and /home. Any ideas?
bbunge
Posts: 2934
Joined: Mon Mar 26, 2012 11:40 am
Location: Pennsylvania

Re: Unable to view events after upgrade: Unable to open sock lock file No such file or directory

Post by bbunge »

Ubuntu uses a private tmp folder which has caused issues with some programs Zoneminder included. Will have to give your fix a try when my body finally gets moving today!
Locked