# is it possible - sybase sql 10 server on freebsd?



## edhunter (Feb 17, 2009)

Hello guys

In my organization we have store application that uses sybase sql 10 database. I have setup a SQL Anywhere 10 server on windows machne specially for that apclication.
My question is - is it possible to run sybase sql 10 database on freebsd?
In ports tree there is only sybasa ase 11 that seems to be very outdated. I have tried to search in sybase.com but no much luck ... I need just to run the database and accept the client connection over the network.

Need help..
10x in advance


----------



## Djn (Feb 17, 2009)

If there is a linux version, it's fairly likely that it can be made to run on FreeBSD. 

In short, install emulators/linux-base and try running the installer.


----------



## edhunter (Feb 18, 2009)

yep i tried like that 
i had to slightly modify the install script
I changed the #!/bin/sh to #!/compat/linux/bin/sh and the path of tar. And I could install it succesfuly.

First I tried with linux_base-f8 and I even could start the server listening for connections on *:2638 but connections could not be made I dont know why.
I was getting some errors in message log:

```
Feb 17 14:54:46 test kernel: linux: pid 45707 (rm): syscall unlinkat not implemented
Feb 17 14:54:58 test kernel: linux: pid 45714 (rm): syscall unlinkat not implemented
Feb 17 14:55:08 test kernel: linux: pid 45819 (chmod): syscall fchmodat not implemented
Feb 17 14:55:08 test kernel: linux: pid 45821 (chmod): syscall fchmodat not implemented
Feb 17 14:55:08 test kernel: linux: pid 45825 (rm): syscall unlinkat not implemented
Feb 17 14:55:08 test kernel: linux: pid 45827 (rm): syscall unlinkat not implemented
Feb 17 14:55:08 test kernel: linux: pid 45828 (rm): syscall unlinkat not implemented
Feb 17 14:55:08 test kernel: linux: pid 45830 (rm): syscall unlinkat not implemented
Feb 17 14:55:08 test kernel: linux: pid 45843 (chmod): syscall fchmodat not implemented
Feb 17 14:55:08 test kernel: linux: pid 45847 (chmod): syscall fchmodat not implemented
Feb 17 14:55:08 test kernel: linux: pid 45851 (chmod): syscall fchmodat not implemented
....
Feb 17 14:55:09 test kernel: linux: pid 45977 (rm): syscall unlinkat not implemented
Feb 17 14:55:09 test kernel: linux: pid 45980 (rm): syscall fstatat64 not implemented
Feb 17 15:02:08 test kernel: linux: pid 46050 (rm): syscall fstatat64 not implemented
Feb 17 15:02:08 test kernel: linux: pid 46052 (rm): syscall unlinkat not implemented
```

Than I deinstalled linux_base-f8 and installed linux_base-fc4 (I think that is the default port for linux base). And again I installed sql anywhere 10 (I had to set compat.linux.osrelease=2.6.16 for installing, otherwise the setup script complained about old linux kernel).
I could execute the server and I even can connect to it from another machine .. but I could not connect from same machine - I get this error
	
	



```
Connection error: Insufficient system resources - failed to allocate a SYSV semaphore.
```
I'll dig a bit deeper, but any suggestions are welcomed


----------



## edhunter (Feb 18, 2009)

*I got it running ))*

finaly i got it running...
i had to increase valuses for theese sysctl values
kern.ipc.semmns=1024
kern.ipc.semmni=512

I havent tested to fine tune theese values, may be they are too high (defaults are semnns=60 and semmni=10).

So here are all steps in case someone need to get sybase running on freebsd. May be some of the steps are not nessesery but I think they doesnt hurt.

1.1 kldload linux
1.2 add linprocfs to /etc/fstab and mount it
1.3 install emulation/linux_base-fc4

