← Back to team overview

touch-packages team mailing list archive

[Bug 1003854] Re: Database upgrade/migration fails with nested db directories (lucid to precise)

 

Encountered a similar error when updating from 12.04 to 14.04.3.  The
patch (at least the patch alone) did not fix it.

What did finally make it succeed was `mkdir /var/lib/ldap/accesslog`

via https://techhelplist.com/tech-tutorials/34-openldap/332-cloning-my-
openldap-data-between-servers

-- 
You received this bug notification because you are a member of Ubuntu
Touch seeded packages, which is subscribed to openldap in Ubuntu.
https://bugs.launchpad.net/bugs/1003854

Title:
  Database upgrade/migration fails with nested db directories (lucid to
  precise)

Status in openldap package in Ubuntu:
  Fix Released
Status in openldap source package in Precise:
  Confirmed
Status in openldap package in Debian:
  Fix Released

Bug description:
  Hi,

  I've just performed an upgrade of our LDAP server on Ubuntu 10.04.4
  LTS to Ubuntu 12.04 (I acknowledge this upgrade path is not officially
  supported yet).

  The incompatible database upgrading process in the preinst/postinst
  files failed in the following scenario.

  We have two suffixes/databases at the following paths:-

   * /var/lib/ldap
   * /var/lib/ldap/accesslog

  The preinst database dumping part of the process worked just fine and
  created the appropriate LDIF files under
  /var/backup/slapd-2.4.21-0ubuntu5.7, however the restore failed
  stating:-

  """
    Loading from /var/backups/slapd-2.4.21-0ubuntu5.7:
    - directory dc=REDACTEDs,dc=co,dc=uk... failed.

  Loading the database from the LDIF dump failed with the following
  error while running slapadd:
      4fbdfebf olcDbDirectory: value #0: invalid path: No such file or directory
      4fbdfebf config error processing olcDatabase={2}hdb,cn=config: olcDbDirectory: value #0: invalid path: No such file or directory
      slapadd: bad configuration directory!
  """

  This is because when move_incompatible_databases_away() runs it finds
  the main database first (/var/lib/ldap) and moves all top level
  entries (find -mindepth 1 -maxdepth 1 ...) into the backup directory
  and this includes the accesslog subdirectory which then no longer
  exists. When slapadd runs it checks config specifying that directory
  and bails with the above error given it is indeed missing.

  I've tested a tentative fix and that's to patch the two find commands
  (one in is_empty_dir() one in move_old_database_away to also specify
  -type f so that the directory structure is preserved when moving the
  old database away (accesslog will be backed up separately when its
  suffx is iterated over in move_incompatible_databases_away()).

  The simple and very tentative patch for this is:-

  """
  # diff -u slapd.scripts-common.old slapd.scripts-common
  --- slapd.scripts-common.old	2012-05-24 10:33:01.746206585 +0100
  +++ slapd.scripts-common	2012-05-24 10:33:23.967902747 +0100
  @@ -391,7 +391,7 @@
     echo -n "  - directory $suffix... " >&2
     mkdir -p "$backupdir"
     find "$databasedir" -mindepth 1 -maxdepth 1	\
  -			-exec mv {} "$backupdir" \;
  +			-type f -exec mv {} "$backupdir" \;
     echo done. >&2
    else
     cat >&2 <<EOF
  @@ -728,7 +728,7 @@
   # (i.e., contains no files except for an optional DB_CONFIG).
   # Usage: if is_empty_dir "$dir"; then ... fi

  -	output=`find "$1" -mindepth 1 -maxdepth 1 \! -name DB_CONFIG 2>/dev/null`
  +	output=`find "$1" -mindepth 1 -maxdepth 1 -type f \! -name DB_CONFIG 2>/dev/null`
    if [ -n "$output" ]; then
         return 1
    else
  """

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/openldap/+bug/1003854/+subscriptions