troywill/foscam-zoneminder

Can't connect: No such file or directory

Opened this issue · 9 comments

I'm running zoneminder 1.26.5 on Ubuntu 12 LTS with FI8910W cameras. I installed ZM following their wiki, which meant adding their ppa and not using Ubuntu's version.

I've had issues getting various control scripts (including yours) to work due to same issue:

2014-02-17 22:37:59.322350  zmcontrol   11924   FAT Can't connect: No such file or directory    zmcontrol.pl    
2014-02-17 22:37:49.320940  zmcontrol   11926   INF Control server 2/FoscamFI8910W starting at 14/02/17 22:37:49    zmcontrol.pl    
2014-02-17 22:37:49.281640  zmcontrol   11924   INF Starting control server 2/FoscamFI8910W zmcontrol.pl    

After learning a bit of Perl, I discovered that the issue is:

Bareword "ZM_VERSION" not allowed while "strict subs" in use at /usr/share/perl/5.14.2/ZoneMinder/Control/FoscamFI8910W.pm line 79.
Compilation failed in require at /usr/share/perl/5.14.2/Module/Load.pm line 27.
Can't locate ZoneMinder/Control/FoscamFI8910W in @INC (@INC contains: /usr/share/perl/5.14.2 /etc/perl /usr/local/lib/perl/5.14.2 /usr/local/share/perl/5.14.2 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.14 /usr/share/perl/5.14 /usr/local/lib/site_perl .) at /usr/share/perl/5.14.2/Module/Load.pm line 27.

So, to fix it I modified FoscamFI8910W.pm by removing the ZM_VERSION from user agent string at around line 79:

    #$self->{ua}->agent( "ZoneMinder Control Agent/" . ZM_VERSION );
    $self->{ua}->agent( "ZoneMinder Control Agent" );

This solved my issue. Perhaps there's a better way. Hope this will help few others I've seen that have similar problem.

Had the same problem with Zoneminder 1.27. This fixed it. Haven't looked too much into the issue for the root cause, but thanks!

Looks like the link below shows how to solve the actual problem: a minor omission to the zm.conf file
http://www.zoneminder.com/wiki/index.php/Ubuntu_Server_12.04_64-bit_with_Zoneminder_1.26.5_the_easy_way

The permanent fix to this issue is to use the full package name:
ZoneMinder::Base::ZM_VERSION

$self->{ua}->agent( "ZoneMinder Control Agent/" . ZoneMinder::Base::ZM_VERSION );

We have several foscam control scripts recently added to the zoneminder source tree.
https://github.com/ZoneMinder/ZoneMinder/tree/master/scripts/ZoneMinder/lib/ZoneMinder/Control

If your control script is different from these in some imoprtant way, then feel free to geenrate a pull request to have your script added. That way you will not have to track changes in zoneminder that affect control scripts.... we will do that for you.

This was a PERFECT fix for the same problem affecting AxisV2.pm cameras. Thank you!

@MonkberryMedium There was a design change to the ptz control scripts, and the problem manifests itself when users try to use scripts from a previous version of zoneminder or use custom control scripts.
As long as you use the scripts that ship with the lastest version of zoneminder, you won't experience this issue.

For anyone using custom control scripts currently not packaged with ZoneMinder please submit a pull request to get them added.

@knnniggett , thanks. This was a stock install of zoneminder from the repos of Linux Mint 17 and the scripts were all that came with that. zoneminder 1.26.5-1ubuntu3 specifically.

It appears the primary error when you see the sequence of:

Starting control server
Control server .... starting
Can't Connect: No such file or directory

is that the server has exited, this could be because it could not load the controller file. I the case above this would be FoscamFI891W.pm. In my case I had misspelled the protocol name in the Controllers Capabilities screen. (F1 instead of FI).
The connection that is failing is between the primary zmcontrol process and the child it has forked to do the actual controlling.

Hello, I don't want to hijack this issue, but I wanted to mention that this change also fixed this Control script for Apexis cameras: in 1.28 http://www.zoneminder.com/wiki/index.php/Apexis

@knnniggett Can I fork the zm repository and make a PR with this one fixed?

@marcelofernandez
My first budget PTZ IP camera was a Loftek Sentinel D1 PTZ camera. I have since added a ptz control script for it to zoneminder. That camera lasted about a year, and I replaced it with an Apexis PTZ camera, which is identical to the Loftek. They are literally the same camera. Both cameras use the same Foscam firmware and can be programmed as such.

In any case, try the Loftek Sentinel control script. It should work with your Apexis.

What I would ask is you help us keep the WiKi up to date. Please update that page to let users know the control script is already in the source tree.