免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 7693 | 回复: 2
打印 上一主题 下一主题

[ldap] slapd[24437]: auxpropfunc error no mechanism available [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2007-01-31 21:17 |只看该作者 |倒序浏览
openldap启动问题:
#slapd 能启动
#service ldap start  提示启动成功,但没有slapd进程。/var/log/messaegs 显示信息:
Jan 31 20:42:00 linuxas2 slapd[24437]: sql_select option missing
Jan 31 20:42:00 linuxas2 slapd[24437]: auxpropfunc error no mechanism available
Jan 31 20:42:00 linuxas2 ldap: slapd startup succeeded



----------------------------------------------------------------
1.Redhat AS4,openldap-2.3.33,samba-3.0.23b.
2.打算用samba作域控制器,取代现今的win2KServer.想不到在openLDAP上卡住了.
3.原本AS4安装 时有OPENLDAP,我弄掉了,重新由原代码安装.但保留了/etc/init.d/ldap脚本.
4.#cd /softsrc/openldap-2.3.33/
#./configure
#make depend
#make
#mak test
#make install

#ln -s /usr/local/etc/openldap /etc/    --->这样就不用修改/etc/init.d/ldap脚本
#ln -s /usr/local/etc/openldap/ldap.conf /etc/

#vi /usr/local/etc/openldap/slapd.conf ----->

  #
include         /usr/local/etc/openldap/schema/core.schema
include         /usr/local/etc/openldap/schema/corba.schema
include         /usr/local/etc/openldap/schema/cosine.schema
include         /usr/local/etc/openldap/schema/inetorgperson.schema
include         /usr/local/etc/openldap/schema/nis.schema
include         /usr/local/etc/openldap/schema/samba.schema

# Define global ACLs to disable default read access.

# Do not enable referrals until AFTER you have a working directory
# service AND an understanding of referrals.
#referral       ldap://root.openldap.org


#pidfile                /usr/local/var/run/slapd.pid
pidfile         /var/run/slapd.pid
argsfile        /var/run/slapd.args

# Load dynamic backend modules:
# modulepath    /usr/local/libexec/openldap
# moduleload    back_bdb.la
# moduleload    back_ldap.la
# moduleload    back_ldbm.la
# moduleload    back_passwd.la
# moduleload    back_shell.la

#
backend bdb
checkpoint 1024 5
cachesize 10000

#######################################################################
# BDB database definitions
#######################################################################

database        bdb
suffix          "dc=test,dc=cn"
rootdn          "cn=admin,dc=test,dc=cn"
# Cleartext passwords, especially for the rootdn, should
# be avoid.  See slappasswd( and slapd.conf(5) for details.
# Use of strong authentication encouraged.
rootpw          {SSHA}E5FAstDHZs9qbhDRyVXTNRlqNWlhoHwY
# The database directory MUST exist prior to running slapd AND
# should only be accessible by the slapd and slap tools.
# Mode 700 recommended.
directory       /usr/local/var/openldap-data
# Indices to maintain
index   objectClass,uidNumber,gidNumber eq
index   cn,sn,uid,displayName   pres,sub,eq
index   memberUid,mail,givenname eq,subinitial
index   sambaSID,sambaPrimaryGroupSID,sambaDomainName eq
access  to attrs=userPassword,sambaLMPassword,sambaNTPassword
        by self write
        by anonymous auth
        by * none
access  to attrs=shadowLastChange
        by self write
        by * read
access  to *
        by * read
        by anonymous auth
schemacheck on
idletimeout 30

-------------------------------------------------------------
#vi /usr/local/etc/openldap/ldap.conf  ------->

host     127.0.0.1
BASE     dc=test,dc=cn
URI      ldap://127.0.0.1
#NSS_BASE_GROUP ou=Groups,dc=test,dc=cn

binddn  cn=admin,dc=test,dc=cn
bindpw  {SSHA}E5FAstDHZs9qbhDRyVXTNRlqNWlhoHwY
timelimit       50
bind_timelimit  50
bind_policy     hard
idle_timelimit  3600

--------------------------------------------
#vi /usr/local/var/openldap-data/DB_CONFIG --->
# Note: most DB_CONFIG settings will take effect only upon rebuilding
# the DB environment.

# one 0.25 GB cache
set_cachesize 0 268435456 1

# Data Directory
#set_data_dir db

# Transaction Log settings
set_lg_regionmax 262144
set_lg_bsize 2097152
#set_lg_dir logs

# Note: special DB_CONFIG flags are no longer needed for "quick"
# slapadd( or slapindex( access (see their -q option).
~
--------------------------------------------------
#chown -R ldap /usr/local/var/openldap-data
#chown -R ldap /usr/local/var/openldap-slurp
#chown :ldap /usr/local/etc/openldap/slapd.conf
#chonw :ldap /usr/local/etc/openldap/ldap.conf

#cat /etc/init.d/ldap    ------------------->
# description: LDAP stands for Lightweight Directory Access Protocol, used \
#              for implementing the industry standard directory services.
# processname: slapd
# config: /etc/openldap/slapd.conf
# pidfile: /var/run/slapd.pid

# Source function library.
. /etc/init.d/functions

# Source networking configuration and check that networking is up.
if [ -r /etc/sysconfig/network ] ; then
        . /etc/sysconfig/network
        [ ${NETWORKING} = "no" ] && exit 0
fi

# Source an auxiliary options file if we have one, and pick up OPTIONS,
# SLAPD_OPTIONS, and SLURPD_OPTIONS.
if [ -r /etc/sysconfig/ldap ] ; then
        . /etc/sysconfig/ldap
fi

slapd=/usr/sbin/slapd
slurpd=/usr/sbin/slurpd
slaptest=/usr/sbin/slaptest
[ -x ${slapd} ] || exit 0
[ -x ${slurpd} ] || exit 0

RETVAL=0

function start() {
        # Check for simple-but-common errors.
     user=ldap
        ldapuid=`id -u $user`
        # Unaccessible database files.
        for dbdir in `grep ^directory /etc/openldap/slapd.conf | sed s,^directory,,` ; do
                for file in `find ${dbdir}/ -not -uid $ldapuid -and \( -name "*.dbb" -or -name "*.gdbm" -or -name "*.bdb" \)` ; do
                        echo -n $"$file is not owned by \"$user\"" ; warning ; echo
                done
        done
        # Check the configuration file.
        echo -n $"Checking configuration files for $prog: "
        $slaptest
        RETVAL=$?
        if test $RETVAL -eq 0 ; then
            success
        else
            failure
            exit 1
        fi
        # Start daemons.
        prog=`basename ${slapd}`
        echo -n $"Starting $prog: "
        if grep -q ^TLS /etc/openldap/slapd.conf ; then
            daemon ${slapd} -u ldap -h '"ldap:/// ldaps:///"' $OPTIONS $SLAPD_OPTIONS
            RETVAL=$?
        else
            daemon ${slapd} -u ldap -h "ldap:///" $OPTIONS $SLAPD_OPTIONS
            RETVAL=$?
        fi
        echo
        if [ $RETVAL -eq 0 ]; then
            if grep -q "^replogfile" /etc/openldap/slapd.conf; then

        echo "slurpd start"
                prog=`basename ${slurpd}`
                echo -n $"Starting $prog: "
                daemon ${slurpd} $OPTIONS $SLURPD_OPTIONS
                RETVAL=$?
                echo
            fi
        fi
        [ $RETVAL -eq 0 ] && touch /var/lock/subsys/ldap
        return $RETVAL
}
function stop() {
        # Stop daemons.
        prog=`basename ${slapd}`
        echo -n $"Stopping $prog: "
        killproc ${slapd}
        RETVAL=$?
        echo
        if [ $RETVAL -eq 0 ]; then
            if grep -q "^replogfile" /etc/openldap/slapd.conf; then
                prog=`basename ${slurpd}`
                echo -n $"Stopping $prog: "
                killproc ${slurpd}
                RETVAL=$?
                echo
            fi
        fi
        [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/ldap /var/run/slapd.args
        return $RETVAL
}

# See how we were called.
case "$1" in
    start)
        start
        ;;
    stop)
        stop
        ;;
    status)
        status ${slapd}
        if grep -q "^replogfile" /etc/openldap/slapd.conf ; then
            status ${slurpd}
     fi
        ;;
    restart)
        stop
        start
        ;;
    condrestart)
        if [ -f /var/lock/subsys/ldap ] ; then
            stop
            start
        fi
        ;;
    *)
        echo $"Usage: $0 {start|stop|restart|status|condrestart}"
        RETVAL=1
