Backup of Bacula's MySQL catalog fails

Bug #207527 reported by Stuart Griffith
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
bacula (Ubuntu)
Fix Released
Undecided
Unassigned

Bug Description

Binary package hint: bacula-director-mysql

Ubuntu release: Hardy Heron beta, all updates up to 2008-03-26
Package: bacula-director-mysql 2.2.8-5ubuntu4

I encountered the following problems that caused catalog backups to fail:
* The make_catalog_backup_awk script uses the gensub function, but gensub is not included in mawk which was the awk package that was installed by default. -- Installed gawk.
* In the make_catalog_backup_awk script there is an if statement, "if (catname == cat1 || catname == cat2 || catname == cat3 || catname == cat4)" that guards the creation of .my.cnf and execution of mysqldump. On my system cat1 had the value "<CatalogName>" and catname had the value "MyCatalog" so the configuration file was never created and mysqldump never executed. -- Commented out the if statement.
* The mysqldump command failed with an authorization error because nothing connected it to the .my.cnf file that contained the user name and password. -- Added "--defaults-file=/var/lib/bacula/.my.cnf" to the mysqldump command in make_catalog_backup_awk.

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package bacula - 2.2.8-5ubuntu5

---------------
bacula (2.2.8-5ubuntu5) hardy; urgency=low

  * debian/control
    - Add gawk if isnt installed. (LP: #207527)

 -- Chuck Short <email address hidden> Fri, 28 Mar 2008 15:08:02 -0400

Changed in bacula:
status: New → Fix Released
Revision history for this message
Stuart Griffith (stuartg-littlefieldhouse) wrote : Re: [Bug 207527] Re: Backup of Bacula's MySQL catalog fails

I got the update to bacula 2.2.8-5ubuntu5, but have not found any
indication of fixes for the second and third points of my bug report.

What was done to satisfy the if statement in the
"make_catalog_backup_awk" script so it would do the dump?

What was done so the mysqldump command would use the credentials in
the .my.cnf file?

Stuart Griffith

On Fri, 2008-03-28 at 19:15 +0000, Launchpad Bug Tracker wrote:
> This bug was fixed in the package bacula - 2.2.8-5ubuntu5
>
> ---------------
> bacula (2.2.8-5ubuntu5) hardy; urgency=low
>
> * debian/control
> - Add gawk if isnt installed. (LP: #207527)
>
> -- Chuck Short <email address hidden> Fri, 28 Mar 2008 15:08:02 -0400
>
> ** Changed in: bacula (Ubuntu)
> Status: New => Fix Released
>

Revision history for this message
Ante Karamatić (ivoks) wrote :

"* In the make_catalog_backup_awk script there is an if statement, "if (catname == cat1 || catname == cat2 || catname == cat3 || catname == cat4)" that guards the creation of .my.cnf and execution of mysqldump. On my system cat1 had the value "<CatalogName>" and catname had the value "MyCatalog" so the configuration file was never created and mysqldump never executed. -- Commented out the if statement."

You should replace <CatalogName> with the name of the catalog in your configuration, which is, if I understand you correctly, MyCatalog. You have to configure RunBeforeJob correctly, before you use it.

RunBeforeJob runs as 'bacula' user. Home of that user is /var/lib/bacula. mysql client reads ~/.my.cnf, which in case of bacula user is /var/lib/bacula. If you run it as root, it would appear that it doesn't work. Beside that, you'll have problems with root-owned files in /var/lib/bacula.

Revision history for this message
Stuart Griffith (stuartg-littlefieldhouse) wrote :

Thank you for clearing these up.

I didn't see anywhere that indicated that I needed to change the
RunBeforeJob. This is not something I have had to do before with Bacula.

Stuart

On Tue, 2008-04-01 at 15:12 +0000, Ante Karamatić wrote:
> "* In the make_catalog_backup_awk script there is an if statement, "if
> (catname == cat1 || catname == cat2 || catname == cat3 || catname ==
> cat4)" that guards the creation of .my.cnf and execution of mysqldump.
> On my system cat1 had the value "<CatalogName>" and catname had the
> value "MyCatalog" so the configuration file was never created and
> mysqldump never executed. -- Commented out the if statement."
>
> You should replace <CatalogName> with the name of the catalog in your
> configuration, which is, if I understand you correctly, MyCatalog. You
> have to configure RunBeforeJob correctly, before you use it.
>
> RunBeforeJob runs as 'bacula' user. Home of that user is
> /var/lib/bacula. mysql client reads ~/.my.cnf, which in case of bacula
> user is /var/lib/bacula. If you run it as root, it would appear that it
> doesn't work. Beside that, you'll have problems with root-owned files in
> /var/lib/bacula.
>

Revision history for this message
Ante Karamatić (ivoks) wrote :

On Wed, 02 Apr 2008 01:18:49 -0000
Stuart Griffith <email address hidden> wrote:

> I didn't see anywhere that indicated that I needed to change the
> RunBeforeJob. This is not something I have had to do before with
> Bacula.

Maybe you don't remember, but you had to insert username and password
of a DB user:

RunBeforeJob = "/etc/bacula/scripts/make_catalog_backup -u<username> -p<password>"

Anyway, in next upload, I'll add a comment about what's needed to make
it functional.

Revision history for this message
Stuart Griffith (stuartg-littlefieldhouse) wrote :

Actually, I didn't insert the username and password. When I did the
initial install of the Bacula packages a dialog came up asking for that
information. Since I didn't enter the values directly into the file I'm
assuming that whatever put up that dialog did. It's possible that I
clicked right through the question asking for the DB name.

I'd like to take advantage of this ongoing conversation to say that,
even though there have been a couple minor rocks in the road, I was
really happy to see the Bacula packages in the Ubuntu repository, and
that they were the current versions. I have been using Bacula for a few
years and it was nice to be able to just click on the packages and port
over my configuration.

Stuart

On Wed, 2008-04-02 at 05:44 +0000, Ante Karamatić wrote:
> On Wed, 02 Apr 2008 01:18:49 -0000
> Stuart Griffith <email address hidden> wrote:
>
> > I didn't see anywhere that indicated that I needed to change the
> > RunBeforeJob. This is not something I have had to do before with
> > Bacula.
>
> Maybe you don't remember, but you had to insert username and password
> of a DB user:
>
> RunBeforeJob = "/etc/bacula/scripts/make_catalog_backup -u<username>
> -p<password>"
>
> Anyway, in next upload, I'll add a comment about what's needed to make
> it functional.
>

Revision history for this message
Hanno Stock (hefe_bia) (hanno-stock) wrote :

I am still experiencing the last issue mentioned in the original bug report. I have reported this as a new bug. (See bug #227410)

Revision history for this message
Tomse (tomse-tomse) wrote :

this is once again an issue due to the upgrade to Bacula 5.

it helps just to install gawk

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

Other bug subscribers

Remote bug watches

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