Upgrading Ubuntu LTS skips database version - Fatal error: Version error for database "bacula". Wanted 12, got 10

Bug #579924 reported by Tomasz
68
This bug affects 13 people
Affects Status Importance Assigned to Milestone
Bacula
Invalid
Undecided
Unassigned
bacula (Ubuntu)
Confirmed
Medium
Unassigned

Bug Description

Binary package hint: bacula

After upgrading Ubuntu from 8.04 LTS to 10.04 LTS backup software Bacula stopped working, starting bacula-director MySQL version results in:

bacula-dir JobId 0: Fatal error: Version error for database "bacula". Wanted 12, got 10

During upgrade Bacula was upgraded from 2.2 series (db version 10) to 5.0 (db version 12), dpkg.log shows.

2010-05-12 21:16:32 upgrade bacula-director-mysql 2.2.8-5ubuntu7.2 5.0.1-1ubuntu1

and /usr/share/bacula-director/update_mysql_tables upgrades only from db version 11:

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

Running it for version 10 destroys database structure! Running a job results in a failure, messages:

13-maj 14:16 magazyn-dir JobId 0: Fatal error: sql_get.c:623 sql_get.c:623 query SELECT PoolId,Name,NumVols,MaxVols,UseOnce,UseCatalog,AcceptAnyVolume,AutoPrune,Recycle,VolRetention,VolUseDuration,MaxVolJobs,MaxVolFiles,MaxVolBytes,PoolType,LabelType,LabelFormat,RecyclePoolId,ScratchPoolId,ActionOnPurge FROM Pool WHERE Pool.Name='Default' failed:
Unknown column 'ActionOnPurge' in 'field list'
13-maj 14:16 magazyn-dir JobId 0: Fatal error: sql_get.c:623 sql_get.c:623 query SELECT PoolId,Name,NumVols,MaxVols,UseOnce,UseCatalog,AcceptAnyVolume,AutoPrune,Recycle,VolRetention,VolUseDuration,MaxVolJobs,MaxVolFiles,MaxVolBytes,PoolType,LabelType,LabelFormat,RecyclePoolId,ScratchPoolId,ActionOnPurge FROM Pool WHERE Pool.Name='Default' failed:
Unknown column 'ActionOnPurge' in 'field list'
13-maj 14:16 magazyn-dir JobId 0: Fatal error: Pool Default not in database. sql_create.c:181 pool record Default already exists
13-maj 14:16 magazyn-dir JobId 0: Fatal error: sql_get.c:623 sql_get.c:623 query SELECT PoolId,Name,NumVols,MaxVols,UseOnce,UseCatalog,AcceptAnyVolume,AutoPrune,Recycle,VolRetention,VolUseDuration,MaxVolJobs,MaxVolFiles,MaxVolBytes,PoolType,LabelType,LabelFormat,RecyclePoolId,ScratchPoolId,ActionOnPurge FROM Pool WHERE Pool.Name='Default' failed:
Unknown column 'ActionOnPurge' in 'field list'
13-maj 14:16 magazyn-dir JobId 0: Fatal error: sql_get.c:623 sql_get.c:623 query SELECT PoolId,Name,NumVols,MaxVols,UseOnce,UseCatalog,AcceptAnyVolume,AutoPrune,Recycle,VolRetention,VolUseDuration,MaxVolJobs,MaxVolFiles,MaxVolBytes,PoolType,LabelType,LabelFormat,RecyclePoolId,ScratchPoolId,ActionOnPurge FROM Pool WHERE Pool.Name='Default' failed:
Unknown column 'ActionOnPurge' in 'field list'
13-maj 14:16 magazyn-dir JobId 0: Fatal error: Pool Default not in database. sql_create.c:181 pool record Default already exists
13-maj 14:16 magazyn-dir JobId 0: Fatal error: sql_get.c:623 sql_get.c:623 query SELECT PoolId,Name,NumVols,MaxVols,UseOnce,UseCatalog,AcceptAnyVolume,AutoPrune,Recycle,VolRetention,VolUseDuration,MaxVolJobs,MaxVolFiles,MaxVolBytes,PoolType,LabelType,LabelFormat,RecyclePoolId,ScratchPoolId,ActionOnPurge FROM Pool WHERE Pool.Name='Default' failed:
Unknown column 'ActionOnPurge' in 'field list'