esac

exit $RETVAL


-----------------------------------------------
# service ldap start
检查  的配置文件:bdb_db_open: db_open(/usr/local/var/openldap-data/id2entry.bdb) failed: No such file or directory (2)
backend_startup_one: bi_db_open failed! (2)
slap_startup failed (test would succeed using the -u switch)
[root@linuxas2 init.d]# slapd
[root@linuxas2 init.d]# ps aux|grep slapd
root     24600  0.7  0.8 354132 3216 ?       Ssl  21:11   0:00 slapd
root     24606  0.0  0.1  5516  772 pts/0    R+   21:11   0:00 grep slapd
[root@linuxas2 init.d]# ls -la /usr/local/var/openldap-data/
总用量 4068
drwxr-xr-x  2 ldap root      4096  1月 31 21:11 .
drwxr-sr-x  8 root root      4096  1月 31 16:44 ..
-rw-r--r--  1 root root      2048  1月 31 21:11 alock
-rw-------  1 root root     16384  1月 31 21:10 __db.001
-rw-------  1 root root 335552512  1月 31 21:10 __db.002
-rw-------  1 root root   2359296  1月 31 21:10 __db.003
-rw-------  1 root root    450560  1月 31 21:10 __db.004
-rw-------  1 root root     24576  1月 31 21:10 __db.005
-rw-------  1 ldap root       886  1月 31 20:30 DB_CONFIG
-rw-------  1 root root      8192  1月 31 21:11 dn2id.bdb
-rw-------  1 root root     32768  1月 31 21:11 id2entry.bdb
-rw-------  1 root root     41998  1月 31 21:11 log.0000000001

# kill -9 24600
[root@linuxas2 init.d]# service ldap start
/usr/local/var/openldap-data/id2entry.bdb is not owned by "[警告]
/usr/local/var/openldap-data/dn2id.bdb is not owned by "lda[警告]
检查  的配置文件:bdb_db_open: unclean shutdown detected; attempting recovery.
bdb_db_open: Recovery skipped in read-only mode. Run manual recovery if errors are encountered.
config file testing succeeded
启动 slapd:                                               [  确定  ]

#cd /usr/local/var/openldap-data
#chown ldap *
# service ldap start
检查  的配置文件:config file testing succeeded
启动 slapd:                                               [  确定  ]
[root@linuxas2 openldap-data]# ps aux|grep slapd
root     24673  0.0  0.0   456  152 pts/0    R+   21:16   0:00 grep slapd

--------------------------------------
#vi /var/log/messages ------>
Jan 31 21:15:59 linuxas2 slapd[24663]: sql_select option missing
Jan 31 21:15:59 linuxas2 slapd[24663]: auxpropfunc error no mechanism available
Jan 31 21:16:00 linuxas2 ldap: slapd 启动 succeeded

论坛徽章:
0
2 [报告]
发表于 2007-01-31 21:41 |只看该作者
(1)在网上查了一下,有人说是/usr/local/var/openldap-data的权限没设置为ldap,也有人说是因为把ldap.conf 放在了/etc下,而没放在/etc/openldap下的原因.
还有人说是SASL的原因。我重新又编译了openldap
#./configure     --enable-spasswd \
                --enable-crypt
问题一样。

(2)改动/etc/init.d/ldap   ---------》将ldap用户改为root ,仍然不能通过service ldap start启动,问题和上面的完全一样。但#slapd 仍能启动。我试过将/usr/local/var/openldap-data/中的文件清除(只留下DB_CONFIG)重复上面的各种组合操作,问题一样。


(3)简单归纳问题就是:service ldap start 初始启动提示少文件:id2entry.bdb, 这种方式启动不能生成上述文件, slapd 启动能生成上述文件,且生成的文件全为root用户的.更改了文件的用户後,用servcie ldap start启动会提示成功,但无slapd进程,messages显示上面的错误。


(4)上面的问题网上很多人提出,但都没有好的答复。很多根本就是只有问题,没有回答。我个人倒有点认为是slapd.conf的设置可能有问题,无奈我是新手,不知从何下手。盼高人指点一二,不胜感激。

论坛徽章:
0
3 [报告]
发表于 2007-02-01 12:16 |只看该作者
Try to start openldap without using your scripts unless you understand the whole things altogether.

ps. I don't think the problem you encountered is related to openldap itself if you have successfully done the 'make test'. Use the minimum slapd.conf and comment all content in ldap.conf, then use debug mode to probe your issue.
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP