You are not logged in.

#1 2007-03-29 14:38:31

LiFo2
Member
From: France
Registered: 2007-03-29
Posts: 25
Website

Problem with LDAP after BDB upgrade

Hello,
after a pacman -Suy, I had a problem with my LDAP server. I had the following message in /var/log/everything.log :
Mar 29 15:45:22 frcls0509 slapd[18273]: bdb(o=telcoo,dc=com): Program version 4.5 doesn't match environment version 4.4

The problem is Berkeley DB had been upgraded, and old format isn't recognized anymore. I found a way to upgrade it, but I'd rather warn you : it's not a very clean method tongue

First, I downgraded to db-4.4. For this, you have to cross your finger, and hope you didn't run pacman -Sc or pacman -Scc recently :

cd /var/cache/pacman/pkg
pacman --nodeps --force -U db-4.4.20-3.pkg.tar.gz

Then I can dump my database (I will work on a copy) :

cd /var/lib/openldap
cp -rp data data.old
cd data.old
for i in `ls *.bdb`; do db_dump -f $i.dump -h /var/lib/openldap/data.old/ $i; done

I can know upgrade to db-4.5

pacman -U db

Then I can create a new database and reload my data from dump files :

cd /var/lib/openldap/data
rm -f *
cd /var/lib/openldap/data.old/
for i in `ls *.dump | sed 's/.dump$//'`; do db_load -f /var/lib/openldap/data.old/$i.dump -h /var/lib/openldap/data/ /var/lib/openldap/data/$i; done

Well, now it works, but I was wondering ... what was the good way to do it ? How could have I prevented it ? Help is welcome big_smile

Offline

#2 2007-03-29 21:53:08

JGC
Developer
Registered: 2003-12-03
Posts: 1,664

Re: Problem with LDAP after BDB upgrade

hmm, I think your upgrade for openldap was a bit too much work tongue

cd /var/lib/openldap/data
db_upgrade

would have worked usually

This would be 100% working:
/etc/rc.d/openldap stop
slapcat -l /root/ldif
pacman -S openldap
rm /var/lib/openldap/data/* (though you could keep a backup of DB_CONFIG)
slapadd -l /root/ldif
/etc/rc.d/openldap start

Offline

#3 2007-03-30 08:31:55

LiFo2
Member
From: France
Registered: 2007-03-29
Posts: 25
Website

Re: Problem with LDAP after BDB upgrade

Well, I forgot to say I tried the db_upgrade after running pacman -Suy, and got the same answer :
"Program version 4.5 doesn't match environment version 4.4" (which is strange, if db_upgrade can't read old versions, how can I upgrade ?!)

I also tried with db_upgrade after downgrading, but as I thought, it didn't work (how could db_upgrade know to which version I will upgrade, and how could it use a posterior version format ?).

I didn't tried slapcat, but if slapd can't open the database because bdb can't read db files, would slapcat work ? And after the downgrade, slapd wouldn't run because the new version required db-4.5, so I think it would be the same for slapcat, wouldn't it ?

Offline

#4 2007-03-30 18:21:10

JGC
Developer
Registered: 2003-12-03
Posts: 1,664

Re: Problem with LDAP after BDB upgrade

Old slapcat combined with old DB would read it out fine, after that you could upgrade openldap and restore the database from ldif.

Offline

Board footer

Powered by FluxBB