Mac OS Lion Server 上出现“密码服务器:已停止”。启动期间因错误 -1 而停止

Mac OS Lion Server 上出现“密码服务器:已停止”。启动期间因错误 -1 而停止

由于我的服务器崩溃了,数据库也损坏了,所以我从存档中恢复了 Open Directory。密码服务器不再启动。日志如下所示:

Feb 14 2012 21:41:20 156746us    Mac OS X Password Service version 376.1 (pid = 2438) was started at: Tue Feb 14 21:41:20 2012.
Feb 14 2012 21:41:20 156801us    RunAppThread Created
Feb 14 2012 21:41:20 156852us    RunAppThread Started
Feb 14 2012 21:41:20 156879us    Initializing Server Globals ...
Feb 14 2012 21:41:20 163094us    Initializing Networking ...
Feb 14 2012 21:41:20 163196us    Initializing TCP ...
Feb 14 2012 21:41:20 191790us    SASL is using realm "SERVER.HOME.POST-NET.CH"
Feb 14 2012 21:41:20 191847us    Starting Central Thread ...
Feb 14 2012 21:41:20 191860us    Starting other server processes ...
Feb 14 2012 21:41:20 191873us    StartCentralThreads: 1 threads to stop
Feb 14 2012 21:41:20 191905us    Initializing TCP ...
Feb 14 2012 21:41:20 191954us    Starting TCP/IP Listener on ethernet interface, port 106
Feb 14 2012 21:41:20 192012us    Starting TCP/IP Listener on ethernet interface, port 3659
Feb 14 2012 21:41:20 192048us    Starting TCP/IP Listener on interface lo0, port 106
Feb 14 2012 21:41:20 192082us    Starting TCP/IP Listener on interface lo0, port 3659
Feb 14 2012 21:41:20 192117us    StartCentralThreads: Created 4 TCP/IP Connection Listeners
Feb 14 2012 21:41:20 192132us    Starting UNIX domain socket listener /var/run/passwordserver
Feb 14 2012 21:41:20 193034us    CRunAppThread::StartUp: caught error -1.
Feb 14 2012 21:41:20 193056us    ** ERROR: The Server received an error during startup.  See error log for details.
Feb 14 2012 21:41:20 193075us    RunAppThread::StartUp() returned: 4294967295
Feb 14 2012 21:41:20 193107us    Stopping server processes ...
Feb 14 2012 21:41:20 193119us    Stopping Network Processes ...
Feb 14 2012 21:41:20 193131us    Deinitializing networking ...
Feb 14 2012 21:41:20 193149us    Server Processes Stopped ...
Feb 14 2012 21:41:20 193165us    RunAppThread Stopped
Feb 14 2012 21:41:20 193202us    Aborting Password Service.  See error log.

错误日志重复以下内容:

Feb 14 2012 21:41:50 409022us    Server received error -1 during startup.
Feb 14 2012 21:41:50 409141us    Aborting Password Service.

有人知道这里出了什么问题以及我该如何修复它吗?

答案1

我遇到了这个问题。这不是密码服务的问题,而是损坏的 ldap 数据库。

http://www.iredmail.org/forum/topic3694-iredmail-support-power-cut-ldap-dont-sta实时.html https://discussions.apple.com/thread/4149695?start=0&tstart=0

这是我所做的。

  1. 检查这是否是问题所在

    $ sudo /usr/libexec/slapd -Tt 
    >> bdb_db_open: database "cn=authdata": db_open(/var/db/openldap/authdata/id2entry.bdb) failed: Invalid argument (22).
    
  2. 停止 OD Master 上的 LDAP

    $ sudo launchctl unload /System/Library/LaunchDaemons/org.openldap.slapd.plist
    
  3. 修复权限

    $ diskutil repairPermissions /
    
  4. 备份 openldap 数据库

    $ sudo cp /var/db/openldap/authdata/id2entry.bdb /var/db/openldap/authdata/id2entry.bdb.backup
    
  5. 维修

    $ sudo db_recover -cv -h /var/db/openldap/openldap-data/
    >> Recovery complete at Thu Jun  6 11:01:35 2013
    >> Maximum transaction ID 8000060e Recovery checkpoint [2][6589846]
    
  6. 再次运行修复以检查

    $ sudo db_recover -cv -h /var/db/openldap/openldap-data/
    >> Finding last valid log LSN: file: 2 offset 6589938
    >> Recovery starting from [1][28]
    >> Recovery complete at Thu Jun  6 11:02:32 2013
    >> Maximum transaction ID 8000060e Recovery checkpoint [2][6589938]`
    
  7. 再次检查是否修复正确

    $ sudo /usr/libexec/slapd -Tt
    >> bdb_monitor_db_open: monitoring disabled; configure monitor database to enable
    

    配置文件测试成功

  8. 重启服务

    $ sudo launchctl load /System/Library/LaunchDaemons/org.openldap.slapd.plist
    

答案2

我过去遇到过类似的问题,通常通过用 Time Machine 备份替换 /var/db/openldap 的全部内容来解决这个问题。

确保首先停止 ldap:

sudo launchctl 卸载 /System/Library/LaunchDaemons/org.openldap.slapd.plist

然后对于 CYA,将 /var/db/openldap 中的所有内容复制到您选择的位置。然后删除 /var/db/openldap 中的三个文件夹。

从 /var/db/openldap 目录打开 Time Machine 并从已知的工作日期/时间恢复 3 个文件夹。

启动 ldap:

sudo launchctl 加载 /System/Library/LaunchDaemons/org.openldap.slapd.plist

为了确保万无一失,请重新启动,一切通常都会恢复正常。

相关内容