LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 02-13-2008, 05:43 PM   #1
bbennett
LQ Newbie
 
Registered: Feb 2008
Posts: 12

Rep: Reputation: 0
Frustrating OpenLDAP problem


Hello.

I'm trying to migrate an OpenLDAP database from one server to another. The old server was using Linux From Scratch and the new Server is using CentOS 5.1. I'm using a "stock" build and doing my best to try and use yum packages where ever possible. The machine was installed with Openldap-servers and openldap-clients installed. Here's my problem.

If I start ldap using the "stock" configuration file, it works fine. When I start it using the config files from the other server, it segfaults.

Here's the ldap.conf file:

BASE dc=eb,dc=loc
URI ldap://127.0.0.1

And here's slapd.conf. You'll notice I've commented out the replication portion of things because this is a test box that doesn't have a "partner" to replicate to.

include /etc/openldap/schema/core.schema
include /etc/openldap/schema/cosine.schema
include /etc/openldap/schema/inetorgperson.schema
include /etc/openldap/schema/nis.schema
include /etc/openldap/schema/sphinx.schema
include /etc/openldap/schema/samba.schema
include /etc/openldap/schema/qmail.schema
include /etc/openldap/schema/mozilla.schema
include /etc/openldap/schema/pureftpd.schema
#include /etc/openldap/schema/sphinx.schema

pidfile /var/run/openldap/slapd.pid
argsfile /var/run/openldap/slapd.args


database bdb
suffix "dc=eb,dc=loc"
rootdn "cn=Manager,dc=eb,dc=loc"
rootpw {SSHA}garbagehere
directory /var/openldap/openldap-data
password-hash {MD5}
password-crypt-salt-format "$1$.8s"


#replogfile /etc/openldap/replog
#updatedn "cn=replicator,dc=eb,dc=loc"
#updateref ldap://10.255.255.30


index objectClass,uidNumber,gidNumber eq
index cn,sn,uid,displayName pres,sub,eq
index memberUid,givenName eq
index sambaSID,sambaPrimaryGroupSID,sambaDomainName eq
index default sub


#access to attrs=userPassword,sambaLMPassword,sambaNTPassword
# by self write
# by anonymous auth
# by dn="cn=replicator,dc=eb,dc=loc" write
# by * none
#
#access to *
# by dn="cn=replicator,dc=eb,dc=loc" write
# by * read

Now, one of the first things I did was copy over the data files from /srv/ldap to /var/openldap. Then I deleted the alock file. Then I chown -R ldap:ldap /var/openldap to allow for permissions. Just to be on the safe side, I also issued a setsebool -R slapd_disable_trans=0 so that way SELinux wouldn't interfere with it.

Now, whenever I try to start it, I get this:
[root@hptestlin openldap]# service ldap start
Checking configuration files for slapd: bdb_db_open: unclean shutdown detected; attempting recovery.
bdb_db_open: Recovery skipped in read-only mode. Run manual recovery if errors are encountered.
[ OK ]
Starting slapd: [ OK ]

slapd or slurpd are not listed in the process list! /var/log/messages shows this:

Feb 13 16:39:02 hptestlin kernel: slaptest[22371]: segfault at 00002aaaae5a0008 rip 00002aaaaad66982 rsp 00007fffc0e08490 error 4
Feb 13 16:39:02 hptestlin kernel: slapd[22379]: segfault at 00002aaaaaacc008 rip 00002aaaaad66982 rsp 00007fff55738dc0 error 4

Doing a slapd_db_recover -v doesn't make any difference.

Lastly, if I attempt to start slapd manually with a -d 4, I get this:

