[SRU] catalog Backup fails because .my.cnf is not read

Bug #227410 reported by Hanno Stock (hefe_bia)
8
Affects Status Importance Assigned to Milestone
bacula (Ubuntu)
Fix Released
Medium
Chuck Short
Declined for Intrepid by Mathias Gug
Hardy
Fix Released
Undecided
Unassigned
Jaunty
Fix Released
Medium
Chuck Short

Bug Description

Binary package hint: bacula

Actually this is the last point of the original report of bug #207527.
I am opening this as a new bug report, since the other issues of bug #207527 appear to be fixed.

This is on version 2.2.8-5ubuntu7.

When running the BackupCatalog job, I get the following error:

06-Mai 18:27 baculatestsrv-dir JobId 17: BeforeJob: run command "/usr/bin/awk -f /etc/bacula/scripts/make_catalog_backup_awk -v cat1=MyCatalog /etc/bacula/bacula-dir.conf"
06-Mai 18:27 baculatestsrv-dir JobId 17: BeforeJob: mysqldump: Got error: 1045: Access denied for user 'bacula'@'localhost' (using password: NO) when trying to connect

It seems that .my.cnf is not read, since the command is not executed in a login shell and HOME is not set.

I was able to get the backup running by specifying HOME in the mysqldump command (see attached patch).

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

This is with version 2.2.8-5ubuntu7 on Hardy. (Forgot to mention this in the previous post)

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

Well, that script is running as bacula user. Check your bacula user, it should have /var/lib/bacula as $HOME.

Changed in bacula:
importance: Undecided → Medium
status: New → Triaged
Revision history for this message
Hanno Stock (hefe_bia) (hanno-stock) wrote :

From /etc/passwd:

bacula:x:105:113:Bacula:/var/lib/bacula:/bin/false

But AFAIK running a command in the security context of a user does not automatically set the home directory.

BTW: I have a fairly clean install of Hardy, since this is a VM specifically set up for testing bacula before using it for production.

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

Urgh... True. Bug confirmed. Thanks!

Changed in bacula:
status: Triaged → Confirmed
Revision history for this message
Ante Karamatić (ivoks) wrote :

I'm testing debdiff (both sqlite and pgsql versions of script have same problems) and if everything goes well, I'll request SRU for it.

Revision history for this message
Hauke Smit (hsmit) wrote :

I've added '--defaults-file=/var/lib/bacula/.my.cnf' to the mysqldump:

--- /etc/bacula/scripts/make_catalog_backup_awk.dist 2008-05-16 09:08:14.000000000 +0200
+++ /etc/bacula/scripts/make_catalog_backup_awk 2008-05-16 09:04:48.000000000 +0200
@@ -48,6 +48,6 @@
                        printf " port=%s\n",dbport >> "/var/lib/bacula/.my.cnf"
                if (dbsocket != "")
                        printf " socket=%s\n",dbsocket >> "/var/lib/bacula/.my.cnf"
- system(sprintf ("mysqldump %s > /var/lib/bacula/bacula.sql",dbname))
+ system(sprintf ("mysqldump --defaults-file=/var/lib/bacula/.my.cnf %s > /var/lib/bacula/bacula.sql",dbname))
        }
 }

Ante Karamatić (ivoks)
Changed in bacula:
status: Confirmed → In Progress
Revision history for this message
Chuck Short (zulcss) wrote :

This is due to a typo in the script that generates the bacula databases. This debdiff fixes the issue:

TEST CASE:

1. Enable the hardy-proposed repository.
2. Install bacula
3. Try creating the bacula databases
4. Make sure you dont get the bacula error message as below.

There should not be any regressions from the debdiff

Revision history for this message
Chuck Short (zulcss) wrote :
Revision history for this message
Martin Pitt (pitti) wrote :

Accepted into -proposed, please test and give feedback here

Changed in bacula:
status: New → Fix Committed
Revision history for this message
Hanno Stock (hefe_bia) (hanno-stock) wrote :

I upgraded my server to the version from hardy-proposed. Since the new make_catalog_backup_awk has exactly the same modifications as I already had made, catalog backup works fine.

Also the other changes in the package don't seem to cause any regressions. Note that however I upgraded an existing installation and did not try to install from scratch.

description: updated
Revision history for this message
Darren Faulke (darren-alidaf) wrote :

I tried upgrading to hardy-proposed and it killed bacula completely. I have gone back to the original version and have it working bar this bug. How do I use the diff file to patch?

Revision history for this message
Ante Karamatić (ivoks) wrote : Re: [Bug 227410] Re: [SRU] catalog Backup fails because .my.cnf is not read

On Mon, 21 Jul 2008 09:51:15 -0000
alidaf <email address hidden> wrote:

> I tried upgrading to hardy-proposed and it killed bacula completely.
> I have gone back to the original version and have it working bar this
> bug. How do I use the diff file to patch?

Killed in what way? If you apply this patch, you'll get exactly the
same bacula as from proposed repository, so it won't help.

Revision history for this message
Darren Faulke (darren-alidaf) wrote : ***Spam***Re: [Bug 227410] Re: [SRU] catalog Backup fails because .my.cnf is not read

Thanks for you reply.

I have fixed it now by applying the patch by hand.

FYI After adding the hardy-proposed to my sources.list and running apt-get update and apt-get upgrade ubuntu it only upgraded mysql. I couldn't connect to the director. I uninstalled mysql and ubuntu, removed proposed and re-installed, reconfigured and applied the patch. Its working again now thanks.

Regards

Darren

----- Original Message -----
From: "Ante Karamatić" <email address hidden>
To: "darren faulke" <email address hidden>
Sent: Monday, 21 July, 2008 11:10:47 AM GMT +00:00 GMT Britain, Ireland, Portugal
Subject: Re: [Bug 227410] Re: [SRU] catalog Backup fails because .my.cnf is not read

On Mon, 21 Jul 2008 09:51:15 -0000
alidaf <email address hidden> wrote:

> I tried upgrading to hardy-proposed and it killed bacula completely.
> I have gone back to the original version and have it working bar this
> bug. How do I use the diff file to patch?

Killed in what way? If you apply this patch, you'll get exactly the
same bacula as from proposed repository, so it won't help.

--
[SRU] catalog Backup fails because .my.cnf is not read
https://bugs.launchpad.net/bugs/227410
You received this bug notification because you are a direct subscriber
of the bug.

Status in “bacula” source package in Ubuntu: In Progress
Status in bacula in Ubuntu Hardy: Fix Committed

Bug description:
Binary package hint: bacula

Actually this is the last point of the original report of bug #207527.
I am opening this as a new bug report, since the other issues of bug #207527 appear to be fixed.

This is on version 2.2.8-5ubuntu7.

When running the BackupCatalog job, I get the following error:

06-Mai 18:27 baculatestsrv-dir JobId 17: BeforeJob: run command "/usr/bin/awk -f /etc/bacula/scripts/make_catalog_backup_awk -v cat1=MyCatalog /etc/bacula/bacula-dir.conf"
06-Mai 18:27 baculatestsrv-dir JobId 17: BeforeJob: mysqldump: Got error: 1045: Access denied for user 'bacula'@'localhost' (using password: NO) when trying to connect

It seems that .my.cnf is not read, since the command is not executed in a login shell and HOME is not set.

I was able to get the backup running by specifying HOME in the mysqldump command (see attached patch).

Revision history for this message
Martin Pitt (pitti) wrote :

Accepted into hardy-proposed, please test and give feedback here. Please see https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Thank you in advance!

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

True, this is fixed only for hardy.

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

Martin, reported reported that version from proposed works for him:

https://bugs.edge.launchpad.net/ubuntu/+source/bacula/+bug/227410/comments/11

Could we get verification-done tag?

Revision history for this message
Martin Pitt (pitti) wrote :

Please get this fixed in Jaunty ASAP.

Changed in bacula:
assignee: nobody → zulcss
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package bacula - 2.2.8-5ubuntu7.2

---------------
bacula (2.2.8-5ubuntu7.2) hardy-proposed; urgency=low

  * Applied upstream's 2.2.8-strippath.patch, modified to compile
    cleanly on hardy. (http://bacula.svn.sourceforge.net/viewvc/bacula?view=rev&revision=6867)
    - Fix strippath bug that created a buffer overrun and crash the FD.
     (LP: #227613)

  [Ante Karamatic]
  * Export $HOME in /etc/bacula/scripts/make_catalog_backup_awk.
    - Thanks to Hanno Stock. (LP: #227410)
  * debian/bacula-director-pgsql.postinst
    - Really compare versions. (LP: #228693)
  * debian/bacula-directory-pgsql.postinst:
    - grant all privileges to new user on the new new database.
  * patches/ubuntu_grant_privileges.patch
    - test if $USER and $db_name are set in grant_postgresql_privileges.

 -- Chuck Short <email address hidden> Fri, 21 Nov 2008 08:15:06 -0500

Changed in bacula:
status: Fix Committed → Fix Released
Revision history for this message
Mathias Gug (mathiaz) wrote :

HOME is exported in /etc/bacula/scripts/make_catalog_backup_awk.{mysql,psql}.

Marking Fix Released.

Changed in bacula:
status: In Progress → Fix Released
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.