ZM 1.34.6 install in 11.3 jail - yes, it works. Edit on 14 April 2020: use the official plugin instead.

Frank Collins

Explorer
Joined
Apr 10, 2019
Messages
53
Update: On 11 April 2020, the official plugin was updated to the latest version, 1.34.9, so use it instead.

In another thread, essentially and correctly, bemoaning how out of date the official plugin is, @turtlepants very kindly posted code which solves this problem and you get a recent version of ZM with minimal effort. Applause to @turtlepants. My gratitude also to @cherup for his assistance.
Instructions from that thread, along with some of my comments, are below.

I will be updating this post as improvements or changes are suggested in the tread. Also, if there are any errors, please advise and I will correct them.

1. Log into the shell of FreeNAS

2. Create a pkgs.json file (I used vi for this but you can use a different editor)
Code:
vi pkgs.json[

Comment: I used the built-in editor ee and it works well for me. In this case, it is:
Code:
ee pkgs.json

3. Copy the following to it & save it.
Code:
{
    "pkgs": [
    "mysql57-server",
    "mysql57-client",
    "fcgiwrap",
    "nginx",
    "zoneminder",
    "git"
    ]
}

Copy this exactly to pkgs.json.

4. Run the following commands.
Note: I named my jail zoneminder-jail but you can change to to something else. Just make sure they are all the same below & the jail name you pick is not used yet.
Code:
iocage fetch -r 11.3-RELEASE
iocage create -r 11.3-RELEASE -p ./pkgs.json -n zoneminder-jail dhcp=on boot=on
iocage exec zoneminder-jail git clone https://github.com/freenas/iocage-plugin-zoneminder.git
iocage exec zoneminder-jail cp -R iocage-plugin-zoneminder/overlay/ /
iocage exec zoneminder-jail iocage-plugin-zoneminder/post_install.sh

Comment: Being a newbie, I tried to run it as a block. I found out that doesn't work, so run each line separately at the root of the shell, root@FreeNAS #

After the last line, if you get the following output, the install should have been successful.;
nginx_enable: -> YES
mysql_enable: -> YES
fcgiwrap_enable: -> YES
fcgiwrap_user: -> www
fcgiwrap_socket_owner: -> www
fcgiwrap_flags: -> -c 4
php_fpm_enable: -> YES
zoneminder_enable: -> YES
Performing sanity check on nginx configuration:
Starting nginx.
Performing sanity check on php-fpm configuration:
Starting php_fpm.
Starting fcgiwrap.
Starting mysql.
Database User: dbadmin
Database Password: [randomly generated password]
SQL Temp Password: [randomly generated password]
mysql: [Warning] Using a password on the command line interface can be insecure.
mysql: [Warning] Using a password on the command line interface can be insecure.
Stopping mysql.
Waiting for PIDS: 64245.
Starting mysql.
Stopping fcgiwrap.
Waiting for PIDS: 52334.
Starting fcgiwrap.
Performing sanity check on php-fpm configuration:
Stopping php_fpm.
Waiting for PIDS: 52249.
Performing sanity check on php-fpm configuration:
Starting php_fpm.
Performing sanity check on nginx configuration:
Stopping nginx.
Waiting for PIDS: 52179.
Performing sanity check on nginx configuration:
Starting nginx.

The Database User, and Database Password are stored in ~/ folder as dbuser and dbpassword. These are needed if you ever need to access the MYSQL database for some reason.

The official plugins have a "Manage" command in the jail to open another browser tab to manage it. Just open another tab and type in the IP address and the Zone Minder GUI will display. Have fun.
 
Last edited:

Visseroth

Guru
Joined
Nov 4, 2011
Messages
546
Thank you!!!
Been fighting trying to make this work on and off for the past couple years. The Plugin doesn't even work if you try and update it. Update breaks the plugin but this works! First time I've been able to do anything with ZM!
Thank you!!!
Edit: Oh, and I did get a error when using zoneminder-jail, I changed that to zoneminder and the error went away.
 
Last edited:

Jailer

Not strong, but bad
Joined
Sep 12, 2014
Messages
4,974
Is there some reason you don't just install the zoneminder package in a standard jail?
 

Visseroth

Guru
Joined
Nov 4, 2011
Messages
546
Because it broke. After installing the jail and telling FreeNAS via the GUI to update the jail, I would get a error...
Access denied for user 'zmuser'@'localhost'
I looked around and could not find any information in regards to why or any documentation on the zoneminder jail in case I was missing something during the setup process. I did find this thread and tried this and it worked. I even had the jail run a update and it still worked following the update.
 

Jailer

Not strong, but bad
Joined
Sep 12, 2014
Messages
4,974
After installing the jail and telling FreeNAS via the GUI to update the jail, I would get a error...
So you're talking about the plugin correct? What I suggested has nothing to do with the plugin. Is the zoneminder package broken? If so someone should contact the package maintainer and let them know.
 

Visseroth

Guru
Joined
Nov 4, 2011
Messages
546
Oh, I thought you were talking about the plugin and yes I was talking about the plugin.
The package seems OK as far as I know but truthfully I'm not all that great with the back end of things, not as good as I'd like to be.
The point I was trying to make was the plugin had issues but using the method posted here worked just fine.
I guess I didn't clarify that and with that I guess I can also say I'm not all that good at being blatantly clear.
 

Frank Collins

Explorer
Joined
Apr 10, 2019
Messages
53
@Jailer
So you're talking about the plugin correct? What I suggested has nothing to do with the plugin. Is the zoneminder package broken? If so someone should contact the package maintainer and let them know.
The official plugin, up until later on 11 April, was 1.32.3 and was old and obsolete. After running update, the plugin becomes inaccessible with an error message.
The latest version available for FreeBSD is 1.34.9 and this thread is about installing 1.34.6. Given an easy install of this much later (and more bug free) version, I don't understand why the official version has not been updated. If there is a package maintainer, they should know, both, how old it is and how much it does not work properly.
And running update on this install does not break the jail, it only displays an error message there is not updated package available.
 
Last edited:

Visseroth

Guru
Joined
Nov 4, 2011
Messages
546
One would think but I've seen months go by before some the package maintainer updates a package and now that you point it out, I do see that the current version is 1.34.6 though I'm not sure how to update it to the latest version. I've tried pkg upgrade but it says everything is up to date and I don't exactly now how to tell it do pull the most current version and to update it.
There is a method for a manual install I had tried at one time but it's information is old too as it's using a old unsupported mysql version and I tried adjusting the install method to use a more current version but kept running into problems

Does anyone know how to update ZM to the most current version or a more current method if installing ZM?
 

Frank Collins

Explorer
Joined
Apr 10, 2019
Messages
53
Update:
The official plugin was updated to 1.34.9 on the same day as I posted this thread and this was a day after @turtlepants posted his directions on installing 1.34.6. Up until Saturday, the official version was 1.32.3 and had many problems.
I live in Australia and the maintainer appears in to be in Russia, so there was an interval of several hours during which the maintainer probably saw this or other threads and updated the plugin.

Kudos to the maintainer for the update to the latest version.
 

Jailer

Not strong, but bad
Joined
Sep 12, 2014
Messages
4,974
If there is a package maintainer, they should know, both, how old it is and how much it does not work properly.
The package maintainer for zoneminder has nothing to do with FreeNAS plugins. I offered up the suggestion of doing a manual install of the zoneminder package in a standard jail so you are not dependent upon someone maintaining the FreeNAS plugin for you.
 

turtlepants

Dabbler
Joined
Jan 10, 2018
Messages
12
The official plugin was updated to 1.34.9

Nice! I had an old plugin that I just updated. It was pretty easy except I had to do a few more things afterwards to get it working again though...

  • Re-add Database User & Password to /usr/local/etc/zm.conf file. This fixes Unable to connect to ZM db.SQLSTATE[HY000] [1045] Access denied for user 'zmuser'@'localhost' (using password: YES) issue when loading the web interface. You can get the user & password from the plugin "Post Install Notes" in the FreeNAS plugin section.
  • Zoneminder complained about the database still using the old version so I accessed the jail via shell and did the following to update it.
Code:
service zoneminder stop
zmupdate.pl
service zoneminder start


I didn't backup the database before updating it (probably should have) but it took a bit and updated it. It looks like all my recordings are all there except some really old archived ones (something about not being supported) but I am ok with that.
  • Got some mysql errors (SQL-ERR 'SQLSTATE[42S02]: Base table or view not found...) in the Zoneminder log and had to upgrade mysql manually by running mysql_upgrade -u root -p.

Once that was all done, I restarted the plugin and I am now running v1.34.9. Thanks @Frank Collins for kickstarting all of this and to the maintainer for updating it! It is running much better than that older version.

Here is a little more info on versions...
  • FreeNAS version 11.3-U1
  • Plugin version 11.2-U4.1? upgraded to 11.2-RELEASE-p15
  • Zoneminder version 1.32.3 upgraded to 1.34.9
  • MySQL version 5.6.45 (not upgraded).
 

Visseroth

Guru
Joined
Nov 4, 2011
Messages
546
Well I tried it, I had two installs via the plugins that just didn't work and gave me a 404 error, the 3rd one worked and I did exactly what you just posted and it worked without a hitch, thank you very very much!
 

Deckel

Cadet
Joined
Apr 11, 2020
Messages
6
I had to a boot drive going south so I just replaced that. Afterwards, I decided to update to the latest 11.3-U2. I've never messed with Jails or Plugins before so I decided to give it a whirl. My first attempt was not good. ZM was my test subject and after installation it came up with an unable to login to MySql error. I couldn't really figure out what was going on quickly (I actually know MySql well as I have developed several projects around it), so I opted to wipe the plugin and try again. This time it came up perfectly. I don't know what I did differently (in fact, I could pass a lie detector test saying I didn't do *anything* differently!), but the second time was the charm.
 

Visseroth

Guru
Joined
Nov 4, 2011
Messages
546
Yea, I've had the same issue and deleting the jail and trying again seems to fix it, sometimes I have to do it a few times.
Be sure to follow turtlepants instructions if you update the jail because updating it will break the zm.conf file and you'll need to put in the dbadmin user and password to get the jail working again.
 

Myriad

Dabbler
Joined
Feb 13, 2018
Messages
14
Except the email function does not work! Anybody get it to email (using ssmtp)??? Deal killer for me.
 

RussH

Cadet
Joined
May 12, 2020
Messages
1
I just applied the update, and after an hour's off and on head-scratching found that the new zoneminder version enforces ssl. If you don't already have ssl certs generated, run this command in the jail's shell otherwise you wont be able to connect;
Code:
openssl req -x509 -nodes -days 365 -newkey rsa:2048 -outform PEM -keyout /usr/local/etc/ssl/key.pem -out /usr/local/etc/ssl/cert.pem


..then restart nginx. This is for a self-signed cert to get you up and running (it'll complain when you first connect), but it'll get you started long enough to think about using LetsEncrypt certs.
 

nikinp

Contributor
Joined
Sep 7, 2014
Messages
116
Update: On 11 April 2020, the official plugin was updated to the latest version, 1.34.9, so use it instead.

In another thread, essentially and correctly, bemoaning how out of date the official plugin is, @turtlepants very kindly posted code which solves this problem and you get a recent version of ZM with minimal effort. Applause to @turtlepants. My gratitude also to @cherup for his assistance.
Instructions from that thread, along with some of my comments, are below.

I will be updating this post as improvements or changes are suggested in the tread. Also, if there are any errors, please advise and I will correct them.

1. Log into the shell of FreeNAS

2. Create a pkgs.json file (I used vi for this but you can use a different editor)
Code:
vi pkgs.json[

Comment: I used the built-in editor ee and it works well for me. In this case, it is:
Code:
ee pkgs.json

3. Copy the following to it & save it.
Code:
{
    "pkgs": [
    "mysql57-server",
    "mysql57-client",
    "fcgiwrap",
    "nginx",
    "zoneminder",
    "git"
    ]
}

Copy this exactly to pkgs.json.

4. Run the following commands.
Note: I named my jail zoneminder-jail but you can change to to something else. Just make sure they are all the same below & the jail name you pick is not used yet.
Code:
iocage fetch -r 11.3-RELEASE
iocage create -r 11.3-RELEASE -p ./pkgs.json -n zoneminder-jail dhcp=on boot=on
iocage exec zoneminder-jail git clone https://github.com/freenas/iocage-plugin-zoneminder.git
iocage exec zoneminder-jail cp -R iocage-plugin-zoneminder/overlay/ /
iocage exec zoneminder-jail iocage-plugin-zoneminder/post_install.sh

Comment: Being a newbie, I tried to run it as a block. I found out that doesn't work, so run each line separately at the root of the shell, root@FreeNAS #

After the last line, if you get the following output, the install should have been successful.;


The Database User, and Database Password are stored in ~/ folder as dbuser and dbpassword. These are needed if you ever need to access the MYSQL database for some reason.

The official plugins have a "Manage" command in the jail to open another browser tab to manage it. Just open another tab and type in the IP address and the Zone Minder GUI will display. Have fun.

Can I assume that you should update to Freenas 11.3 before running these commands if you want to use the latest Zoneminder 1.34.9?
 

Frank Collins

Explorer
Joined
Apr 10, 2019
Messages
53
Can I assume that you should update to Freenas 11.3 before running these commands if you want to use the latest Zoneminder 1.34.9?
Yes. Out of curiosity, why haven't you updated yet?
 

nikinp

Contributor
Joined
Sep 7, 2014
Messages
116
I have now, and I installed 1.34.9 without a hitch
 

Roy360

Dabbler
Joined
Nov 27, 2017
Messages
28
I installed via the plugin, but my log is fulled with this error:

Code:
ZoneMinder is not configured properly: php's date.timezone +0000 does not match the system timezone -0400! Please check Options->System->Timezone.


In the GUI I have the timezone set to use the php.ini file.
1594655301689.png

I've also updated the timezone in the following directories to date.timezone = "America/New_York"
  • iocage\jails\ZoneMinder\plugin\overlay\usr\local\etc
  • iocage\jails\ZoneMinder\root\usr\local\etc
I've restarted my system. Not sure why I'm still getting this error. The Timezone for FreeNAS is set correctly.

I heard you have to update the timezone used by mysql, but I haven't found where that is set yet.
 
Top