2.1 download linux version of sybase developers edition from sybase (they will provide you with key), i have downloaded 10.0.1 version, because my database currently is on this version http://www.sybase.com/detail?id=1055872
2.2 untargz the file
2.3 edit file setup and replace #!/bin/sh with !/compat/linux/bin/sh
2.4 find string /bin/tar in the file and replace it /usr/bin/tar`
(optional 2.5.... edit every occurance of #!/bin/ and replace it with #!/compat/linux/bin in all files)

3.1 sysctl compat.linux.osrelease=2.6.16
3.2 execute setup and install (on step with the key enter the dev key or real key, if dev key is entered there is prompt on every start of dbeng10/dbsrv10)
I have deselected all components except sql engine/server/client and tools
3.3 there were express bug fix for sql anyhere 10.0.1 I had downloaded it and installed it like in previous steps 2.2-3.2

4.1 cd to the directory where installed sqlanywhere (I installed in /compat/linux/opt/sqlanywhere)
4.2 find every occurance in files of #!/bin and again replace it with #!/compat/linux/bin

5.1 return the defalt value for compat.linux.osrelease - sysctl compat.linux.osrelease=2.4.2
5.2 edit /boot/loader.conf and add theese:
kern.ipc.semmns=1024
kern.ipc.semmni=512
5.3 reboot

6.1 execute
/compat/linux/bin/sh
6.2 execute source /compat/linux/opt/sqlanywhere/bin32/sa_config.sh
6.3 run whatever needed from sqlanywhere (dbeng dbsrv10 dbstop dbisqlc ... etc.)


Thats it.
Of course, it would be good to have rc scripts for running and stopping server (especially stopping) it  And may be running as different (non root) user.

p.s. tested on freebsd 7.1-stable i386 (sources and world from 11.2.2009)


----------



## Mel_Flynn (Feb 18, 2009)

I'm not sure why you do this compat.linux.os_release juggling rather then installing linux_base-fc6, which is the recommended version for FreeBSD 7 and higher.


----------



## edhunter (Feb 18, 2009)

I have tried with linux_base-fc6 too but for some reason sql server could not start successfully.
the error were something like ... could not start TCPIP

and also the default value for compat.linux.os_release is still 2.4.2 in freebsd 7.1-stable, thats why i think that fc4 is better choice for linux_base.


----------



## Mel_Flynn (Feb 19, 2009)

So I guess the move is still not done, even though for Skype+7.x you need fc6.
Either way, I don't understand why you need to juggle those sysctl vars. If 2.4.2 is default, you shouldn't have to change anything at all. The fact that changing to 2.6.16 makes things magically work, even though fc4 is installed, sounds very dubious.
I would ping freebsd-emulation list and report your findings.


----------



## edhunter (Feb 19, 2009)

I change it only for the install script ... it checks for the version of os, and if i dont change the compat.linux.osrelease var the setup script exits with a message that the os is too old 
But for running sql server the value of compat.linux.osrelease must be old one - 2.4.2, otherwise the server doesnt start correct.


----------



## frankpeng (May 19, 2013)

Hi, I was trying to run SQLanywhere 11.0.1 on FreeBSD 9.1-STABLE, when I do `dbeng11 ../demo.db`
it shows the following:

```
Copyright (c) 2001-2009, iAnywhere Solutions, Inc.
Portions copyright (c) 1988-2009, Sybase, Inc. All rights reserved.
Use of this software is governed by the Sybase License Agreement. Refer to [url]http://www.sybase.com/softwarelicenses[/url]

2 logical processor(s) on 1 physical processor(s) detected.
This server is licensed to:
    Developer Edition
    Restricted Use
Running Linux 2.6.16 FreeBSD 9.1-STABLE #4: Sun May  5 20:21:55 EDT 2013 on X86 (X86_64)
Server built for X86 processor architecture
8192K of memory used for caching
Minimum cache size: 8192K, maximum cache size: 1834880K
Using a maximum page size of 2048 bytes
TCP/IP functions not found
Database server shutdown due to startup error
```

I am using linux_base-fc4. If *I* try `sysctl compat.linux.osrelease=2.4.2` it will display 
	
	



```
epoll_wait: Function not implemented
```
 forever.


----------

