DB errors in /usr/share/perl5/vendor_perl/ZoneMinder/Config.pm

Discussions related to the 1.36.x series of ZoneMinder
Post Reply
_zot_
Posts: 3
Joined: Fri Aug 12, 2022 6:08 am

DB errors in /usr/share/perl5/vendor_perl/ZoneMinder/Config.pm

Post by _zot_ »

Dear ZM Forum,

I’m new here, so please forgive any simple solutions I overread.

I am running ZM on CentOS 8 with apache.

After updating ZM from 1.36.17-1 to 1.36.21-1 during a dnf update of the whole system, the web interface shows a blank page with no content.

Doing a systemctl status zoneminder, the output is as follows:

Code: Select all

● zoneminder.service - ZoneMinder CCTV recording and security system
   Loaded: loaded (/usr/lib/systemd/system/zoneminder.service; enabled; vendor preset: disabled)
  Drop-In: /usr/lib/systemd/system/zoneminder.service.d
           └─zm-httpd.conf
   Active: active (running) since Fri 2022-08-12 08:15:51 CEST; 7min ago
  Process: 116621 ExecStop=/usr/bin/zmpkg.pl stop (code=exited, status=0/SUCCESS)
  Process: 116634 ExecStart=/usr/bin/zmpkg.pl start (code=exited, status=0/SUCCESS)
 Main PID: 116642 (zmdc.pl)
    Tasks: 7 (limit: 23648)
   Memory: 124.9M
   CGroup: /system.slice/zoneminder.service
           ├─116642 /usr/bin/perl -wT /usr/bin/zmdc.pl startup
           ├─116673 /usr/bin/perl -wT /usr/bin/zmfilter.pl --filter_id=1 --daemon
           ├─116677 /usr/bin/perl -wT /usr/bin/zmfilter.pl --filter_id=2 --daemon
           ├─116682 /usr/bin/perl -wT /usr/bin/zmwatch.pl
           ├─116685 /usr/bin/perl -wT /usr/bin/zmupdate.pl -c
           ├─116691 /usr/bin/perl -wT /usr/bin/zmtelemetry.pl
           └─116695 /usr/bin/perl -wT /usr/bin/zmstats.pl

Aug 12 08:22:54 surveillance zmdc[117023]: INF ['zmc -m 1' started at 22/08/12 08:22:54]
Aug 12 08:22:54 surveillance zmc_m1[117023]: ERR [zmc_m1] [fopen() for ./zmc_m1.log, error = Permission denied]
Aug 12 08:22:54 surveillance zmc_m1[117023]: ERR [zmc_m1] [Config mismatch, expected 225 items, read 221. Try running 'zmupdate.pl -f' to reload config.]
Aug 12 08:22:54 surveillance zmdc[116642]: ERR ['zmc -m 1' exited abnormally, exit status 255]
Aug 12 08:22:55 surveillance zmdc[116642]: INF [Starting pending process, zmc -m 1]
Aug 12 08:22:55 surveillance zmdc[116642]: INF ['zmc -m 1' starting at 22/08/12 08:22:55, pid = 117025]
Aug 12 08:22:55 surveillance zmdc[117025]: INF ['zmc -m 1' started at 22/08/12 08:22:55]
Aug 12 08:22:55 surveillance zmc_m1[117025]: ERR [zmc_m1] [fopen() for ./zmc_m1.log, error = Permission denied]
Aug 12 08:22:55 surveillance zmc_m1[117025]: ERR [zmc_m1] [Config mismatch, expected 225 items, read 221. Try running 'zmupdate.pl -f' to reload config.]
Aug 12 08:22:55 surveillance zmdc[116642]: ERR ['zmc -m 1' exited abnormally, exit status 255]
The output of zmupdate.pl -f is:

Code: Select all

Freshening configuration in database
Migratings passwords, if any...
Loading config from DB 221 entries
Saving config to DB 225 entries
DBD::mysql::st execute failed: Unknown column 'Private' in 'field list' at /usr/share/perl5/vendor_perl/ZoneMinder/Config.pm line 244.
Can't execute when updating config entry ZM_SKIN_DEFAULT: Unknown column 'Private' in 'field list' at /usr/bin/zmupdate.pl line 333.

I rolled back to 1.36.17-1 and was able to log into ZM. The output of systemctl status zoneminder is:

Code: Select all

