broken debian upgrade to 1.32: Constant ZM_DIR_EVENTS already defined

Forum for questions and support relating to the 1.32.x releases only.
Post Reply
marcmerlin
Posts: 87
Joined: Thu Jan 17, 2013 6:13 pm

broken debian upgrade to 1.32: Constant ZM_DIR_EVENTS already defined

Post by marcmerlin » Mon Dec 09, 2019 6:28 pm

After an upgrade from hell due to the php5 to php7 forced migration that broke so many things (sigh), I upgraded zoneminder too, since my old one worked with php5 and now I'm forced to have php7 in apache due to other packages.

I'm now stuck at the zoneminder privacy accept screen, and accept loops and goes nowhere.
I see this in my logs:

Code: Select all

PHP Notice:  Constant ZM_DIR_EVENTS already defined in /usr/share/zoneminder/www/includes/config.php on line 173, referer: https://home.merlins.org/zm/index.php?view=console  
PHP Notice:  Constant ZM_DIR_IMAGES already defined in /usr/share/zoneminder/www/includes/config.php on line 173, referer: https://home.merlins.org/zm/index.php?view=console
PHP Notice:  Constant ZM_DIR_SOUNDS already defined in /usr/share/zoneminder/www/includes/config.php on line 173, referer: https://home.merlins.org/zm/index.php?view=console  
PHP Notice:  Constant ZM_PATH_ZMS already defined in /usr/share/zoneminder/www/includes/config.php on line 173, referer: https://home.merlins.org/zm/index.php?view=console  
PHP Notice:  Constant ZM_PATH_MAP already defined in /usr/share/zoneminder/www/includes/config.php on line 173, referer: https://home.merlins.org/zm/index.php?view=console
PHP Notice:  Constant ZM_PATH_SOCKS already defined in /usr/share/zoneminder/www/includes/config.php on line 173, referer: https://home.merlins.org/zm/index.php?view=console  
PHP Notice:  Constant ZM_PATH_LOGS already defined in /usr/share/zoneminder/www/includes/config.php on line 173, referer: https://home.merlins.org/zm/index.php?view=console  
PHP Notice:  Constant ZM_PATH_SWAP already defined in /usr/share/zoneminder/www/includes/config.php on line 173, referer: https://home.merlins.org/zm/index.php?view=console
PHP Notice:  Constant ZM_PATH_ARP already defined in /usr/share/zoneminder/www/includes/config.php on line 173, referer: https://home.merlins.org/zm/index.php?view=console  
PHP Notice:  Use of undefined constant ZM_BANDWIDTH_DEFAULT - assumed 'ZM_BANDWIDTH_DEFAULT' in /usr/share/zoneminder/www/skins/classic/skin.php on line 22, referer: https://home.merlins.org/zm/index.php?view=console  
PHP Notice:  Use of undefined constant ZM_AUTH_HASH_TTL - assumed 'ZM_AUTH_HASH_TTL' in /usr/share/zoneminder/www/includes/auth.php on line 117, referer: https://home.merlins.org/zm/index.php?view=console
PHP Notice:  Use of undefined constant ZM_SHOW_PRIVACY - assumed 'ZM_SHOW_PRIVACY' in /usr/share/zoneminder/www/index.php on line 232, referer: https://home.merlins.org/zm/index.php?view=console
PHP Notice:  Use of undefined constant ZM_WEB_AJAX_TIMEOUT - assumed 'ZM_WEB_AJAX_TIMEOUT' in /usr/share/zoneminder/www/skins/classic/js/skin.js.php on line 27, referer: https://home.merlins.org/zm/index.php?view=console
PHP Notice:  Use of undefined constant ZM_WEB_REFRESH_NAVBAR - assumed 'ZM_WEB_REFRESH_NAVBAR' in /usr/share/zoneminder/www/skins/classic/js/skin.js.php on line 29, referer: https://home.merlins.org/zm/index.php?view=console

This points to a broken upgrade and maybe files left over from my old package (normally debian would handle this, but it seems not in this case). Here's what I see:

