LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (http://www.linuxquestions.org/questions/linux-networking-3/)
-   -   ldap_bind:cannot contact to ldap (-1) (http://www.linuxquestions.org/questions/linux-networking-3/ldap_bind-cannot-contact-to-ldap-1-a-758145/)

defeater_man 09-27-2009 08:59 PM

ldap_bind:cannot contact to ldap (-1)
 
I am new in ldap

i have install my openldap2,openldap2_client,nss_ldap,pam_ldap,db42 on suse enterprise10 and configure my ldap and add some organisation and users by ldapadd in DIT
buy when i restart my pc and try to enter again after 2 days
I tried to enter some ldap user but the follwing error appear

ldap_bind:cannot contact to ldap (-1)

and also when i try to search in my DIT same error occure

Hint: ldap are running and no errors occure

and i want to know how to listen to ldap port?

bathory 09-28-2009 12:13 AM

If slapd is running, try to stop it and then start it again from command line in debug mode.
Code:

/usr/lib/openldap/slapd -d 65535
Quote:

and i want to know how to listen to ldap port?
The slapd daemon is listening on port 389. To verify:
Code:

netstat -tanpl|grep 389
Regards

defeater_man 09-28-2009 10:01 AM

thank you man for your fast reply

i write the command of starting ldap and the result of the last 3 lines

Quote:

backend_startup: starting "dc=my-domain,dc=com"
bdb_db_open: dc=my-domain,dc=com
bdb_db_open: dbenv_open(/var/lib/ldap)

then it stop and diddnot continue

and when i listen to port 389 nothing done

bathory 09-28-2009 11:17 AM

Strange that slapd stops at "bdb_db_open: dbenv_open(/var/lib/ldap)". Does is seems hanged? What is the output of
Code:

ps -ef|grep slapd
after running the slapd in debug mode?
Also what gives:
Code:

ls -la /var/lib/ldap

defeater_man 09-28-2009 02:25 PM

the output of ps -ef | grep slapd
Quote:

root 7539 7499 1 02:09 pts/0 00:03:00 /usr/lib/openldap/slapd -d 65535
root 7601 7499 0 02:13 pts/0 00:00:00 /usr/lib/openldap/slapd -d 65535
root 12693 7499 0 06:34 pts/0 00:00:00 grep slapd
and what u mean by debug mode sorry iam beginer in ldap so i donnot know what u mean by debug mode

and the output of ls -la /var/lib/ldap

Quote:

drwx------ 2 ldap ldap 328 Sep 27 03:20 .
drwxr-xr-x 38 root root 992 Sep 23 19:04 ..
-rw------- 1 ldap ldap 48 Sep 9 2005 DB_CONFIG
-rw------- 1 ldap ldap 24576 Sep 23 17:42 __db.001
-rw------- 1 ldap ldap 18759680 Sep 23 17:42 __db.002
-rw------- 1 ldap ldap 2162688 Sep 23 17:42 __db.003
-rw------- 1 ldap ldap 450560 Sep 23 17:42 __db.004
-rw------- 1 ldap ldap 24576 Sep 23 17:42 __db.005
-rw------- 1 ldap ldap 8192 Sep 23 20:16 dn2id.bdb
-rw------- 1 ldap ldap 32768 Sep 23 20:16 id2entry.bdb
-rw------- 1 ldap ldap 10485760 Sep 23 20:16 log.0000000001
-rw------- 1 ldap ldap 8192 Sep 23 20:16 objectClass.bdb
and i want to point that i cannot listen to port 389 is that normal?

bathory 09-28-2009 05:27 PM

Debug mode is when you run slapd with the "-d" option, so it does not run in the background and produces more verbose output.
From the ps output, you have 2 slapd processes running (hanged?). You can kill them, try to recover the database, restart and see if it works. To do all of the above you need to run the following commands:
Code:

pkill slapd
cd /var/lib/ldap
db_recover -v
/usr/lib/openldap/slapd -d 65535

Could you also post the openldap and BerkeleyDB versions, how you installed them and also slapd.conf?

defeater_man 09-28-2009 06:00 PM

thank you for your fast reply

the command
Quote:

db_recover -v
command not found

i change my dn but still the problem

my ldap installed package

Quote:

rpm -qa | grep ldap
yast2-ldap-2.12.2-2
pam_ldap-178-3
openldap2-client-2.2.27-6
multisync-ldap-0.82+cvs-8
nss_ldap-238-2
yast2-ldap-client-2.12.9-2
openldap2-2.2.27-6
ldapcpplib-0.0.3-33
while BerkeleyDB versions

Quote:

rpm -qa | grep db
db-4.3.27-7
dbus-1-0.35.2-8
libcddb-1.2.1-2
gdbm-1.8.3-232
libgnomedb-1.3.91-5
dbus-1-python-0.35.2-8
db42-4.2.52-5
dbus-1-qt-0.35.2-8
dbus-1-mono-0.35.2-8
db42-devel-4.2.52-5
dbus-1-glib-0.35.2-8
dbus-1-x11-0.35.2-8
dbus-1-gtk-0.35.2-8
gdb-6.3-20


defeater_man 09-28-2009 06:50 PM

i think that the problem is not from the packages because i aready installed them and ldap runnung normal but when i restart i think my ldap database corrupted by someway
so ldap cannot contact server

scottro11 09-28-2009 08:23 PM

I'm not familiar with SuSE's version of LDAP, but usually it's pretty similar between distributions.

I have my own little page on LDAP. I'm not sure how useful it would be for SuSE, but perhaps the steps about setting up the config files and database might be useful.

http://home.roadrunner.com/~computertaijutsu/ldap.html

bathory 09-29-2009 12:15 AM

You have to install db_utils, in order to be able to check and repair your ldap database.
Since slapd in debug mode stucks, you can try
Code:

slaptest -d -1
to see if you get any useful results.

defeater_man 10-01-2009 03:36 PM

i instal db-utilts and run db_recovery the result was :

Quote:

db_recover -v Finding last valid log LSN: file: 1 offset 64236
Recovery starting from [1][64052]
Recovery complete at Thu Oct 1 07:46:24 2009
Maximum transaction ID 80000002 Recovery checkpoint [1][64236]

then i do slaptest -d -l the result of last 6 lines

Quote:

config file testing succeeded
slaptest shutdown: freeing system resources.
bdb(dc=linuxcbt,dc=internal): Database handles remain at environment close
bdb(dc=linuxcbt,dc=internal): Open database handle: dn2id.bdb
bdb(dc=linuxcbt,dc=internal): Open database handle: id2entry.bdb
bdb_db_destroy: close failed: Invalid argument (22)
AND THE PROBLEM STILL AS IT IS

bathory 10-01-2009 04:19 PM

Well, I don't know what is the problem with the database. Are you sure it's not some security thing, like SELinux or Apparmor?
If it's not a security problem, you can (re)move everything from /var/lib/ldap (make sure slapd is not running), use slapadd to add your initial ldif, start slapd and see what happens.


All times are GMT -5. The time now is 12:43 PM.