web_php and web_js claim ZMS socket does not exist

Forum for questions and support relating to 1.33.x development only.
Post Reply
vitus
Posts: 8
Joined: Tue Jul 09, 2019 2:08 am

web_php and web_js claim ZMS socket does not exist

Post by vitus » Tue Jul 09, 2019 2:47 am

I'm having an issue where ZM can't seem to show the camera's feed on the website. The error log is spammed with logs like the following:

Code: Select all

Socket /var/lib/zoneminder/sock/zms-482603s.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.
There's a lot packed into that log message. So let's start from the top.
...either zms did not run, or zms exited early.
To check this I replaced the zms and nph-zms binaries will shell scripts that logged to /tmp/{nph-,}zms.log every time they were invoked. After attempting to view the console I didn't see any entries in those files. So it seems zms is not being invoked.
Please check your zms logs
I went to the Options >> Logging tab and turned on debug logging for the target "_zms". Nothing of interest has appeared in /var/log/zoneminder/. For a short while I had debug logging turned on for the web interface as well but it didn't provide any additional information so I turned it off. It at least confirmed that the log directory is writable.
... and ensure that CGI is enabled in apache ...
As far as I can tell, it's enabled.

Code: Select all

<IfModule !mpm_prefork_module>
        LoadModule cgid_module modules/mod_cgid.so
</IfModule>
<IfModule mpm_prefork_module>
        LoadModule cgi_module modules/mod_cgi.so
</IfModule>
... and check that the PATH_ZMS is set correctly.
I installed zoneminder via the zoneminder-git AUR package. The PKGBUILD is pretty broken, so I did make some minor adjustments to update a dependency and set some paths. Maybe this is where I went wrong. Prior to fixing the configuration directory path in the PKGBUILD I got errors in Apache's error_log saying there were undefined constants. The constants aligned with the ones in /etc/conf.d/*, which I fixed to be /etc/zm/conf.d/*. Those have all gone away now so I believe I have that setup correctly.

Code: Select all

-    git://github.com/FriendsOfCake/crud.git
+    git://github.com/ZoneMinder/crud.git
-          -DZM_SOCKDIR=/var/lib/zoneminder/sock .
+          -DZM_SOCKDIR=/var/lib/zoneminder/sock . \
+         -DZM_CONFIG_DIR=/etc/zm \
+         -DZM_CONFIG_SUBDIR=/etc/zm/conf.d
-    chown -v  http.http $pkgdir/etc/zm.conf 
-    chmod 0700          $pkgdir/etc/zm.conf
+    chown -v  http.http $pkgdir/etc/zm/zm.conf 
+    chmod 0700          $pkgdir/etc/zm/zm.conf
Currently my PATH_ZMS is set to:

Code: Select all

ZM_PATH_ZMS=/cgi-bin/nph-zms
. The Apache DocumentRoot is set to "/srv/http" and /srv/http/cgi-bin/nph-zms exists.

Make sure that ZM is actually recording.
It's kind of hard to tell this, since the web UI is not loading. I do get snapshots in my recording directory sporadically.
If you are trying to view a live stream and the capture process (zmc) is not running then zms will exit.
ZMC is running and has a stable process ID, suggesting it is not boot looping.
Please go to ... for more informatiion
This link puts forth two options. I'm not running IE (lol), so that's not it. The ScriptAlias is setup to be the correct path as far as

Code: Select all

    ScriptAlias /cgi-bin/ "/srv/http/cgi-bin/" 
I switched the ZMS_PATH to be pointing to just 'zms' instead of 'nph-zms' and restarted both Apache and ZM, to no avail. No new entries in the /tmp/{nph-,}zms files, suggesting they're not even being invoked.

vitus
Posts: 8
Joined: Tue Jul 09, 2019 2:08 am

Re: web_php and web_js claim ZMS socket does not exist

Post by vitus » Tue Jul 09, 2019 2:53 am

I forgot to post the details of the camera. Here's how I have it configured:

