DB Issue Upgrading to Bareos 21

676 views
Skip to first unread message

Jim Oltman

unread,
Feb 20, 2022, 3:57:31 PM2/20/22
to bareos-users
I'm running Barcus Bareos DIR/FD/WebUI docker containers.  It took me a bit, but I think I was able to migrate to PostgreSQL from my MariaDB.  I'm currently running the 20-ubuntu tag from Barcus, which appears to be PostgreSQL only.  When I move to the "latest" tag (Bareos 21 with Ubuntu) the director container never starts up and is constantly restarting (I have restart set to always in the docker-compose file).  These are the errors I see in the docker log for the Director container:

Waiting for postgresql...
bareos-db:5432 - accepting connections
...postgresql is alive
bareos-dir: dird/check_catalog.cc:64-0 Could not open Catalog "MyCatalog", database "bareos".
bareos-dir: dird/check_catalog.cc:71-0 Version error for database "bareos". Wanted 2210, got 2192
bareos-dir ERROR TERMINATION
Please correct the configuration in /etc/bareos/bareos-dir.d/*/*.conf

For reference, bareos-db is another docker container running postgres 9.3 from their official docker hub.  The old MariaDB container was named "mariadb".  In the docker-compose file, I have the DB_UDPATE=TRUE.  I'm not seeing anything in the 21 release notes mentioning a DB schema update.

This is the MyCatalog.conf file:

Catalog {
  Name = MyCatalog
  #dbdriver = "sqlite3"
  DB Name = bareos
  DB Address = "bareos-db"
  DB Port = "5432"
  DB User = postgres
  DB Password = "PASSWORD"
}

Here is the bareos-dir.conf:

Director {                            # define myself
  Name = bareos-dir
  QueryFile = "/usr/lib/bareos/scripts/query.sql"
  Maximum Concurrent Jobs = 10
  Password = "PASSWORD"         # Console password
  Messages = Daemon
  Auditing = yes
}

Any assistance would be appreciated.  Thanks.

Jim

Andreas Rogge

unread,
Feb 22, 2022, 9:02:11 AM2/22/22
to bareos...@googlegroups.com
Hi Jim,

you need to run the schema-upgrade-scripts on your database.
See
https://docs.bareos.org/IntroductionAndTutorial/UpdatingBareos.html#updating-the-database-scheme

I don't know if Barcus' Director-Image has a switch to do that
automatically...

Best Regards,
Andreas

Am 20.02.22 um 21:57 schrieb Jim Oltman:
> --
> You received this message because you are subscribed to the Google
> Groups "bareos-users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to bareos-users...@googlegroups.com
> <mailto:bareos-users...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/bareos-users/d16c2315-9c65-4533-abc8-0787468cda90n%40googlegroups.com
> <https://groups.google.com/d/msgid/bareos-users/d16c2315-9c65-4533-abc8-0787468cda90n%40googlegroups.com?utm_medium=email&utm_source=footer>.

--
Andreas Rogge andrea...@bareos.com
Bareos GmbH & Co. KG Phone: +49 221-630693-86
http://www.bareos.com

Sitz der Gesellschaft: Köln | Amtsgericht Köln: HRA 29646
Komplementär: Bareos Verwaltungs-GmbH
Geschäftsführer: S. Dühr, M. Außendorf, J. Steffens, Philipp Storz

Jim Oltman

unread,
Feb 22, 2022, 10:18:48 AM2/22/22
to Andreas Rogge, bareos...@googlegroups.com
It does, hence the reason for my question.  Will Bareos 20 flip out once I upgrade the schema?  I will certainly stop the director service before the upgrade. I'm assuming it can't start up again after the upgrade?  I'll have to migrate straight to 21?  Thanks!

To unsubscribe from this group and stop receiving emails from it, send an email to bareos-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/bareos-users/4bc04af5-d715-26e0-1292-3191b6fe83bc%40bareos.com.

Andreas Rogge

unread,
Feb 22, 2022, 10:39:45 AM2/22/22
to Jim Oltman, bareos...@googlegroups.com
Am 22.02.22 um 16:18 schrieb Jim Oltman:
> It does, hence the reason for my question.  Will Bareos 20 flip out once
> I upgrade the schema?  I will certainly stop the director service before
> the upgrade. I'm assuming it can't start up again after the upgrade?
> I'll have to migrate straight to 21?  Thanks!

Once you upgrade your catalog to the new DB schema version, you cannot
use it with an older director version.
You can keep a backup of the older version and - if you're fluent in SQL
- you could manually undo the schema changes (they're rather trivial in
this case) and run the older version again.

Keep in mind that you'll need to upgrade the SD together with the
Director. The Filedaemon can be older: In Bareos 21 we would support
down to Bareos 19.2 Filedaemon. However, the Filedaemon from Bareos 16.2
is known to still work with Bareos 21 Director/SD.

Hope that helps!

Best Regards,
Andreas

Jim Oltman

unread,
Feb 22, 2022, 1:40:35 PM2/22/22
to Andreas Rogge, bareos...@googlegroups.com
I asked my question incorrectly.  Sorry about that!  Would I be correct in saying I can only upgrade the schema on the Bareos 21 install?  I would have to jump up to Barcus' Bareos 21 version then run the upgrade_database_tables then the grant_permissions scripts?  If that's the case, then that's the root of my problem.  Anytime I try to upgrade to director 21, the director container keeps restarting and I can never get a /bin/bash prompt in the container.  Or should I download the scripts from the Bareos 21 repo and get them on the 20 container and run them, then upgrade to 21 after the script is done?  Thanks!

Jim

Jim Oltman

unread,
Feb 22, 2022, 5:31:19 PM2/22/22
to bareos...@googlegroups.com

Once you upgrade your catalog to the new DB schema version, you cannot
use it with an older director version.
You can keep a backup of the older version and - if you're fluent in SQL
- you could manually undo the schema changes (they're rather trivial in
this case) and run the older version again.

Keep in mind that you'll need to upgrade the SD together with the
Director. The Filedaemon can be older: In Bareos 21 we would support
down to Bareos 19.2 Filedaemon. However, the Filedaemon from Bareos 16.2
is known to still work with Bareos 21 Director/SD.

Hope that helps!

Best Regards,
Andreas


So I took some other advice from another user.  I copied the update_bareos_tables and bareos-config-lib.sh files from the Bareos 21 container and moved them into the PostgreSQL container and tried running them.  This is what I received:

postgres@2217f02bb475:/usr/lib/bareos/scripts$ ./update_bareos_tables --db bareos
Updating postgresql tables
Don't know how to upgrade from version 2192 to 2210

I'm still at a loss here.  I'd appreciate any guidance.  Thank you!

Jim

Jim Oltman

unread,
Feb 22, 2022, 5:39:09 PM2/22/22
to bareos...@googlegroups.com
So I took some other advice from another user.  I copied the update_bareos_tables and bareos-config-lib.sh files from the Bareos 21 container and moved them into the PostgreSQL container and tried running them.  This is what I received:

postgres@2217f02bb475:/usr/lib/bareos/scripts$ ./update_bareos_tables --db bareos
Updating postgresql tables
Don't know how to upgrade from version 2192 to 2210

I'm still at a loss here.  I'd appreciate any guidance.  Thank you!

OK, so I tried copying the whole folder instead of those 2 scripts.  I then ran the script from inside PostgreSQL.  The tables updated!  I was able then able to start the director correctly.  There must be some issue with the docker-compose commands listed in the Github project.  I'll open an issue there.  Thanks for the advice, all!

Jim

Andreas Rogge

unread,
Feb 23, 2022, 4:13:54 AM2/23/22
to Jim Oltman, bareos...@googlegroups.com
Am 22.02.22 um 19:40 schrieb Jim Oltman:
> I asked my question incorrectly.  Sorry about that!  Would I be correct
> in saying I can only upgrade the schema on the Bareos 21 install?  I
> would have to jump up to Barcus' Bareos 21 version then run the
> upgrade_database_tables then the grant_permissions scripts?  If that's
> the case, then that's the root of my problem.  Anytime I try to upgrade
> to director 21, the director container keeps restarting and I can never
> get a /bin/bash prompt in the container.  Or should I download the
> scripts from the Bareos 21 repo and get them on the 20 container and run
> them, then upgrade to 21 after the script is done?  Thanks!

Usually containers have some way to do the upgrade procedure. I guess
Barcus probably provides an option for that. However, I haven't tried
running Bareos with Barcus yet, so I don't know how it is supposed to work.
Reply all
Reply to author
Forward
0 new messages