ZoneMinder + Raspberry Pi 4?

Forum for questions and support relating to the 1.32.x releases only.
Ken
Posts: 3
Joined: Wed Jul 03, 2019 12:45 am

ZoneMinder + Raspberry Pi 4?

Post by Ken »

I'm going to attempt to use ZoneMinder on a Raspberry Pi 4 (4 GB RAM, Gigabit Ethernet, ...) using a SSD concoction (250 GB M.2 SSD in a USB 3.1-compatible enclosure) inspired by this [https://jamesachambers.com/raspberry-pi ... pgrade-30/]. More than likely I'll throw the output to a NAS device via Ethernet but with file management I might just leverage the SSD - I just don't want to busy out the Pi with "serving" video. Right now I've got one wired cam set up. I have an identical one still in the box that will join the party if this works out. Please be easy on the noob here. I want to do this right.

First, is this folly? I'm not sure if I'm wasting my time. I figured the extra RAM should give me some elbow room and I could probably work something out with the SSD if the network (all gigabit to the NAS) gave me heartburn.

Second, will ZoneMinder play well on my "preordered ETA Aug 1" Pi 4? If so, I see discussions about Raspbian. Please point me in the right direction. I like GUI but want this built for speed so I can cowboy up to the manly command line with little regret.

Can you guys give me any advice, constructive criticism, sad/slow head shake while mumbling "seriously?" Until the Pi 4 actually hits the market, this is all speculation but I'd like to know I'm at least doing the best possible setup I can. ...unless some of you crazy lucky readers actually have a "beta" one in hand to test... *grin*

Thanks, man.
Ken
AfricanSwallow
Posts: 16
Joined: Sat Jun 23, 2018 6:56 pm

Re: ZoneMinder + Raspberry Pi 4?

Post by AfricanSwallow »

Great question, i too am very interested. I thought the 4 had already released though? Just backordered most places. Please let me know how it goes if you do so. I know most people were getting decent enough performance on the 3 with 2 cameras, but the 4 significantly improved with moving nic off the usb bus and adding usb3.0

I can't imagine it being an issue now to run 3 or 4 cameras on a 4. Before, with the nic running on the same usb 2 bus, there was no way to get your network and disk performance above usb 2.0 speeds. Didnt matter if you mounted sshfs or ran a locally connected usb drive, you were hitting a max either way - even if you split it. Thats changed now. Plus with a quad core ARM and 4GB of RAM, i highly suspect the rPi 4 to be a zoneminder dream machine. Perfect for the application.

Personally, I think the gigabit eth capability is plenty for me to simply mount my network ZFS raid via sshfs and just run everything over eth. I have 3 cameras currently, but may up it later. I also run home-assistant attached to zoneminder for security, and would LOVE, absolutely LOVE to run both of those on the new rPi so the rest of my automation can run on my server. This would allow me to have a simplified setup for my alarm to limit the possibility of me mucking around changing my security functionality or bringing it down.

Anyway, hopefully someone who has already worked on this, or someone who has a better in-depth knowledge of the specific requirement limits that will be hit on the new pi via zoneminder can chime in. I do have high hopes though, for what thats worth!
AfricanSwallow
Posts: 16
Joined: Sat Jun 23, 2018 6:56 pm

Re: ZoneMinder + Raspberry Pi 4?

Post by AfricanSwallow »

Just seeing if anyone has had a chance to try this out, or have any ideas on what might be encountered. I have backordered one to arrive in august - so if nobody has tried by then, i can pave the way I reckon.

AfricanSwallow
Chimaera
Posts: 21
Joined: Mon Apr 15, 2019 8:13 pm

Re: ZoneMinder + Raspberry Pi 4?

Post by Chimaera »

I have Zoneminder running on my Pi 4 with 4gb ram. Storage is on a NAS vs the SD or USB but that shouldn't be a problem. There are some tricks to getting the API to work (.htaccess files seem to not be generated/installed) and I can't get event notification working right but I have 5 Amcrest cams being monitored in modect mode. I currently have an issue where I can't add more than 5, still troubleshooting that.
bbunge
Posts: 2930
Joined: Mon Mar 26, 2012 11:40 am
Location: Pennsylvania

Re: ZoneMinder + Raspberry Pi 4?

Post by bbunge »

Chimaera wrote: Tue Jul 16, 2019 11:42 am I have Zoneminder running on my Pi 4 with 4gb ram. Storage is on a NAS vs the SD or USB but that shouldn't be a problem. There are some tricks to getting the API to work (.htaccess files seem to not be generated/installed) and I can't get event notification working right but I have 5 Amcrest cams being monitored in modect mode. I currently have an issue where I can't add more than 5, still troubleshooting that.
Kindly share what you did with the .htaccess files. Thanks!

Edit: Found it!
User avatar
knight-of-ni
Posts: 2404
Joined: Thu Oct 18, 2007 1:55 pm
Location: Shiloh, IL

Re: ZoneMinder + Raspberry Pi 4?

Post by knight-of-ni »