[root@hptestlin openldap-data]# slapd -d 4
@(#) $OpenLDAP: slapd 2.3.27 (Nov 10 2007 09:23:56) $
mockbuild@builder6.centos.org:/builddir/build/BUILD/openldap-2.3.27/openldap-2.3.27/build-servers/servers/slapd
daemon_init: <null>
=> ldap_bv2dn(dc=eb,dc=loc,0)
<= ldap_bv2dn(dc=eb,dc=loc)=0
=> ldap_dn2bv(272)
<= ldap_dn2bv(dc=eb,dc=loc)=0
=> ldap_dn2bv(272)
<= ldap_dn2bv(dc=eb,dc=loc)=0
=> ldap_bv2dn(cn=Manager,dc=eb,dc=loc,0)
<= ldap_bv2dn(cn=Manager,dc=eb,dc=loc)=0
=> ldap_dn2bv(272)
<= ldap_dn2bv(cn=Manager,dc=eb,dc=loc)=0
=> ldap_dn2bv(272)
<= ldap_dn2bv(cn=manager,dc=eb,dc=loc)=0
=> ldap_bv2dn(cn=Subschema,0)
<= ldap_bv2dn(cn=Subschema)=0
=> ldap_dn2bv(272)
<= ldap_dn2bv(cn=subschema)=0
bdb_db_open: dc=eb,dc=loc
bdb_db_open: unclean shutdown detected; attempting recovery.
Segmentation fault

I'm at my wits end here. Does anyone have any ideas? Does anyone need more information to be able to help out? I've Googled this with no luck, It always segfaults at the same address.

Your help is highly appreciated.

Last edited by bbennett; 02-13-2008 at 05:46 PM.
 
Old 02-13-2008, 09:07 PM   #2
frndrfoe
Member
 
Registered: Jan 2008
Distribution: RHEL, CentOS, Ubuntu
Posts: 379

Rep: Reputation: 38
trying to copy the data from the old machine may be a problem. Have you tried just starting the server with the appropriate slapd.conf and then importing the data with a ldif?
 
Old 02-14-2008, 10:50 AM   #3
bbennett
LQ Newbie
 
Registered: Feb 2008
Posts: 12

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by frndrfoe View Post
trying to copy the data from the old machine may be a problem. Have you tried just starting the server with the appropriate slapd.conf and then importing the data with a ldif?
Thanks for the advice.

OK. Exporting the LDIF file worked fine from the old server.

However, this was the result:

[root@hptestlin ~]# slapadd -v -l openldap.ldif
bdb_db_open: unclean shutdown detected; attempting recovery.
Segmentation fault
[root@hptestlin ~]#

And if I tail /var/log/messages, I get the following:

Feb 14 08:36:25 hptestlin kernel: slapadd[25138]: segfault at 00002aaaae5a0008 rip 00002aaaaad66982 rsp 00007fff9f7d04a0 error 4

From what I can tell, all the LDIF file is, is the structure of the database, correct?

I also need to copy over all the data too. What's the best way to do that?

As well, I'm assuming that the reason why it keeps complaining about an unclean shutdown is because the alock file is missing and/or invalid.

What you've told me though, if I've understood you correctly, is that I need to fully export the database and then import it into the new machine, not just copy the data over with an scp command.

Thanks for all your patience.
 
Old 02-14-2008, 11:25 AM   #4
bbennett
LQ Newbie
 
Registered: Feb 2008
Posts: 12

Original Poster
Rep: Reputation: 0
Just thought I'd add this.. The reason why I didn't think that LDIF did a full backup was because the LDIF file slapcat created is only 48 Kilobytes in side, (Unless I did something wrong?) wherease the entire /var/openldap directory is about 269 Megabytes in size.

So, would ldapsearch and ldapadd be the right commands to export and import data? If so, I get something like this:

root@eb-lin-2:/etc# ldapsearch -w somepassword *
SASL/OTP authentication started
ldap_sasl_interactive_bind_s: Invalid credentials (49)
additional info: SASL(-13): user not found: no OTP secret in database

Now, I'm guessing this error is because I don't have the right password to the LDAP database. How do I extract it?
 
Old 02-14-2008, 04:32 PM   #5
frndrfoe
Member
 
Registered: Jan 2008
Distribution: RHEL, CentOS, Ubuntu
Posts: 379

Rep: Reputation: 38
find your "slapd.conf"
It should have some lines like this:
Code:
rootdn          "cn=Manager,dc=example,dc=org"
rootpw          {SSHA}REFEhgjfdd57678RFGGRGybdmjzjb/cRKr4
The garbage on the rootpw line is the encrypted password for the user specified in the rootdn line.

Type in "slappasswd" and then issue it your new password at it's request. It will give you the info to put on the "rootpw" line and then your new password will allow you access.

You can view the ldif, it's a plain text file. MAke sure it has stuff that looks like an ldif with user's parameters.

Last edited by frndrfoe; 02-14-2008 at 04:34 PM.
 
Old 02-14-2008, 05:06 PM   #6
aot2002
Member
 
Registered: Dec 2003
Location: NY
Distribution: Ubuntu 7.10
Posts: 66

Rep: Reputation: 15
sounds like your berkely database is corrupted

how do you handle stopping the dameon once its started according to the manuel theres a specific way to do this please make sure your not using the kill command

check your berkely db for corruption too
 
Old 02-14-2008, 05:07 PM   #7
aot2002
Member
 
Registered: Dec 2003
Location: NY
Distribution: Ubuntu 7.10
Posts: 66

Rep: Reputation: 15
also be catious of mixing config files unless your using the exact same openldap versions
 
Old 02-15-2008, 09:15 AM   #8
bbennett
LQ Newbie
 
Registered: Feb 2008
Posts: 12

Original Poster
Rep: Reputation: 0
Thanks AOT2002.

I think this is quite possibly what could be causing my problems. The new server is running openldap from yum, whereas the old server is probably running a version of LDAP that is at least 3-4 years old.

So, I guess the big question is, how do I properly move the data from the old to the new server? Obviously, I'm doing it incorrectly. The two config files which seem to matter the most are included in with this post.

Any ideas?
 
Old 02-15-2008, 09:31 AM   #9
aot2002
Member
 
Registered: Dec 2003
Location: NY
Distribution: Ubuntu 7.10
Posts: 66

Rep: Reputation: 15
Quote:
Originally Posted by bbennett View Post
Thanks AOT2002.

I think this is quite possibly what could be causing my problems. The new server is running openldap from yum, whereas the old server is probably running a version of LDAP that is at least 3-4 years old.

So, I guess the big question is, how do I properly move the data from the old to the new server? Obviously, I'm doing it incorrectly. The two config files which seem to matter the most are included in with this post.

Any ideas?
heres some migration scripts for linux openldap
http://www.padl.com/OSS/MigrationTools.html

also this editor is great for what u need
http://sourceforge.net/projects/led/

also ldap has a replication feature so if you create your new ldap server as a slave to your existing setup it will suck all the info over
http://www.openldap.org/doc/admin22/syncrepl.html

another option is to write a perl script to interface ldap and do it yourself.
i hope this helps you
 
Old 02-15-2008, 10:54 AM   #10
bbennett
LQ Newbie
 
Registered: Feb 2008
Posts: 12

Original Poster
Rep: Reputation: 0
Thank you very much. I'll try messing with these.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
One frustrating problem: I/o wait khoma Linux - Newbie 3 12-17-2007 05:39 PM
Frustrating problem with sound atanveer Linux - General 1 10-14-2007 07:02 PM
very frustrating problem with the nvidia driver fakie_flip Linux - Software 2 06-10-2007 10:30 PM
Frustrating Gdk problem. garamatt Linux - General 1 10-11-2003 10:28 PM
most frustrating linux problem bogler General 7 02-25-2003 04:45 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 03:24 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration