Troubleshooting

From ZoneMinder Wiki
Jump to navigationJump to search

General Troubleshooting

If you are having problems with ZoneMinder here are some things to try. If these don't work then check the ZoneMinder FAQ at http://www.zoneminder.com/faq.html and then the forums at http://www.zoneminder.com/forums.html first and see if anyone has had the same problem in the past. If not then feel free to get in touch and I'll see if I can suggest something else. Please ensure that you read the posting guidelines and go through the steps listed below before posting or mailing though.

The first thing you need to do is check the ZoneMinder logs to see if you can find out what is and what isn’t working. See the Logging section above for details about where the logs are and how to enable and control debug output, if required.

In general though, the best places to look for errors are in the system error log (normally /var/log/messages on RedHat), the ZoneMinder logs, and the web server log (/var/log/httpd/error_log unless otherwise defined). There should be something in one of those that gives you some kind of tip off.

Some other things you can check.

  • Device configuration. If you can't get your cameras to work in ZoneMinder, firstly make sure that you have the correct settings. Use xawtv or something like that to check for settings that work and then run zmu -d <device> -q -v to get the settings. If you can't get them to work with that then the likelihood is they won't work with ZoneMinder. Also check the system logs (usually /var/log/messages) for any video configuration errors. If you get some and you're sure they're not a problem then switch off ZM_STRICT_VIDEO_CONFIG in zmconfig.pl or the ‘options’ tab.
  • Start simple. Begin with a single monitor and single zone. You can run the zmc capture daemon from the command line as 'zmc --device <device>' (or whatever your video device is). If it returns immediately there's a problem so check the logs, if it stays up then your video configuration is probably ok. To get more information out of it use debug as specified below. Also check that the shared memory segment has been created by doing 'ipcs -m'. Finally, beware of doing tests as root and then trying to run as another user as some files may not be accessible. If you're checking things as root make sure that you clean up afterwards!
  • Web server. Ensure that your web server can serve PHP files. It's also possible that your php.ini file may have some settings which break ZoneMinder, I'm not a PHP guru but setting safe mode may prevent your PHP files from running certain programs. You may have to set configuration to allow this. Also since the daemons are started by your web server, if it dies or is shut down then the daemons may disappear. In this version the daemons are run under the control of a script which should trap expected signals but it is possible this doesn't cover all circumstances. If everything else works but you can’t get images in your browser a likely cause is a mismatch between where your web server expects to execute CGI scripts and where you have installed the zms streaming server. Check your server configuration for the correct CGI location and ensure you have supplied the same directory to the ZoneMinder configure script via the --with-cgidir option.
  • One of the more common errors you can see in the log files is of the form 'Can't shmget: Invalid argument'. Generally speaking this is caused by an attempt to allocate an amount of shared memory greater than your system can handle. The size it requests is base on the following formula, ring buffer size x image width x image height x 3 (for 24 bits images) + a bit of overhead. So if for instance you were using 24bit 640x480 then this would come to about 92Mb if you are using the default buffer size of 100. If this is too large then you can either reduce the image or buffer sizes or increase the maximum amount of shared memory available. If you are using RedHat then you can get details on how to change these settings at http://www.redhat.com/docs/manuals/database/RHDB-2.1-Manual/admin_user/kernel-resources.html.
  • You should be able to use a similar procedure with other distributions to modify the shared memory pool without kernel recompilations though in some cases this may be necessary. You can also sometimes get shared memory errors if you have changed the monitor image size for instance. In this case it is sometimes that an old process is hanging onto the shared memory and will not let it be resized. Ensure that you do a full ZoneMinder restart and/or manually delete the shared memory segment to check. Use the ipcs and ipcrm system commands to check and remove segments if necessary.
  • If you get odd javascript errors and your web console or other screens come up with bits missing then it's possible that there is a problem with the PHP configuration. Since version 0.9.8 ZoneMinder has used short PHP open tags to output information, so instead of something like this '<?php echo $value ?>', it will be something like this '<?= $value ?>' which is easier and quicker to write as well as being neater. More information about this directive can be seen at the following location, http://www.php.net/manual/en/configuration.directives.php#ini.short-open-tag. However although by default most PHP installations support this form, some will need to have it switched on explicitly. To do this you will first need to find your php.ini file (do a 'locate php.ini' or 'find / -name php.ini'. Be aware however that sometimes you might find more than one, so ensure you identify the one that is actually being used. You will then need to find the line that starts 'short_open_tag = ' and change the Off value to On. This will correct the problem. However in some cases you may have explicitly switched it off, so that XML compliant documents can be more easily served, or you may even not have permission to edit the file. In this case you can go into the web directory of ZoneMinder and run 'sh retag.sh' which will replace all the short open tags in the files themselves with the longer variant. You will obviously have to remember to do this for each subsequent version of ZoneMinder that you install as well.
  • Paths. I admit it, the various paths in ZoneMinder can be a little hard to work out mainly because some relate to real directories and others to web paths. Make sure that they are all sensible and correct and that permissions are such that the various parts of ZoneMinder can actually run.
  • Missing perl modules. There are various perl modules used by the various scripts. The configure script should inform you if a required or optional module is absent but it is possible some may get missed. If you get errors about missing modules, the easiest way to install them is via 'yum' or your distributions package manager. In Fedora for example to install module XXX:YYY is to type yum install perl-XXX-YYY. The alternative, if the module is not available via that route or your prefer to build from source, is to type the following (you will probably need to be root), perl -MCPAN -eshell this will then (eventually, after some configuration if it’s your first time) present you with a prompt. From there you can type install module, e.g. Archive::Zip and the rest should be more or less automatic as it will chase any dependencies for you. There may be some initial configuration questions it might ask you on startup if you've never run it before and to speed things up I would not install a new Bundle at this point (it can end up building you a whole new perl if you’re not careful) if it asks you but everything else should be quite straightforward. You can often also install perl modules via your ordinary package manager, e.g. yum or apt.
  • Unsupported palettes. ZoneMinder currently is designed to use the simple palettes of greyscale and 24 bit as well as now the YUV420P and some other palettes. This should cover most cameras but it's possible that there are ones out there that might want to use more esoteric formats that ZoneMinder doesn’t support. This will often show up as the capture daemon being unable to set picture attributes. If this occurs try using different palettes starting with greyscale and if you can't get anything to work let me know and I'll try and add it.
  • USB bus problems. If you have multiple USB cameras on one bus then it can appear as if ZoneMinder is causing your cameras to fail. This is because the bandwidth available to cameras is limited by the fairly low USB speed. In order to use more than one USB camera with ZoneMinder (or any application) you will need to inform the driver that there are other cameras requiring bandwidth. This is usually done with a simple module option. Examples are usb_alt=<n> for the OV511 driver and cams=<n> for CPIA etc. Check your driver documentation for more details. Be aware however that sharing cameras in this way on one bus will also limit the capture rate due to the reduced bandwidth.
  • Incorrect libjpeg.a detection. It seems to be the case that in some cases the library file libjpeg.a is reported as missing even when apparently present. This appears to actually be down to the g++ compiler not being installed on the host system. Since ZoneMinder contains both C++ and C files you need to be able to compile both of these file types and so usually need to ensure you have gcc and g++ installed (though they are often the same binary).
  • Httpd and zms memory leaks. It has been reported by some users with RedHat 9 that the zms process fails to terminate correctly when the controlled window is killed and also that it, and it’s associated httpd process, continue to grow in memory size until they kill the system. This appears to be a bug in early versions of apache 2. On other systems it may appear that zms is leaking and growing. However what grows is the total and shared memory size while the non-shared memory size stays constant. It's a little odd but I think what it happening is that as zms picks images out of the shared memory ring buffer to display, as each slot is read the size of that bit of memory is added to the shared memory total for the process. As streamed images are not read consecutively it's a semi-random process so initially most of the buffer slots are new and the shared memory size grows then as time goes on the remaining unaccessed slots reduce until once all have been read the shared memory use caps out at the same size as the actual segment. This is what I would have expected it to be in the first place, but it seems to do it incrementally. Then once this total is hit it grows no further. As it's shared memory anyway and already in use this apparent leak is not consuming any more memory than when it started.