I expected to have the database upgraded from version 10 to 12 when upgrading Ubuntu LTS series.

Tomasz (nowak2000)
description: updated
Revision history for this message
Kern Sibbald (kern) wrote : Re: [Bug 579924] [NEW] Upgrading Ubuntu LTS skips database version - Fatal error: Version error for database "bacula". Wanted 12, got 10

It appears that the upgrade process attempted to upgrade two versions of the
database at one time. Bacula only supports upgrading one version at a time,
so from database version 10, you must first apply the scripts that do the
upgrade to version 11, and then apply the upgrade scripts that upgrade from
version 11 to version 12.

All the scripts for an upgrade from the prior version to the version of the
current release are found in <bacula>/src/cats ...

All scripts for making an upgrade from an old version to a newer version (e.g.
8 to 9 or 10 to 11) are kept in <bacula>/updatedb. These scripts may need
some manual editing to get the install locations to match where your database
is installed.

Kern

On Thursday 13 May 2010 13:59:48 Tomasz wrote:
> Public bug reported:
>
> Binary package hint: bacula
>
> After upgrading Ubuntu from 8.04 LTS to 10.04 LTS backup software Bacula
> stopped working, starting bacula-director MySQL version results in:
>
> bacula-dir JobId 0: Fatal error: Version error for database "bacula".
> Wanted 12, got 10
>
>
> During upgrade Bacula was upgraded from 2.2 series (db version 10) to 5.0
> (db version 12), dpkg.log shows.
>
> 2010-05-12 21:16:32 upgrade bacula-director-mysql 2.2.8-5ubuntu7.2
> 5.0.1-1ubuntu1
>
>
> and /usr/share/bacula-director/update_mysql_tables upgrades only from db
> version 11:
>
> 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
>
>
> I expected to have the database upgraded from version 10 to 12 when
> upgrading Ubuntu LTS series.
>
> ** Affects: bacula
> Importance: Undecided
> Status: New
>
> ** Affects: bacula (Ubuntu)
> Importance: Undecided
> Status: New
>
> ** Also affects: bacula
> Importance: Undecided
> Status: New

Revision history for this message
Jim Padel (jim-1-6regulars) wrote :

I would like to confirm both posts. The package from the repos only contain the 11 to 12 update scripts, but to get the 10 to 11 scripts you must obtain the source code from bacula.org, as far as I can tell they do not come with the distro package.

Revision history for this message
Jim Padel (jim-1-6regulars) wrote :

Here is the mysql 10 to 11 update script. Ensure that you modify the script for the correct db_name.

Execution is as follows

./update_mysql_tables_10_to_11 -u root -p

Revision history for this message
jmedina (jorgearma1982) wrote : Re: [Bug 579924] Re: Upgrading Ubuntu LTS skips database version - Fatal error: Version error for database "bacula". Wanted 12, got 10

Jim Padel wrote:
> I would like to confirm both posts. The package from the repos only
> contain the 11 to 12 update scripts, but to get the 10 to 11 scripts you
> must obtain the source code from bacula.org, as far as I can tell they
> do not come with the distro package.
>
I guess you can also download the bacula deb sources:

# cd /usr/src

# apt-get source bacula

Revision history for this message
Johan Vervloet (jvervloet) wrote :

For the update script 11_to_12, I modified src/cats/update_mysql_tables.in, made it executable, and started it with '-u root -p' as well. Changed 'bindir' and 'db_name'.

Chuck Short (zulcss)
Changed in bacula (Ubuntu):
importance: Undecided → Medium
status: New → Confirmed
Revision history for this message
Manson Thomas (dev-mansonthomas) wrote :

Hi,

 I'm affected too but in my case I upgrade from 9.10 to 10.04.

Thomas.

Revision history for this message
nico.coenen (nico-coenen) wrote :

 I'm affected too but in my case I upgrade from 9.10 to 10.04.

nico

Revision history for this message
Pedro Monteiro (regie) wrote :

I'm affected, but my 9.10 -> 10.04 upgrade will not proceed. I'm stuck on the screen:
" Configuring bacula-director-mysql"

with the following error:
"An error occurred while upgrading the database:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket \u2592
'/var/run/mysqld/mysqld.sock' (2) "

The problem is that there is an <OK> prompt in the Ubuntu "Distribution Upgrade" terminal window, but it is unresponsive, so I cannot complete the 10.04 upgrade, even if I chose to ignore bacula. Are there any work-arounds so that I can finish the rest of the 10.04 upgrade?

Revision history for this message
Ariel Wainer (ariel-cafelug) wrote :

I confirm this bug using Postgres when upgrading from 8.04 to 10.04.

Revision history for this message
Mads Bennedbæk (mads-bennedbaek) wrote :

I confirm this bug using postgresql, upgrading from 9.10 to 10.04.

Revision history for this message
Sam (samuel-hameau) wrote :

Upgrade from karmic to lucid, using mysql : the karmic db version was 10, and the upgrade script try and fails to upgrade database from version 11 to version 12.

Revision history for this message
PeterNSteinmetz (ndoc2) wrote :

Also just affected me on upgrade from karmic to lucid, using mysql. This just cost me a couple of hours, so I definitely vote in favor of having this handled properly during upgrade, especially as it affects LTS->LTS upgrades.

Revision history for this message
Joni-Pekka Kurronen (joni-kurronen) wrote :

hi,

Same here 11.10 to 12.4 upgrade,... SQL version nalso must change in this transition,..
 dose not help dumping and reloading,...

Revision history for this message
Kern Sibbald (kern) wrote :

It looks like the Bacula version has changed between LTS versions, and in the change, the Bacula catalog
database changed format, so it has a new version number. Updating the Bacula catalog is done automatically
in rpms, but probably not in .debs. You must apply an update script that you can find in the <bacula>/src/cats directory
or in the <bacula>/updatedb directory. Sometimes the updatedb is package separately.

Actually, it looks like you need to apply two update scripts. One goes from 10 to 11 and the second from 11 to 12.
Of course, that all depends on the Bacula version you are starting from and the one you are going to. Normally,
if one upgrades each major bacula version (change in second digit of version), you will move only one database
version at a time.

You might ask packagers to include the update procedure automatically when installing new packages.
It is a lot more user friendly.

Revision history for this message
Joni-Pekka Kurronen (joni-kurronen) wrote :

hi,

Ubuntu 11.10 to 12.4, MySQL 5.0.0 changed to 5.2

My solution was to:
To dump old bacula db's to text file
>mysqldump -u bacula -p --database bacula > bacula.txt
>mysql -u bacula -p < bacula.txt

Then update version:
>cd /usr/share/bacula-director

>gedit update_mysql_tables
and chaged line to db_name=bacula

Then save and start upgrade scrip:
>./update_mysql_tables -u bacula -p

Boot computer or re-start bacula.

Revision history for this message
Brad Figg (brad-figg) wrote : Missing required logs.

This bug is missing log files that will aid in diagnosing the problem. From a terminal window please run:

apport-collect 579924

and then change the status of the bug to 'Confirmed'.

If, due to the nature of the issue you have encountered, you are unable to run this command, please add a comment stating that fact and change the bug status to 'Confirmed'.

This change has been made by an automated script, maintained by the Ubuntu Kernel Team.

Changed in linux (Ubuntu):
status: New → Incomplete
Revision history for this message
Martin (martin-planet-renner) wrote :

I am a litte bit surprised: Bacula is NOT an universe package and a LTS to LTS upgrade is broken (8.04 to 10.04). But noone takes care of this issue - even after 2 years.......

And yes, I am affected by this problem: An upgrade from 8.04 to 10.04 does not work as expected.

Revision history for this message
Kern Sibbald (kern) wrote : Re: [Bug 579924] Re: Upgrading Ubuntu LTS skips database version - Fatal error: Version error for database "bacula". Wanted 12, got 10

Hello,