Code: Select all

gargamel:/usr/share/zoneminder# grep -r ZM_DIR_EVENTS .
./www/includes/Event.php:      # A default Server will result in the use of ZM_DIR_EVENTS
./www/includes/Monitor.php:      deletePath(ZM_DIR_EVENTS.'/'.basename($this->{'Name'}));
./www/includes/Monitor.php:      deletePath(ZM_DIR_EVENTS.'/'.$this->{'Id'});
./www/includes/Monitor.php:      if ( $Storage->Path() != ZM_DIR_EVENTS ) {
./www/includes/Storage.php:      $path = ZM_DIR_EVENTS;
./www/includes/Storage.php:        $this->{'Path'} = ZM_PATH_WEB.'/'.ZM_DIR_EVENTS;
./www/includes/Storage.php:        $this->{'Path'} = ZM_DIR_EVENTS;
./www/includes/functions.php:  } elseif ( strpos( ZM_DIR_EVENTS, '/' ) === 0 ) {
./www/includes/functions.php:  return( ZM_DIR_EVENTS.'/'.$path );
./www/includes/functions.php:function getDiskPercent($path = ZM_DIR_EVENTS) {
./www/views/image.php:  $dir_events = realpath(ZM_DIR_EVENTS);
./www/api/app/Controller/Component/ImageComponent.php:		$analFile =  $config['ZM_DIR_EVENTS']."/".$analPath;
./www/api/app/Controller/Component/ImageComponent.php:			$imageFile = $config['ZM_DIR_EVENTS']."/".$imagePath;
./www/api/app/Controller/Component/ImageComponent.php:			$thumbFile = $config['ZM_DIR_EVENTS']."/".$thumbPath;
./www/api/app/Controller/Component/ImageComponent.php:			$imageFile = $config['ZM_DIR_EVENTS']."/".$imagePath;
./www/api/app/Controller/Component/ImageComponent.php:			//$thumbFile = ZM_DIR_EVENTS."/".$thumbPath;
./www/api/app/Controller/EventsController.php:          'ZM_DIR_EVENTS'
./www/api/app/Controller/HostController.php:    $zm_dir_events = ZM_DIR_EVENTS;
./www/api/app/Controller/UsersController.php:			'conditions' => array('Name' => array('ZM_DIR_EVENTS'))
./www/skins/classic/includes/export_functions.php:    $monitorPath = ZM_DIR_EVENTS.'/';
./www/skins/classic/includes/functions.php:  if ( ! isset($storage_paths[ZM_DIR_EVENTS]) ) {
./www/skins/classic/views/filter.php://$storageareas[0] = 'Default ' . ZM_DIR_EVENTS;
./www/skins/classic/views/video.php:      <h3 id="videoFile"><?php echo substr($videoFiles[$showIndex], strlen(ZM_DIR_EVENTS)+1) ?></h3>
./www/skins/classic/views/video.php:          <td><?php echo makePopupLink('?view='.$view.'&amp;eid='.$event['Id'].'&amp;width='.$width.'&amp;height='.$height.'&amp;showIndex='.$index, 'zmVideo'.$event['Id'].'-'.$scale, array( 'videoview', $width, $height ), translate('View') ); ?>&nbsp;/&nbsp;<a href="<?php echo substr( $file, strlen(ZM_DIR_EVENTS)+1 ) ?>" onclick="downloadVideo( <?php echo $index ?> ); return( false );"><?php echo translate('Download') ?></a>&nbsp;/&nbsp;<a href="#" onclick="deleteVideo( <?php echo $index ?> ); return( false );"><?php echo translate('Delete') ?></a></td>
./www/index.php:if ( !is_writable(ZM_DIR_EVENTS) || !is_writable(ZM_DIR_IMAGES) ) {
./www/index.php:  Warning("Cannot write to content dirs('".ZM_DIR_EVENTS."','".ZM_DIR_IMAGES."').  Check that these exist and are owned by the web account user");
Any idea of what doesn't belong there? It seems that I have one file left over that I should delete, but I'm also confused about "Use of undefined constant ZM_BANDWIDTH_DEFAULT in /usr/share/zoneminder/www/skins/classic/skin.php " errors, which seem to point to another incomplete install issue?
Seems that said file is from the package I just installed, and not a leftover:
gargamel:/usr/share/zoneminder# dpkg -S /usr/share/zoneminder/www/skins/classic/skin.php
zoneminder: /usr/share/zoneminder/www/skins/classic/skin.php

Any ideas? Thanks, Marc

User avatar
snake
Posts: 334
Joined: Sat May 21, 2016 2:20 am

Re: broken debian upgrade to 1.32: Constant ZM_DIR_EVENTS already defined

Post by snake » Mon Dec 09, 2019 7:31 pm

Were there any upgrade errors, or did apt/apt-get complete successfully?

If you can't decipher the broken upgrade quickly, you can always apt-get purge and install again. Just backup the DB before reinstalling, and restore it after its up and running. Sometimes you have to run zmupdate.pl manually if the db doesn't upgrade correctly.

All settings are saved in the db.

marcmerlin
Posts: 87
Joined: Thu Jan 17, 2013 6:13 pm

Re: broken debian upgrade to 1.32: Constant ZM_DIR_EVENTS already defined

Post by marcmerlin » Tue Dec 10, 2019 7:47 am

snake wrote:
Mon Dec 09, 2019 7:31 pm
Were there any upgrade errors, or did apt/apt-get complete successfully?

If you can't decipher the broken upgrade quickly, you can always apt-get purge and install again. Just backup the DB before reinstalling, and restore it after its up and running. Sometimes you have to run zmupdate.pl manually if the db doesn't upgrade correctly.

All settings are saved in the db.
Fair suggestion, so I did 'apt-get remove zoneminder' , then ran find in /usr /var to make sure nothing relevant was left over.
Then I re-installed it: 'apt-get install zoneminder' but that wasn't the problem.

Your other guess was correct that the upgrade didn't run

Code: Select all

gargamel:~# /usr/bin/zmupdate.pl

Initiating database upgrade to version 1.32.3 from version 1.30.4

Please ensure that ZoneMinder is stopped on your system prior to upgrading the database.
Press enter to continue or ctrl-C to stop : 

Do you wish to take a backup of your database prior to upgrading?
This may result in a large file in /tmp/zm if you have a lot of events.
Press 'y' for a backup or 'n' to continue : n

Upgrading database to version 1.32.3

Migrating custom config values from Options -> Paths
to /etc/zm/conf.d/zmcustom.conf.

Please verify these values before starting ZoneMinder.

Loading config from DBNo option 'ZM_DIR_EVENTS' found, removing.
No option 'ZM_DIR_IMAGES' found, removing.
No option 'ZM_DIR_SOUNDS' found, removing.
No option 'ZM_FRAME_SOCKET_SIZE' found, removing.
No option 'ZM_OPT_FRAME_SERVER' found, removing.
No option 'ZM_PATH_ARP' found, removing.
No option 'ZM_PATH_LOGS' found, removing.
No option 'ZM_PATH_MAP' found, removing.
No option 'ZM_PATH_SOCKS' found, removing.
No option 'ZM_PATH_SWAP' found, removing.
No option 'ZM_PATH_ZMS' found, removing.
No option 'ZM_SIGNAL_CHECK_POINTS' found, removing.
 206 entries
Saving config to DB 223 entries
DBD::mysql::st execute failed: Data too long for column 'DefaultValue' at row 1 at /usr/share/perl5/ZoneMinder/Config.pm line 260, <STDIN> line 2.
Can't execute: Data too long for column 'DefaultValue' at row 1 at /usr/bin/zmupdate.pl line 420.
gargamel:~# 
So there's my problem, but it's not very obvious how I fix it. The 2nd time I run it, now I get

Code: Select all

Saving config to DB 223 entries
DBD::mysql::st execute failed: Data too long for column 'DefaultValue' at row 1 at /usr/share/perl5/ZoneMinder/Config.pm line 260, <STDIN> line 2.
Can't execute: Data too long for column 'DefaultValue' at row 1 at /usr/bin/zmupdate.pl line 420.
Ok, so at least google has the fix for that
https://zoneminder.readthedocs.io/en/la ... untu-16-04
after updating mysql to have
sql_mode = NO_ENGINE_SUBSTITUTION
then /usr/bin/zmupdate.pl worked. Disappointing that the debian package doesn't take care of that.

Now, it's taking what looks like an hour or more to update the db, so I'll confirm tomorrow whether it worked.
Thanks.

marcmerlin
Posts: 87
Joined: Thu Jan 17, 2013 6:13 pm

Re: broken debian upgrade to 1.32: Constant ZM_DIR_EVENTS already defined

Post by marcmerlin » Tue Dec 10, 2019 5:15 pm

snake wrote:
Mon Dec 09, 2019 7:31 pm
Were there any upgrade errors, or did apt/apt-get complete successfully?

If you can't decipher the broken upgrade quickly, you can always apt-get purge and install again. Just backup the DB before reinstalling, and restore it after its up and running. Sometimes you have to run zmupdate.pl manually if the db doesn't upgrade correctly.

All settings are saved in the db.
Took a long time, but the upgrade is done:

Code: Select all

...
Database successfully upgraded to version 1.32.2.
Upgrading DB to 1.32.3 from 1.30.4
Database successfully upgraded to version 1.32.3.
Database upgrade to version 1.32.3 successful.
Now, I can get past the first page (which still looks very wrong) and get to the main page, which also looks very wrong
Image
Image won't render, not sure why, see http://marc.merlins.org/tmp/zm.jpeg


Looks like the skin support is completely broken on my fresh re-install, and I don't see any errors in my apache log.

Is that some kind of known problem with a known fix?

marcmerlin
Posts: 87
Joined: Thu Jan 17, 2013 6:13 pm

Re: broken debian upgrade to 1.32: Constant ZM_DIR_EVENTS already defined

Post by marcmerlin » Wed Dec 11, 2019 12:32 am

Ok, my new problem is due to virtual hosts and zoneminder.conf not working in the right place in the overall apache config.
The same problem was described on viewtopic.php?t=27514

I fixed that manually.
Now, the interface looks ok.

marcmerlin
Posts: 87
Joined: Thu Jan 17, 2013 6:13 pm

Re: broken debian upgrade to 1.32: Constant ZM_DIR_EVENTS already defined

Post by marcmerlin » Wed Dec 11, 2019 1:05 am

after that, video recording/display failed repeatedly on all inputs.
The logs gave this

Code: Select all

Dec 10 16:56:42 gargamel zmtrigger[22776]: ERR [Memory map file '/dev/shm/zm.mmap.11' should have been 1160 but was instead 0]
Dec 10 16:56:42 gargamel zmtrigger[22776]: ERR [Memory map file '/dev/shm/zm.mmap.9' should have been 1160 but was instead 0]
Dec 10 16:56:42 gargamel zmtrigger[22776]: ERR [Memory map file '/dev/shm/zm.mmap.4' should have been 1160 but was instead 0]
Dec 10 16:56:42 gargamel zmtrigger[22776]: ERR [Memory map file '/dev/shm/zm.mmap.8' should have been 1160 but was instead 0]
Dec 10 16:56:42 gargamel zmtrigger[22776]: ERR [Memory map file '/dev/shm/zm.mmap.16' should have been 1160 but was instead 0]
Dec 10 16:56:42 gargamel zmtrigger[22776]: ERR [Memory map file '/dev/shm/zm.mmap.5' should have been 1160 but was instead 0]
Dec 10 16:56:42 gargamel zmtrigger[22776]: ERR [Memory map file '/dev/shm/zm.mmap.1' should have been 1160 but was instead 0]
Dec 10 16:56:42 gargamel zmtrigger[22776]: ERR [Memory map file '/dev/shm/zm.mmap.17' should have been 1160 but was instead 0]
Dec 10 16:56:42 gargamel zmtrigger[22776]: ERR [Memory map file '/dev/shm/zm.mmap.6' should have been 1160 but was instead 0]
Dec 10 16:56:42 gargamel zmtrigger[22776]: ERR [Memory map file '/dev/shm/zm.mmap.23' should have been 1160 but was instead 0]
Dec 10 16:56:42 gargamel zmtrigger[22776]: ERR [Memory map file '/dev/shm/zm.mmap.24' should have been 1160 but was instead 0]
Dec 10 16:56:42 gargamel zmtrigger[22776]: ERR [Memory map file '/dev/shm/zm.mmap.10' should have been 1160 but was instead 0]
Dec 10 16:56:42 gargamel zmtrigger[22776]: ERR [Memory map file '/dev/shm/zm.mmap.19' should have been 1160 but was instead 0]
Dec 10 16:56:42 gargamel zmtrigger[22776]: ERR [Memory map file '/dev/shm/zm.mmap.11' should have been 1160 but was instead 0]
Dec 10 16:56:42 gargamel zmtrigger[22776]: ERR [Memory map file '/dev/shm/zm.mmap.9' should have been 1160 but was instead 0]
Dec 10 16:56:42 gargamel zmtrigger[22776]: ERR [Memory map file '/dev/shm/zm.mmap.4' should have been 1160 but was instead 0]
Dec 10 16:56:42 gargamel zmtrigger[22776]: ERR [Memory map file '/dev/shm/zm.mmap.8' should have been 1160 but was instead 0]
Dec 10 16:56:42 gargamel zmtrigger[22776]: ERR [Memory map file '/dev/shm/zm.mmap.16' should have been 1160 but was instead 0]
Dec 10 16:56:42 gargamel zmtrigger[22776]: ERR [Memory map file '/dev/shm/zm.mmap.5' should have been 1160 but was instead 0]
Dec 10 16:56:42 gargamel zmtrigger[22776]: ERR [Memory map file '/dev/shm/zm.mmap.1' should have been 1160 but was instead 0]
Dec 10 16:56:42 gargamel zmtrigger[22776]: ERR [Memory map file '/dev/shm/zm.mmap.17' should have been 1160 but was instead 0]
Dec 10 16:56:42 gargamel zmtrigger[22776]: ERR [Memory map file '/dev/shm/zm.mmap.6' should have been 1160 but was instead 0]
Dec 10 16:56:42 gargamel zmtrigger[22776]: ERR [Memory map file '/dev/shm/zm.mmap.23' should have been 1160 but was instead 0]
Dec 10 16:56:42 gargamel zmtrigger[22776]: ERR [Memory map file '/dev/shm/zm.mmap.24' should have been 1160 but was instead 0]
Dec 10 16:56:42 gargamel zmtrigger[22776]: ERR [Memory map file '/dev/shm/zm.mmap.10' should have been 1160 but was instead 0]
Dec 10 16:56:42 gargamel zmtrigger[22776]: ERR [Memory map file '/dev/shm/zm.mmap.19' should have been 1160 but was instead 0]
That was not useful, but then I got this more useful one on a single monitor:

Code: Select all

Dec 10 16:56:42 gargamel zmc_m24[1677]: FAT [zmc_m24] [Unable to initialise libgcrypt]
I made a guess and upgraded all my gcrypt libs (didn't check which one zm used), and then things started working:
apt-get install libgcrypt7 libgcrypt1 libgcrypt11 libgcrypt20 rng-tools

Unfortunately, the zm deb package didn't force the library upgrade, I guess the package author didn't know that the older version of that lib, would cause failures. Maybe this will be useful to someone if they run into the same problem.

marcmerlin
Posts: 87
Joined: Thu Jan 17, 2013 6:13 pm

Re: broken debian upgrade to 1.32: Constant ZM_DIR_EVENTS already defined

Post by marcmerlin » Wed Dec 11, 2019 3:17 am

Well, there are unfortunately plenty of other problems after the upgrade, still. I started a new thread for them:
viewtopic.php?f=38&t=28830

Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests