Thread: Works as Administrator but FAILS as postgres user

Works as Administrator but FAILS as postgres user

From
derry.birse@tde.alstom.com
Date:

The good news:

I have successfully installed PostgreSQL 7.2 on Cygwin 1.3.17, with the postmaster
running as a service on Windows NT. However this was installed such that the ipc-daemon
service is owned by the "System" account, the postmaster service is owned by the
"Administrator" account and all databases have been created by the "Administrator" account.

The bad news:

For my production environment I am trying to move to a situation where the postmaster
service and all databases are owned by the specially created "postgres" account. I have
started by following the "Install as Service" instructions below and building a new
database (I will move the data later).

However when I run postmaster (step 6) I get the following error. However if I follow the
instructions replacing the postgres user with the Administrator user everything works.

    IpcMemoryCreate: shmget(key=5432001, size=1441792, 03600) failed:
    Not enough core

    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 1441792 bytes), reduce
    PostgreSQL's shared_buffers parameter (currently 64) and/or
    its max_connections parameter (currently 32).

    The PostgreSQL Administrator's Guide contains more information about
    shared memory configuration.

I am not sure that I believe this error as installing under the Administrator
account produces no such error.

Derry Birse

Install as Service
==================

The following is the NT services Cygwin PostgreSQL installation procedure:

1. Install the cygipc ipc-daemon as a NT service:

# ipc-daemon --install-as-service

2. Create the "postgres" user account:

# cmd /c lusrmgr.msc # [3] # mkpasswd -l -u postgres >>/etc/passwd

3. Grant the "postgres" user the "Log on as a service" user right:

# cmd /c secpol.msc [4]

4. Install postmaster as a NT service (one line):

# cygrunsrv --install postmaster --path /usr/bin/postmaster --args "-D
/usr/share/postgresql/data -i" --dep ipc-daemon --termsig INT --user postgres --shutdown # [5] [6]

5. Create the PostgreSQL data directory:

# mkdir /usr/share/postgresql/data

6. Change ownership of the PostgreSQL data directory:

# chown postgres /usr/share/postgresql/data

7. Initialize PostgreSQL (*when running under the "postgres" account*):

$ initdb -D /usr/share/postgresql/data

5. Start the cygipc ipc-daemon:

# net start ipc-daemon # [7]

6. Start postmaster:

# net start postmaster # [7]

7. Connect to PostgreSQL:

# psql -U postgres template1 [8] [9]

The following are the notes to the above:

[1] The "#" prompt indicates running as a user which is a member of the Local
    Administrators group.
[2] The "$" prompt indicates running as the "postgres" user. Log in as
    "postgres" or use ssh to emulate Unix's "su" command.
[3] On Windows 2000, this starts the "Local Users and Groups" applet. On
    Windows NT 4.0, do the analogous operation.
[4] On Windows 2000, this starts the "Local Security Settings" applet. On
    Windows NT 4.0, do the analogous operation.
[5] Do not use rxvt for this step because the password exchange will not work
    properly.
[6] Clean postmaster shutdown will only work with a post Cygwin 1.3.2 snapshot
    from 2001-Jul-28 or later.
[7] Cygwin's bin directory (e.g., C:Cygwinbin) must be added to the Windows
    NT/2000's system PATH and the machine rebooted for the SCM to find
    cygwin1.dll.
[8] Actually, psql can run under any user account.
[9] One can use PostgreSQL's createuser command or set PGUSER to obviate the
    need to specify "-U postgres" on the psql command line.




Re: Works as Administrator but FAILS as postgres user

From
"Dave Page"
Date:

> -----Original Message-----
> From: derry.birse@tde.alstom.com [mailto:derry.birse@tde.alstom.com]
> Sent: 10 December 2002 10:03
> To: pgsql-cygwin@postgresql.org
> Subject: [CYGWIN] Works as Administrator but FAILS as postgres user
> Importance: High
>
>
> However when I run postmaster (step 6) I get the following
> error. However if I follow the instructions replacing the
> postgres user with the Administrator user everything works.
>
>     IpcMemoryCreate: shmget(key=5432001, size=1441792, 03600) failed:
>     Not enough core

I believe this can be caused by permissions on your /tmp directory
preventing the postgres user writing there (and updating ipc files?).

Regards, Dave.

Re: Works as Administrator but FAILS as postgres user

From
derry.birse@tde.alstom.com
Date:

Thanks to all who replied, particularly Patrick Pliessnig who hit the nail
right on the head.

Derry Birse






"Patrick Pliessnig" <p.pliessnig@gmx.net> on 10/12/2002 10:33:19

To:    Derry BIRSE/GBRUG02/TDE/ALSTOM@GA
cc:

Subject:    Re: Works as Administrator but FAILS as postgres user


>
> However when I run postmaster (step 6) I get the following error. However
if I follow the
> instructions replacing the postgres user with the Administrator user
everything works.
>
>     IpcMemoryCreate: shmget(key=5432001, size=1441792, 03600) failed:
>     Not enough core
>
>     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 1441792 bytes), reduce
>     PostgreSQL's shared_buffers parameter (currently 64) and/or
>     its max_connections parameter (currently 32).

delete the MultiFile* files in the cygwin/tmp directory and start the
service again




CONFIDENTIALITY : This  e-mail  and  any attachments are confidential and
may be privileged. If  you are not a named recipient, please notify the
sender immediately and do not disclose the contents to another person, use
it for any purpose or store or copy the information in any medium.