Wednesday, 26 May 2010

Bacula upgrade while updating ubuntu to 10.04

When you update your ubuntu to 10.04, the upgrade process forgets to update the bacula database which ends with this in bacula logs :

02-May 17:39 bacula-dir JobId 0: Fatal error: Version error for database "bacula". Wanted 12, got 10
02-May 17:39 bacula-dir JobId 0: Fatal error: Could not open Catalog "MyCatalog", database "bacula".
02-May 17:39 bacula-dir JobId 0: Fatal error: Version error for database "bacula". Wanted 12, got 10
02-May 17:39 bacula-dir ERROR TERMINATION
Please correct configuration file: /etc/bacula/bacula-dir.conf

to correct this you need to run manuall two SQL scripts to upgrade the database (extracted from sources of bacula).


First you need to edit ~/.my.cnf so that 'mysql' command use this file to connect to the database :

[client]
user=root
password=YOU_MYSQL_ROOT_PWD_HERE
protocol=tcp

or change the scripts so that

this line :

if $bindir/mysql $* -f <<END-OF-DATA

is changed to this line :

if $bindir/mysql -uroot -p $* -f <<END-OF-DATA



here is this scripts you need to upgrade the database :

upgrade-v10-to-v11.sh

upgrade-v11-to-v12.sh

Download theses files on your server, review what changes it brings (you should always check these kind of things found on internet ;)
edit these files to update the bacula database name

db_name=bacula

and run it :

root@home:~/upgradeBacula# ./upgrade-v10-to-v11.sh

This script will update a Bacula MySQL database from version 10 to 11
 which is needed to convert from Bacula version 2.0.x to 3.0.x or higher

Update of Bacula MySQL tables succeeded.
root@home:~/upgradeBacula# ./upgrade-v11-to-v12.sh

This script will update a Bacula MySQL database from version 11 to 12
 which is needed to convert from Bacula Enterprise 2.6 to 4.0 or
 Standard version 3.0 to 5.0

Update of Bacula MySQL tables succeeded.

Next, try to start bacula :

sudo service bacula-director start
sudo service bacula-fd       start
sudo service bacula-sd       start

you should now be able to connect with bconsole and run a job !


This post was written based on information found on this bug report : https://bugs.launchpad.net/ubuntu/+source/bacula/+bug/579924

4 comments:

Peter said...

Thanks - this blog post saved me a lot of trouble.

Daniel Díaz said...

You the man!

Animesh said...

Awesome! Right on the money, I had the same issue when I upgrade from karmic to lucid. Saved me loads of trouble. Thanks for the detailed instructions and the files.

Stryder said...

Kudos to you for great content!