ZM 1.30.4 API issue on ubuntu 17.10

Forum for questions and support relating to the 1.30.x releases only.
evb
Posts: 3
Joined: Fri Oct 20, 2017 2:39 pm

ZM 1.30.4 API issue on ubuntu 17.10

Post by evb »

I have an issue with zoneminder API after upgrading ubuntu to 17.10 distributive.

It looks like the is a problem with CakePHP:

[Fri Oct 20 16:09:04.536516 2017] [php7:error] [pid 13476] [client xx.xx.xx.xx] PHP Fatal error: Uncaught InternalErrorException: Internal Serv
er Error in /usr/share/php/Cake/Error/ErrorHandler.php:261\nStack trace:\n#0 /usr/share/php/Cake/Error/ErrorHandler.php(212): ErrorHandler::handleFatalError(256, '[MissingPluginE...', '/usr/share/php/...', 138)\n#1 [internal function]: ErrorHandler::handleError(256, '[MissingPluginE...', '/usr/share/php/...', 138, Array)\n#2 /usr/share/php/Cake/Error /ErrorHandler.php(138): trigger_error('[MissingPluginE...', 256)\n#3 [internal function]: ErrorHandler::handleException(Object(MissingPluginException))\n#4 {main}\n thrown in
/usr/share/php/Cake/Error/ErrorHandler.php on line 261

In web interface, while trying to get access to API, I've got the message on the picture attached.
img-2017-10-20-16-41-18.png
img-2017-10-20-16-41-18.png (36.69 KiB) Viewed 28018 times
Does somebody have experience of upgrading to 17.10 with ZM 1.30.4+dfsg-2 installed?

Thanks!
bbunge
Posts: 2923
Joined: Mon Mar 26, 2012 11:40 am
Location: Pennsylvania

Re: ZM 1.30.4 API issue on ubuntu 17.10

Post by bbunge »

Looks like the problem is with cakephp not working. I did a fresh install of 17.10 with Zoneminder and the API's do not work either.

Still looking for a fix...
evb
Posts: 3
Joined: Fri Oct 20, 2017 2:39 pm

Re: ZM 1.30.4 API issue on ubuntu 17.10

Post by evb »

bbunge wrote: Sat Oct 21, 2017 12:04 am Looks like the problem is with cakephp not working. I did a fresh install of 17.10 with Zoneminder and the API's do not work either.

Still looking for a fix...
I've tried to upgrade cakephp from github ( version 2.10 instead of 2.8 ), but still not results...
SteveGilvarry
Posts: 494
Joined: Sun Jun 29, 2014 1:12 pm
Location: Melbourne, AU

Re: ZM 1.30.4 API issue on ubuntu 17.10

Post by SteveGilvarry »

I believe you will be missing the crud plugin from /api/app/plugin it is a specific version of friendsofcake crud. Best bet would be clone zm, init submodules and get the folder.
Or iconnor ppa which won’t be missing critical components.
Production Zoneminder 1.37.x (Living dangerously)
Random Selection of Cameras (Dahua and Hikvision)
bbunge
Posts: 2923
Joined: Mon Mar 26, 2012 11:40 am
Location: Pennsylvania

Re: ZM 1.30.4 API issue on ubuntu 17.10

Post by bbunge »

SteveGilvarry wrote: Sat Oct 21, 2017 11:40 am I believe you will be missing the crud plugin from /api/app/plugin it is a specific version of friendsofcake crud. Best bet would be clone zm, init submodules and get the folder.
Or iconnor ppa which won’t be missing critical components.
/Plugin is missing from /usr/share/zoneminder/www/api (as compared to a working Ubuntu 16.04 zm system)
bbunge
Posts: 2923
Joined: Mon Mar 26, 2012 11:40 am
Location: Pennsylvania

Re: ZM 1.30.4 API issue on ubuntu 17.10

Post by bbunge »

I was able to get the API working.
Fresh install of 17.10 with just LAMP and Webmin
Downloaded the Zesty .deb from the iconnor PPA and copied to my home directory. Shortened the name to zoneminder.deb
installed Zoneminder .deb with: apt install /home/bill/zoneminder.deb
used the WIKI instructions for 16.04 -zm 1.30.4 except used PHP 7.1 in one spot.

