# fedora directory server on FreeBSD?



## rocky (May 10, 2009)

I like OpenLDAP but my boss forces me to use Fedora Directory Server (http://directory.fedoraproject.org/). FDS sounds very good and easy to setup 

Because FDS supports OpenSolaris I think it's reasonable to install it on FreeBSD, but I didn't find any way to do that.

Do you have any idea about this?

Thanks for your helps and suggetions.


----------



## SirDice (May 11, 2009)

rocky said:
			
		

> Because FDS supports OpenSolaris I think it's reasonable to install it on FreeBSD,


Why? OpenSolaris != *BSD

Just install linux_base-fc4 and go from there...

http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/linuxemu.html


----------



## rocky (May 13, 2009)

Thank you, SirDice!

I have linux_base-fc8. After extracting the FDS-*.rpm to /compat/linux/opt using rpm2cpio and cpio, I executed */compat/linux/opt/fedora-ds/setup/setup* and got the following error:


```
bin/slapd/server/dsktune: error while loading shared libraries: ../../../../lib/libstdc++.so.6: ELF file OS ABI invalid
```

The path of file (../../../../) shows that it's FreeBSD library (not a Linux library). Does this mean that I should install C-libraries for /compat/linux? And how?


----------



## rocky (May 19, 2009)

How can I load the right version of glib for Linux in /compat/linux?


```
Can't load '/usr/local/lib/perl5/site_perl/5.8.9/auto/Mozilla/LDAP/API/API.so' for module Mozilla::LDAP::API: /usr/local/lib/compat/libc.so.6: version GLIBC_2.1.3 required by /usr/local/lib/perl5/site_perl/5.8.9/auto/Mozilla/LDAP/API/API.so not defined at /usr/local/lib/perl5/5.8.9/mach/DynaLoader.pm line 226.
```

There are two versions of glibc: in /usr/local/lib/compat/ and in /compat/linux/lib. The later one was installed by using a rpm package from Fedora Core 8 packages...


----------



## SaveTheRbtz (May 19, 2009)

Try this:

```
[PH34R] ~> sudo chroot /compat/linux /bin/bash
```
Then you can do everything like in linux:


```
bash-3.2# uname -a
Linux PH34R 2.6.16 FreeBSD 8.0-CURRENT #44 r192199M: Sat May 16 20:28:20 MSD 2009 i686 athlon i386 GNU/Linux
```


----------



## rocky (May 19, 2009)

Great! I wonder why this tip is missed from FreeBSD handbook 

I try it now...


----------



## rocky (May 20, 2009)

*Failed to create semaphore for stats file*

SaveTheRbtz suggests me to use chroot to use linux /compat. That's cool but I still have some problems.

To start FDS inside chrooted-Linux, I run


```
/opt/fedora-ds/sbin/ns-slapd \
  -d 9 \
  -D /opt/fedora-ds/etc/dirsrv/slapd-fds2 \
  -i /opt/fedora-ds/var/run/dirsrv/slapd-fds2.pid \
  -w /opt/fedora-ds/var/run/dirsrv/slapd-fds2.startpid
```

The log message is as below.


```
[20/May/2009:13:35:17 +0700] Fedora-Directory/1.2.0 - debug level: trace+connections (9)
[20/May/2009:13:35:17 +0700] - defbackend_init
[20/May/2009:13:35:17 +0700] slapi_be_new - Added new backend name [default] type [default] nbackends [1]
[20/May/2009:13:35:17 +0700] - => str2entry_dupcheck
[20/May/2009:13:35:17 +0700] - <= str2entry_dupcheck 0x80a9ed0 ""
[20/May/2009:13:35:17 +0700] - => str2entry_dupcheck
[20/May/2009:13:35:17 +0700] - <= str2entry_dupcheck 0x80b3a30 "cn=config"
[20/May/2009:13:35:17 +0700] - => str2entry_dupcheck
[20/May/2009:13:35:17 +0700] - <= str2entry_dupcheck 0x80b3a30 "cn=monitor"
[20/May/2009:13:35:17 +0700] - => str2entry_dupcheck

% stuff cut

[20/May/2009:13:35:17 +0700] - => ids_sasl_init
[20/May/2009:13:35:17 +0700] - gethostbyname("icy") failed, error 0 (Success)
[20/May/2009:13:35:17 +0700] - sasl service fqdn is: (null)
[20/May/2009:13:35:17 +0700] - ids_sasl_getopt: plugin= option=plugin_list
[20/May/2009:13:35:17 +0700] - <= ids_sasl_init
[20/May/2009:13:35:17 +0700] - => str2entry_dupcheck
[20/May/2009:13:35:17 +0700] - <= str2entry_dupcheck 0x80ac758 "cn=schema"

% stuff cut

[20/May/2009:13:35:18 +0700] - => send_ldap_result 68::
[20/May/2009:13:35:18 +0700] - <= send_ldap_result
[20/May/2009:13:35:18 +0700] - => str2entry_fast
[20/May/2009:13:35:18 +0700] - <= str2entry_fast 0x811f988
[20/May/2009:13:35:18 +0700] - add_created_attrs
[20/May/2009:13:35:18 +0700] - => send_ldap_result 0::
[20/May/2009:13:35:18 +0700] - <= send_ldap_result
[20/May/2009:13:35:18 +0700] - descriptor limit changed from 11095 to 1024
[20/May/2009:13:35:18 +0700] - Fedora-Directory/1.2.0 B2009.139.99 starting up
[20/May/2009:13:35:18 +0700] - Failed to create semaphore for stats file (/opt/fedora-ds/var/run/dirsrv/slapd-fds2.stats). Error 38.(Function not implemented)
```

Everything seems to work except two issues

(a) the internal *gethostbyname* doesn't work. This may not be important because ns-slapd continues to run

(b) `ns-slapd` tried to create stat file to store its PID but it failed to do that (*Failed to create semaphore for stats file*) After exposing this message `ns-slapd` stopped working

I think this problem relates to the compatibility of running chrooted-Linux in FreeBSD. How to overcome this error?

Thanks for your helps.


----------



## SirDice (May 20, 2009)

rocky said:
			
		

> (a) the internal *gethostbyname* doesn't work. This may not be important because ns-slapd continues to run


Make sure resolv.conf is setup properly inside /compat/linux.



> (b) `ns-slapd` tried to create stat file to store its PID but it failed to do that (*Failed to create semaphore for stats file*) After exposing this message `ns-slapd` stopped working


/opt probably doesn't exist. Have you tried creating that directory structure (inside the /compat/linux chroot of course)? Also make sure the account the ns-slapd runs on is able to write there.


----------



## rocky (May 20, 2009)

Thanks SirDice.

(a)

To get `gethostbyname` to work I changed in /etc/hosts. Of course I can use your tip (edit in /etc/resolv.conf) but that requires something in local DNS 

(b)

In fact I copy the FC8 root from a native installation (see http://www.onlamp.com/pub/a/bsd/2000/11/16/Big_Scary_Daemons.html) to /home/fedora_core/ then chroot:


```
$ chroot /home/fedora_core8 /bin/bash
```

In /home/fedora_core8 the directory /opt/ , /opt/fedora-ds/ do exist.


You can read some thing in my `dmemsg` (from FreeBSD system) at http://viettug.org/attachments/download/190/dmesg_linux.txt :


```
linux: pid 2024 (netstat): ioctl fd=3, cmd=0x891d ('\M^I',29) is not implemented
linux: pid 2024 (netstat): ioctl fd=3, cmd=0x8970 ('\M^I',112) is not implemented
linux: pid 2024 (netstat): ioctl fd=3, cmd=0x8970 ('\M^I',112) is not implemented
linux: pid 2024 (netstat): ioctl fd=3, cmd=0x8942 ('\M^I',66) is not implemented
linux: pid 2026 (netstat): ioctl fd=3, cmd=0x891d ('\M^I',29) is not implemented
linux: pid 2026 (netstat): ioctl fd=3, cmd=0x8970 ('\M^I',112) is not implemented
linux: pid 2026 (netstat): ioctl fd=3, cmd=0x8970 ('\M^I',112) is not implemented
linux: pid 2026 (netstat): ioctl fd=3, cmd=0x8942 ('\M^I',66) is not implemented
linux: pid 2026 (netstat): ioctl fd=3, cmd=0x891d ('\M^I',29) is not implemented
linux: pid 2026 (netstat): ioctl fd=3, cmd=0x8970 ('\M^I',112) is not implemented
linux: pid 2026 (netstat): ioctl fd=3, cmd=0x8970 ('\M^I',112) is not implemented
linux: pid 2026 (netstat): ioctl fd=3, cmd=0x8942 ('\M^I',66) is not implemented
linux: pid 2027 (netstat): ioctl fd=3, cmd=0x891d ('\M^I',29) is not implemented
linux: pid 2027 (netstat): ioctl fd=3, cmd=0x8970 ('\M^I',112) is not implemented
linux: pid 2027 (netstat): ioctl fd=3, cmd=0x8970 ('\M^I',112) is not implemented
linux: pid 2027 (netstat): ioctl fd=3, cmd=0x8942 ('\M^I',66) is not implemented
linux: pid 2027 (netstat): ioctl fd=3, cmd=0x891d ('\M^I',29) is not implemented
linux: pid 2027 (netstat): ioctl fd=3, cmd=0x8970 ('\M^I',112) is not implemented
linux: pid 2027 (netstat): ioctl fd=3, cmd=0x8970 ('\M^I',112) is not implemented
linux: pid 2027 (netstat): ioctl fd=3, cmd=0x8942 ('\M^I',66) is not implemented
```


----------



## SaveTheRbtz (May 22, 2009)

What is kernel version in your fedora instalation?


----------



## rocky (May 22, 2009)

SaveTheRbtz said:
			
		

> What is kernel version in your fedora instalation?


Uhm... your question may be a nice tip. As I said I installed FC8 that used Linux-2.6.23.1-42.fc8.

I also note that the command `rm -rfv /home/foobar/` can't work inside my chrooted-Linux due to the same problem. (See log in http://viettug.org/attachments/download/190/dmesg_linux.txt)


----------



## SirDice (May 22, 2009)

There is no linux kernel in linux_base-*, it's not needed. 
On the fbsd side what's the output of *sysctl compat.linux.osrelease*?
You may need to set it to 2.6.16.


----------



## SaveTheRbtz (May 22, 2009)

Indeed kernel is not needed, but choosing distributive with kernel closer to 2.6.16 is better
Also don't forget to do something like this:


```
# vi /etc/fstab
linproc                         /compat/linux/proc linprocfs rw 0 0
linsys          /compat/linux/sys       linsysfs        rw 0 0
devfs                   /compat/linux/dev devfs rw 0 0
```


----------



## rocky (May 23, 2009)

Thank you, SaveTheRbtz and SirDice.

I use FC8 that uses a new version. It seems hard to find another kernel which closes to 2.6.16.

My `compat.linux.osrelease` is 2.6.16. After mouting system files as SaveTheRbtz said I still have problems.

Not all Linux functions are supported by the FreeBSD. If this is true I think we can't get rid of the error...


----------



## SaveTheRbtz (May 23, 2009)

as i know there are improvements in linuxulator in 8.0. May be you should try it?


----------



## rocky (May 23, 2009)

SaveTheRbtz said:
			
		

> as i know there are improvements in linuxulator in 8.0. May be you should try it?


Thanks SaveTheRbtz.

I need a production environment for my company so I am afraid that I can't do this on the main machine. I am also buiding FDS on native FreeBSD but I have some problems with compiling process (see http://forums.freebsd.org/showthread.php?p=24996)

Anyway on my laptop `ndis0` is often flicked and I should try the 8 branch then I have a change to run `linuxulator`. (I can't find where to download it). I will try it next week.


----------



## SirDice (May 23, 2009)

rocky said:
			
		

> Anyway on my laptop `ndis0` is often flicked and I should try the 8 branch then I have a change to run `linuxulator`. (I can't find where to download it). I will try it next week.




```
cd /usr/ports/emulators/linux_base-f8 && make install clean
```


----------



## SaveTheRbtz (May 24, 2009)

maybe its easier to install fedora as second system setup 389ds there and than mount linux's partition as /compat/linux ?


----------



## rocky (May 25, 2009)

Thank you!

I tried
* linux_base-f8
* mount a FC8 linux installation under FreeBSD then chroot...

All failed with error "`foobar` is not implemented".

Temporarily relax myself


----------