● zoneminder.service - ZoneMinder CCTV recording and security system
   Loaded: loaded (/usr/lib/systemd/system/zoneminder.service; enabled; vendor preset: disabled)
  Drop-In: /usr/lib/systemd/system/zoneminder.service.d
           └─zm-httpd.conf
   Active: active (running) since Sat 2022-08-06 12:15:41 CEST; 1min 12s ago
  Process: 1676 ExecStart=/usr/bin/zmpkg.pl start (code=exited, status=0/SUCCESS)
 Main PID: 2296 (zmdc.pl)
    Tasks: 11 (limit: 23648)
   Memory: 313.4M
   CGroup: /system.slice/zoneminder.service
           ├─2296 /usr/bin/perl -wT /usr/bin/zmdc.pl startup
           ├─3648 /usr/bin/zmc -m 1
           ├─3734 /usr/bin/perl -wT /usr/bin/zmfilter.pl --filter_id=1 --daemon
           ├─3740 /usr/bin/perl -wT /usr/bin/zmfilter.pl --filter_id=2 --daemon
           ├─3767 /usr/bin/perl -wT /usr/bin/zmwatch.pl
           ├─3778 /usr/bin/perl -wT /usr/bin/zmupdate.pl -c
           ├─3846 /usr/bin/perl -wT /usr/bin/zmtelemetry.pl
           └─3856 /usr/bin/perl -wT /usr/bin/zmstats.pl

Aug 06 12:15:49 surveillance zmc_m1[3648]: INF [zmc_m1] [Briefkasten: 60 - Capturing at 9.98 fps, capturing bandwidth 15327bytes/sec Analysing at 1.50 fps]
Aug 06 12:15:50 surveillance zmc_m1[3648]: INF [zmc_m1] [Briefkasten: 70 - Capturing at 9.65 fps, capturing bandwidth 63676bytes/sec Analysing at 4.83 fps]
Aug 06 12:15:51 surveillance zmc_m1[3648]: INF [zmc_m1] [Briefkasten: 80 - Capturing at 9.96 fps, capturing bandwidth 15807bytes/sec Analysing at 4.98 fps]
Aug 06 12:15:53 surveillance zmc_m1[3648]: INF [zmc_m1] [Briefkasten: 100 - Capturing at 10.01 fps, capturing bandwidth 39712bytes/sec Analysing at 5.01 fps]
The output of zmupdate.pl -f is:

Code: Select all

Freshening configuration in database
Migratings passwords, if any...
Loading config from DB 221 entries
Saving config to DB 221 entries
DBD::mysql::st execute failed: Unknown column 'System' in 'field list' at /usr/share/perl5/vendor_perl/ZoneMinder/Config.pm line 243.
Can't execute when updating config entry ZM_SKIN_DEFAULT: Unknown column 'System' in 'field list' at /usr/bin/zmupdate.pl line 333.
I also installed php-intl following viewtopic.php?t=31968 to no avail.

It seems to me the permissions issue for zmc_m1.log is just a symptom and the Config.pm got messed up somewhere in time before, but this is just an assumption.

Can you please point me to the right direction? What other information should I give?


Best,
_zot_
Magic919
Posts: 1381
Joined: Wed Sep 18, 2013 6:56 am

Re: DB errors in /usr/share/perl5/vendor_perl/ZoneMinder/Config.pm

Post by Magic919 »

This bit -

Unknown column 'Private' in 'field list'

Run this against your DB to add it.

/usr/share/zoneminder/db/zm_update-1.36.18.sql
-
_zot_
Posts: 3
Joined: Fri Aug 12, 2022 6:08 am

Re: DB errors in /usr/share/perl5/vendor_perl/ZoneMinder/Config.pm

Post by _zot_ »

Hi Magic919,

Thank you very much for your input!

However, zm_update-1.36.18.sql does not exist in the 1.36.17 version (for obvious reasons). So I first updated zoneminder-common (and zoneminder-httpd) and then applied the command.

Since I’m not so fond of databases, let me first line up my steps:
  • mysql -u zmuser -p
    use zm
    source /usr/share/zoneminder/db/zm_update-1.36.18.sql
Please see the output of the source command:

Code: Select all

MariaDB [zm]> source /usr/share/zoneminder/db/zm_update-1.36.18.sql
+--------------------------------+
| Checking for Private in Config |
+--------------------------------+
| Checking for Private in Config |
+--------------------------------+
1 row in set (0.000 sec)

Query OK, 0 rows affected (0.001 sec)

Query OK, 0 rows affected (0.000 sec)
Statement prepared

Query OK, 0 rows affected (0.041 sec)
Records: 0  Duplicates: 0  Warnings: 0
The output of zmupdate.pl -f threw the same error (with column 'System') as before.

So this did not do the trick or I misunderstood something.


Best,
_zot_
Magic919
Posts: 1381
Joined: Wed Sep 18, 2013 6:56 am

Re: DB errors in /usr/share/perl5/vendor_perl/ZoneMinder/Config.pm

Post by Magic919 »

Code: Select all

mysql -u zmuser -p zm <  /usr/share/zoneminder/db/zm_update-1.36.18.sql
-
_zot_
Posts: 3
Joined: Fri Aug 12, 2022 6:08 am

Re: DB errors in /usr/share/perl5/vendor_perl/ZoneMinder/Config.pm

Post by _zot_ »

Hi Magic919,

Thanks a lot for your help!