Chimaera wrote: Tue Jul 16, 2019 11:42 am I have Zoneminder running on my Pi 4 with 4gb ram. Storage is on a NAS vs the SD or USB but that shouldn't be a problem. There are some tricks to getting the API to work (.htaccess files seem to not be generated/installed) and I can't get event notification working right but I have 5 Amcrest cams being monitored in modect mode. I currently have an issue where I can't add more than 5, still troubleshooting that.
ZoneMinder no longer uses .htaccess files. The contents of the former .htaccess files have been moved into the main ZoneMinder Apache config file for better visibility.

See this for the generic Apache config:
https://github.com/ZoneMinder/zoneminde ... onf.in#L58

Compare that to the config file you are using. Since that is the generic config, it might not match the one you are using exactly, but it should be pretty close.

If they don't match, then you should investigate why not. For example, if the config file was unmodified by you and came with a package, then the question to answer is where did the package come from? We have to know where you got it, in order to find the root cause and then fix it.
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/
Chimaera
Posts: 21
Joined: Mon Apr 15, 2019 8:13 pm

Re: ZoneMinder + Raspberry Pi 4?

Post by Chimaera »

My install came from the stock Raspian Buster repository. Forgive my ignorance, but if I'm placing the stuff from that conf in my conf-enabled/zoneminder.conf I have to replace all of the @variable@ with the actual path, yes?
bbunge
Posts: 2930
Joined: Mon Mar 26, 2012 11:40 am
Location: Pennsylvania

Re: ZoneMinder + Raspberry Pi 4?

Post by bbunge »

The zoneminder.conf in Debian 10 seems to lack what you are talking about. The .htaccess file adds work. What needs to be added to this file?

########################
#
# Remember to enable cgi mod and serve-cgi-bin.conf configuration
#
# a2enmod cgi
# a2enconf serve-cgi-bin.conf
#
########################
ScriptAlias /cgi-bin "/usr/lib/zoneminder/cgi-bin"
<Directory "/usr/lib/zoneminder/cgi-bin">
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
AllowOverride All
Require all granted
</Directory>

Alias /zm /usr/share/zoneminder/www
<Directory /usr/share/zoneminder/www>
php_flag register_globals off
Options -Indexes +FollowSymLinks
<IfModule mod_dir.c>
DirectoryIndex index.php
</IfModule>
</Directory>

<Directory /usr/share/zoneminder/www/api>
AllowOverride All
</Directory>
Chimaera
Posts: 21
Joined: Mon Apr 15, 2019 8:13 pm

Re: ZoneMinder + Raspberry Pi 4?

Post by Chimaera »

This is what my zoneminder.conf is now (and working, without .htaccess files)

Code: Select all

pi@astropi:/etc/apache2/conf-enabled $ cat zoneminder.conf
# Remember to enable cgi mod (i.e. "a2enmod cgi").

SSLEngine On
SSLCertificateFile /etc/ssl/localcerts/apache.pem
SSLCertificateKeyFile /etc/ssl/localcerts/apache.key

    # Order matters. This alias must come first.
    Alias /zm/cache /var/cache/zoneminder
    <Directory /var/cache/zoneminder>
        Options -Indexes +FollowSymLinks
        AllowOverride None
        <IfModule mod_authz_core.c>
           # Apache 2.4
           Require all granted
        </IfModule>
        <IfModule !mod_authz_core.c>
            # Apache 2.2
            Order deny,allow
            Allow from all
        </IfModule>
    </Directory>

    Alias /zm /usr/share/zoneminder/www
    <Directory /usr/share/zoneminder/www>
        Options -Indexes +FollowSymLinks
        AllowOverride All
        <IfModule mod_authz_core.c>
           # Apache 2.4
           Require all granted
        </IfModule>
        <IfModule !mod_authz_core.c>
            # Apache 2.2
            Order deny,allow
            Allow from all
        </IfModule>
    </Directory>

    ScriptAlias /cgi-bin /usr/lib/zoneminder/cgi-bin
    <Directory /usr/lib/zoneminder/cgi-bin>
        Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
        AllowOverride All
        <IfModule mod_authz_core.c>
           # Apache 2.4
           Require all granted
        </IfModule>
        <IfModule !mod_authz_core.c>
            # Apache 2.2
            Order deny,allow
            Allow from all
        </IfModule>
    </Directory>

    # For better visibility, the following directives have been migrated from the
    # default .htaccess files included with the CakePHP project.
    # Parameters not set here are inherited from the parent directive above.
    <Directory /usr/share/zoneminder/www/api>
       RewriteEngine on
       RewriteRule ^$ app/webroot/ [L]
       RewriteRule (.*) app/webroot/$1 [L]
       RewriteBase /zm/api
    </Directory>

    <Directory /usr/share/zoneminder/www/api/app>
       RewriteEngine on
       RewriteRule ^$ webroot/ [L]
       RewriteRule (.*) webroot/$1 [L]
       RewriteBase /zm/api
    </Directory>

    <Directory /usr/share/zoneminder/www/api/app/webroot>
        RewriteEngine On
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteRule ^ index.php [L]
        RewriteBase /zm/api
    </Directory>

    # Use the first option to have Apache logs written to the general log
    # directory, or the second to have them written to the regular Apache
    # directory (you may have to change the path to that used on your system)
    #ErrorLog @ZM_LOGDIR@/apache-error.log
    ErrorLog /var/log/apache2/zm-error.log

    # Possible values include: debug, info, notice, warn, error, crit,
    # alert, emerg.
    LogLevel warn

    # Use the first option to have Apache logs written to the general log
    # directory, or the second to have them written to the regular Apache
    # directory (you may have to change the path to that used on your system)
    #CustomLog @ZM_LOGDIR@/apache-access.log combined
    CustomLog /var/log/apache2/zm-access.log combined
