Unable to use external mariadb

Support for the docker image maintained by dlandon
Post Reply
Jokerigno
Posts: 2
Joined: Thu Jan 07, 2021 5:50 pm

Unable to use external mariadb

Post by Jokerigno » Thu Jan 07, 2021 10:36 pm

Hi all,

I tried to use an external mariadb instead of the default internal.

Looking at the configs I created a mysql.conf file in conf folder with the following content:
# ZoneMinder database hostname or ip address and optionally port or unix socket
# Acceptable formats include hostname[:port], ip_address[:port], or localhost:unix_socket
ZM_DB_HOST=192.168.2.100

# ZoneMinder database name
ZM_DB_NAME=zm

# ZoneMinder database user
ZM_DB_USER=zmuser

# ZoneMinder database password
ZM_DB_PASS=zmpass

# SSL CA certificate for ZoneMinder database
ZM_DB_SSL_CA_CERT=

# SSL client key for ZoneMinder database
ZM_DB_SSL_CLIENT_KEY=

# SSL client cert for ZoneMinder database
ZM_DB_SSL_CLIENT_CERT=
I also created a db and a user using this commands

Code: Select all

MariaDB>mysql -u root -p -h localhost
MariaDB> create database zm;
MariaDB> grant all privileges on zm.* TO 'zmuser'@'%' identified by 'zmpass';
MariaDB> flush privileges;
So I finally started the docker but it doesn't work. Here's the log:
ErrorWarningSystemArrayLogin


*** Running /etc/my_init.d/00_regen_ssh_host_keys.sh...
*** Running /etc/my_init.d/05_set_the_time.sh...
Setting the timezone to : Europe/Berlin

Current default time zone: 'Europe/Berlin'
Local time is now: Thu Jan 7 17:11:19 CET 2021.
Universal Time is now: Thu Jan 7 16:11:19 UTC 2021.

Date: Thu Jan 7 17:11:20 CET 2021
*** Running /etc/my_init.d/06_set_php_time.sh...
*** Running /etc/my_init.d/07_set_dri_permissions.sh...
Granting permissions on /dev/dri/* devices...
*** Running /etc/my_init.d/10_syslog-ng.init...
[2021-01-07T17:11:20.299005] WARNING: With use-dns(no), dns-cache() will be forced to 'no' too!;

Jan 7 17:11:20 bbfb130c3dea syslog-ng[38]: syslog-ng starting up; version='3.25.1'

*** Running /etc/my_init.d/20_apt_update.sh...
Performing updates...
Get:1 http://security.ubuntu.com/ubuntu focal-security InRelease [109 kB]
Hit:2 http://ppa.launchpad.net/iconnor/zoneminder-1.34/ubuntu focal InRelease
Hit:3 http://archive.ubuntu.com/ubuntu focal InRelease
Get:4 http://archive.ubuntu.com/ubuntu focal-updates InRelease [114 kB]
Hit:5 http://ppa.launchpad.net/ondrej/php/ubuntu focal InRelease
Get:6 http://archive.ubuntu.com/ubuntu focal-backports InRelease [101 kB]
Get:7 http://security.ubuntu.com/ubuntu focal-security/restricted Sources [7338 B]
Get:8 http://security.ubuntu.com/ubuntu focal-security/main Sources [141 kB]
Get:9 http://security.ubuntu.com/ubuntu focal-security/universe amd64 Packages [648 kB]
Get:10 http://archive.ubuntu.com/ubuntu focal-updates/main Sources [440 kB]
Get:11 http://security.ubuntu.com/ubuntu focal-security/restricted amd64 Packages [112 kB]
Get:12 http://security.ubuntu.com/ubuntu focal-security/main amd64 Packages [524 kB]
Get:13 http://archive.ubuntu.com/ubuntu focal-updates/restricted Sources [9236 B]
Get:14 http://archive.ubuntu.com/ubuntu focal-updates/universe Sources [179 kB]
Get:15 http://archive.ubuntu.com/ubuntu focal-updates/universe amd64 Packages [905 kB]
Get:16 http://archive.ubuntu.com/ubuntu focal-updates/multiverse amd64 Packages [29.9 kB]
Get:17 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 Packages [927 kB]
Get:18 http://archive.ubuntu.com/ubuntu focal-updates/restricted amd64 Packages [145 kB]
Fetched 4391 kB in 1s (3264 kB/s)
Reading package lists...
Reading package lists...
Building dependency tree...
Reading state information...
Calculating upgrade...
The following packages have been kept back:
libegl-mesa0 libgbm1 libgl1-mesa-dri libglapi-mesa libglx-mesa0
mesa-va-drivers mesa-vdpau-drivers mesa-vulkan-drivers
The following packages will be upgraded:
libdrm-amdgpu1 libdrm-common libdrm-intel1 libdrm-nouveau2 libdrm-radeon1
libdrm2 libegl1 libgl1 libgles2 libglvnd0 libglx0 libopenjp2-7 libwavpack1
13 upgraded, 0 newly installed, 0 to remove and 8 not upgraded.
Need to get 590 kB of archives.
After this operation, 0 B of additional disk space will be used.
Get:1 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 libdrm-common all 2.4.102-1ubuntu1~20.04.1 [5388 B]
Get:2 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 libdrm2 amd64 2.4.102-1ubuntu1~20.04.1 [32.3 kB]
Get:3 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 libdrm-amdgpu1 amd64 2.4.102-1ubuntu1~20.04.1 [18.4 kB]
Get:4 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 libdrm-intel1 amd64 2.4.102-1ubuntu1~20.04.1 [60.3 kB]
Get:5 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 libdrm-nouveau2 amd64 2.4.102-1ubuntu1~20.04.1 [16.4 kB]
Get:6 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 libdrm-radeon1 amd64 2.4.102-1ubuntu1~20.04.1 [19.7 kB]
Get:7 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 libwavpack1 amd64 5.2.0-1ubuntu0.1 [77.3 kB]
Get:8 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 libgl1 amd64 1.3.2-1~ubuntu0.20.04.1 [86.9 kB]
Get:9 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 libglx0 amd64 1.3.2-1~ubuntu0.20.04.1 [32.6 kB]
Get:10 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 libgles2 amd64 1.3.2-1~ubuntu0.20.04.1 [15.6 kB]
Get:11 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 libegl1 amd64 1.3.2-1~ubuntu0.20.04.1 [31.9 kB]
Get:12 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 libglvnd0 amd64 1.3.2-1~ubuntu0.20.04.1 [51.4 kB]
Get:13 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 libopenjp2-7 amd64 2.3.1-1ubuntu4.20.04.1 [141 kB]
Fetched 590 kB in 0s (1714 kB/s)
Preparing to unpack .../00-libdrm-common_2.4.102-1ubuntu1~20.04.1_all.deb ...
Unpacking libdrm-common (2.4.102-1ubuntu1~20.04.1) over (2.4.101-2) ...
Preparing to unpack .../01-libdrm2_2.4.102-1ubuntu1~20.04.1_amd64.deb ...
Unpacking libdrm2:amd64 (2.4.102-1ubuntu1~20.04.1) over (2.4.101-2) ...
Preparing to unpack .../02-libdrm-amdgpu1_2.4.102-1ubuntu1~20.04.1_amd64.deb ...
Unpacking libdrm-amdgpu1:amd64 (2.4.102-1ubuntu1~20.04.1) over (2.4.101-2) ...
Unpacking libdrm-amdgpu1:amd64 (2.4.102-1ubuntu1~20.04.1) over (2.4.101-2) ...
Preparing to unpack .../03-libdrm-intel1_2.4.102-1ubuntu1~20.04.1_amd64.deb ...
Unpacking libdrm-intel1:amd64 (2.4.102-1ubuntu1~20.04.1) over (2.4.101-2) ...
Preparing to unpack .../04-libdrm-nouveau2_2.4.102-1ubuntu1~20.04.1_amd64.deb ...
Unpacking libdrm-nouveau2:amd64 (2.4.102-1ubuntu1~20.04.1) over (2.4.101-2) ...
Preparing to unpack .../05-libdrm-radeon1_2.4.102-1ubuntu1~20.04.1_amd64.deb ...
Preparing to unpack .../05-libdrm-radeon1_2.4.102-1ubuntu1~20.04.1_amd64.deb ...
Unpacking libdrm-radeon1:amd64 (2.4.102-1ubuntu1~20.04.1) over (2.4.101-2) ...
Preparing to unpack .../06-libwavpack1_5.2.0-1ubuntu0.1_amd64.deb ...
Unpacking libwavpack1:amd64 (5.2.0-1ubuntu0.1) over (5.2.0-1) ...
Preparing to unpack .../07-libgl1_1.3.2-1~ubuntu0.20.04.1_amd64.deb ...
Preparing to unpack .../07-libgl1_1.3.2-1~ubuntu0.20.04.1_amd64.deb ...
Unpacking libgl1:amd64 (1.3.2-1~ubuntu0.20.04.1) over (1.3.1-1ubuntu0.20.04.1) ...
Preparing to unpack .../08-libglx0_1.3.2-1~ubuntu0.20.04.1_amd64.deb ...
Unpacking libglx0:amd64 (1.3.2-1~ubuntu0.20.04.1) over (1.3.1-1ubuntu0.20.04.1) ...
Preparing to unpack .../09-libgles2_1.3.2-1~ubuntu0.20.04.1_amd64.deb ...
Preparing to unpack .../09-libgles2_1.3.2-1~ubuntu0.20.04.1_amd64.deb ...
Unpacking libgles2:amd64 (1.3.2-1~ubuntu0.20.04.1) over (1.3.1-1ubuntu0.20.04.1) ...
Preparing to unpack .../10-libegl1_1.3.2-1~ubuntu0.20.04.1_amd64.deb ...
Unpacking libegl1:amd64 (1.3.2-1~ubuntu0.20.04.1) over (1.3.1-1ubuntu0.20.04.1) ...
Preparing to unpack .../11-libglvnd0_1.3.2-1~ubuntu0.20.04.1_amd64.deb ...
Unpacking libglvnd0:amd64 (1.3.2-1~ubuntu0.20.04.1) over (1.3.1-1ubuntu0.20.04.1) ...
Preparing to unpack .../12-libopenjp2-7_2.3.1-1ubuntu4.20.04.1_amd64.deb ...
Unpacking libopenjp2-7:amd64 (2.3.1-1ubuntu4.20.04.1) over (2.3.1-1ubuntu4) ...
Setting up libglvnd0:amd64 (1.3.2-1~ubuntu0.20.04.1) ...
Setting up libgles2:amd64 (1.3.2-1~ubuntu0.20.04.1) ...
Setting up libgles2:amd64 (1.3.2-1~ubuntu0.20.04.1) ...
Setting up libwavpack1:amd64 (5.2.0-1ubuntu0.1) ...
Setting up libegl1:amd64 (1.3.2-1~ubuntu0.20.04.1) ...
Setting up libopenjp2-7:amd64 (2.3.1-1ubuntu4.20.04.1) ...
Setting up libdrm-common (2.4.102-1ubuntu1~20.04.1) ...
Setting up libglx0:amd64 (1.3.2-1~ubuntu0.20.04.1) ...
Setting up libgl1:amd64 (1.3.2-1~ubuntu0.20.04.1) ...
Setting up libdrm2:amd64 (2.4.102-1ubuntu1~20.04.1) ...
Setting up libdrm2:amd64 (2.4.102-1ubuntu1~20.04.1) ...
Setting up libdrm-amdgpu1:amd64 (2.4.102-1ubuntu1~20.04.1) ...
Setting up libdrm-nouveau2:amd64 (2.4.102-1ubuntu1~20.04.1) ...
Setting up libdrm-radeon1:amd64 (2.4.102-1ubuntu1~20.04.1) ...
Setting up libdrm-intel1:amd64 (2.4.102-1ubuntu1~20.04.1) ...
Processing triggers for libc-bin (2.31-0ubuntu9.1) ...
Reading package lists...
Building dependency tree...
Reading state information...
0 upgraded, 0 newly installed, 0 to remove and 8 not upgraded.
*** Running /etc/my_init.d/30_gen_ssl_keys.sh...
using existing keys in "/config/keys"
*** Running /etc/my_init.d/40_firstrun.sh...
Using existing conf folder
File zm.conf already copied
Copy custom 99-mysql.conf to /etc/zm/conf.d/
Moving zmeventnotification.ini
Moving secrets.ini
Moving opencv.sh
Moving debug_opencv.sh
Moving the event notification server
Pushover api already moved
Using existing ssmtp folder
Using existing mysql database folder
Copy /config/control/ scripts to /usr/share/perl5/ZoneMinder/Control/
Copy /config/conf/ scripts to /etc/zm/conf.d/
Creating symbolink links
Using existing data directory for events
Using existing data directory for images
Using existing data directory for temp
Using existing data directory for cache
no crontab for root
Starting services...
* Starting Apache httpd web server apache2
Using existing data directory for events
Using existing data directory for images
Using existing data directory for temp
Using existing data directory for cache
no crontab for root
Starting services...
* Starting Apache httpd web server apache2
*
* Starting MariaDB database server mysqld
...done.
Jan 7 17:11:51 bbfb130c3dea /etc/mysql/debian-start[951]: Upgrading MySQL tables if necessary.
Jan 7 17:11:51 bbfb130c3dea /etc/mysql/debian-start[955]: Looking for 'mysql' as: /usr/bin/mysql
Jan 7 17:11:51 bbfb130c3dea /etc/mysql/debian-start[955]: Looking for 'mysqlcheck' as: /usr/bin/mysqlcheck
Jan 7 17:11:51 bbfb130c3dea /etc/mysql/debian-start[955]: This installation of MySQL is already upgraded to 10.3.25-MariaDB, use --force if you still need to run mysql_upgrade
Jan 7 17:11:51 bbfb130c3dea /etc/mysql/debian-start[963]: Checking for insecure root accounts.
Jan 7 17:11:51 bbfb130c3dea /etc/mysql/debian-start[967]: Triggering myisam-recover for all MyISAM tables and aria-recover for all Aria tables
DBD::mysql::st execute failed: Table 'zm.Config' doesn't exist at /usr/share/perl5/ZoneMinder/Config.pm line 97.

Can't execute: Table 'zm.Config' doesn't exist at /usr/share/perl5/ZoneMinder/Config.pm line 147.
BEGIN failed--compilation aborted at /usr/share/perl5/ZoneMinder/Config.pm line 147.

Compilation failed in require at /usr/bin/zmupdate.pl line 73.

BEGIN failed--compilation aborted at /usr/bin/zmupdate.pl line 73.

DBD::mysql::st execute failed: Table 'zm.Config' doesn't exist at /usr/share/perl5/ZoneMinder/Config.pm line 97.

Can't execute: Table 'zm.Config' doesn't exist at /usr/share/perl5/ZoneMinder/Config.pm line 147.
BEGIN failed--compilation aborted at /usr/share/perl5/ZoneMinder/Config.pm line 147.

Compilation failed in require at /usr/bin/zmupdate.pl line 73.

BEGIN failed--compilation aborted at /usr/bin/zmupdate.pl line 73.

Starting ZoneMinder:
...done.
Jan 7 17:11:51 bbfb130c3dea /etc/mysql/debian-start[951]: Upgrading MySQL tables if necessary.
Jan 7 17:11:51 bbfb130c3dea /etc/mysql/debian-start[955]: Looking for 'mysql' as: /usr/bin/mysql
Jan 7 17:11:51 bbfb130c3dea /etc/mysql/debian-start[955]: Looking for 'mysqlcheck' as: /usr/bin/mysqlcheck
Jan 7 17:11:51 bbfb130c3dea /etc/mysql/debian-start[955]: This installation of MySQL is already upgraded to 10.3.25-MariaDB, use --force if you still need to run mysql_upgrade
Jan 7 17:11:51 bbfb130c3dea /etc/mysql/debian-start[963]: Checking for insecure root accounts.
Jan 7 17:11:51 bbfb130c3dea /etc/mysql/debian-start[967]: Triggering myisam-recover for all MyISAM tables and aria-recover for all Aria tables
DBD::mysql::st execute failed: Table 'zm.Config' doesn't exist at /usr/share/perl5/ZoneMinder/Config.pm line 97.

Can't execute: Table 'zm.Config' doesn't exist at /usr/share/perl5/ZoneMinder/Config.pm line 147.
BEGIN failed--compilation aborted at /usr/share/perl5/ZoneMinder/Config.pm line 147.

Compilation failed in require at /usr/bin/zmupdate.pl line 73.

BEGIN failed--compilation aborted at /usr/bin/zmupdate.pl line 73.

DBD::mysql::st execute failed: Table 'zm.Config' doesn't exist at /usr/share/perl5/ZoneMinder/Config.pm line 97.

Can't execute: Table 'zm.Config' doesn't exist at /usr/share/perl5/ZoneMinder/Config.pm line 147.
BEGIN failed--compilation aborted at /usr/share/perl5/ZoneMinder/Config.pm line 147.

Compilation failed in require at /usr/bin/zmupdate.pl line 73.

BEGIN failed--compilation aborted at /usr/bin/zmupdate.pl line 73.

Starting ZoneMinder:
DBD::mysql::st execute failed: Table 'zm.Config' doesn't exist at /usr/share/perl5/ZoneMinder/Config.pm line 97.

Can't execute: Table 'zm.Config' doesn't exist at /usr/share/perl5/ZoneMinder/Config.pm line 147.
BEGIN failed--compilation aborted at /usr/share/perl5/ZoneMinder/Config.pm line 147.

Compilation failed in require at /usr/share/perl5/ZoneMinder.pm line 33.

BEGIN failed--compilation aborted at /usr/share/perl5/ZoneMinder.pm line 33.

Compilation failed in require at /usr/bin/zmpkg.pl line 34.

BEGIN failed--compilation aborted at /usr/bin/zmpkg.pl line 34.

ZoneMinder failed to start


*** /etc/my_init.d/40_firstrun.sh failed with status 255


*** Killing all processes...
Jan 7 17:11:51 bbfb130c3dea syslog-ng[38]: syslog-ng shutting down; version='3.25.1'
can someone please point me to the right direction?

Thank you in advance!

burger
Posts: 262
Joined: Mon May 11, 2020 4:32 pm

Re: Unable to use external mariadb

Post by burger » Fri Jan 08, 2021 5:18 pm

You must create the db tables and structure, not just create the db.
https://wiki.zoneminder.com/MySQL#Setup

Code: Select all

mysql -u root -p < /usr/share/zoneminder/db/zm_create.sql
mysql -u root -p -e "grant all on zm.* to 'zmuser'@localhost identified by 'zmpass';"
mysqladmin -u root -p reload
fastest way to test streams:
ffmpeg -i rtsp://<ipaddress>:554/path output.mp4
from terminal, and run through paths on ispydb or in zm hcl

If you are new to security software, read this:
https://wiki.zoneminder.com/Dummies_Guide

Jokerigno
Posts: 2
Joined: Thu Jan 07, 2021 5:50 pm

Re: Unable to use external mariadb

Post by Jokerigno » Sat Jan 09, 2021 10:05 am

Thank you for your reply.

If I understand well those are commands to recreate db in the same path, right?

Can you please me help to adapt them to an external destionation?

I need support mostly on the first one:
mysql -u root -p < /usr/share/zoneminder/db/zm_create.sql
TY

Magic919
Posts: 475
Joined: Wed Sep 18, 2013 6:56 am

Re: Unable to use external mariadb

Post by Magic919 » Sat Jan 09, 2021 11:20 am

Just run the commands on the machine with the DB.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest