Simon Connah wrote:
Sorry if this is the wrong list, I debated whether to post it to ports but as it is not a problem with the port itself and is more a user problem (i.e I'm being stupid :)) I thought misc was probably more appropriate.

Anyway I've been trying to get PostgreSQL setup on my 4.3 box and I'm not having much luck at all. I've followed the instructions in README.OpenBSD but I think I am missing something very simple here. Any help would be greatly appreciated.

Thank you.

It would probably be easier to post a log of all the steps I have taken so here it is:

[Sun Oct 26 16:20:48 [EMAIL PROTECTED]:~]sudo su -
[Sun Oct 26 16:20:52 [EMAIL PROTECTED]:~]passwd _postgresql
Changing local password for _postgresql.
New password:
Retype new password:
[Sun Oct 26 16:21:12 [EMAIL PROTECTED]:~]logout
[Sun Oct 26 16:21:16 [EMAIL PROTECTED]:~]su - _postgresql
Password:
$ mkdir /var/postgresql/data
$ initdb -D /var/postgresql/data -U postgres -A md5 -W
The files belonging to this database system will be owned by user "_postgresql".
This user must also own the server process.

The database cluster will be initialized with locale C.

fixing permissions on existing directory /var/postgresql/data ... 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 /var/postgresql/data/base/1 ... FATAL: could not create shared memory segment: Cannot allocate memory
DETAIL: Failed system call was shmget(key=1, size=1646592, 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 1646592 bytes), reduce PostgreSQL's shared_buffers parameter (currently 50) and/or its max_connections parameter (currently 10). The PostgreSQL documentation contains more information about shared memory configuration.
child process exited with exit code 1
initdb: removing contents of data directory "/var/postgresql/data"
$ logout
sh: logout: not found
$ exit
[Sun Oct 26 16:23:32 [EMAIL PROTECTED]:~]sudo shutdown -r now
Shutdown NOW!
shutdown: [pid 30708]
[Sun Oct 26 16:23:44 [EMAIL PROTECTED]:~]
*** FINAL System shutdown message from [EMAIL PROTECTED] ***
System going down IMMEDIATELY



System shutdown time has arrived
Connection to 192.168.1.15 closed by remote host.
Connection to 192.168.1.15 closed.
typhoon:~ simon$ ssh [EMAIL PROTECTED]
ssh: connect to host 192.168.1.15 port 22: Connection refused
typhoon:~ simon$ ssh [EMAIL PROTECTED]
[EMAIL PROTECTED]'s password:
Last login: Sun Oct 26 16:22:14 2008 from typhoon.local
OpenBSD 4.3 (GENERIC) #2: Wed Oct 22 22:43:28 BST 2008

Welcome to OpenBSD: The proactively secure Unix-like operating system.

Please use the sendbug(1) utility to report bugs in the system.
Before reporting a bug, please try to reproduce it with the latest
version of the code. With bug reports, please try to ensure that
enough information to reproduce the problem is enclosed, and if a
known fix for it exists, include that as well.

[Sun Oct 26 16:25:14 [EMAIL PROTECTED]:~]top
[Sun Oct 26 16:25:36 [EMAIL PROTECTED]:~]su - _postgresql
Password:
$ initdb -D /var/postgresql/data -U postgres -A md5 -W
The files belonging to this database system will be owned by user "_postgresql".
This user must also own the server process.

The database cluster will be initialized with locale C.

fixing permissions on existing directory /var/postgresql/data ... ok
creating subdirectories ... ok
selecting default max_connections ... 40
selecting default shared_buffers/max_fsm_pages ... 28MB/179200
creating configuration files ... ok
creating template1 database in /var/postgresql/data/base/1 ... ok
initializing pg_authid ... ok
Enter new superuser password:
Enter it again:
setting password ... ok
initializing dependencies ... ok
creating system views ... ok
loading system objects' descriptions ... ok
creating conversions ... ok
setting privileges on built-in objects ... ok
creating information schema ... ok
vacuuming database template1 ... ok
copying template1 to template0 ... ok
copying template1 to postgres ... ok

Success. You can now start the database server using:

postgres -D /var/postgresql/data
or
pg_ctl -D /var/postgresql/data -l logfile start

$ pg_ctl -D /var/postgresql/data -l logfile start
server starting
$ createuser simon
Shall the new role be a superuser? (y/n) n
Shall the new role be allowed to create databases? (y/n) y
Shall the new role be allowed to create more new roles? (y/n) y
Password:
createuser: could not connect to database postgres: FATAL: password authentication failed for user "_postgresql"
$ createuser simon
Shall the new role be a superuser? (y/n) n
Shall the new role be allowed to create databases? (y/n) y
Shall the new role be allowed to create more new roles? (y/n) y
Password:
createuser: could not connect to database postgres: FATAL: password authentication failed for user "_postgresql"
$ createuser simon
Shall the new role be a superuser? (y/n) n
Shall the new role be allowed to create databases? (y/n) n
Shall the new role be allowed to create more new roles? (y/n) n
Password:
Password:
Password:
createuser: could not connect to database postgres: FATAL: password authentication failed for user "_postgresql"
$ createuser simon
Shall the new role be a superuser? (y/n) y
Password:
createuser: could not connect to database postgres: FATAL: password authentication failed for user "_postgresql"
$ createuser simon
Shall the new role be a superuser? (y/n) y
Password:
createuser: could not connect to database postgres: FATAL: password authentication failed for user "_postgresql"
$ exit

Simon.

"I disapprove of what you say, but I'll defend to the death your right to say it." - Voltaire


Late answer, had to find the proper back of an envelope ;-)

First, you must make the distinction between the user '_postgresql' and the role 'postgres'.

Since 8.?.? the default user for postgresql is named postgre, that is what is printed everywhere.
Bad vocabulary: should be read: the default role for postgresql is postgres.
The default user is chosen by the packager of the (any) OS.
OpenBSD standardized the names for deamons and background tasks to be prepended with an
underscore.
Hence under OpenBSD the default role for postgresql is postgres, the user and group are
named _postgresql.
One example of strict observance to rules which can become a real pain.

Meaning that I don't know how to use createuser and the like as the script will search for a
_postgresql role (and database) which does not exists.

So, simple way, once you have su'd to the superuser _postgresql,
you should
psql -d template1 postgres
and create the roles (aka "users") there

$ psql -d template1 postgres
Welcome to psql 8.2.3, the PostgreSQL interactive terminal.

Type:  \copyright for distribution terms
      \h for help with SQL commands
      \? for help with psql commands
      \g or terminate with semicolon to execute query
      \q to quit

template1=# create role <your_name> with superuser login password 'supersecret';
CREATE ROLE
template1=# \q

$ exit
# exit

Reply via email to