[Bug 1003854] Re: Database upgrade/migration fails with nested db directories (lucid to precise)
Paul Bergene
1003854 at bugs.launchpad.net
Thu Oct 3 11:39:03 UTC 2013
This problem seems to still exist.
I encountered it this week when upgrading from 10.4 to 12.04.3.
The changes above work, but since I had a half-installed slapd package
changing /var/lib/dpkg/info/slapd.config was what did the trick.
The scripts that I got from apt were still the old broken version.
** Description changed:
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
+ * /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 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!
+ 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 \
+ 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
+ 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
-
+ # (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
+ if [ -n "$output" ]; then
+ return 1
+ else
"""
--
You received this bug notification because you are a member of Ubuntu
Server Team, 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)
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/openldap/+bug/1003854/+subscriptions
More information about the Ubuntu-server-bugs
mailing list