Subject Re: [firebird-support] firebird on debian SQLCODE = -902 as normal user
Author Helen Borrie
At 09:56 AM 28/11/2007, you wrote:
>Helen Borrie wrote:
> > Next, what *model* of firebird 1.5 have you installed?
>
>Thats what I already wrote:
>mrburns:/var/log# aptitude show firebird2-classic-server
>Paket: firebird2-classic-server
>Zustand: Installiert
>Automatisch installiert: nein
>Version: 1.5.3.4870-12
>
>I installed the classic version.

Could you follow through the symlinks to libfbclient.so and libfbembed.so and discover anything strange about the permissions on those? Note, we are not looking at any of the "usual" setup problems here...the Debian packaging does totally its own thing WRT locations and permissions. One of the people involved in the packaging posts to the firebird-devel list occasionally and I believe he also runs a firebird-dedicated packager list in Debian's domain.

>> b) The firebird group doesn't have execute permissions on the directory
>> where the database file is located.
>
>Directory permissions:
>mrburns:/var/lib/firebird2# ls -l
>drwxrwxrwx 2 firebird firebird 4096 2007-11-26 08:12 data
>
>The database (permissions):
>mrburns:/var/lib/firebird2/data# ls -l
>-rwxrwxrwx 1 firebird firebird 412581888 2007-11-26 08:20 database.gdb

Making a local connection with Classic, you are connecting your OS user directly to the database file via libfbembed.so, which is a single-user client with the server code embedded. That's why the OS user must have the file and directory permissions that, on a full server, are needed only by the OS user firebird. That OS user must also *log into the database* with a valid *database* user name and password.

Possibly there is something creaky about OS user 'andi' - are you sure it has the needed group membership? And, one step further in, are you sure that the SYSDBA password is 'masterkey'? On the POSIX builds, it should not be so. The password is generated during the install...so perhaps the Debian packager has overlooked it and SYSDBA actually has no password...?

>> 2. You have renamed isql to isql-fb
>
>it is the standard installation of debian. /usr/lib/firebird2/bin/isql
>is linked to /usr/bin/isql-fb

OK.


>> 3. You are in $firebirdroot$/bin directory
>>
>> ~~~$ .isql-fb [return]
>> Use CONNECT or CREATE DATABASE to specify a database
>> SQL> CONNECT 'localhost:\path\to\database.gdb'
>> CON> USER 'ANDI' PASSWORD 'xxxxxxxxxxx';
>> SQL>
>>
>> Or, you can connect directly from the command-line:
>> ~~~$ .isql-fb 'localhost:\path\to\database.gdb' -user ANDI -pass
>> xxxxxxxxxxx [return]
>> SQL>
>
>I removed everything related to firebird, also all configuration files
>and also the modified security.fdb.
>Then I reinstalled all firebird2-classic debian packages.
>security.fdb contains only SYSDBA.
>
>Now I can connect when I'm logged in as user andi, but only this way:
>andi@mrbruns:/usr/lib/firebird2/bin$ isql-fb
>SQL> CONNECT '/path/to/database.gdb'
>CON> USER 'SYSDBA' PASSWORD 'masterkey';
>lock manager: couldn't set uid to superuser
>Database: '/path/to/database.gdb', User: SYSDBA

This is using the local direct connect: you are invoking an instance of libfbembed.so. The lock manager problem indicates (I think) that "something is missing" that associates SYSDBA with root (superuser), which is automatic on the POSIX builds. Another reason why I think you should post a clear description of the problem in firebird-devel.

>When I try this way:
>andi@mrburns:/usr/lib/firebird2/bin$ isql-fb
>'localhost:/path/to/database.gdb -user SYSDBA -pass masterkey
>Statement failed, SQLCODE = -902
>
>operating system directive open failed
>-Permission denied

In this example, the client part of libfbembed.so, or an invocation of libfbclient.so, is attempting to obtain an instance of fb_inet_server through xinet.d. Are you sure you have xinet.d installed and running? Are you sure that the localhost server is defined in /etc/hosts?

>The same error occurs, when I try this as root.
>
>This error I also retrieve when I start my website which is connecting
>to firebird.
>apache user is www-data.

Do you mean www-data is the OS user that owns the Apache process? If so, is www-data a member of the firebird group?

Are you trying to invoke multiple instances of libfbembed.so simultaneously? i.e. one libfbembed process already has the database file open and locked when another user tries to open it through another libfbembed.so instance?

>What problem do I have?

Good question.

>I've no more idea what to do...

I think you need to communicate with the packager. And, when you do, you might like to suggest that he contacts me about getting a platform page for Debian and Ubuntu under way in our website.

You might like also to look at the Documentation Index at our website. There are a couple of papers there on Ubuntu installs, which should be applicable, at least in part, to Debian...

At least one of the core developers (who are "resident" in firebird-devel) is using Ubuntu.

./heLen