Bacula Catalog Backup Failure (Postgresql Database)

Overview

Bacula catalog service uses a database back-end to keep tack of the backup jobs by storing such information as names of archived files, their locations, dates and clients. When you are backing up the catalog, you are essentially saving a copy of the database.

The catalog backup job invokes a Bacula script which uses an external tool specific to the back-end to dump the entire database. Lack of proper access permissions for the user could result in the failure of the tool, the script and ultimately the backup job.

Symptoms

I came across this issue recently when backing up the catalog following a PostgreSQL server upgrade. Below are the main parts of error messages as observed on bconsole and in bacula.log. Note that, in case of PostgreSQL, the backup tool is pg_dump.

pg_dump: [archiver (db)] query failed: ERROR:  permission denied for relation snapshot
pg_dump: [archiver (db)] query was: LOCK TABLE public.snapshot IN ACCESS SHARE MODE

Resolution

Modify and run the Bacula grant_postgresql_privileges script. On my Debian system, the script is located at:

/usr/share/bacula-director/grant_postgresql_privileges

There are three parameters to be changed:

db_user=<bacula_db_user>
db_name=<bacula_db_name>
db_password=<bacula_db_password>

The script asks for your PostgreSQL user password when you run it.

Environment

Date: July 2016
Operating System: Debian Testing (Stretch)
Bacula: bacula-director-pgsql 7.4.1~dfsg-1
PostgreSQL: postgresql-9.4 9.4.5-2

About organiclinux

Linux and cloud technologist
This entry was posted in Database. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s