Also, if you are using IE under Windows and get lots of annoying clicks when various windows refresh then you'll need to edit your registry and remove the value for HKEY_CURRENT_USER\AppEvents\Schemes\Apps\Explorer\Navigating\.current or download the registry script to do it for you from http://www.zoneminder.com/downloads/noIEClick.reg


Missing/No video or monitor shows RED in ZM Console

  • First and most importantly TRY accessing the camera stream using FFMPEG/mplayer/xawtv and make sure you can access the video stream that way, as frequently if it won't work there its easier to troubleshoot it with those applications than with ZM. If you do get it working with FFMPEG there is almost no reason it shouldn't work in ZM. Note if your camera is putting out a mjpeg stream then FFMPEG/mplayer require the file to end in .mjpg or .mjpeg for remote urls this can be accomplished by appending ?a=.mjpg to the stream so if your camera url is: http://123.123.123.123/stream.cgi you would turn this into: http://123.123.123.123/stream.cgi?a=.mjpg if your stream already has a query string on it (a ? ) then just do &a=.mjpg at the end of it.
    • If you did get it working using mplayer/ffmpeg and are using a "Source Type" other than FFMPEG in zoneminder try using FFMPEG. FFMPEG is frequently more tolerant of issues than some of the native ZM camera support.
  • Make sure the Monitor Function is obviously not set to "None" for the monitor or ZM will not touch it.
  • Ensure zoneminder is setup for extra debugging so go to the Options in the web console then the debug tab:
    • Switch additional debugging on(EXTRA_DEBUG)
    • Set debug level to 5 (EXTRA_DEBUG_LEVEL)
    • Make sure The debug output location is valid the default of /tmp/zm_debug.log+ is generally fine (EXTRA_DEBUG_LOG)
    • Make sure the general log path (Under Path's tab) is valid(PATH_LOGS)
    • Save changes and Restart zoneminder so changes take effect.
  • Now make note of the monitor ID you want to debug (if you are not sure click it under the Source column and in the popup window it will say: Monitor - WhateverMonitorName (1234) where 1234 will be the monitor ID
  • Now you will want to check two sets of logs, first are the generally logs which for zone minder will be in the folder PATH_LOGS and also in your syslog. You may find it easier to filter the zoneminder messages out of your default syslog file (but that is beyond this scope) if you have not filtered them out they will most likely be in /var/log/messages (or whatever your default log file is). It can be helpful to stop zone minder, erase them, and then start zone minder so you can look at each one and see exactly what happened as ZM started up.
  • Finally/Most usefully you will want to check the individual log file for the exact zone minder capture daemon for that monitor (zoneminder should be running). To find this log file from a shell run "ps axf | grep zmc" it should show you one or more zmc processes. After each one will be a "-m 1234" where 1234 is the monitor it is capturing for. You will also notice on the far left side of the output of that line will be a number, this is the PID of the process. Now the ZM log file for the process will be at EXTRA_DEBUG_LOG + .PID however the PID is padded out to 5 chars (with 0's at the front) So if your EXTRA_DEBUG_LOG is: "/tmp/zm_debug.log+" and the PID is 459 of the ZMC process then the log file would be /tmp/zm_debug.log.00459 This file will most likely have the gold that you are looking for as to what is going on/wrong.
  • Of course if ZMC shows no errors and seems to be going fine, it may make sense to look at the ZMA daemon it is the next its the next step.

Getting FREE help from others

There are two main places you can ask for help, the forums and IRC (irc.freenode.net #zoneminder) BEFORE you ask for help please make sure you read ALL of the Documentation and all of this troubleshooting page. Search for problems like yours on the forums. Please try and upgrade to the latest version of zoneminder if you can, as many bugs get fixed and we generally prefer to debug issues on the current version. If you still need assistance its time to do so correctly. Make sure you are very specific on whats going on, what you have done to try and troubleshoot it, and use http://pastebin.com/ to post output from logs related to your issue (try to only post the related parts). Make sure you are very specific and give as much details as possible. If you ask very generic questions or it doesn't seem you have tried what is recommended you may not get responses.

Getting PAID suppport

If you are willing to pay for support still try the forums or IRC if you have the time/ability may help you find someone who can help you anyway, but otherwise email support at zoneminder dot com and mention you are looking for paid support. We should be able to have someone get in contact with you shortly and help you. It is still recommended you do the above things as it will help us speed up helping you which means it will also cost you less and get you running faster.