Suspect the vlc-plugins did not make it as I got one error at the end of the install.

Will try it again later. Lawn work calls on a beautiful day in Pennsylvania!
bbunge
Posts: 2923
Joined: Mon Mar 26, 2012 11:40 am
Location: Pennsylvania

Re: ZM 1.30.4 API issue on ubuntu 17.10

Post by bbunge »

Here is an interim install procedure for ZM on Ubuntu 17.10. Am working to get it on the WIKI

Install Zoneminder 1.30.4 on Ubuntu 17.10

There are some issues with the Zoneminder package provided with Ubuntu 17.10. This is an alternate install procedure that uses the install package from the iconnor PPA for Zesty (Ubuntu 17.04)

You will need to make a settings change to MySQL as follows:

This removes the current symbolic link

rm /etc/mysql/my.cnf

This moves the MYSQL Configuration file

cp /etc/mysql/mysql.conf.d/mysqld.cnf /etc/mysql/my.cnf

To change MySQL settings:

nano /etc/mysql/my.cnf

In the [mysqld] section add the following

sql_mode = NO_ENGINE_SUBSTITUTION

Ctrl+o Enter to save

CTRL+x to exit

Restart MySQL

systemctl restart mysql

Download the Zoneminder install package from the iconnor PPA. Note this is for the 64 bit version.

wget https://launchpad.net/~iconnor/+archive ... _amd64.deb

Install Zoneminder - Note: Change (user) to the user in the home directory on your system

apt install vlc-plugin-base /home/(user)/zoneminder_1.30.4-zesty1_amd64.deb

Create a new user

adduser www-data video

Enable CGI, Zoneminder and rewrite configuration in Apache.

a2enmod cgi

a2enconf zoneminder

a2enmod rewrite

Fix Permissions

chown -R www-data:www-data /usr/share/zoneminder/

Enable and start Zoneminder

systemctl enable zoneminder

service zoneminder start

Add timezone to PHP

nano /etc/php/7.1/apache2/php.ini

Search for [Date] (Ctrl + w then type Date and press Enter) and make changes as follows for your time zone. Make sure to remove the ; from the front of date.timezone

[Date]
; Defines the default timezone used by the date functions
; http://php.net/date.timezone
date.timezone = America/New_York

Ctrl+o Enter to save

CTRL+x to exit

Restart Apache

service apache2 reload