Disclaimer: I don't have anything to do with LTS (other than I develop on a
Ubuntu system), so I cannot resolve the Ubuntu problem.

However, I suggest you download the source, either from the Ubuntu
source or from Source Forge and look in the updatedb directory. It has
all the scripts you need to go from one version to the next. Note, there
may be more than one script that needs to be applied depending on what
Bacula versions involved. In your case, I imagine you must apply the
10_to_11 script, and then the 11_to_12 script, so that the database
will be upgraded from version 10 to 11 then from 11 to 12. The text in
the script
tells you what Bacula versions the upgrade corresponds to.

Best regards,
Kern

On 04/19/2012 10:21 PM, Martin wrote:
> I am a litte bit surprised: Bacula is NOT an universe package and a LTS
> to LTS upgrade is broken (8.04 to 10.04). But noone takes care of this
> issue - even after 2 years.......
>
> And yes, I am affected by this problem: An upgrade from 8.04 to 10.04
> does not work as expected.
>

James Page (james-page)
no longer affects: linux (Ubuntu)
Changed in bacula:
status: New → Invalid
Revision history for this message
James Page (james-page) wrote :

As this bug is still being updated with comments I'm assuming its still impacting people.

I took a look at the bacula packages in Lucid - they should be using dbconfig-common to do DB upgrades during packaging upgrade and I can see the required update scripts at version 3.0.0 (version 11) and 5.0.0 (version 12).

So I'm a little mystified as to why this is not happening automatically.

I'll do some more investigation.

Revision history for this message
James Page (james-page) wrote :

Setting up bacula-director-mysql (5.0.1-1ubuntu1) ...
Installing new version of config file /etc/bacula/scripts/delete_catalog_backup ...
Installing new version of config file /etc/bacula/scripts/make_catalog_backup ...
debconf: Unknown template field '_description', in stanza #9 of /var/lib/dpkg/info/bacula-director-mysql.templates

dbconfig-common: writing config to /etc/dbconfig-common/bacula-director-mysql.conf

Creating config file /etc/dbconfig-common/bacula-director-mysql.conf with new version
creating database backup in /var/cache/dbconfig-common/backups/bacula-director-mysql_2.2.8-5ubuntu7.2.mysql.
applying upgrade sql for 2.2.8-5ubuntu7.2 -> 3.0.0.
applying upgrade script for 2.2.8-5ubuntu7.2 -> 5.0.0.
Found column Stripe in JobMedia; removing.
applying upgrade sql for 2.2.8-5ubuntu7.2 -> 5.0.0.
dbconfig-common: flushing administrative password
 * Stopping Bacula Director... [ OK ]
Processing configuration...Ok.
 * Starting Bacula Director... [ OK ]

Revision history for this message
James Page (james-page) wrote :

The output in #20 was an upgrade from 8.04 to 10.04.

I was prompted during upgrade as to whether I wanted to configure the database using dbconfig-common; to which I said yes and then provided the required details in terms of passwords.

AFAICT the bacula director seem to be functional post upgrade and I validated that the database had actually been upgraded:

mysql> select * from Version;
+-----------+
| VersionId |
+-----------+
| 12 |
+-----------+
1 row in set (0.00 sec)

mysql>

Are users who are seeing this issue allowing dbconfig-common to upgrade the database during upgrade?

Revision history for this message
Kern Sibbald (kern) wrote :

Hello,