bbunge
Posts: 2930
Joined: Mon Mar 26, 2012 11:40 am
Location: Pennsylvania

Re: ZoneMinder + Raspberry Pi 4?

Post by bbunge »

Will give it a try on the Buster AMD64 version. Thanks!
bbunge
Posts: 2930
Joined: Mon Mar 26, 2012 11:40 am
Location: Pennsylvania

Re: ZoneMinder + Raspberry Pi 4?

Post by bbunge »

Tested on my Pi 3B and AMD64 with Buster and Zoneminder 1.32.3.

Edit zoneminder.conf

nano /etc/apache2/conf-enabled/zoneminder.conf

At the end of the file add:

<Directory /usr/share/zoneminder/www/api>
RewriteEngine on
RewriteRule ^$ app/webroot/ [L]
RewriteRule (.*) app/webroot/$1 [L]
RewriteBase /zm/api
</Directory>

<Directory /usr/share/zoneminder/www/api/app>
RewriteEngine on
RewriteRule ^$ webroot/ [L]
RewriteRule (.*) webroot/$1 [L]
RewriteBase /zm/api
</Directory>

<Directory /usr/share/zoneminder/www/api/app/webroot>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
RewriteBase /zm/api
</Directory>

Save the file with CTRL + o then CTRL + x

Restart Apache:

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

Re: ZoneMinder + Raspberry Pi 4?

Post by knight-of-ni »

Chimaera wrote: Tue Jul 16, 2019 3:00 pm My install came from the stock Raspian Buster repository. Forgive my ignorance, but if I'm placing the stuff from that conf in my conf-enabled/zoneminder.conf I have to replace all of the @variable@ with the actual path, yes?
That's good to hear ZoneMinder has made it back into the Debian repositories, or at least the raspbian repos. I was not aware of that.

Yes, the @variable@ names are make macros that get populated with the proper file paths when zoneminder is built.
You may be able to use the Ubuntu config file with no modifications:
https://github.com/ZoneMinder/zoneminde ... inder.conf

This one has the paths already populated so it might be easier for you.

In order to get this resolved for everyone, a bug report needs to be filed against the package . The place to do that appears to be here:
https://bugs.debian.org/cgi-bin/pkgrepo ... t=unstable

Note that this is the sid unstable repo, rather then the buster repo.
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/
bbunge
Posts: 2930
Joined: Mon Mar 26, 2012 11:40 am
Location: Pennsylvania

Re: ZoneMinder + Raspberry Pi 4?

Post by bbunge »

1.32.3 is in deb http://www.deb-multimedia.org buster main non-free as well as the new raspbian Pi Buster repository.

https://wiki.zoneminder.com/Debian_10_B ... e_Easy_Way

My zoneminder.conf looked like the one at https://github.com/ZoneMinder/zoneminde ... inder.conf

I've moved on with my Pi to the Raspbian Buster desktop and back to Ubuntu with my test PC.
User avatar
knight-of-ni
Posts: 2404
Joined: Thu Oct 18, 2007 1:55 pm
Location: Shiloh, IL

Re: ZoneMinder + Raspberry Pi 4?

Post by knight-of-ni »

Maybe things have changed with multimedia-deb repo, but the zoneminder package from this repo was known to be broken.
Multimedia-deb is not an official Debian repo so I'm not sure how to report bugs against their packages.
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/
bbunge
Posts: 2930
Joined: Mon Mar 26, 2012 11:40 am
Location: Pennsylvania

Re: ZoneMinder + Raspberry Pi 4?

Post by bbunge »

knight-of-ni wrote: Wed Jul 17, 2019 4:36 pm Maybe things have changed with multimedia-deb repo, but the zoneminder package from this repo was known to be broken.
Multimedia-deb is not an official Debian repo so I'm not sure how to report bugs against their packages.
Hot outside today and the wife has me protected in the A/C so I'll look into the multimedia-deb repro.

I've worked on the Buster install procedure a bit this morning:
https://wiki.zoneminder.com/Debian_10_B ... e_Easy_Way
Did an install on a fresh Buster PC AMD64 and things came out OK. About the only difference for the PI is to un-comment the extra source in the /etc/apt/sources.list.
Post Reply