Code: Select all

MariaDB [zm]> select * from Monitors \G
*************************** 1. row ***************************
                    Id: 4
                  Name: Monitor-4
              ServerId: NULL
             StorageId: 2
                  Type: Ffmpeg
              Function: Mocord
               Enabled: 1
        LinkedMonitors: NULL
              Triggers: 
                Device: /dev/video0
               Channel: 0
                Format: 255
        V4LMultiBuffer: NULL
   V4LCapturesPerFrame: 1
              Protocol: NULL
                Method: rtpUni
                  Host: NULL
                  Port: 80
               SubPath: 
                  Path: rtsp://10.0.4.2:5554
               Options: NULL
                  User: NULL
                  Pass: NULL
                 Width: 640
                Height: 480
               Colours: 4
               Palette: 0
           Orientation: 0
         Deinterlacing: 0
    DecoderHWAccelName: NULL
  DecoderHWAccelDevice: NULL
             SaveJPEGs: 0
           VideoWriter: 1
           OutputCodec: NULL
       OutputContainer: NULL
     EncoderParameters: # Lines beginning with # are a comment 
# For changing quality, use the crf option
# 1 is best, 51 is worst quality
#crf=23
           RecordAudio: 0
          RTSPDescribe: 0
            Brightness: -1
              Contrast: -1
                   Hue: -1
                Colour: -1
           EventPrefix: Event-
           LabelFormat: %N - %d/%m/%y %H:%M:%S
                LabelX: 0
                LabelY: 0
             LabelSize: 1
      ImageBufferCount: 20
           WarmupCount: 0
         PreEventCount: 0
        PostEventCount: 5
    StreamReplayBuffer: 0
       AlarmFrameCount: 1
         SectionLength: 600
      MinSectionLength: 10
             FrameSkip: 0
       MotionFrameSkip: 0
      AnalysisFPSLimit: NULL
   AnalysisUpdateDelay: 0
                MaxFPS: NULL
           AlarmMaxFPS: NULL
     FPSReportInterval: 100
          RefBlendPerc: 6
     AlarmRefBlendPerc: 6
          Controllable: 0
             ControlId: NULL
         ControlDevice: NULL
        ControlAddress: NULL
       AutoStopTimeout: NULL
           TrackMotion: 0
            TrackDelay: NULL
        ReturnLocation: -1
           ReturnDelay: NULL
           DefaultRate: 100
          DefaultScale: 100
          DefaultCodec: auto
     SignalCheckPoints: 10
     SignalCheckColour: #0000c0
             WebColour: red
                  Exif: 0
              Sequence: 1
           TotalEvents: 8
   TotalEventDiskSpace: 27795
            HourEvents: 7
    HourEventDiskSpace: 0
             DayEvents: 8
     DayEventDiskSpace: 27795
            WeekEvents: 8
    WeekEventDiskSpace: 27795
           MonthEvents: 8
   MonthEventDiskSpace: 27795
        ArchivedEvents: NULL
ArchivedEventDiskSpace: NULL
             ZoneCount: 1
               Refresh: NULL
1 row in set (0.001 sec)
I've cycled through FFMPEG, Remote, and VLC source types. None seem to make much difference at all. Fwiw, the camera streams fine into VLC.

vitus
Posts: 8
Joined: Tue Jul 09, 2019 2:08 am

Re: web_php and web_js claim ZMS socket does not exist

Post by vitus » Tue Jul 09, 2019 3:05 am

One last observation. Various zms socket files are created. They live transiently and then disappear. It's not clear what component creates them.

bbunge
Posts: 2405
Joined: Mon Mar 26, 2012 11:40 am
Location: Pennsylvania

Re: web_php and web_js claim ZMS socket does not exist

Post by bbunge » Tue Jul 09, 2019 2:49 pm

Did you check the video resolution reported by VLC? Camera resolution in Zoneminder does not match camera output. Use VLC (Tools, Media Information, Codec) to check camera Display Resolution.

