Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm trying to set up a test LDAP-server for some developers but I'm running into some trouble.

service slapd start

errors so I run

/usr/sbin/slapd -d 1

and this gives me the following error at the end:

unable to open pid file "/var/run/ldap/slapd.pid": 13 (Permission denied)

slapd destroy: freeing system resources.

slapd stopped.

The rights for /var/run/ldap are as follows:

root@pec:/var/run/ldap# ls -ld
drwxr-xr-x 2 openldap openldap 60 2012-07-04 20:45 

So I don't get why there is still a permission denied. Syslog gives the following when running slapd:

Jul  4 21:00:27 pec slapd[13758]: @(#) $OpenLDAP: slapd 2.4.21 (Dec 19 2011 15:40:04) $#012#011buildd@allspice:/build/buildd/openldap-2.4.21/debian/build/servers/slapd
Jul  4 21:00:27 pec kernel: [8147247.203100] type=1503 audit(1341428427.953:64):  operation="truncate" pid=13758 parent=20433 profile="/usr/sbin/slapd" requested_mask="::w" denied_mask="::w" fsuid=0 ouid=119 name="/var/run/ldap/slapd.pid"

Can anyone point me in the right direction?

share|improve this question

1 Answer 1

up vote 6 down vote accepted

What distribution are you running and how did you install OpenLDAP?

The error you got is from AppArmor and tells you that it prevented slapd from creating it's pid file.

For Ubuntu: You should have something like the following in your /etc/apparmor.d/usr.bin.slapd file:

  /{,var/}run/ldap/* w,

to allow this.

Normally, this should be set up to work without further configuration.

share|improve this answer
    
Running Ubuntu 10.04 server and installed it by copying everything from the master installation to another server and deleting some replicate statements from the config file. A rather brute way, maybe that's why this happened. I'll try your solution tonight. Thanks! –  Foezjie Jul 5 '12 at 7:01
    
Yeah, this method is most likely the source of your problem. One thing I noticed is that the default path for the slapd.pid on at least Ubuntu 12.04 is /var/run/slapd.pid and the AppArmor config file contains /{,var/}run/slapd/* w,, so if you overwrote the default, you will end up with problems. –  SvW Jul 5 '12 at 8:11
    
One more hint: I highly recommend to convert the configuration to the modern cn=config format, which allows online reconfiguration of OpenLDAP. –  SvW Jul 5 '12 at 8:13
    
I'm having some other problems now. When I start slapd using "/usr/sbin/slapd -d 1" The output blocks after "backend_startup_one: starting "dc=ulyssis,dc=org" bdb_db_open: database "dc=ulyssis,dc=org": dbenv_open(/var/lib/ldap). slapd starting" Syslog output is only " Jul 6 21:16:55 pec slapd[11415]: @(#) $OpenLDAP: slapd 2.4.21 (Dec 19 2011 15:40:04) $#012#011buildd@allspice:/build/buildd/openldap-2.4.21/debian/build/servers/slap‌​d" which doesn't look like an error.. Any ideas? –  Foezjie Jul 6 '12 at 19:19

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.