Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 291821 - Upgrade from sys-libs/db-4.6 to 4.7 breaks existing LDAP databases
Summary: Upgrade from sys-libs/db-4.6 to 4.7 breaks existing LDAP databases
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: All Linux
: High critical (vote)
Assignee: Gentoo LDAP project
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-11-04 10:55 UTC by Janos Pasztor
Modified: 2009-12-06 15:41 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Janos Pasztor 2009-11-04 10:55:01 UTC
Upgrading from sys-libs/db-4.6 to 4-7 breaks existing OpenLDAP databases.

Reproducible: Always

Steps to Reproduce:
1. Upgrade to sys-libs/db-4.7
2. Re-emerge OpenLDAP
3. Restart OpenLDAP (and see it fail)

Actual Results:  
Program version 4.7 doesn't match environment version 4.6

Expected Results:  
OpenLDAP start correctly / have a warning in the ebuild.

Please provide a warning in the ebuild with a notice how to upgrade databases.
Comment 1 Jeremy Sermersheim 2009-11-05 00:47:08 UTC
I had this same problem and followed the steps found under bug#470084 listed here (http://www.redhat.com/docs/manuals/dir-server/8.1/rel-notes/Release_Notes-Bugs_Addressed-Known_Issues.html).  Here are the quick steps I performed (NOTE: i was going from db4.7 to db4.8 based on the error message i was receiving [Program version 4.8 doesn't match environment version 4.7]):

mkdir /var/lib/openldap-data.BKP
rsync -av /var/lib/openldap-data/. /var/lib/openldap-data.BKP/.
cd /var/lib/openldap-data
db4.7_recover
db4.8_checkpoint -1
chown ldap:ldap /var/lib/openldap-data/log.*
chmod 600 /var/lib/openldap-data/log.*
/etc/init.d/slapd restart