vitus
Posts: 8
Joined: Tue Jul 09, 2019 2:08 am

Re: web_php and web_js claim ZMS socket does not exist

Post by vitus » Wed Jul 10, 2019 9:00 pm

VLC reports:

Code: Select all

Stream 0:
  Codec: H264 - MPEG-4 AVC (part 10) (h264)
  Video resolution: 640x480
Stream 1:
  Codec: MPEG AAC Audio (mp4a)
  Channels: Stereo
  Sample rate: 44100 Hz
  Bits per sample 32
Which matches the dump from the ZM Config table and what I've manually configured in the camera. I've tried configuring the camera at 1FPS, 15 FPS, and 24 FPS to see if that helped ZM at all. Even at 1FPS the same thing happens, so I don't think it's a "keeping up with the analysis" issue.

rockedge
Posts: 1097
Joined: Fri Apr 04, 2014 1:46 pm
Location: Connecticut,USA
Contact:

Re: web_php and web_js claim ZMS socket does not exist

Post by rockedge » Thu Jul 11, 2019 4:20 pm

can you see snapshots of the camera stream? So to say stills from the camera? I notice you do mention it...what happens if you look at a camera's zone settings? can you see anything? are all the permissions correct? can you reach the /cgi-bin via URL in the browser?

vitus
Posts: 8
Joined: Tue Jul 09, 2019 2:08 am

Re: web_php and web_js claim ZMS socket does not exist

Post by vitus » Thu Jul 11, 2019 9:34 pm

Both the Monitor live view and the zone view do not show an image. The live view refreshes the page once a second, each time producing the error from the OP in the logs.

I had not checked the access to /cgi-bin yet, and that looks like it's the issue. The root directory listing in Apache shows three directories, /zonemanager, /recordings (where I've set up storage) and /cgi-bin. I can access the first two just fine. The /cgi-bin gives me a 403 error.

The ZoneMinder mixin for Apache looks correct,

Code: Select all

# /etc/httpd/conf/extra/httpd-zoneminder.conf
# Config for zoneminder web app

Alias /zm "/srv/http/zoneminder"
<Directory "/srv/http/zoneminder">
  Options -Indexes +MultiViews +FollowSymLinks
  AllowOverride None
  Order allow,deny
  Allow from all
  # Provide PHP directory and file access, see http://php.net/manual/en/ini.core.php#ini.open-basedir
  php_admin_value open_basedir "/tmp/:/etc/zm/zm.conf:/etc/zm:/dev/shm:/srv/http/zoneminder/:/var/cache/zoneminder/:/var/lib/zoneminder/:/var/log/zoneminder/:/recordings:/var/lib/zoneminder/sock/"
</Directory>

ScriptAlias /cgi-bin "/srv/http/cgi-bin"
<Directory "/srv/http/cgi-bin">
  AllowOverride None
  Options +ExecCGI +FollowSymLinks
  Order allow,deny
  Allow from all
</Directory>
But then I found this in the main httpd.conf:

Code: Select all

<Directory "/srv/http/cgi-bin">
    AllowOverride None
    Options None
    Require all granted
</Directory>
That AllowOverride None is preventing the mixin from taking effect. I removed that whole block and now it's working fine. Not sure if this is something worth opening a bug report about. Either ZM needs to document this and the user has to modify the Apache configuration manually or ZM needs to provide whatever authentication Apache is requesting.

User avatar
knight-of-ni
Posts: 2226
Joined: Thu Oct 18, 2007 1:55 pm
Location: Shiloh, IL

Re: web_php and web_js claim ZMS socket does not exist

Post by knight-of-ni » Fri Jul 12, 2019 1:25 pm

You've identified an issue unique to Archlinux.

Archlinux ZoneMinder documentation lives on the Archlinux wiki:
https://wiki.archlinux.org/index.php/ZoneMinder

If any documentation needs to be changed, that is where it needs to happen. You might want to have a conversation with the package maintainer first.
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/

Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests