Error Starting - Bareword not allowed when use strict...

Forum for questions and support relating to the 1.26.x releases only.
Locked
Ruler
Posts: 232
Joined: Mon Nov 08, 2004 9:02 pm
Location: Bay City, MI

Error Starting - Bareword not allowed when use strict...

Post by Ruler »

I just wiped my old ZM box and installed CentOS 6.4 and ZM from RPM. Everything seemed to function as it should after working through the quirks of CentOS. Started ZM and it came up with all processes running as they should. Now I've run into another problem.

I stopped ZM to move the events and images directories to a RAID so as not to fill the boot drive. (I did this by doing 'cp -Rp /var/lib/zoneminder/* /video', 'mv /var/lib/zoneminder /var/lib/zoneminder.o', and 'ln -s /video /var/lib/zoneminder'.) This created a symbolic link to the RAID, such that anything written to /var/lib/zoneminder would end up on the dedicated 2TB file system and I didn't have to muck around in the ZM/apache configs to get things working. However, ZM refused to start after this. After putting everything back the way it was ('rm /var/lib/zoneminder', 'mv /var/lib/zoneminder.o /var/lib/zoneminder'), ZM still won't start. Instead, I get the following when executing 'service zoneminder start':

Code: Select all

Bareword "ZM_DYN_DB_VERSION" not allowed while "strict subs" in use at /usr/bin/zmupdate.pl line 116.
BEGIN not safe after errors--compilation aborted at /usr/bin/zmupdate.pl line 154.

Line 116 is the end of an if statement that begins:
   if ( ZM_DYN_DB_VERSION )
This had me scratching my head in confusion - everything was the way it was initially, but there's now a syntax error in one of the perl files???

Looking at /etc/init.d/zoneminder, I found it was running '/usr/bin/zmupdate.pl -f' before starting ZM itself. If I enter this command manually, it produces the same error. OK, so I'll just bypass it - no big deal, just comment out the line calling the function which executes zmupdate.pl. Unfortunately, several similar errors then crop up in /usr/bin/zmpkg.pl all related to ZM_DYN_DB_VERSION.

The thing that really puzzles me is that it started fine the first time, now refuses to run. I'm going to delve into the perl code shortly, but am hoping somebody has a suggestion. (I did find a similar problem was reported here a few weeks ago, but there are no responses/solutions in that post.) ZM_DYN_DB_VERSION looks like a constant in the coding style I use, but I don't know if this is true in ZM or not. If true, I don't understand why it's being used in an if statement alone or why perl is complaining about it. I also still can't wrap my head around ZM starting fine the first time and not the second, even though everything is back the way it was, file ownership/permissions intact.
This message is made up of not less than 90% recycled electrons.
Ruler
Posts: 232
Joined: Mon Nov 08, 2004 9:02 pm
Location: Bay City, MI

Re: Error Starting - Bareword not allowed when use strict...

Post by Ruler »

This is freakin odd...

So I dug into the code a bit and realized that it'd take more than a little time to decipher what's going on. Also, if there were a flaw in the code, more people would be complaining about it. So something must've happened between the first start and the second, or gone haywire because I redirected the directories to the RAID file system and tried to start it. I removed zoneminder using 'yum -r zoneminder.i686' and reinstalled. Changed /etc/zm.conf to match my database password and enabled the web daemon. Started ZM and it worked fine, same as before. Stopped it and started it again - also fine. Did this twice more, just to be certain.

Here's the kicker. To confirm that the problem was caused by the symbolic links I created, I repeated the same steps. (So what if I spent another 10 minutes uninstalling/reinstalling it again - at least I'd know.) Starting zoneminder, I figured it was going to error out, but it started up fine! I stopped/started it half a dozen times and there are no problems whatsoever.

So I guess nevermind the problem in this thread, other than an FYI that *something* will cause this condition... :|
This message is made up of not less than 90% recycled electrons.
chippy99
Posts: 66
Joined: Wed Aug 30, 2006 5:38 pm
Location: Barnet, Herts. UK

Re: Error Starting - Bareword not allowed when use strict...

Post by chippy99 »

I had the same error after I messed around with database settings and corrupted the Config table. I resolved it by recreating the Config table. I created a copy of zm_create.sql that is in the db directory and then removed everything except the lines that create the config table and further down in the file the lines that populate the table. Then went into mysql and ran "source name of your file" and all was well. I would backup the database bfore attempting this.

regards, John
c128
Posts: 88
Joined: Sat Sep 14, 2013 3:36 pm

Re: Error Starting - Bareword not allowed when use strict...

Post by c128 »

chippy99 wrote:I had the same error after I messed around with database settings and corrupted the Config table. I resolved it by recreating the Config table. I created a copy of zm_create.sql that is in the db directory and then removed everything except the lines that create the config table and further down in the file the lines that populate the table. Then went into mysql and ran "source name of your file" and all was well. I would backup the database bfore attempting this.

regards, John
Just had the same problem too - possibly after a dodgy shutdown.
Re-creating and populating the Config table sorted it for me as well - thanks for that :D .
Locked