IMPORTANT FINAL STEP: Open Zoneminder in a web browser (http://server-ip/zm). Click on Options - Paths and change PATH_ZMS to /zm/cgi-bin/nph-zms
SteveGilvarry
Posts: 494
Joined: Sun Jun 29, 2014 1:12 pm
Location: Melbourne, AU

Re: ZM 1.30.4 API issue on ubuntu 17.10

Post by SteveGilvarry »

Bbunge,
Caught iconnor today and he had time to spin up a 17.10 PPA now to hopefully save you some steps.
Thanks iconnor.

EDIT might still need the vlc package, need to check when I get home as Iconnor said he had issues with it building.
Production Zoneminder 1.37.x (Living dangerously)
Random Selection of Cameras (Dahua and Hikvision)
SteveGilvarry
Posts: 494
Joined: Sun Jun 29, 2014 1:12 pm
Location: Melbourne, AU

Re: ZM 1.30.4 API issue on ubuntu 17.10

Post by SteveGilvarry »

Nope issues with getting a new PPA for 17.10, version related and Iconnor is a little busy. Revert to bbunge workaround using 17.04
Production Zoneminder 1.37.x (Living dangerously)
Random Selection of Cameras (Dahua and Hikvision)
lselinger
Posts: 35
Joined: Fri Oct 25, 2013 9:57 pm

Re: ZM 1.30.4 API issue on ubuntu 17.10

Post by lselinger »

Having the same issue with the API not working. I'm assuming as long as I leave the DB in place I can remove the zoneminder package and install the .deb in its' place? I have cameras configured and working and did some tweaking etc so I'd prefer to not have to redo all my config. Worst case I could dump the DB and import later.
bbunge
Posts: 2923
Joined: Mon Mar 26, 2012 11:40 am
Location: Pennsylvania

Re: ZM 1.30.4 API issue on ubuntu 17.10

Post by bbunge »

lselinger wrote: Mon Oct 30, 2017 8:37 pm Having the same issue with the API not working. I'm assuming as long as I leave the DB in place I can remove the zoneminder package and install the .deb in its' place? I have cameras configured and working and did some tweaking etc so I'd prefer to not have to redo all my config. Worst case I could dump the DB and import later.
Short answer is yes.
With that said it would be a great idea to take a dump of the ZM database. Not sure if doing an uninstall will remove the zm database or not but it is best to be safe.
With a dump of the database you can go back to Ubuntu 16.04 and keep all your settings. Am still not sure about Ubuntu 17.10....

bb
lselinger
Posts: 35
Joined: Fri Oct 25, 2013 9:57 pm

Re: ZM 1.30.4 API issue on ubuntu 17.10

Post by lselinger »

Ok this was bugging me and I probably didn't do this the right way, but I grabbed an older install's api/app/Plugin directory and copied it over just to see if it would work ... it did :? I now have zmninja working and the zm api functioning with an older (I'm assuming) version of Crud :D

CORRECTION: I 'kind of' have it working. From a fresh install of zmninja I can see everything and work with events/cameras etc (very cool app) however after I exit and try to start the app again, all I ever see is:

Code: Select all

Application Error

The connection to the server was unsuccessful.
(file:///android_asset/www/index.html)
... on my phone although this may be something specific to zmninja
User avatar
asker
Posts: 1553
Joined: Sun Mar 01, 2015 12:12 pm

Re: ZM 1.30.4 API issue on ubuntu 17.10

Post by asker »

lselinger wrote: Tue Oct 31, 2017 4:57 pm

Code: Select all

Application Error

The connection to the server was unsuccessful.
(file:///android_asset/www/index.html)
... on my phone although this may be something specific to zmninja

Yup, that was a zmNinja bug which you've been helping resolve (thanks ;) )
I no longer work on zmNinja, zmeventnotification, pyzm or mlapi. I may respond on occasion based on my available time/interest.

Please read before posting:
How to set up logging properly
How to troubleshoot and report - ES
How to troubleshoot and report - zmNinja
ES docs
zmNinja docs
detxm80
Posts: 38
Joined: Fri Oct 13, 2017 9:42 am

Re: ZM 1.30.4 API issue on ubuntu 17.10

Post by detxm80 »

hi guys, i try bbunge guide, all ok for one days then after invalid api in zmninja, api access failed.

log:

Logs for version:1.2.507D (desktop)

Nov 14, 2017 04:16 PM DEBUG 2nd auth API failed, going to login
Nov 14, 2017 04:16 PM DEBUG getAPIversion error handler {"data":"","status":500,"config":{"method":"GET","transformRequest":[null],"transformResponse":[null],"url":"http://xxx.xxx.x.x/zm/api/host/getVersi ... ation/json, text/plain, */*"}},"statusText":"Internal Server Error"}
Nov 14, 2017 04:16 PM DEBUG getAPIversion called
Nov 14, 2017 04:16 PM DEBUG 2nd auth login worked
Nov 14, 2017 04:16 PM INFO Stream authentication construction:
Nov 14, 2017 04:16 PM DEBUG Storing login time as Tue Nov 14 2017 16:16:02 GMT+0100
Nov 14, 2017 04:16 PM INFO Deferring auth key, as monitorId unknown
Nov 14, 2017 04:16 PM DEBUG auth-success emit:Successful
Nov 14, 2017 04:16 PM INFO zmAutologin successfully logged into Zoneminder
Nov 14, 2017 04:16 PM INFO ZM has recaptcha disabled - good
Nov 14, 2017 04:16 PM INFO Checking if reCaptcha is enabled in ZM...
Nov 14, 2017 04:16 PM INFO zmAutologin called
Nov 14, 2017 04:16 PM DEBUG Resetting zmCookie...
Nov 14, 2017 04:16 PM DEBUG Doing the Aaron Hack after 1 sec....
Nov 14, 2017 04:16 PM INFO API Error handler: going to login getAPI returned error: "-1.-1.-1"
Nov 14, 2017 04:16 PM DEBUG getAPIversion error handler {"data":"","status":500,"config":{"method":"GET","transformRequest":[null],"transformResponse":[null],"url":"http://xxx.xxx.x.x/zm/api/host/getVersi ... ation/json, text/plain, */*"}},"statusText":"Internal Server Error"}
Nov 14, 2017 04:16 PM INFO ZM has recaptcha disabled - good
Nov 14, 2017 04:16 PM DEBUG getAPIversion called
Nov 14, 2017 04:16 PM DEBUG PortalLogin: auth success
Nov 14, 2017 04:16 PM INFO Stream authentication construction:
Nov 14, 2017 04:16 PM DEBUG Storing login time as Tue Nov 14 2017 16:16:01 GMT+0100
Nov 14, 2017 04:16 PM INFO Deferring auth key, as monitorId unknown
Nov 14, 2017 04:16 PM DEBUG auth-success emit:Successful
Nov 14, 2017 04:16 PM INFO zmAutologin successfully logged into Zoneminder
Nov 14, 2017 04:16 PM DEBUG current version: 1.2.507D & available version 1.2.507D
Nov 14, 2017 04:16 PM DEBUG Latest post dated 2017-02-25 14:54:24 but you read 2017-11-02 00:37:54
Nov 14, 2017 04:16 PM INFO Checking if reCaptcha is enabled in ZM...
Nov 14, 2017 04:16 PM INFO zmAutologin called
Nov 14, 2017 04:16 PM DEBUG Resetting zmCookie...
Nov 14, 2017 04:16 PM INFO Cancelling zmAutologin timer
Nov 14, 2017 04:16 PM DEBUG PIN code entered is correct, or there is no PIN set
Nov 14, 2017 04:16 PM DEBUG unlock called with check PIN=true
Nov 14, 2017 04:16 PM INFO not checking for touchID
Nov 14, 2017 04:16 PM INFO User credentials are provided
Nov 14, 2017 04:16 PM DEBUG Inside Portal login Enter handler
Nov 14, 2017 04:16 PM INFO Entering Portal Main

can you help me to solve it?
thanks
emuhack
Posts: 8
Joined: Mon Jan 29, 2018 10:48 pm

Re: ZM 1.30.4 API issue on ubuntu 17.10

Post by emuhack »

bbunge wrote: Sat Oct 21, 2017 5:10 pm I was able to get the API working.
Fresh install of 17.10 with just LAMP and Webmin
Downloaded the Zesty .deb from the iconnor PPA and copied to my home directory. Shortened the name to zoneminder.deb
installed Zoneminder .deb with: apt install /home/bill/zoneminder.deb
used the WIKI instructions for 16.04 -zm 1.30.4 except used PHP 7.1 in one spot.

Suspect the vlc-plugins did not make it as I got one error at the end of the install.

Will try it again later. Lawn work calls on a beautiful day in Pennsylvania!
I downloaded the .zeb file with firefox and let Ubuntu install it. I was on 1.30.4 and this .zeb is the updated to Zesty 1.31.1 x64
That being said I did not have any loss in settings. I do have my install on a VM and I took a snapshot before incase it messed it up.

For the easy steps we all love to have :)

1. Load Firefox and go to https://launchpad.net/~iconnor/+archive ... /+packages
2. Locate your flavor x86 or x64
2a. x64 file = https://launchpad.net/~iconnor/+archive ... _amd64.deb
3. Let Ubuntu install
4. Reboot your VM or Computer
4a. If you cant reboot
4b. sudo service apache2 restart
4c. sudo service zoneminder restart

After i did this zmNinja worked and no API errors.

ENJOY!
Locked