ZoneMinder is working again. I still had to install php-intl to get the UI work again, but I never would have thought of issuing this sql update command.


Best,
_zot_
Magic919
Posts: 1381
Joined: Wed Sep 18, 2013 6:56 am

Re: DB errors in /usr/share/perl5/vendor_perl/ZoneMinder/Config.pm

Post by Magic919 »

You’re welcome

It’s one of those standard fixes. Missing column in DB, grep through those files and find one that adds it.

Ideally it’ll all happen automatically, of course.
-
Greg_Talyor
Posts: 34
Joined: Mon Aug 17, 2020 7:41 pm

Re: [SOLVED] Re: DB errors in /usr/share/perl5/vendor_perl/ZoneMinder/Config.pm

Post by Greg_Talyor »

_zot_ wrote: Fri Aug 12, 2022 11:41 am Hi Magic919,

Thank you very much for your input!

However, zm_update-1.36.18.sql does not exist in the 1.36.17 version (for obvious reasons). So I first updated zoneminder-common (and zoneminder-httpd) and then applied the command.

Since I’m not so fond of databases, let me first line up my steps:
  • mysql -u zmuser -p
    use zm
    source /usr/share/zoneminder/db/zm_update-1.36.18.sql
Please see the output of the source command:

Code: Select all

MariaDB [zm]> source /usr/share/zoneminder/db/zm_update-1.36.18.sql
+--------------------------------+
| Checking for Private in Config |
+--------------------------------+
| Checking for Private in Config |
+--------------------------------+
1 row in set (0.000 sec)

Query OK, 0 rows affected (0.001 sec)

Query OK, 0 rows affected (0.000 sec)
Statement prepared

Query OK, 0 rows affected (0.041 sec)
Records: 0  Duplicates: 0  Warnings: 0
The output of zmupdate.pl -f threw the same error (with column 'System') as before.

So this did not do the trick or I misunderstood something.


Best,
_zot_
This thread is very useful to me. I had the same problem when upgrading from Debian Bullseye to Bookworm and Zoneminder 1.36.13 to 1.36.33. If you will allow me to add my adaptation here. Default mysql (MariaDB) password for zmuser is zmpass as listed in /etc/zm/zm.conf . Problem solved.

Code: Select all

$ mysql -u zmuser -p
Enter password: zmpass
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 1234
Server version: 10.11.3-MariaDB-1 Debian 12

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> use zm
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed

MariaDB [zm]> source /usr/share/zoneminder/db/zm_update-1.36.16.sql
+-------------------------------+
| Checking for System in Config |
+-------------------------------+
| Checking for System in Config |
+-------------------------------+
1 row in set (0.000 sec)
...

MariaDB [zm]> source /usr/share/zoneminder/db/zm_update-1.36.18.sql
+--------------------------------+
| Checking for Private in Config |
+--------------------------------+
| Checking for Private in Config |
+--------------------------------+
1 row in set (0.000 sec)
...

MariaDB [zm]> quit
Bye

$ sudo zmupdate.pl -f
Freshening configuration in database
Migratings passwords, if any...
Loading config from DB 221 entries
Saving config to DB 227 entries

$ sudo systemctl restart zoneminder.service
$ sudo systemctl status zoneminder.service
● zoneminder.service - ZoneMinder CCTV recording and surveillance system
     Loaded: loaded (/lib/systemd/system/zoneminder.service; enabled; preset: enabled)
     Active: active (running) since Tue 2023-08-08 23:57:10 XXX; 3s ago
       Docs: http://zoneminder.readthedocs.org/en/latest/
    Process: 8386 ExecStart=/usr/bin/zmpkg.pl start (code=exited, status=0/SUCCESS)
   Main PID: 8397 (zmdc.pl)
      Tasks: 12 (limit: 9311)
     Memory: 215.1M
        CPU: 2.556s
     CGroup: /system.slice/zoneminder.service
             ├─8397 /usr/bin/perl -wT /usr/bin/zmdc.pl startup
             ├─8424 /usr/bin/zmc -m 1
             ├─8428 /usr/bin/zmc -m 2
             ├─8432 /usr/bin/zmc -m 3
             ├─8436 /usr/bin/perl -wT /usr/bin/zmfilter.pl --filter_id=1 --daemon
             ├─8440 /usr/bin/perl -wT /usr/bin/zmfilter.pl --filter_id=2 --daemon
             ├─8445 /usr/bin/perl -wT /usr/bin/zmwatch.pl
             ├─8449 /usr/bin/perl -wT /usr/bin/zmupdate.pl -c
             └─8453 /usr/bin/perl -wT /usr/bin/zmstats.pl

Aug 08 23:57:08 foobar systemd[1]: Starting zoneminder.service - ZoneMinder CCTV recording and surveillance system...
Aug 08 23:57:10 foobar systemd[1]: Started zoneminder.service - ZoneMinder CCTV recording and surveillance system.
Post Reply