[SRU] bacula-director-pgsql postinstall broken

Bug #228693 reported by Brian Koebbe
16
This bug affects 1 person
Affects Status Importance Assigned to Milestone
bacula (Ubuntu)
Fix Released
Medium
Unassigned
Hardy
Fix Released
Medium
Chuck Short
Intrepid
Fix Released
Medium
Unassigned

Bug Description

Binary package hint: bacula-director-pgsql

The install of bacula-director-pgsql (2.2.8-5ubuntu7) on Hardy is failing with the following message:

# apt-get install bacula-director-pgsql
....
Unpacking bacula-director-pgsql (from .../bacula-director-pgsql_2.2.8-5ubuntu7_amd64.deb) ...
Setting up bacula-director-pgsql (2.2.8-5ubuntu7) ...
dpkg: --compare-versions takes three arguments: <version> <relation> <version>
....
....
....

It looks like maybe in bacula-director-pgsql.postinst:

  if dpkg --compare-versions lt 2.2.8-5ubuntu1

should be:

  if dpkg --compare-versions "$2" lt 2.2.8-5ubuntu1

At least that's what it looks like in bacula-director-mysql.postinst

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

Thanks for the bug report I have it fixed locally will be uploading soonish.

chuck

Changed in bacula:
status: New → In Progress
Revision history for this message
Mathias Gug (mathiaz) wrote : Re: [Bug 228693] [NEW] bacula-director-pgsql postinstall broken

On Fri, May 09, 2008 at 02:29:46PM -0000, Brian Koebbe wrote:

  status triaged
  importance medium

--
Mathias Gug
Ubuntu Developer http://www.ubuntu.com

Changed in bacula:
importance: Undecided → Medium
status: In Progress → Triaged
Steve Langasek (vorlon)
Changed in bacula:
importance: Undecided → Medium
milestone: none → ubuntu-8.04.1
status: New → Triaged
Ante Karamatić (ivoks)
Changed in bacula:
status: Triaged → In Progress
Revision history for this message
Chuck Short (zulcss) wrote :

This is due to a typo in the postinst file. I have attached the debdiff for your review.

TEST CASE:

1. Enable the hardy-proposed repository.
2. Run the following command: apt-get install bacula-director-pgsql
3. Installation should finish without errors.

There should not be any regressions from this patch.

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:
milestone: ubuntu-8.04.1 → none
status: In Progress → Fix Committed
Steve Langasek (vorlon)
Changed in bacula:
milestone: none → ubuntu-8.04.1
Revision history for this message
Steve Langasek (vorlon) wrote :

Installing the hardy version of bacula-director-pgsql I can reproduce this install error. Installing the hardy-proposed version fixes this error, allowing the install to progress, but the maintainer script then attempts to run a series of commands as the "postgres" user. This user will only exist on the postgres server, and bacula-director-pgsql only depends on the client.

I'm marking this bug as verification-failed; while the implemented fix is an incremental improvement over the version in 8.04, the maintainer script is still not very robust and this package in present form is unusable on any sort of remote backup server.

Changed in bacula:
status: Fix Committed → Triaged
Steve Langasek (vorlon)
Changed in bacula:
milestone: ubuntu-8.04.1 → ubuntu-8.04.2
assignee: nobody → zulcss
Revision history for this message
Steve Langasek (vorlon) wrote :

As two of three bugfixes have failed verification in bacula -5ubuntu7.1, I'm dropping the package now from hardy-proposed to make way for Ubuntu 8.04.1 CD builds. Please reupload whenever these bugs are fixed.

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

OK. This debdiff should solve the 'execute as non existing user' problem.

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

And... the patch :)

Revision history for this message
Tiefflieger (tiefflieger) wrote :

Still, same problem here :-/ ... hopefully the patch will be uploaded to the automatical updates of ubuntu soon?

Nevertheless, I attached the console-output of the error, just in case...

Thanks for your work!

Revision history for this message
Tiefflieger (tiefflieger) wrote :

by the way, just a guess since I am no expert:
shouldn't the line
+ * debian/bacula-direcotr-pgsql.postinst
 in bacula-2.debdiff
be
+ * debian/bacula-director-pgsql.postinst
? Looks like 'o' and 't' are mixed up in 'director'

Revision history for this message
Tiefflieger (tiefflieger) wrote :

Sorry for my flooding, but after applying the proposed patch I got the error

bash: /usr/share/bacula-director/grant_pgsql_privileges: No such file or directory

since a similar file already existed, I linked to it via

ln -s grant_postgresql_privileges grant_pgsql_privileges

but then I got the error
---------------------------------------------------
[...]
Processing configuration ...bacula|bacula|UTF8
There is already a database named bacula.
You must create your PostgreSQL database manually.
Ok.
 * Starting Bacula Director: [ OK ]

Richte bacula-server ein (2.2.8-5ubuntu7) ...
-----------------------------------------------------

Hopefully it will work now anyway

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

You are using unpatched version (2.2.8-5ubuntu7). Proposed version is 2.2.8-5ubuntu7.2. You can compile this version by downloading bacula source package and applying Chuck's patch (bacula.debdiff) and mine (bacula-2.debdiff). Procedure would be:

cd some/temporary/directory
apt-get source bacula
sudo apt-get install build-essential fakeroot
sudo apt-get build-dep bacula
wget http://launchpadlibrarian.net/14659854/bacula.debdiff
wget http://launchpadlibrarian.net/16211559/bacula-2.debdiff
cd bacula-2.2.8
patch -p1 -i ../bacula.debdiff
patch -p1 -i ../bacula-2.debdiff
fakeroot dpkg-buildpackage
[wait an hour or two]
cd ..
sudo dpkg -i bacula-common*2.2.8-5ubuntu7.2*deb
sudo dpkg -i bacula-director-common*2.2.8-5ubuntu7.2*deb
sudo dpkg -i bacula-director-pgsql*2.2.8-5ubuntu7.2*deb

If you opt for doing this, please report any changes in behavior.

Revision history for this message
Tiefflieger (tiefflieger) wrote :

Thank you for your help and your effort :-)

I tried the steps you described, but I got the errors shown in the attachment

Looks like I had to do a similar thing with python2.5... ?

BTW, whats "2.2.8-5ubuntu7.2" exactly ? Some kind of internal Version-counter for ubuntu-programs?

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

Do an upgrade first - apt-get dist-upgrade

Revision history for this message
Tiefflieger (tiefflieger) wrote :

sudo apt-get dist-upgrade doesn't do anything. Do you mean I should upgrade to Intrepid? I could do that with
update-manager -d
maybe I'll try that lateron. (But this bug is related to Hardy, too, isn't it?)

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

This bug was fixed in the package bacula - 2.4.2-1ubuntu3

---------------
bacula (2.4.2-1ubuntu3) intrepid; urgency=low

  * debian/patches/ubuntu_grant_privileges.patch:
    - test if $USER and db_name are set in grant_postgresql_privileges.
  * debian/bacula-director-pgsql.postinst:
    - Create databse as postgres user only if user exists. (LP: #228693)

 -- Chuck Short <email address hidden> Tue, 19 Aug 2008 10:35:41 -0400

Changed in bacula:
status: Triaged → Fix Released
Revision history for this message
Steve Langasek (vorlon) wrote :

The bacula 2.2.8-5ubuntu7.2 version in the unapproved queue looks to have a correct fix for this issue, but bug #227613 is still verification-failed and no fix has been provided. Rejecting from the queue; please provide a package that fixes both of these bugs at the same time, or else roll back the changes for 227613 completely since we shouldn't be including changes in SRUs that don't fix bugs.

Revision history for this message
Steve Langasek (vorlon) wrote :

Also, when uploading please build your source package with -v2.2.8-5ubuntu7 so that the full changelog from the previous hardy version is included; this helps the SRU team to be able to track the bugs that are in need of verification.

Revision history for this message
Launchpad Janitor (janitor) wrote :
Download full text (9.0 KiB)

This bug was fixed in the package bacula - 2.4.2-1ubuntu4~hardy1

---------------
bacula (2.4.2-1ubuntu4~hardy1) hardy-backports; urgency=low

  * Automated backport upload; no source changes.

bacula (2.4.2-1ubuntu4) intrepid; urgency=low

  * debian/patches/ubuntu_grant_privileges.patch:
    Update patch, fixes FTBFS.

bacula (2.4.2-1ubuntu3) intrepid; urgency=low

  * debian/patches/ubuntu_grant_privileges.patch:
    - test if $USER and db_name are set in grant_postgresql_privileges.
  * debian/bacula-director-pgsql.postinst:
    - Create databse as postgres user only if user exists. (LP: #228693)

bacula (2.4.2-1ubuntu2) intrepid; urgency=low

  * debian/rules: Disable fortify source since it was causing
    bacula-director to segfault.

bacula (2.4.2-1ubuntu1) intrepid; urgency=low

  * Merge from debian unstable, remaining changes:
    - debian/bacula-director-mysql.postinst:
      debian/bacula-director-pgsql.postinst:
      + Worked in some smarts to do no databases if bacula is already installed.
    - debian/control:
      + Added libdbi-perl and libdb-mysql-perl to depends for bacula-director-mysql
        due to new postinst configuration.
      + Cleaned up bacula-director-pgsql dependenices and recommends.
      + Made mysql the default director to install bacula-director-{mysql|pgsql}
 added database handling to postinstall scripts and templates, modifiied
        postinstall script's sed expressions.
      + Removed libwgtk-2.6-dev as a build dependency; as a result bacula-console-wx
        isn't built anymore.
      + Install gawk if not installed. (LP: #207527)
    - debian/make_catalog_backup_awk.[mysql|pgsql|sqlite3|sqlite]:
      + New scripts for catalog backup. (CVE-2007-5626)
    - debian/bacula-console-wx:
      + Dropped since we are not building them anymore.
    - debian/bacula-director-common.bacula-director.init,
      debian/bacula-fd.init, debian/bacula-sd.init
      + Made more LSB specific.

bacula (2.4.2-1) unstable; urgency=high

  * Fix sed pattern in debian/rules to correctly remove
    'USE ${db_name};' from the MySQL command tables. This prevented
    bacula-director-mysql from being installed properly and was thus RC.
    Closes: #441995, #489578.
  * While investigating the above problem, also discovered 'USE bacula;'
    statements in some upgrade tables. This would cause the upgrade of
    bacula-director-mysql to fail for anyone that had their MySQL
    database named something other than "bacula". Added pattern to fix this.
  * New upstream release is a bugfix release, and fixes these issues:
    + 2.4.1 included an unintentional debug statement whose purpose
      was to crash the storage daemon. This was triggered during a restore
      at the end of a tape. Fixed in 2.4.2 (upstream bug 1125). When the
      SD is crashed, no backups or restores can be performed until it is
      restarted.
    + During a multi-tape restore, Bacula could incorrectly attempt
      to reread the same tape. (Upstream bug 1126)
    + bcopy no longer reads too many records (upstream bug 1107)
    + Now sets a large timeout on MySQL databases to prevent trouble
      with the connection timining out before dat...

Read more...

Changed in bacula:
status: Triaged → Fix Released
Revision history for this message
Steve Langasek (vorlon) wrote :

reopening, I don't know why the hardy-backports upload closed this bug :/

Changed in bacula:
status: Fix Released → Triaged
Revision history for this message
Kern Sibbald (kern) wrote :

Thanks for upgrading to the 2.4.2 version, which is much more stable than 2.4.0 and 2.4.1.

One additional consideration when producing Bacula packages. I regularly release well tested patches to bugs to the bacula-bugs section of the Source Forge release are. When you are building new packages, you might want to check what has been released there. Sometimes the fixes are trivial, but other times, they are important.

These patches are also available in the current branch Branch-2.4 and the trunk SVN (now imported to Lauchpad Bazaar) in bacula/patches and are all named 2.4.2-xxx.patch. It is possible from time to time that the patches are order dependent, so they should be applied in order of their date. In the Notes section of the Source Forge bacula-bugs release the patches are listed with the most recent one on top.

Finally, the documentation on what the patch fixes or possibly fixes, if we don't have a positive confirmation, and how to apply the patches is at the top of each patch file.

Personally, I prefer to pull the current Branch-2.4 rather than applying patches, but everyone has his own way of handling these things.

If there is anything I can do to make this all easier for you, please don't hesitate to let me know: kern at sibbald.com

Kern
Bacula upstream

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

Please, accept this patch into hardy-proposed. Previous version (5ubuntu7.1) solved issues in this bug and bug 227410. This version (5ubuntu7.2) solves remaining issue from the bug 227613.

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

The current version in hardy-proposed queue does this in debian/bacula-director-pgsql.postinst:

- if dpkg --compare-versions lt 2.2.8-5ubuntu1
+ if dpkg --compare-versions "$2" lt 2.2.8-5ubuntu1

This still looks wrong for fresh installations. If this is an upgrade quirk, it must be "lt-nl". Should that be fixed with another upload, or will the code that is run there do the right thing for fresh installations as well?

Changed in bacula:
status: Triaged → Incomplete
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!

Changed in bacula:
milestone: ubuntu-8.04.2 → none
status: Incomplete → Fix Committed
Revision history for this message
IwSL5LAGdpcRVZFTrlxJogGkcNcwsR5N (whuobvk113tfvksdcnmyzo2tkgmpmp4j-deactivatedaccount) wrote :

This update solved this issue for me, downgrade from 2.4.2-1ubuntu4 ->2.2.8-5ubuntu7.2 went without problems.
Note: In /etc/bacula/bacula-dir.conf, “dbuser” needed to be changed to “user” for me.

Thanks!

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
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.