Thread: PostgreSQL vs FreeBSD 7.0 as regular user

PostgreSQL vs FreeBSD 7.0 as regular user

From
Zoltan Boszormenyi
Date:
Hi,

is there anyone using PostgreSQL on FreeBSD 7.0 starting from scratch?
I compiled 8.3.3 and wanted to run initdb in my home directory but
it fails with the error below.

--------------------------------------------
[zozo@freebsd1 ~]$ PGDATA=/home/zozo/pgd833
PATH=/home/zozo/pgc833/bin:$PATH initdb
The files belonging to this database system will be owned by user "zozo".
This user must also own the server process.

The database cluster will be initialized with locale C.
The default database encoding has accordingly been set to SQL_ASCII.
The default text search configuration will be set to "english".

creating directory /home/zozo/pgd833 ... ok
creating subdirectories ... ok
selecting default max_connections ... 10
selecting default shared_buffers/max_fsm_pages ... 400kB/20000
creating configuration files ... ok
creating template1 database in /home/zozo/pgd833/base/1 ... FATAL:
could not create shared memory segment: Cannot allocate memory
DETAIL:  Failed system call was shmget(key=16, size=1785856, 03600).
HINT:  This error usually means that PostgreSQL's request for a shared
memory segment exceeded available memory or swap space. To reduce the
request size (currently 1785856 bytes), reduce PostgreSQL's
shared_buffers parameter (currently 50) and/or its max_connections
parameter (currently 13).
    The PostgreSQL documentation contains more information about shared
memory configuration.
child process exited with exit code 1
initdb: removing data directory "/home/zozo/pgd833"
--------------------------------------------

I configured the shared memory settings in advance according to
the PostgreSQL 8.3 online docs:

$ cat /etc/sysctl.conf
...
kern.ipc.shmall=32768
kern.ipc.shmmax=134217728
kern.ipc.semmap=256

These three settings were also set with "sysctl -w ..." to take effect
immediately.
So, there is enough shared memory, especially for the downsized
configuration
determined at initdb time. Why can't I get some shared memory as a
regular user?
It's a fresh install of FreeBSD 7.0, only bison and gmake were added
from the ports
repository and the above sysctls were set in the system. No matter if I
log in from
the console or via ssh, I get the same error above. Is there a magic to
enable a user
to allocate shared memory?

Best regards,
Zoltán Böszörményi

--
----------------------------------
Zoltán Böszörményi
Cybertec Schönig & Schönig GmbH
http://www.postgresql.at/


Re: PostgreSQL vs FreeBSD 7.0 as regular user

From
"Joshua D. Drake"
Date:
On Fri, 2008-07-25 at 22:39 +0200, Zoltan Boszormenyi wrote:
> Hi,
>
> is there anyone using PostgreSQL on FreeBSD 7.0 starting from scratch?
> I compiled 8.3.3 and wanted to run initdb in my home directory but
> it fails with the error below.

> I configured the shared memory settings in advance according to
> the PostgreSQL 8.3 online docs:
>
> $ cat /etc/sysctl.conf
> ...
> kern.ipc.shmall=32768
> kern.ipc.shmmax=134217728
> kern.ipc.semmap=256
>
> These three settings were also set with "sysctl -w ..." to take effect
> immediately.

Are you buy chance in a jail?

Joshua D. Drake

--
The PostgreSQL Company since 1997: http://www.commandprompt.com/
PostgreSQL Community Conference: http://www.postgresqlconference.org/
United States PostgreSQL Association: http://www.postgresql.us/
Donate to the PostgreSQL Project: http://www.postgresql.org/about/donate




Re: PostgreSQL vs FreeBSD 7.0 as regular user

From
Zoltan Boszormenyi
Date:
Joshua D. Drake írta:
> On Fri, 2008-07-25 at 22:39 +0200, Zoltan Boszormenyi wrote:
>
>> Hi,
>>
>> is there anyone using PostgreSQL on FreeBSD 7.0 starting from scratch?
>> I compiled 8.3.3 and wanted to run initdb in my home directory but
>> it fails with the error below.
>>
>
>
>> I configured the shared memory settings in advance according to
>> the PostgreSQL 8.3 online docs:
>>
>> $ cat /etc/sysctl.conf
>> ...
>> kern.ipc.shmall=32768
>> kern.ipc.shmmax=134217728
>> kern.ipc.semmap=256
>>
>> These three settings were also set with "sysctl -w ..." to take effect
>> immediately.
>>
>
> Are you buy chance in a jail?
>
> Joshua D. Drake
>

I don't know. How to determine? Running this as my own user:
$ sysctl -a | grep "^kern.ipc"
shows the same settings as above.

Thanks.

--
----------------------------------
Zoltán Böszörményi
Cybertec Schönig & Schönig GmbH
http://www.postgresql.at/


Re: PostgreSQL vs FreeBSD 7.0 as regular user

From
"Francisco Reyes"
Date:
On 4:53 pm 07/25/08 Zoltan Boszormenyi <zb@cybertec.at> wrote:
> I don't know. How to determine? Running this as my own user:

Is this your own machine or at an ISP?
If it is your own machine, then most likely you are not in a jail. You
would know if you were since you would have had to do it.

If at an ISP once way to know if you are in a jail I think is to try to
ping and traceroute.

I think by default you can't do one of those within a jail.
Also try ifconfig. A jail will show you a single IP. A "real" machine will
show you usually at least two. 127.0.0.1 and some other address.


Re: PostgreSQL vs FreeBSD 7.0 as regular user

From
Zoltan Boszormenyi
Date:
Francisco Reyes írta:
> On 4:53 pm 07/25/08 Zoltan Boszormenyi <zb@cybertec.at> wrote:
>
>> I don't know. How to determine? Running this as my own user:
>>
>
> Is this your own machine or at an ISP?
>

It's my own machine, FreeBSD is installed as a VMWare guest.

> If it is your own machine, then most likely you are not in a jail. You
> would know if you were since you would have had to do it.
>
> If at an ISP once way to know if you are in a jail I think is to try to
> ping and traceroute.
>
> I think by default you can't do one of those within a jail.
> Also try ifconfig. A jail will show you a single IP. A "real" machine will
> show you usually at least two. 127.0.0.1 and some other address.
>


--
----------------------------------
Zoltán Böszörményi
Cybertec Schönig & Schönig GmbH
http://www.postgresql.at/


Re: PostgreSQL vs FreeBSD 7.0 as regular user

From
Zoltan Boszormenyi
Date:
Zoltan Boszormenyi írta:
> Joshua D. Drake írta:
>
>> On Fri, 2008-07-25 at 22:39 +0200, Zoltan Boszormenyi wrote:
>>
>>
>>> Hi,
>>>
>>> is there anyone using PostgreSQL on FreeBSD 7.0 starting from scratch?
>>> I compiled 8.3.3 and wanted to run initdb in my home directory but
>>> it fails with the error below.
>>>
>>>
>>
>>
>>> I configured the shared memory settings in advance according to
>>> the PostgreSQL 8.3 online docs:
>>>
>>> $ cat /etc/sysctl.conf
>>> ...
>>> kern.ipc.shmall=32768
>>> kern.ipc.shmmax=134217728
>>> kern.ipc.semmap=256
>>>
>>> These three settings were also set with "sysctl -w ..." to take effect
>>> immediately.
>>>
>>>
>> Are you buy chance in a jail?
>>
>> Joshua D. Drake
>>
>>
>
> I don't know. How to determine? Running this as my own user:
> $ sysctl -a | grep "^kern.ipc"
> shows the same settings as above.
>
> Thanks.
>

Rebooting FreeBSD solved it. Huh? Is it really like W#&@$#&?
Anyway, thanks for the help.

--
----------------------------------
Zoltán Böszörményi
Cybertec Schönig & Schönig GmbH
http://www.postgresql.at/


Re: PostgreSQL vs FreeBSD 7.0 as regular user

From
Greg Smith
Date:
On Sat, 26 Jul 2008, Zoltan Boszormenyi wrote:

> Zoltan Boszormenyi �rta:
>>>> These three settings were also set with "sysctl -w ..." to take effect
>>>> immediately.
> Rebooting FreeBSD solved it. Huh? Is it really like W#&@$#&?

Looks like the PostgreSQL documentation here (
http://www.postgresql.org/docs/current/static/kernel-resources.html ) is
now outdated.  From http://www.manpages.info/freebsd/sysctl.8.html :

"The -w option has been deprecated and is silently ignored."

Looks like the correct thing to do here now is to edit the
/etc/sysctl.conf file, then issue:

/etc/rc.d/sysctl reload

to use those values without needing to reboot.  (I don't actually have
such a machine to check for sure).

Any FreeBSD users want to figure out when this changed (a quick check
suggests 4.4 may have been the one), confirm this is the right thing to do
now, and generate a doc patch?

--
* Greg Smith gsmith@gregsmith.com http://www.gregsmith.com Baltimore, MD

Re: PostgreSQL vs FreeBSD 7.0 as regular user

From
Ivan Voras
Date:
Greg Smith wrote:
> On Sat, 26 Jul 2008, Zoltan Boszormenyi wrote:
>
>> Zoltan Boszormenyi �rta:
>>>>> These three settings were also set with "sysctl -w ..." to take effect
>>>>> immediately.
>> Rebooting FreeBSD solved it. Huh? Is it really like W#&@$#&?
>
> Looks like the PostgreSQL documentation here (
> http://www.postgresql.org/docs/current/static/kernel-resources.html ) is
> now outdated.  From http://www.manpages.info/freebsd/sysctl.8.html :
>
> "The -w option has been deprecated and is silently ignored."

It's not ignored as in "the whole command will have no effect". Only the
switch itself is ignored. So,

sysctl -w a.b=c

is 100% equivalent to

sysctl a.b=c

> Looks like the correct thing to do here now is to edit the
> /etc/sysctl.conf file, then issue:
>
> /etc/rc.d/sysctl reload
>
> to use those values without needing to reboot.  (I don't actually have
> such a machine to check for sure).

Yes, that will work. Sysctl.conf will not reload itself :)



Attachment

Re: PostgreSQL vs FreeBSD 7.0 as regular user

From
Kirk Strauser
Date:
On Friday 25 July 2008, Zoltan Boszormenyi wrote:

> is there anyone using PostgreSQL on FreeBSD 7.0 starting from scratch?

Every day.

> I compiled 8.3.3 and wanted to run initdb in my home directory but
> it fails with the error below.

How did you install PostgreSQL?
--
Kirk Strauser
Daycos

Re: PostgreSQL vs FreeBSD 7.0 as regular user

From
ptjm@news-reader-radius.uniserve.com (Patrick TJ McPhee)
Date:
In article <Pine.GSO.4.64.0807261714200.29072@westnet.com>,
Greg Smith <gsmith@gregsmith.com> wrote:

% Looks like the PostgreSQL documentation here (
% http://www.postgresql.org/docs/current/static/kernel-resources.html ) is
% now outdated.  From http://www.manpages.info/freebsd/sysctl.8.html :
%
% "The -w option has been deprecated and is silently ignored."
%
% Looks like the correct thing to do here now is to edit the
% /etc/sysctl.conf file, then issue:
%
% /etc/rc.d/sysctl reload

I guess this would work, but you can still change variables from the
command-line. It's just that -w isn't required any more (i.e., the same
command works with or without the -w flag). I'm not sure the docs should
change, since -w is still required at least on NetBSD.
--

Patrick TJ McPhee
North York  Canada
ptjm@interlog.com