Error /var/lock/zm & /tmp/zm

Forum for questions and support relating to the 1.29.x releases only.
skydiver
Posts: 86
Joined: Wed Jun 16, 2004 7:15 pm

Error /var/lock/zm & /tmp/zm

Post by skydiver »

I am upgrading what was an existing 1.28 ZM running on Ubuntu server 14.04 LTS. While performing the upgrade, my configuration and database disappeared so I am treating this like a fresh install.The system is currently running but I cannot stream.

Following the install wiki for Ubuntu, I get to the init.d restart ad I am getting the following errors when starting the service:

Code: Select all

Stopping ZoneMinder: 
success
rm: cannot remove /var/lock/zm: Operation not permitted
Starting ZoneMinder: chown: changing ownership of /var/run/zm: Operation not permitted
chown: changing ownership of /tmp/zm: Operation not permitted
success
I have confirmed that the directories and files re chown'ed www-data:www-data

Additionally I have the following errors in teh zonemnder logs:

Code: Select all

2016-03-20 15:10:25.830110	zmdc		20767	ERR	'zma -m 1' exited abnormally, exit status 255	zmdc.pl	
2016-03-20 15:10:25.693152	zma_m1		20797	ERR	Shared data not initialised by capture daemon for monitor Backyard	zm_monitor.cpp	442
I have a feeling that my configuration may be off due to the prior now disappeared installation. Where do I fix the run and lock errors? I am sure this will lead to new problems.
bbunge
Posts: 2956
Joined: Mon Mar 26, 2012 11:40 am
Location: Pennsylvania

Re: Error /var/lock/zm & /tmp/zm

Post by bbunge »

skydiver
Posts: 86
Joined: Wed Jun 16, 2004 7:15 pm

Re: Error /var/lock/zm & /tmp/zm

Post by skydiver »

I had already followed the
Ubuntu 14.04 - ZM 1.26.5 or later to 1.29.0 or the latest PPA version

instructions and that is how my old 1.28 setup along with 4 years of events got reset (my own fault for not having a backup)

I just went through again and still the same result. Can you provide some direction as to what setting needs to be looked at for these two process files?
skydiver
Posts: 86
Joined: Wed Jun 16, 2004 7:15 pm

Re: Error /var/lock/zm & /tmp/zm

Post by skydiver »

OK did it a third time this time as sudo su instead od sudo each comnad and that seemed to fix the tmp/lock issues.

Now I still cannot stream. This is the error in the ZM logs:

2016-03-20 20:51:13.941936 web_js 28352 ERR getStreamCmdResponse stream error: socket_sendto( /var/run/zm/zms-661580s.sock ) failed: No such file or directory - checkStreamForErrors() ?view=watch
2016-03-20 20:51:13.707367 web_php 28352 ERR socket_sendto( /var/run/zm/zms-661580s.sock ) failed: No such file or directory /usr/share/zoneminder/www/includes/functions.php 2371
skydiver
Posts: 86
Joined: Wed Jun 16, 2004 7:15 pm

Re: Error /var/lock/zm & /tmp/zm

Post by skydiver »

Any help here? I have RTFM'd both the upgrade and fresh install with no luck.
bbunge
Posts: 2956
Joined: Mon Mar 26, 2012 11:40 am
Location: Pennsylvania

Re: Error /var/lock/zm & /tmp/zm

Post by bbunge »

Can't stream is usually the result of:

1. CGI not enabled (since you had 1.28 running this is not the case)

2 The final step in the upgrade process: Open Zoneminder. Click on Options - Paths, Change PATH_ZMS to /zm/cgi-bin/nph-zms

Oh, make sure these is no space at the end of: /zm/cgi-bin/nph-zms
skydiver
Posts: 86
Joined: Wed Jun 16, 2004 7:15 pm

Re: Error /var/lock/zm & /tmp/zm

Post by skydiver »

Still cannot stream. Have verified all the settings for both urgrading from 1.28 on Ubuntu Server LTS 14.04 and a new install.

Here are some settings from the systems:

Code: Select all