The upgrade scripts used to update from one Bacula DB schema to
the next are kept in <bacula-src>/src/cats and have names that begin
with update_ There is one main script named update_bacula_tables
(build during the ./configure command from update_bacula_tables.in).
This script then calls the appropriate SQL backend script (e.g.
update_postgresql_tables to actually do the schema modifications.

That script must be called when installing a new version of Bacula
AND when the database changes (normally only during major version
changes). The rpm .spec files distributed with the project automatically
call the script when needed, but we do not have .deb scripts, so that
must be done by each packager (e.g. Ubuntu).

That part is fairly straight forward.

However, if you are updating Bacula and going from say version 1.38
to version 5.2.x, you may have several DB updates to make. These must
be done one at a time, which can be slightly painful to know exactly which
scripts need to be called. So to make packagers jobs a bit easier we
supply a directory <bacula-src>/updatedb that has all the scripts necessary
to upgrade from one DB version to the next (it may not have the very
latest upgrade which is in src/cats). If you look in that directory and
read the README file, you should be able to figure out what needs to be
done. Also looking at the comments at the top of the upgrade scripts
you will probably see what Bacula versions correspond to what DB versions.

In the error message included in your subject line, it looks like the
prior version
of Bacula was running version 10 of the database schema, and the new version
of Bacula that was loaded wants DB version 12. This means that the upgrade
script from 10_to_11 must be applied followed by the script from 11_to_12.

I hope this explanation helps.

Best regards,
Kern

On 08/30/2012 05:38 PM, James Page wrote:
> As this bug is still being updated with comments I'm assuming its still
> impacting people.
>
> I took a look at the bacula packages in Lucid - they should be using
> dbconfig-common to do DB upgrades during packaging upgrade and I can see
> the required update scripts at version 3.0.0 (version 11) and 5.0.0
> (version 12).
>
> So I'm a little mystified as to why this is not happening automatically.
>
> I'll do some more investigation.
>

Revision history for this message
James Page (james-page) wrote :

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Hi Kern

On 30/08/12 17:20, Kern Sibbald wrote:
> However, if you are updating Bacula and going from say version
> 1.38 to version 5.2.x, you may have several DB updates to make.
> These must be done one at a time, which can be slightly painful to
> know exactly which scripts need to be called. So to make packagers
> jobs a bit easier we supply a directory <bacula-src>/updatedb that
> has all the scripts necessary to upgrade from one DB version to the
> next (it may not have the very latest upgrade which is in
> src/cats). If you look in that directory and read the README file,
> you should be able to figure out what needs to be done. Also
> looking at the comments at the top of the upgrade scripts you will
> probably see what Bacula versions correspond to what DB versions.

Thanks for the explanation; I've familiar with the DB upgrade process
(having just fixed it for 12.04) hence why I'm looking at this bug as
well.

So long as you use the dbconfig-common option to configure the
database then the bacula database is upgraded from version 10 -> 11 ->
12 - so the packaging does take this into account.

- --
James Page
Ubuntu Core Developer
Debian Maintainer
<email address hidden>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://www.enigmail.net/

iQIcBAEBCAAGBQJQP5fAAAoJEL/srsug59jDH1MP/R97LlI4C0t9n+j4c454Z8xf
GwFRCfapy+mXXc7exaoLq2T336fhT2VjVj5qobGX2ufbVOelchBLPQ/NpqM6fEtr
U6KHG+mKPItzEsY5jaLnuN/BRpLbfet+lg2iDf/4mhxuXv7qIpcDMt1XNYmm6AOa
aaLG4ja3pYmMo+Vxh+hArf8Oh4SFLgcv7YdBwBYPm7QTuvO2bHqQTYKPI2dCGMxP
gndqqYQYGFcGuHRqO2Z3JleFkaD2zDPWbEjynPmr70Xr+xu7RAlIarI9Z7B5hn5e
YDjUVU19v6GwOGV6fzRL/jD3qC0CYXCU5LcsdFH1v/gDctf0byQYwwdic1jLjiIU
iFk3RxVaG/4zYomVEp4Fa1oGg7jYQimz33e8H5D1jVQhPMqcbJHvSe1nhoSN/B0h
89m2s8FFkbZa+eZdN+i85yuGTsBEenRJ7Xli2pdCrcQ32l6ZbUDYE9OEaBkkmWbv
i1KBZy5CpObWyk9ZrQLuAHsZC3jHJwW8t5KvsiqKRIkEnn1Tbefse/9aZZh0FgXm
RXALjhFaOWNWTVQ/i18ilQbQquyYd8AoDmB4RuNXHf6OG/StHgoIB6BGzXt3afPG
HKAMRB+tyYexcKSdGVka/12dcTx/S7tU7UKmvBWNCG0gZa86I4eDgN8JvEjT9i9w
jOe9k5Gq21+yUTRiT/7U
=qKaP
-----END PGP SIGNATURE-----

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.