i then tested with 'getent passwd' and verified that i could see my ldap users and then changed my 'loglevel' back to 0 in /etc/openldap/slapd.conf (don't forget to restart slapd after that change too)
Comment 2 Alessandro Surace 2009-11-23 09:57:20 UTC
Simply Wonderful!
Why don't put this precious info in the ebuild!!!

It isn't the first this happens to me.

Comment 3 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2009-11-24 05:35:23 UTC
Recover+checkpoint like that CAN give you a corrupted archive in some setups.
I've done a different thing in 2.4.19-r1 now, detecting the linked version and REFUSING to upgrade until you do a dump so that you can import it.
Comment 4 Oleg Gawriloff 2009-12-02 08:39:41 UTC
I have openldap as client only (installed as depend for php-ldap) and it refuses to upgrade even when I totally remove /var/lib/openldap-data. So, in this case what I must do?

barzog@media-mo2 ~ $ sudo emerge -val \=net-nds/openldap-2.4.19-r1

These are the packages that would be merged, in order:

Calculating dependencies... done!
[ebuild     U ] net-nds/openldap-2.4.19-r1 [2.4.19] USE="berkdb crypt perl ssl tcpd -cxx -debug -experimental -gnutls -icu -iodbc -ipv6 -kerberos -minimal -odbc -overlays -samba -sasl (-selinux) -slp -smbkrb5passwd -syslog" 0 kB

Total: 1 package (1 upgrade), Size of downloads: 0 kB
Would you like to merge these packages? [Yes/No] y

>>> Verifying ebuild manifests

>>> Emerging (1 of 1) net-nds/openldap-2.4.19-r1
 * openldap-2.4.19.tgz RMD160 SHA1 SHA256 size ;-) ...                   [ ok ]
 * checking ebuild checksums ;-) ...                                     [ ok ]
 * checking auxfile checksums ;-) ...                                    [ ok ]
 * checking miscfile checksums ;-) ...                                   [ ok ]
 *
 * Scanning datadir(s) from slapd.conf and
 * the default installdir for Versiontags
 * (/var/lib/openldap-data may appear twice)
 *
 *      Your existing version of OpenLDAP was built against
 *      sys-libs/db:4.6, but the new one will build against
 *      4.7 and your database would be inaccessible.

 *
 * A (possible old) installation of OpenLDAP was detected,
 * installation will not proceed for now.
 *
 * As major version upgrades can corrupt your database,
 * you need to dump your database and re-create it afterwards.
 *
 * Additionally, rebuilding against different major versions of the
 * sys-libs/db libraries will cause your database to be inaccessible.
 *
 *  1. /etc/init.d/slurpd stop ; /etc/init.d/slapd stop
 *  2. slapcat -l /root/ldapdump.1259742983.raw
 *  3. egrep -v '^entryCSN:' </root/ldapdump.1259742983.raw >/root/ldapdump.1259742983
 *  4. mv /var/lib/openldap-data/ /var/lib/openldap-data-backup/
 *  5. emerge --update \=net-nds/openldap-2.4.19-r1
 *  6. etc-update, and ensure that you apply the changes
 *  7. slapadd -l /root/ldapdump.1259742983
 *  8. chown ldap:ldap /var/lib/openldap-data/*
 *  9. /etc/init.d/slapd start
 * 10. check that your data is intact.
 * 11. set up the new replication system.
 *
 *
 * ERROR: net-nds/openldap-2.4.19-r1 failed.
 * Call stack:
 *                   ebuild.sh, line   49:  Called pkg_setup
 *   openldap-2.4.19-r1.ebuild, line  203:  Called openldap_find_versiontags
 *   openldap-2.4.19-r1.ebuild, line  151:  Called openldap_upgrade_howto
 *   openldap-2.4.19-r1.ebuild, line  187:  Called die
 * The specific snippet of code:
 *              die "You need to upgrade your database first"
 *  The die message:
 *   You need to upgrade your database first
 *
 * If you need support, post the topmost build error, and the call stack if relevant.
 * A complete build log is located at '/var/tmp/portage/net-nds/openldap-2.4.19-r1/temp/build.log'.
 * The ebuild environment file is located at '/var/tmp/portage/net-nds/openldap-2.4.19-r1/temp/die.env'.
 *

>>> Failed to emerge net-nds/openldap-2.4.19-r1, Log file:

>>>  '/var/tmp/portage/net-nds/openldap-2.4.19-r1/temp/build.log'
Comment 5 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2009-12-03 02:47:32 UTC
(In reply to comment #4)
> I have openldap as client only (installed as depend for php-ldap) and it
> refuses to upgrade even when I totally remove /var/lib/openldap-data. So, in
> this case what I must do?
Try again now with rev 1.8 of openldap-2.4.19-r1.ebuild, I just cleaned up the upgrade check some more.
Comment 6 Oleg Gawriloff 2009-12-03 10:40:14 UTC
Nothing changes:(
>>> Emerging binary (1 of 3) net-nds/openldap-2.4.19-r1
 * openldap-2.4.19-r1.tbz2 MD5 SHA1 size ;-) ...                                                                                                      [ ok ]
>>> Extracting info
 *
 * Scanning datadir(s) from slapd.conf and
 * the default installdir for Versiontags
 * (/var/lib/openldap-data may appear twice)
 *
 *      Your existing version of OpenLDAP was built against
 *      sys-libs/db:4.6, but the new one will build against
 *      4.8 and your database would be inaccessible.

 *
 * A (possible old) installation of OpenLDAP was detected,
 * installation will not proceed for now.
 *
 * As major version upgrades can corrupt your database,
 * you need to dump your database and re-create it afterwards.
 *
 * Additionally, rebuilding against different major versions of the
 * sys-libs/db libraries will cause your database to be inaccessible.
 *
 *  1. /etc/init.d/slurpd stop ; /etc/init.d/slapd stop
 *  2. slapcat -l /root/ldapdump.1259836789.raw
 *  3. egrep -v '^entryCSN:' </root/ldapdump.1259836789.raw >/root/ldapdump.1259836789
 *  4. mv /var/lib/openldap-data/ /var/lib/openldap-data-backup/
 *  5. emerge --update \=net-nds/openldap-2.4.19-r1
 *  6. etc-update, and ensure that you apply the changes
 *  7. slapadd -l /root/ldapdump.1259836789
 *  8. chown ldap:ldap /var/lib/openldap-data/*
 *  9. /etc/init.d/slapd start
 * 10. check that your data is intact.
 * 11. set up the new replication system.
 *
 *
 * ERROR: net-nds/openldap-2.4.19-r1 failed.
 * Call stack:
 *               ebuild.sh, line   49:  Called pkg_setup
 *             environment, line 3063:  Called openldap_find_versiontags
 *             environment, line 2984:  Called openldap_upgrade_howto
 *             environment, line 3019:  Called die
 * The specific snippet of code:
 *           die "You need to upgrade your database first";
 *  The die message:
 *   You need to upgrade your database first
 *
 * If you need support, post the topmost build error, and the call stack if relevant.
 * A complete build log is located at '/var/tmp/portage/net-nds/openldap-2.4.19-r1/temp/build.log'.
 * The ebuild environment file is located at '/var/tmp/portage/net-nds/openldap-2.4.19-r1/temp/environment'.
 *

>>> Failed to emerge net-nds/openldap-2.4.19-r1, Log file:
Comment 7 William Riley 2009-12-04 21:30:31 UTC
I used the fix in #1 but also had to convert /var/lib/openldap-ldbm.
Comment 8 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2009-12-04 21:32:23 UTC
(In reply to comment #6)
> Nothing changes:(
> >>> Emerging binary (1 of 3) net-nds/openldap-2.4.19-r1
>  * openldap-2.4.19-r1.tbz2 MD5 SHA1 size ;-)
Why did you use the binary?
You need to recompile. Rev 1.10 of the ebuild now.
Comment 9 Oleg Gawriloff 2009-12-06 15:41:14 UTC
(In reply to comment #8)
> You need to recompile. Rev 1.10 of the ebuild now.
With 1.10 all works perfectly. Thanks.