user@zm:/usr/share/zoneminder/www$ ls -la
total 120
drwxr-xr-x 12 www-data www-data  4096 Mar 20 11:23 .
drwxr-xr-x  4 www-data www-data  4096 Mar 20 11:23 ..
drwxr-xr-x  2 www-data www-data  4096 Mar 13 18:54 ajax
drwxr-xr-x  4 www-data www-data  4096 Mar 13 18:54 api
-rwxrwxr-x  1 www-data www-data 62936 Jun 29  2014 cambozola.jar
drwxr-xr-x  2 www-data www-data  4096 Mar 13 18:54 css
lrwxrwxrwx  1 www-data www-data    28 Feb  4 11:43 events -> /var/cache/zoneminder/events
drwxr-xr-x  2 www-data www-data  4096 Mar 13 18:54 graphics
lrwxrwxrwx  1 www-data www-data    28 Feb  4 11:43 images -> /var/cache/zoneminder/images
drwxr-xr-x  2 www-data www-data  4096 Mar 13 18:54 includes
-rw-r--r--  1 www-data www-data  6435 Feb  4 10:50 index.php
drwxr-xr-x  2 www-data www-data  4096 Mar 13 18:54 js
drwxr-xr-x  2 www-data www-data  4096 Mar 13 18:54 lang
drwxr-xr-x  5 www-data www-data  4096 Mar 13 18:54 skins
lrwxrwxrwx  1 www-data www-data    26 Feb  4 11:43 temp -> /var/cache/zoneminder/temp
drwxr-xr-x  3 www-data www-data  4096 Mar 13 18:54 tools
drwxr-xr-x  2 www-data www-data  4096 Mar 13 18:54 views
Apache Config:

Code: Select all

user@zm:/etc/apache2/conf.d$ ls -la
total 8
drwxr-xr-x 2 root root 4096 Apr 19  2015 .
drwxr-xr-x 9 root root 4096 Mar 21 15:23 ..
lrwxrwxrwx 1 root root   19 Jun 29  2014 zoneminder.conf -> /etc/zm/apache.conf

Code: Select all

user@zm:/etc/zm$ cat apache.conf
Alias /zm /usr/share/zoneminder/www

<Directory "/usr/share/zoneminder/www">
  php_flag register_globals off
  Options Indexes FollowSymLinks
  <IfModule mod_dir.c>
    DirectoryIndex index.php
  </IfModule>
</Directory>
ZM Config:

Code: Select all

user@zm:/etc/zm$ cat zm.conf
# ==========================================================================

# ZoneMinder Base Configuration, $Date$, $Revision$
#
# ==========================================================================
#
# This file is generated by 'configure'. Care should be taken if manually
# editing this file as an changes may be overwritten by subsequent configuration
# or installations.
#

# Path to installed data directory, used mostly for finding DB upgrade scripts
ZM_PATH_DATA=/usr/share/zoneminder/www

# Path to ZoneMinder binaries
ZM_PATH_BIN=/usr/bin

# Path to ZoneMinder libraries (none at present, for future use)
ZM_PATH_LIB=/usr/lib/x86_64-linux-gnu

# Path to ZoneMinder configuration (this file only at present)
ZM_PATH_CONF=/etc/zm

# Path to ZoneMinder web files
ZM_PATH_WEB=/usr/share/zoneminder/www

# Path to ZoneMinder cgi files
ZM_PATH_CGI=/usr/lib/zoneminder/cgi-bin

# Username and group that web daemon (httpd/apache) runs as
ZM_WEB_USER=www-data
ZM_WEB_GROUP=www-data

# ZoneMinder database type: so far only mysql is supported
ZM_DB_TYPE=mysql

# ZoneMinder database hostname or ip address
ZM_DB_HOST=localhost

# ZoneMinder database name
ZM_DB_NAME=zm

# ZoneMinder database user
ZM_DB_USER=zmuser

# ZoneMinder database password
ZM_DB_PASS=<custome set and verified working>

# Host of this machine
ZM_SERVER_HOST=
/var/run

Code: Select all

user@zm:/var/run$ ls -la zm*
total 4
drwxr-xr-x  2 www-data www-data  80 Mar 25 10:17 .
drwxr-xr-x 23 root     root     820 Mar 25 10:24 ..
srwxr-xr-x  1 www-data www-data   0 Mar 21 15:24 zmdc.sock
-rw-r--r--  1 www-data www-data   5 Mar 21 15:24 zm.pid
/var/lock

Code: Select all

root@zm:/run/lock# ls -la
total 0
drwxrwxrwt  5 root     root     140 Mar 21 14:49 .
drwxr-xr-x 23 root     root     820 Mar 25 10:24 ..
drwxr-xr-x  2 www-data root      40 Mar 22 06:50 apache2
-rw-r-----  1 root     root       0 Mar 21 02:30 aptitude
drwx------  2 root     root      40 Mar 20 21:00 lvm
drwxr-xr-x  2 whoopsie whoopsie  60 Mar 20 21:00 whoopsie
-rw-r--r--  1 root     www-data   0 Mar 21 14:49 zm
Where else do I need to look to get streaming to work?
User avatar
knight-of-ni
Posts: 2406
Joined: Thu Oct 18, 2007 1:55 pm
Location: Shiloh, IL

Re: Error /var/lock/zm & /tmp/zm

Post by knight-of-ni »

Your apache config file is from the previous version of ZoneMinder. You should be using the one the ships with the 1.29.0 package.

First, verify the new config file is located under /etc/apache2/conf-available/ and it 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>
  php_flag register_globals off
  Options Indexes FollowSymLinks
  <IfModule mod_dir.c>
    DirectoryIndex index.php
  </IfModule>
</Directory>

<Directory /usr/share/zoneminder/www/api>
    AllowOverride All
</Directory>
Second, delete the old config file apache2.conf under /etc/zm/ and also delete the symlink that points to it under /etc/apache2/conf.d.

Now go to /etc/apache2/conf-enabled and create a symlink that points to zoneminder.conf in ../conf-available.
There is some Debian command which will do this for you, but I don't use Debian so maybe someone else can tell you what it is.

Restart apache and zoneminder, and you should be good to go, provided your PATH_ZMS under Options is correct.

This completely stupid way of configuring apache is one of the reasons I stick with redhat distros.
Visit my blog for ZoneMinder related projects using the Raspberry Pi, Orange Pi, Odroid, and the ESP8266
All of these can be found at https://zoneminder.blogspot.com/
bbunge
Posts: 2956
Joined: Mon Mar 26, 2012 11:40 am
Location: Pennsylvania

Re: Error /var/lock/zm & /tmp/zm

Post by bbunge »

rm /etc/apache2/conf-enabled/zoneminder.conf

https://wiki.zoneminder.com/Common_Issu ... PA_version
skydiver
Posts: 86
Joined: Wed Jun 16, 2004 7:15 pm

Re: Error /var/lock/zm & /tmp/zm

Post by skydiver »

Neither of these suggestions worked. Still getting these errors when trying to stream.:

Code: Select all

2016-03-25 15:21:06.840433	web_js		3366	ERR	getStreamCmdResponse stream error: socket_sendto( /var/run/zm/zms-318744s.sock ) failed: No such file or directory - checkStreamForErrors()	?view=watch	
2016-03-25 15:21:06.630734	web_php		3503	ERR	socket_sendto( /var/run/zm/zms-318744s.sock ) failed: No such file or directory	/usr/share/zoneminder/www/includes/functions.php	2371
It is recording events and the stills are view-able, just no streaming.
User avatar
knight-of-ni
Posts: 2406
Joined: Thu Oct 18, 2007 1:55 pm
Location: Shiloh, IL

Re: Error /var/lock/zm & /tmp/zm

Post by knight-of-ni »

That means you've still got an Apache configuration problem somewhere.
Visit my blog for ZoneMinder related projects using the Raspberry Pi, Orange Pi, Odroid, and the ESP8266
All of these can be found at https://zoneminder.blogspot.com/
bbunge
Posts: 2956
Joined: Mon Mar 26, 2012 11:40 am
Location: Pennsylvania

Re: Error /var/lock/zm & /tmp/zm

Post by bbunge »

Looks like your best bet is to start over with a fresh install of Ubuntu server.

bb
skydiver
Posts: 86
Joined: Wed Jun 16, 2004 7:15 pm

Re: Error /var/lock/zm & /tmp/zm

Post by skydiver »

I am running two other lightweigtht websrvers on this Apache server, so I really don't want to wipe this. Can someone please step through what is causing the error?

What processor & configs files are determining what launches where wand where the pid loock files are needing to be written to?
skydiver
Posts: 86
Joined: Wed Jun 16, 2004 7:15 pm

Re: Error /var/lock/zm & /tmp/zm

Post by skydiver »

So let me re-phrase my question:
When you are logged into the zm Apache page and then request a stream to view, Apache attempts to start streaming.
Where does in the Apache the configuration does Apache look to start the zm streaming process?
Where in the streaming process does the binary look to write files?
I am assuming that since the apache process is running as www-data that all other spawned processes are also running as www-data. What file ownership does the streaming process need to be able to work?
skydiver
Posts: 86
Joined: Wed Jun 16, 2004 7:15 pm

Re: Error /var/lock/zm & /tmp/zm

Post by skydiver »

What file ownership should the usr/lib/zoneminder folders have?

Code: Select all

root@zm:/usr/lib/zoneminder# ls -la
total 20
drwxr-xr-x  3 root root  4096 Mar 13 18:54 .
drwxr-xr-x 83 root root 12288 Mar 13 20:06 ..
drwxr-xr-x  2 root root  4096 Mar 13 18:54 cgi-bin
root@zm:/usr/lib/zoneminder# cd ..
root@zm:/usr/lib# ls -laR ./zoneminder/
./zoneminder/:
total 20
drwxr-xr-x  3 root root  4096 Mar 13 18:54 .
drwxr-xr-x 83 root root 12288 Mar 13 20:06 ..
drwxr-xr-x  2 root root  4096 Mar 13 18:54 cgi-bin

./zoneminder/cgi-bin:
total 1404
drwxr-xr-x 2 root root    4096 Mar 13 18:54 .
drwxr-xr-x 3 root root    4096 Mar 13 18:54 ..
lrwxrwxrwx 1 root root       3 Feb  4 11:43 nph-zms -> zms
-rwxr-xr-x 1 root root 1428768 Feb  4 11:43 zms
Locked