Project

General

Profile

Actions

Bug #5575

closed

Upgrading rudder-inventory-ldap between two major OS versions makes slapd unable to operate because of BerkeleyDB

Added by Matthieu CERDA over 6 years ago. Updated over 6 years ago.

Status:
Released
Priority:
3
Category:
System integration
Target version:
Severity:
User visibility:
Effort required:
Priority:

Description

When an upgrade of Rudder is done after a major OS upgrade (that changes BerkeleyDB to a superior version), slapd refuses to do anything and breaks the update as the database is made for a previous version.

It especially happens during an upgrade from Ubuntu 12.04 to 14.04, like this:
  • Immediately after the upgrade, BDB switches from 5.1.25 to 5.1.29, making the old slapd from 12.04 unable to do anything
  • It makes rudder-inventory-ldap unable to upgrade properly (can't run post/pre in/uninstall scripts) => dead end
  • When forced to upgrade anyway, the expected BDB version bumps to 5.1 to 5.3, making a database export/reimport mandatory
WORKAROUND:
  • Upgrade to the latest Rudder version
  • Before doing anything, export your current LDAP content:
    /opt/rudder/sbin/slapcat -f /opt/rudder/etc/openldap/slapd.conf | gzip > /tmp/database-export.ldif.gz
    
  • kill slapd:
    killall -9 slapd
    
  • Replace key elements (called by postinst/preinst scripts) by dummies to make the upgrade OK
    • Create dummy.sh
      #!/bin/sh
      
      exit 0
      
    • Install it to the right places
      cp /etc/init.d/rudder-slapd /etc/init.d/rudder-slapd.orig
      chmod +x dummy.sh
      cp dummy.sh /etc/init.d/rudder-slapd
      cp dummy.sh /opt/rudder/sbin/slapcat
      cp dummy.sh /opt/rudder/sbin/slapindex
      
  • Upgrade Rudder to your target OS version (in this example, from Ubuntu precise to trusty)
  • Restore the original init script:
    cp /etc/init.d/rudder-slapd.orig /etc/init.d/rudder-slapd
    
  • Import your LDAP backup
    cd /var/rudder/ldap/openldap-data/
    mv DB_CONFIG ~
    rm -rf *
    cp ~/DB_CONFIG .
    zcat /tmp/database-export.ldif.gz | /opt/rudder/sbin/slapadd -q
    
  • Restart slapd
    service rudder-slapd restart
    

You should be OK now :)


Related issues

Related to Rudder - Bug #5705: A Rudder upgrade that leads to a different BDB version usage in slapd failsReleasedJonathan CLARKE2014-10-28Actions
Related to Rudder - Bug #5741: Upgrading rudder-inventory-ldap between two major OS versions makes slapd unable to operate because of BerkeleyDB (backport)ReleasedJonathan CLARKE2015-01-30Actions
Actions #1

Updated by Dennis Cabooter over 6 years ago

This:

cd /opt/rudder/ldap/openldap-data/

Should be this:

cd /var/rudder/ldap/openldap-data
Actions #2

Updated by Dennis Cabooter over 6 years ago

Besides /opt/rudder should be /var/rudder, the above workaround works fine and easy. Thank you. :)

Actions #3

Updated by Jonathan CLARKE over 6 years ago

  • Description updated (diff)
  • Status changed from New to 8
  • Assignee set to Matthieu CERDA
  • Target version set to 2.6.19

Thanks for noting the typo Dennis. I've updated the description.

The root cause for this is that we package our own OpenLDAP server, but not the underlying database libraries (BerkeleyDB). So, we're going to fix this by bundling a version of BerkeleyDB in our OpenLDAP package (rudder-inventory-ldap). Matthieu will be working on this this week.

Actions #4

Updated by Matthieu CERDA over 6 years ago

  • Status changed from 8 to Pending technical review
  • Assignee changed from Matthieu CERDA to Jonathan CLARKE
  • % Done changed from 0 to 100
  • Pull Request set to https://github.com/Normation/rudder-packages/pull/500
Actions #5

Updated by Matthieu CERDA over 6 years ago

  • Status changed from Pending technical review to Pending release

Applied in changeset packages:commit:9b7ff7608f3f20596845b493c1038ab9c2ed332a.

Actions #6

Updated by Matthieu CERDA over 6 years ago

Applied in changeset packages:commit:ed13ef58c49e20a1747e0d0991280d3c7e4090d1.

Actions #7

Updated by Matthieu CERDA over 6 years ago

  • Target version changed from 2.6.19 to 140
Actions #8

Updated by Matthieu CERDA over 6 years ago

  • Target version changed from 140 to 3.0.0~beta1
Actions #9

Updated by Vincent MEMBRÉ over 6 years ago

  • Status changed from Pending release to Released

This bug has been fixed in Rudder 3.0.0~beta1 which was release on 01/12/2014.

Actions

Also available in: Atom PDF