how to avoid re-installation DB error
how to avoid re-installation DB error
I've had zm 1.24.2 installed & running for quite some time. I upgraded from Ubuntu 9.04 to 9.10 and for some reason it removed my zm installation. OK, so I re-ran the .deb and everything about zm works again HOWEVER...
The installation process failed at the end with the error:
Can't find upgrade from version '1.24.2' at /usr/bin/zmupdate.pl line 889
I'm looking at the source and it's easy to see why that is occurring (my DB is already at the latest version), but I'm not sure what to do about it. At a minimum I'd like to prevent zm from continuing to try to run the DB update each time I install anything else, but it also seems like the code should gracefully handle the situation when the database is already up to date.
How can I finish out this installation, and does it sound reasonable that the zmupdate.pl shouldn't fail if the DB is already of the proper version?
Thanks in advance.
The installation process failed at the end with the error:
Can't find upgrade from version '1.24.2' at /usr/bin/zmupdate.pl line 889
I'm looking at the source and it's easy to see why that is occurring (my DB is already at the latest version), but I'm not sure what to do about it. At a minimum I'd like to prevent zm from continuing to try to run the DB update each time I install anything else, but it also seems like the code should gracefully handle the situation when the database is already up to date.
How can I finish out this installation, and does it sound reasonable that the zmupdate.pl shouldn't fail if the DB is already of the proper version?
Thanks in advance.
It doesn't.
Unfortunately, the upgrade process from 8.04 -> 9.04 -> 9.10 removes the older installation of ZoneMinder (1.23.3), BUT, the new installation believes it's still there. As a result, the installation fails. Because of the failed installation, every time you install a new package via apt-get, synaptic, or whatever, it attempts to finish the failed installed and spawns an error.
This all having been said, I solved the problem on my machine. It was a little more hassle than I wanted, but it works.
First, grab the 1.23.3 package off zoneminder.com. Download it and configure it. You don't need to actually build it, compile it, or install it, just configure it. (Regrettably this does mean you'll need all the development dependencies in place.) From there:
Now drop the old database -- note: this removes all your data. This was fine with me because Ubuntu had already nuked my installation.
Next, go into the 1.23.3 source tree and create a 1.23.3 database:
At this point you've got an empty, old database. Now all you have to do is finish the installation of the 1.24.2 package. Assuming you already have a failed installation, all you need to do is:
It will finish installing 1.24.2 correctly.
Unfortunately, the upgrade process from 8.04 -> 9.04 -> 9.10 removes the older installation of ZoneMinder (1.23.3), BUT, the new installation believes it's still there. As a result, the installation fails. Because of the failed installation, every time you install a new package via apt-get, synaptic, or whatever, it attempts to finish the failed installed and spawns an error.
This all having been said, I solved the problem on my machine. It was a little more hassle than I wanted, but it works.
First, grab the 1.23.3 package off zoneminder.com. Download it and configure it. You don't need to actually build it, compile it, or install it, just configure it. (Regrettably this does mean you'll need all the development dependencies in place.) From there:
Now drop the old database -- note: this removes all your data. This was fine with me because Ubuntu had already nuked my installation.
Code: Select all
$ sudo mysql -u root -p
mysql> drop database zm;
Code: Select all
$ cd Zoneminder-1.23.3/db
$ sudo mysql -u root -p <zm_create> grant select,insert,update,delete on zm.* to 'zmuser'@localhost identified by 'zmpass';
mysql> flush privileges;
mysql> quit;
Code: Select all
$ sudo apt-get -f install
If there is some wizard out there that has a better way to convince the 1.24.2 package to play nicely, please let me know. The above worked for me, but I fully admit it's not the elegant approach.
I had attempt to to paste the zm_create.sql file from 1.23.3 below, but it's too long. Sorry.
I had attempt to to paste the zm_create.sql file from 1.23.3 below, but it's too long. Sorry.
Last edited by mtgstuber on Tue Dec 29, 2009 6:35 pm, edited 1 time in total.
I'm back to figuring out what is going on that prompted me to start this thread. I'm looking at the zmupdate.pl source, and I don't understand how it could gracefully exit for you. Perhaps the issue is simply that Ubuntu doesn't let the install "die()" and other distributions do, but I believe in reading the code that at a minimum, zmupdate.pl doesn't exit gracefully.cordel wrote:It should gracefully exit already. I have done similar a few times with 1.24.2 without issue though not on ubuntu which would be the only known difference at this point.
It appears that each of the blocks of code for each version end with
Code: Select all
$cascade = !undef;
Code: Select all
if ( $cascade )
{
my $installed_version = ZM_VERSION;
my $sql = "update Config set Value = ? where Name = ?";
my $sth = $dbh->prepare_cached( $sql ) or die( "Can't prepare '$sql': ".$dbh->errstr() );
my $res = $sth->execute( "$installed_version", "ZM_DYN_DB_VERSION" ) or die( "Can't execute: ".$sth->errstr() );
$res = $sth->execute( "$installed_version", "ZM_DYN_CURR_VERSION" ) or die( "Can't execute: ".$sth->errstr() );
$dbh->disconnect();
}
else
{
$dbh->disconnect();
die( "Can't find upgrade from version '$version'" );
}
Code: Select all
if ( $cascade || $version eq "1.24.2" )
{
# Do nothing, but don't die
$cascade = !undef;
}