Bug 458432

Summary: alternatives (backend) configuration lost after upgrade
Product: [Fedora] Fedora Reporter: Paul Howarth <paul>
Component: baculaAssignee: Gwyn Ciesla <gwync>
Status: CLOSED NEXTRELEASE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: medium    
Version: 9CC: gwync, mmcgrath
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2008-09-16 23:22:22 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Paul Howarth 2008-08-08 08:53:47 UTC
Description of problem:
After upgrading bacula packages to 2.2.8-2.fc9, the alternatives settings to select the backend (mysql in my case) are lost and there is no /usr/sbin/bacula-dir link left, so a "service bacula-dir restart" fails.

Version-Release number of selected component (if applicable):
2.2.8-2.fc9

How reproducible:
Every time.

Steps to Reproduce:
1. Install original 2.0.3-13.fc9 bacula packages for storage and/or director
2. Upgrade these packages to 2.2.8-2.fc9
  
Actual results:
# alternatives --display bacula-sd
# alternatives --display bacula-dir
(i.e. no output)

Expected results:
# alternatives --display bacula-sd
bacula-sd - status is auto.
 link currently points to /usr/sbin/bcopy.mysql
/usr/sbin/bcopy.mysql - priority 50
 slave bacula-bscan: /usr/sbin/bscan.mysql
Current `best' version is /usr/sbin/bcopy.mysql.
# alternatives --display bacula-dir
bacula-dir - status is auto.
 link currently points to /usr/sbin/bacula-dir.mysql
/usr/sbin/bacula-dir.mysql - priority 50
 slave bacula-dbcheck: /usr/sbin/dbcheck.mysql
 slave create_bacula_database: /usr/libexec/bacula/create_bacula_database.mysql
 slave drop_bacula_database: /usr/libexec/bacula/drop_bacula_database.mysql
 slave drop_bacula_tables: /usr/libexec/bacula/drop_bacula_tables.mysql
 slave grant_bacula_privileges: /usr/libexec/bacula/grant_bacula_privileges.mysql
 slave make_bacula_tables: /usr/libexec/bacula/make_bacula_tables.mysql
 slave make_catalog_backup: /usr/libexec/bacula/make_catalog_backup.mysql
 slave update_bacula_tables: /usr/libexec/bacula/update_bacula_tables.mysql
Current `best' version is /usr/sbin/bacula-dir.mysql.


Additional info:
This problem can be worked around by running the %post scripts for bacula-storage-mysql and bacula-director-mysql manually:

# /usr/sbin/alternatives --install /usr/sbin/bcopy bacula-sd /usr/sbin/bcopy.mysql 50 \
	--slave /usr/sbin/dbcheck bacula-bscan /usr/sbin/bscan.mysql
# /usr/sbin/alternatives --install /usr/sbin/bacula-dir bacula-dir /usr/sbin/bacula-dir.mysql 50 \
	--slave /usr/sbin/dbcheck bacula-dbcheck /usr/sbin/dbcheck.mysql \
	--slave /usr/libexec/bacula/create_bacula_database create_bacula_database /usr/libexec/bacula/create_bacula_database.mysql \
	--slave /usr/libexec/bacula/drop_bacula_database drop_bacula_database /usr/libexec/bacula/drop_bacula_database.mysql \
	--slave /usr/libexec/bacula/drop_bacula_tables drop_bacula_tables /usr/libexec/bacula/drop_bacula_tables.mysql \
	--slave /usr/libexec/bacula/grant_bacula_privileges grant_bacula_privileges /usr/libexec/bacula/grant_bacula_privileges.mysql \
	--slave /usr/libexec/bacula/make_bacula_tables make_bacula_tables /usr/libexec/bacula/make_bacula_tables.mysql \
	--slave /usr/libexec/bacula/make_catalog_backup make_catalog_backup /usr/libexec/bacula/make_catalog_backup.mysql \
	--slave /usr/libexec/bacula/update_bacula_tables update_bacula_tables /usr/libexec/bacula/update_bacula_tables.mysql


The cause of the problem is that the "alternatives --remove" invocations in the %preun scripts are unconditional rather than applying only on package removal. They should be wrapped in a "if [ $1 = 0 ]" clause, e.g.

if [ $1 = 0 ]; then
  /usr/sbin/alternatives --remove ...
fi

(note that %preun runs *after* %post on package upgrades - see http://fedoraproject.org/wiki/Packaging/ScriptletSnippets)

Comment 1 Gwyn Ciesla 2008-09-09 19:28:49 UTC
Testing a fix. . .

Comment 2 Fedora Update System 2008-09-10 16:14:01 UTC
bacula-2.2.8-3.fc9 has been submitted as an update for Fedora 9.
http://admin.fedoraproject.org/updates/bacula-2.2.8-3.fc9

Comment 3 Gwyn Ciesla 2008-09-10 16:20:39 UTC
Please test and report here and comment on the update linked above.  These changes work for me, but my local copy is 2.4.2.  Shouldn't matter.

Comment 4 Fedora Update System 2008-09-11 17:02:06 UTC
bacula-2.2.8-3.fc9 has been pushed to the Fedora 9 testing repository.  If problems still persist, please make note of it in this bug report.
 If you want to test the update, you can install it with 
 su -c 'yum --enablerepo=updates-testing update bacula'.  You can provide feedback for this update here: http://admin.fedoraproject.org/updates/F9/FEDORA-2008-7857

Comment 5 Fedora Update System 2008-09-16 23:22:17 UTC
bacula-2.2.8-3.fc9 has been pushed to the Fedora 9 stable repository.  If problems still persist, please make note of it in this bug report.