Possible Corrupt DB

Discussions related to the 1.36.x series of ZoneMinder
Post Reply
bullmoose20
Posts: 1
Joined: Tue Jul 06, 2021 3:26 pm

Possible Corrupt DB

Post by bullmoose20 »

Hello,

I am running the dlandon container for Zoneminder in Unraid.... on or around June 25, Zoneminder was failing to start... Upon reviewing the logs, it looks like I have a corrupt database based on the information that DLandon mentioned in his support forum on unraid. His advice was to ask for help here.

Here is what the logs are showing:

Code: Select all

*** Running /etc/my_init.d/40_firstrun.sh...
Using existing conf folder
File zm.conf already copied
Moving zmeventnotification.ini
Moving secrets.ini
Moving the event notification server
Moving the pushover api
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
0 upgraded, 0 newly installed, 0 to remove and 0 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
Moving zmeventnotification.ini
Moving secrets.ini
Moving the event notification server
Moving the pushover api
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
*
* Starting MariaDB database server mysqld
...fail!
And essentially, ZM will quit as it cannot talk to the DB. I do have access to the DB folder on unraid, but of course, since the container stops, I cannot log into the console to run any commands per se. I can however drop to a console and navigate to the folder where the mariaDB is sitting and here is what it looks like:

Code: Select all

root@NZWHS01:/mnt/user/appdata/Zoneminder# cd mysql
root@NZWHS01:/mnt/user/appdata/Zoneminder/mysql# ls -al
total 188468
drwxr-xr-x 1    106   108      328 Jul  6 11:16 ./
drwxrwxrwx 1 nobody users      270 Jun 30 12:19 ../
-rw-rw---- 1    106   108    16384 Jun 26 09:08 aria_log.00000001
-rw-rw---- 1    106   108       52 Jun 26 09:08 aria_log_control
-rw-r--r-- 1    106   108        0 Jan  4  2021 debian-10.3.flag
-rw-rw---- 1    106   108     1865 Jun 30 21:33 ib_buffer_pool
-rw-rw---- 1    106   108 50331648 Jul  6 11:16 ib_logfile0
-rw-rw---- 1    106   108 50331648 Jul  6 11:16 ib_logfile1
-rw-rw---- 1    106   108 79691776 Jun 26 23:25 ibdata1
-rw-rw---- 1    106   108 12582912 Jul  6 11:16 ibtmp1
-rw-rw---- 1    106   108        0 Jan  4  2021 multi-master.info
drwx------ 1    106   108     2708 May 20 00:08 mysql/
-rw------- 1    106   108       16 May 20 00:08 mysql_upgrade_info
drwx------ 1    106   108       12 May 20 00:08 performance_schema/
-rw-rw---- 1    106   108    24576 Jul  6 11:16 tc.log
drwx------ 1    106   108     2690 Jun 15 06:16 zm/
root@NZWHS01:/mnt/user/appdata/Zoneminder/mysql# 
Any ideas on what I can do? I had cameras defined and other jobs and I don't know how to recover or what steps I can take without starting all over again. I am fine with losing the videos, but all the settings and jobs and the setup I had, I would like to recover...
ergamus
Posts: 27
Joined: Sat May 29, 2021 10:09 am

Re: Possible Corrupt DB

Post by ergamus »

bullmoose20 wrote: Tue Jul 06, 2021 3:44 pm Hello,

I am running the dlandon container for Zoneminder in Unraid.... on or around June 25, Zoneminder was failing to start... Upon reviewing the logs, it looks like I have a corrupt database based on the information that DLandon mentioned in his support forum on unraid. His advice was to ask for help here.

Here is what the logs are showing:

Code: Select all

*** Running /etc/my_init.d/40_firstrun.sh...
Using existing conf folder
File zm.conf already copied
Moving zmeventnotification.ini
Moving secrets.ini
Moving the event notification server
Moving the pushover api
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
0 upgraded, 0 newly installed, 0 to remove and 0 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
Moving zmeventnotification.ini
Moving secrets.ini
Moving the event notification server
Moving the pushover api
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
*
* Starting MariaDB database server mysqld
...fail!
And essentially, ZM will quit as it cannot talk to the DB. I do have access to the DB folder on unraid, but of course, since the container stops, I cannot log into the console to run any commands per se. I can however drop to a console and navigate to the folder where the mariaDB is sitting and here is what it looks like:

Code: Select all

root@NZWHS01:/mnt/user/appdata/Zoneminder# cd mysql
root@NZWHS01:/mnt/user/appdata/Zoneminder/mysql# ls -al
total 188468
drwxr-xr-x 1    106   108      328 Jul  6 11:16 ./
drwxrwxrwx 1 nobody users      270 Jun 30 12:19 ../
-rw-rw---- 1    106   108    16384 Jun 26 09:08 aria_log.00000001
-rw-rw---- 1    106   108       52 Jun 26 09:08 aria_log_control
-rw-r--r-- 1    106   108        0 Jan  4  2021 debian-10.3.flag
-rw-rw---- 1    106   108     1865 Jun 30 21:33 ib_buffer_pool
-rw-rw---- 1    106   108 50331648 Jul  6 11:16 ib_logfile0
-rw-rw---- 1    106   108 50331648 Jul  6 11:16 ib_logfile1
-rw-rw---- 1    106   108 79691776 Jun 26 23:25 ibdata1
-rw-rw---- 1    106   108 12582912 Jul  6 11:16 ibtmp1
-rw-rw---- 1    106   108        0 Jan  4  2021 multi-master.info
drwx------ 1    106   108     2708 May 20 00:08 mysql/
-rw------- 1    106   108       16 May 20 00:08 mysql_upgrade_info
drwx------ 1    106   108       12 May 20 00:08 performance_schema/
-rw-rw---- 1    106   108    24576 Jul  6 11:16 tc.log
drwx------ 1    106   108     2690 Jun 15 06:16 zm/
root@NZWHS01:/mnt/user/appdata/Zoneminder/mysql# 
Any ideas on what I can do? I had cameras defined and other jobs and I don't know how to recover or what steps I can take without starting all over again. I am fine with losing the videos, but all the settings and jobs and the setup I had, I would like to recover...
If you can run commands in the container, run an integrity check. If not, copy the DB files outside (the entire mysql folder for DB files, binary log, etc), maybe to another MariaDB container and try doing an integrity check there.

Also, configure your MariaDB instance to log to a mounted, persistent directory, so you can see logged errors, authentication errors, etc.

https://mariadb.com/kb/en/mysqlcheck/
https://mariadb.com/kb/en/server-monitoring-logs/
Post Reply