Mac OS X OpenDirectory Corruption

Had some issues with OpenDirectory a little while ago and thought I would publish the outcome so someone else can learn from what I found!

mkdir ~/ldap-rescue # create convenient directory
sudo slapcat -l ldif # create text file from slapd database
cd /var/db/openldap # move to openldap directory
sudo su
mv openldap-data openldap-data-old # srchive old data
mkdir openldap-data # new directory
chmod go-rx openldap-data # fix permissions, don’t know if needed.
/usr/libexec/slapd # test to see if slapd will run. This didn’t work before, with slapd exiting.
cat /var/run/slapd.pid # This resulted in a return value of 18691 on my system, so now slapd will run.
sudo launchctl unload /System/Library/LaunchDaemons/org.openldap.slapd.plist
exit # get out of root. I’m dangerous.
cd ~/ldap_rescue # back to the rescue directory.
sudo slapadd -l ldif # reload the data. I’m lucky I got away with this.
sudo slapcat -l ldifnew # diff reports no differences in ldif and ldifnew
sudo launchctl unload /System/Library/LaunchDaemons/org.openldap.slapd.plist


Posted

in

by

Comments

2 responses to “Mac OS X OpenDirectory Corruption”

  1. mk

    hi, i am running lion , could you tranfer a /System/Library/LaunchDaemons/org.openldap.slapd.plist file to me,



  2. Disabled

    HardResourceLimits

    NumberOfFiles
    8192

    Label
    org.openldap.slapd
    OnDemand

    Program
    /usr/libexec/slapd
    ProgramArguments

    /usr/libexec/slapd
    -d
    0
    -h
    ldap:/// ldapi://%2Fvar%2Frun%2Fldapi

    ServiceIPC

    SoftResourceLimits

    NumberOfFiles
    8192

    Umask
    63