On Mon, 27 Oct 2008 12:19:02 +0000
Simon Connah <[EMAIL PROTECTED]> 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

This means that the PostgreSQL user with databases administration
privileges is named "postgres".
So, when creating your first PostgreSQL user, you must specify this
username to createuser.

> The files belonging to this database system will be owned by user  
> "_postgresql".

This means that the Unix (or system) user that owns the files is named
"_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

You do not specify the database user who actually creates the user in
the createuser command line, so it assumes that this user is the
current system user, "_postgresql". The problem is, that user is
unknown to PostgreSQL, so the authentication fails.

Check the createuser man page for further information, but :
createuser -U postgres -W -S -d -R -P simon
should do the job.


Regards,
Maxime DERCHE

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


-- 
Maxime DERCHE : maxime /at/ mouet-mouet.net | maxime.derche /at/ free.fr
http://www.mouet-mouet.net/maxime/blog/index.php

Reply via email to